Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
I
installer
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vnp-framework
installer
Commits
b2a2515c
Commit
b2a2515c
authored
Dec 19, 2015
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ability to install dev version
parent
cf4b285b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
4 deletions
+33
-4
NewCommand.php
src/NewCommand.php
+33
-4
No files found.
src/NewCommand.php
View file @
b2a2515c
...
@@ -7,6 +7,7 @@ use RuntimeException;
...
@@ -7,6 +7,7 @@ use RuntimeException;
use
GuzzleHttp\Client
;
use
GuzzleHttp\Client
;
use
Symfony\Component\Process\Process
;
use
Symfony\Component\Process\Process
;
use
Symfony\Component\Console\Command\Command
;
use
Symfony\Component\Console\Command\Command
;
use
Symfony\Component\Console\Input\InputOption
;
use
Symfony\Component\Console\Input\InputArgument
;
use
Symfony\Component\Console\Input\InputArgument
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Output\OutputInterface
;
use
Symfony\Component\Console\Output\OutputInterface
;
...
@@ -23,7 +24,8 @@ class NewCommand extends Command
...
@@ -23,7 +24,8 @@ class NewCommand extends Command
$this
$this
->
setName
(
'new'
)
->
setName
(
'new'
)
->
setDescription
(
'Create a new Laravel application.'
)
->
setDescription
(
'Create a new Laravel application.'
)
->
addArgument
(
'name'
,
InputArgument
::
REQUIRED
);
->
addArgument
(
'name'
,
InputArgument
::
REQUIRED
)
->
addOption
(
'dev'
,
null
,
InputOption
::
VALUE_NONE
,
'Installs the latest "development" release'
);
}
}
/**
/**
...
@@ -42,7 +44,9 @@ class NewCommand extends Command
...
@@ -42,7 +44,9 @@ class NewCommand extends Command
$output
->
writeln
(
'<info>Crafting application...</info>'
);
$output
->
writeln
(
'<info>Crafting application...</info>'
);
$this
->
download
(
$zipFile
=
$this
->
makeFilename
())
$version
=
$this
->
getVersion
(
$input
);
$this
->
download
(
$zipFile
=
$this
->
makeFilename
(),
$version
)
->
extract
(
$zipFile
,
$directory
)
->
extract
(
$zipFile
,
$directory
)
->
cleanUp
(
$zipFile
);
->
cleanUp
(
$zipFile
);
...
@@ -91,11 +95,21 @@ class NewCommand extends Command
...
@@ -91,11 +95,21 @@ class NewCommand extends Command
* Download the temporary Zip to the given file.
* Download the temporary Zip to the given file.
*
*
* @param string $zipFile
* @param string $zipFile
* @param string $version
* @return $this
* @return $this
*/
*/
protected
function
download
(
$zipFile
)
protected
function
download
(
$zipFile
,
$version
=
'master'
)
{
{
$response
=
(
new
Client
)
->
get
(
'http://cabinet.laravel.com/latest.zip'
);
switch
(
$version
)
{
case
'master'
:
$filename
=
'latest.zip'
;
break
;
case
'develop'
:
$filename
=
'latest-develop.zip'
;
break
;
}
$response
=
(
new
Client
)
->
get
(
'http://cabinet.laravel.com/'
.
$filename
);
file_put_contents
(
$zipFile
,
$response
->
getBody
());
file_put_contents
(
$zipFile
,
$response
->
getBody
());
...
@@ -137,6 +151,21 @@ class NewCommand extends Command
...
@@ -137,6 +151,21 @@ class NewCommand extends Command
return
$this
;
return
$this
;
}
}
/**
* Get the version that should be downloaded.
*
* @param \Symfony\Component\Console\Input\InputInterface
* @return string
*/
protected
function
getVersion
(
$input
)
{
if
(
$input
->
getOption
(
'dev'
))
{
return
'develop'
;
}
return
'master'
;
}
/**
/**
* Get the composer command for the environment.
* Get the composer command for the environment.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment