laravel 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +17 -7
- data/bin/laravel +14 -2
- data/features/S_1_new.feature +58 -0
- data/features/S_2_generate_key.feature +18 -0
- data/features/{update_index.feature → S_3_update_index.feature} +4 -6
- data/features/step_definitions/laravel.rb +65 -19
- data/features/support/laravel_helpers.rb +16 -0
- data/lib/laravel/create.rb +11 -1
- data/lib/laravel/info.rb +13 -0
- data/lib/laravel/manage.rb +33 -13
- data/lib/laravel/version.rb +1 -1
- metadata +8 -10
- data/features/new.feature +0 -50
- data/features/step_definitions/new.rb +0 -26
- data/features/step_definitions/update_index.rb +0 -16
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Laravel
|
2
2
|
|
3
|
-
A wrapper around Laravel framework for PHP.
|
3
|
+
A wrapper around Laravel framework for PHP.
|
4
4
|
Currently, is only capable of downloading Laravel source from
|
5
5
|
a local directory, some git based (online/offline) repository
|
6
|
-
or from the official source on Github.
|
6
|
+
or from the official source on Github.
|
7
7
|
Still in development.
|
8
8
|
|
9
9
|
[![Code
|
@@ -42,25 +42,35 @@ cached!
|
|
42
42
|
|
43
43
|
# use default settings (fetches source from http://github.com/laravel/laravel.git)
|
44
44
|
laravel new my_app
|
45
|
-
|
45
|
+
|
46
46
|
# force a clean install on existing directory
|
47
47
|
laravel new my_app --force
|
48
|
-
|
48
|
+
|
49
49
|
# use an existing (already downloaded) source
|
50
50
|
laravel new my_app --local=/usr/src/laravel
|
51
51
|
|
52
52
|
# use a remote repository
|
53
53
|
laravel new my_app --remote="http://github.com/user/my_laravel_fork"
|
54
|
-
|
54
|
+
|
55
55
|
# use default settings and update Application Index
|
56
56
|
laravel new my_app --index='home.php'
|
57
57
|
|
58
|
+
# use default settings and generate a new key
|
59
|
+
laravel new my_app --key
|
60
|
+
|
61
|
+
# use default settings but do not update permissions on storage/ directory
|
62
|
+
laravel new my_app --no_perms
|
63
|
+
|
58
64
|
### In an existing Laravel application
|
59
65
|
|
60
66
|
# update Application Index for the application
|
61
67
|
laravel update_index '' # removes application index for app in current directory
|
62
68
|
laravel update_index 'home.php' --app=./new_app # update for app in specified directory
|
63
|
-
|
69
|
+
|
70
|
+
# generate a new key for the application
|
71
|
+
laravel generate_key # generates key for app in current directory
|
72
|
+
laravel generate_key --app=./new_app # generate key for app in specified directory
|
73
|
+
|
64
74
|
### Help
|
65
75
|
|
66
76
|
laravel help
|
@@ -68,7 +78,7 @@ cached!
|
|
68
78
|
## Coming Soon..
|
69
79
|
# create and customize a new Laravel application
|
70
80
|
<del>laravel new my_app --index='' # set application index to blank</del>
|
71
|
-
laravel new my_app --
|
81
|
+
<del>laravel new my_app --key # generate a new key<del>
|
72
82
|
laravel new my_app --database=db_my_app # create a database, defaults to app name
|
73
83
|
laravel new my_app --[no-]generator # download the Laravel Generator by Jeffrey Way
|
74
84
|
laravel new my_app --bundles=sentry,bob # install the provided bundles
|
data/bin/laravel
CHANGED
@@ -27,9 +27,11 @@ module Laravel
|
|
27
27
|
# default => create a bare bone Laravel application
|
28
28
|
# --local => use a local directory for source
|
29
29
|
# --remote => use a remote git repository for source
|
30
|
-
# --index => update Application Index for newly created application
|
31
30
|
# --force => overwrite target directory, if it exists
|
32
|
-
|
31
|
+
# --index => update Application Index for newly created application
|
32
|
+
# --key => generate a new key for this application
|
33
|
+
# --no_perms => do not update permissions on storage/ directory
|
34
|
+
desc "new [MY_APP]", "create a new Laravel application"
|
33
35
|
method_option :local, :type => :string, :aliases => "-l", :banner => "DIRECTORY",
|
34
36
|
:desc => "use laravel source from a local directory"
|
35
37
|
method_option :remote, :type => :string, :aliases => "-r", :banner => "GIT_REPO",
|
@@ -37,6 +39,9 @@ module Laravel
|
|
37
39
|
method_option :force, :type => :boolean, :desc => "force overwrite"
|
38
40
|
method_option :index, :type => :string, :aliases => "-i",
|
39
41
|
:desc => "change the Application Index"
|
42
|
+
method_option :key, :type => :boolean, :aliases => "-k",
|
43
|
+
:desc => "generate a new key for this application"
|
44
|
+
method_option :no_perms, :type => :boolean, :desc => "do not update permissions on storage/ directory"
|
40
45
|
def new(app_name)
|
41
46
|
Laravel::Create::source app_name, options
|
42
47
|
end
|
@@ -50,6 +55,13 @@ module Laravel
|
|
50
55
|
Laravel::Manage::update_index new_index, options[:app]
|
51
56
|
end
|
52
57
|
|
58
|
+
desc "generate_key", "generate a new key for Laravel application"
|
59
|
+
method_option :app, :type => :string, :aliases => "-a",
|
60
|
+
:desc => "use the specified Laravel application instead of current directory"
|
61
|
+
def generate_key
|
62
|
+
Laravel::Manage::generate_key options[:app]
|
63
|
+
end
|
64
|
+
|
53
65
|
# choose a default task to run
|
54
66
|
default_task :info
|
55
67
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
Feature: Create a new application based on Laravel framework for PHP
|
2
|
+
In order to develop awesome web application
|
3
|
+
As a PHP developer acquinted with ruby
|
4
|
+
I want to use Laravel gem to setup Laravel framework
|
5
|
+
|
6
|
+
@requires_repository_download @very_slow
|
7
|
+
Scenario: create Laravel application with default settings
|
8
|
+
Given local cache does not exist for "official" repository
|
9
|
+
When I run `laravel new my_app`
|
10
|
+
Then laravel application should be ready to use in "my_app" directory
|
11
|
+
|
12
|
+
@may_require_repository_download
|
13
|
+
Scenario: create Laravel application in the current directory
|
14
|
+
When I run `laravel new . --force`
|
15
|
+
Then laravel application should be ready to use in "." directory
|
16
|
+
When I run `laravel new .`
|
17
|
+
Then the stdout should contain "ERROR"
|
18
|
+
|
19
|
+
@requires_repository_download
|
20
|
+
Scenario: create Laravel application using source from a non-official repo
|
21
|
+
Given local cache does not exist for "pastes" repository
|
22
|
+
When I run `laravel new my_app --remote=http://github.com/laravel/pastes`
|
23
|
+
Then laravel application should be ready to use in "my_app" directory using "pastes" repository
|
24
|
+
|
25
|
+
@requires_repository_download
|
26
|
+
Scenario: create Laravel application using non-laravel repository
|
27
|
+
When I run `laravel new my_app --remote=http://github.com/github/gitignore`
|
28
|
+
Then local cache for "non_laravel" repository should not exist
|
29
|
+
And the stdout should contain "source is corrupt"
|
30
|
+
And the stdout should contain "ERROR"
|
31
|
+
And laravel application must not exist in "my_app" directory
|
32
|
+
|
33
|
+
@may_require_repository_download
|
34
|
+
Scenario: create Laravel application using repository from local cache
|
35
|
+
Given local cache exists for "pastes" repository
|
36
|
+
When I run `laravel new my_app --remote=http://github.com/laravel/pastes`
|
37
|
+
Then laravel application should be ready to use in "my_app" directory using "pastes" repository
|
38
|
+
|
39
|
+
@may_require_repository_download
|
40
|
+
Scenario: create Laravel application using source from a directory
|
41
|
+
Given laravel source has already been downloaded in "laravel" directory
|
42
|
+
When I run `laravel new my_app --local=laravel`
|
43
|
+
Then laravel application should be ready to use in "my_app" directory
|
44
|
+
|
45
|
+
@may_require_repository_download
|
46
|
+
Scenario: create Laravel application but do not update permissions on storage/ directory
|
47
|
+
When I run `laravel new my_app --no_perms`
|
48
|
+
Then the stdout should contain "Hurray!"
|
49
|
+
And laravel application must exist in "my_app" directory
|
50
|
+
And permissions should not be updated on "storage" directory
|
51
|
+
|
52
|
+
@may_require_repository_download
|
53
|
+
Scenario: create Laravel application with maximum customizations
|
54
|
+
When I run `laravel new -ki '' -r http://github.com/laravel/pastes my_app --force`
|
55
|
+
Then laravel application should be ready to use in "my_app" directory
|
56
|
+
And the stdout should contain "Creating application forcefully"
|
57
|
+
And the stdout should contain "Generated a new key"
|
58
|
+
And the stdout should contain "Changed Application Index"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Generate a new key for Laravel application
|
2
|
+
In order to make the Laravel application more secure
|
3
|
+
As a PHP developer acquinted with ruby
|
4
|
+
I want to use Laravel gem to generate a key
|
5
|
+
|
6
|
+
@may_require_repository_download
|
7
|
+
Scenario: generate a new key for a Laravel application
|
8
|
+
Given laravel application exists in "my_app" directory
|
9
|
+
Then application key must not be set for "my_app" application
|
10
|
+
When I run `laravel generate_key --app=my_app`
|
11
|
+
Then the stdout should contain "Generated a new key"
|
12
|
+
And application key must be set for "my_app" application
|
13
|
+
|
14
|
+
@may_require_repository_download
|
15
|
+
Scenario: create Laravel application and generate a key for it
|
16
|
+
When I run `laravel new my_app --key`
|
17
|
+
Then laravel application should be ready to use in "my_app" directory
|
18
|
+
And application key must be set for "my_app" application
|
@@ -1,7 +1,7 @@
|
|
1
|
-
Feature: Laravel
|
2
|
-
In order to
|
1
|
+
Feature: Update Application Index for a Laravel based application
|
2
|
+
In order to have pretty links in my web application
|
3
3
|
As a PHP developer acquinted with ruby
|
4
|
-
I want to use Laravel gem
|
4
|
+
I want to use Laravel gem to update Application Index for this application
|
5
5
|
|
6
6
|
@may_require_repository_download
|
7
7
|
Scenario: update Application Index in a Laravel application
|
@@ -13,7 +13,5 @@ Feature: Laravel 'update_index'
|
|
13
13
|
@may_require_repository_download
|
14
14
|
Scenario: create Laravel application without an Application Index
|
15
15
|
When I run `laravel new my_app --index=''`
|
16
|
-
Then
|
17
|
-
And the stdout should contain "Hurray!"
|
18
|
-
And laravel application must be created inside "my_app" directory
|
16
|
+
Then laravel application should be ready to use in "my_app" directory
|
19
17
|
And application index must be set to "" for "my_app" application
|
@@ -1,34 +1,80 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# suppress any output from Thor based shell while testing
|
2
|
+
module Laravel
|
3
|
+
def self.say(status, message = "", log_status = true)
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
#### GIVEN ####
|
8
|
+
# local cache exists
|
9
|
+
Given /^local cache( does not)? exists? for "(.*?)" repository$/ do |negation, repo|
|
3
10
|
repo_url = get_test_repo_url(repo)
|
4
11
|
repo_path = get_test_repo_path(repo, repo_url)
|
5
|
-
|
6
|
-
unless Laravel::has_laravel?(repo_path)
|
12
|
+
if negation
|
7
13
|
FileUtils.rm_rf repo_path
|
8
|
-
|
14
|
+
else
|
15
|
+
# easiest method to ensure local cache exists is to clone repo from github
|
16
|
+
unless Laravel::has_laravel?(repo_path)
|
17
|
+
FileUtils.rm_rf repo_path
|
18
|
+
`git clone #{repo_url} #{repo_path} &>/dev/null`
|
19
|
+
end
|
9
20
|
end
|
10
21
|
end
|
11
22
|
|
12
|
-
|
13
|
-
|
14
|
-
|
23
|
+
# laravel exists in directory
|
24
|
+
Given /^laravel application exists in "(.*?)" directory$/ do |dir|
|
25
|
+
dir = get_relative_path_to_test_directory(dir)
|
26
|
+
Laravel::Create::source(dir, :force => true, :quiet => true) unless Laravel::has_laravel?(dir)
|
27
|
+
end
|
28
|
+
|
29
|
+
# laravel has been downloaded in directory
|
30
|
+
Given /^laravel source has already been downloaded in "(.*?)" directory$/ do |dir|
|
31
|
+
# creating laravel in directory is virtually same as it being downloaded there
|
32
|
+
step "laravel application exists in \"#{dir}\" directory"
|
33
|
+
end
|
34
|
+
|
35
|
+
#### THEN ####
|
36
|
+
# check if we have a running Laravel instance using 'Official' repository
|
37
|
+
Then /^laravel application should be ready to use in "(.*?)" directory$/ do |dir|
|
38
|
+
step "local cache for \"official\" repository should exist"
|
39
|
+
step "the stdout should contain \"Hurray!\""
|
40
|
+
step "laravel application must exist in \"#{dir}\" directory"
|
41
|
+
step "permissions should be updated on \"storage\" directory"
|
42
|
+
end
|
43
|
+
|
44
|
+
# check if we have a running Laravel instance using 'non-official' repository
|
45
|
+
Then /^laravel application should be ready to use in "(.*?)" directory using "(.*?)" repository$/ do |dir, repo|
|
46
|
+
step "local cache for \"#{repo}\" repository should exist"
|
47
|
+
step "the stdout should contain \"Hurray!\""
|
48
|
+
step "laravel application must exist in \"#{dir}\" directory"
|
49
|
+
step "permissions should be updated on \"storage\" directory"
|
15
50
|
end
|
16
51
|
|
17
|
-
|
52
|
+
# check if local cache exists
|
53
|
+
Then /^local cache for "(.*?)" repository should( not)? exist$/ do |repo, negation|
|
18
54
|
repo_path = get_test_repo_path(repo)
|
19
|
-
Laravel::has_laravel?(repo_path)
|
55
|
+
raise_error_based_on_condition(Laravel::has_laravel?(repo_path), negation)
|
20
56
|
end
|
21
57
|
|
22
|
-
#
|
23
|
-
|
24
|
-
default_repo = get_test_repo_path("official")
|
58
|
+
# check if laravel application exists in the given directory
|
59
|
+
Then /^laravel application must( not)? exist in "(.*?)" directory$/ do |negation, dir|
|
25
60
|
dir = get_relative_path_to_test_directory(dir)
|
26
|
-
|
27
|
-
Laravel::Create::source(dir, :force => true, :quiet => true) unless Laravel::has_laravel?(dir)
|
61
|
+
raise_error_based_on_condition(Laravel::has_laravel?(dir), negation)
|
28
62
|
end
|
29
63
|
|
30
|
-
#
|
31
|
-
|
32
|
-
|
33
|
-
|
64
|
+
# check if valid permissions were set on the "storage/" directory
|
65
|
+
Then /^permissions should( not)? be updated on "(.*?)" directory$/ do |negation, dir|
|
66
|
+
dir = File.join(get_relative_path_to_test_directory(dir), "storage")
|
67
|
+
is_world_writable = File.world_writable?(dir)
|
68
|
+
raise_error_based_on_condition(is_world_writable, negation)
|
69
|
+
end
|
70
|
+
|
71
|
+
# check if application index was set
|
72
|
+
Then /^application index must be set to "(.*?)" for "(.*?)" application$/ do |new_index, app_directory|
|
73
|
+
check_config_file_for_string("'index' => '#{new_index}'", app_directory)
|
74
|
+
end
|
75
|
+
|
76
|
+
# check if application key was set
|
77
|
+
Then /^application key must(| not) be set for "(.*?)" application$/ do |negation, app_directory|
|
78
|
+
key_regex = negation.empty? ? "[0-9a-f]{32}" : "YourSecretKeyGoesHere!"
|
79
|
+
check_config_file_for_string("'key' => '#{key_regex}'", app_directory)
|
34
80
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module LaravelHelpers
|
2
2
|
TestDirectory = File.expand_path(File.join(File.dirname(__FILE__), %w[ .. .. tmp aruba]))
|
3
3
|
|
4
|
+
# get the relative path of a directory relative to the temporary path aruba creates
|
4
5
|
def get_relative_path_to_test_directory(dir, relative_to = nil)
|
5
6
|
relative_to = TestDirectory unless relative_to
|
6
7
|
File.expand_path(dir, relative_to)
|
7
8
|
end
|
8
9
|
|
10
|
+
# get the url to the repository by its name
|
9
11
|
def get_test_repo_url(repo = nil)
|
10
12
|
case repo
|
11
13
|
when nil, "official", "default" then Laravel::OfficialRepository
|
@@ -15,10 +17,24 @@ module LaravelHelpers
|
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
20
|
+
# get the full path to the repository by its name
|
18
21
|
def get_test_repo_path(repo = nil, repo_url = nil)
|
19
22
|
repo_url = get_test_repo_url(repo) unless repo_url
|
20
23
|
Laravel::crypted_path(repo_url)
|
21
24
|
end
|
25
|
+
|
26
|
+
# checks if the configuration file contains a particular string
|
27
|
+
def check_config_file_for_string(search, dir)
|
28
|
+
dir = get_relative_path_to_test_directory(dir)
|
29
|
+
config_file = File.join(dir, %w[ application config application.php ])
|
30
|
+
raise RSpec::Expectations::ExpectationNotMetError unless File.readlines(config_file).grep(/#{search}/).any?
|
31
|
+
end
|
32
|
+
|
33
|
+
# raises an error based on a condition and negation
|
34
|
+
# if negation is not supplied, simply raises an error if condition is not true
|
35
|
+
def raise_error_based_on_condition(condition, negate = nil)
|
36
|
+
raise RSpec::Expectations::ExpectationNotMetError if condition == !negate.nil?
|
37
|
+
end
|
22
38
|
end
|
23
39
|
|
24
40
|
World(LaravelHelpers)
|
data/lib/laravel/create.rb
CHANGED
@@ -4,7 +4,7 @@ module Laravel
|
|
4
4
|
#
|
5
5
|
# When downloading from remote repositories, it checks to see if we have
|
6
6
|
# previously used that repository (can be the official Laravel source or
|
7
|
-
# forked one). If so, it updates the local copy of that repository and
|
7
|
+
# forked one). If so, it updates the local copy of that repository and
|
8
8
|
# installs from it. Otherwise, it creates a local copy of the repository
|
9
9
|
# so that future installs from that repository are instant.
|
10
10
|
#
|
@@ -46,8 +46,18 @@ module Laravel
|
|
46
46
|
# make necessary changes for the new app, if we were successful in download
|
47
47
|
# otherwise, remove the downloaded source
|
48
48
|
if Laravel::has_laravel? path
|
49
|
+
storage_directory = File.join(path, "storage")
|
49
50
|
Laravel::say_success "Cloned Laravel repository."
|
51
|
+
unless options.has_key?("no_perms")
|
52
|
+
response = system("chmod -R o+w #{storage_directory}")
|
53
|
+
if response
|
54
|
+
Laravel::say_success "Updated permissions on storage/ directory."
|
55
|
+
else
|
56
|
+
Laravel::say_failed "Could not update permissiosn on storage/ directory."
|
57
|
+
end
|
58
|
+
end
|
50
59
|
Laravel::Manage::update_index options[:index], path if options.has_key?("index")
|
60
|
+
Laravel::Manage::generate_key path if options.has_key?("key")
|
51
61
|
Laravel::say_success "Hurray! Your Laravel application has been created!"
|
52
62
|
else
|
53
63
|
Laravel::say_failed "Downloaded source is not Laravel framework or a possible fork."
|
data/lib/laravel/info.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Laravel
|
2
2
|
INFO = '''
|
3
|
+
Run `laravel help` for more details
|
4
|
+
|
3
5
|
Create a new Laravel application
|
4
6
|
================================
|
5
7
|
laravel new my_app
|
@@ -12,6 +14,10 @@ module Laravel
|
|
12
14
|
# use a remote repository
|
13
15
|
laravel new my_app --index=home.php
|
14
16
|
# use default settings and update Application Index
|
17
|
+
laravel new my_app --key
|
18
|
+
# use default settings and generate a new key
|
19
|
+
laravel new my_app --no_perms
|
20
|
+
# use default settings but do not update permissions on storage/ directory
|
15
21
|
|
16
22
|
Update Application Index on existing Laravel applications
|
17
23
|
=========================================================
|
@@ -19,5 +25,12 @@ module Laravel
|
|
19
25
|
# in the current directory
|
20
26
|
laravel update_index "" --app=./laravel
|
21
27
|
# for application in the specified directory
|
28
|
+
|
29
|
+
Generate a key on existing Laravel applications
|
30
|
+
===============================================
|
31
|
+
laravel generate_key
|
32
|
+
# in the current directory
|
33
|
+
laravel generate_key --app=./laravel
|
34
|
+
# for application in the specified directory
|
22
35
|
'''
|
23
36
|
end
|
data/lib/laravel/manage.rb
CHANGED
@@ -6,11 +6,39 @@ module Laravel
|
|
6
6
|
# - +new_index+ -> the new Application Index
|
7
7
|
# - +app_directory+ -> the directory of the Laravel app, defaults to current working directory
|
8
8
|
#
|
9
|
-
def self.update_index(new_index, app_directory =
|
9
|
+
def self.update_index(new_index, app_directory = nil)
|
10
|
+
if change_configuration(/'index' => '.*'/, "'index' => '#{new_index}'", app_directory)
|
11
|
+
Laravel::say_success "Changed Application Index."
|
12
|
+
else
|
13
|
+
Laravel::say_failed "Could not change Application Index!"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# generates a new key for the application
|
18
|
+
#
|
19
|
+
# * *Args* :
|
20
|
+
# - +app_directory+ -> the directory of the Laravel app, defaults to current working directory
|
21
|
+
#
|
22
|
+
def self.generate_key(app_directory = nil)
|
23
|
+
# 32 char long md5-ed hash
|
24
|
+
new_key = (0...32).map{ ('a'..'z').to_a[rand(26)] }.join
|
25
|
+
new_key = Laravel::crypted_name(new_key)
|
26
|
+
|
27
|
+
# show an appropriate message to the user.
|
28
|
+
if change_configuration(/'key' => '.*'/, "'key' => '#{new_key}'", app_directory)
|
29
|
+
Laravel::say_success "Generated a new key."
|
30
|
+
else
|
31
|
+
Laravel::say_failed "Could not generate a new key!"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def self.change_configuration(match, replace, app_directory = nil)
|
10
38
|
# default to current working directory if path is not specified
|
11
39
|
app_directory ||= Dir.pwd
|
12
40
|
|
13
|
-
# try to change
|
41
|
+
# try to change configuration only if this is a Laravel application
|
14
42
|
if Laravel::has_laravel? app_directory
|
15
43
|
# file path to the configuration file
|
16
44
|
config_file = %w[ application config application.php ]
|
@@ -18,19 +46,11 @@ module Laravel
|
|
18
46
|
|
19
47
|
# perform substitution
|
20
48
|
text = File.read config_file
|
21
|
-
text = text.gsub(
|
49
|
+
text = text.gsub(match, replace)
|
22
50
|
File.open(config_file, "w") {|file| file.puts text}
|
23
51
|
|
24
|
-
# check to ensure we were able to update
|
25
|
-
|
26
|
-
|
27
|
-
# show an appropriate message to the user.
|
28
|
-
if check
|
29
|
-
Laravel::say_success "Changed Application Index."
|
30
|
-
else
|
31
|
-
Laravel::say_failed "Could not change Application Index!"
|
32
|
-
end
|
33
|
-
|
52
|
+
# check to ensure we were able to update configuration
|
53
|
+
File.readlines(config_file).grep(/#{replace}/).any?
|
34
54
|
else
|
35
55
|
Laravel::say_error "Is this a valid Laravel application?"
|
36
56
|
end
|
data/lib/laravel/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: laravel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -74,13 +74,12 @@ files:
|
|
74
74
|
- README.md
|
75
75
|
- Rakefile
|
76
76
|
- bin/laravel
|
77
|
-
- features/
|
77
|
+
- features/S_1_new.feature
|
78
|
+
- features/S_2_generate_key.feature
|
79
|
+
- features/S_3_update_index.feature
|
78
80
|
- features/step_definitions/laravel.rb
|
79
|
-
- features/step_definitions/new.rb
|
80
|
-
- features/step_definitions/update_index.rb
|
81
81
|
- features/support/env.rb
|
82
82
|
- features/support/laravel_helpers.rb
|
83
|
-
- features/update_index.feature
|
84
83
|
- laravel.gemspec
|
85
84
|
- lib/laravel.rb
|
86
85
|
- lib/laravel/create.rb
|
@@ -116,10 +115,9 @@ summary: This gem is a wrapper around the Laravel framework for PHP. Initially,
|
|
116
115
|
gem would allow to create new laravel apps along with options to modify the default
|
117
116
|
behavior for these new installations.
|
118
117
|
test_files:
|
119
|
-
- features/
|
118
|
+
- features/S_1_new.feature
|
119
|
+
- features/S_2_generate_key.feature
|
120
|
+
- features/S_3_update_index.feature
|
120
121
|
- features/step_definitions/laravel.rb
|
121
|
-
- features/step_definitions/new.rb
|
122
|
-
- features/step_definitions/update_index.rb
|
123
122
|
- features/support/env.rb
|
124
123
|
- features/support/laravel_helpers.rb
|
125
|
-
- features/update_index.feature
|
data/features/new.feature
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
Feature: Laravel 'new'
|
2
|
-
In order to create a new application based on Laravel framework
|
3
|
-
As a PHP developer acquinted with ruby
|
4
|
-
I want to use Laravel gem
|
5
|
-
|
6
|
-
@requires_repository_download @very_slow
|
7
|
-
Scenario: create Laravel application with default settings
|
8
|
-
Given local cache does not exist for "official" repository
|
9
|
-
When I run `laravel new my_app`
|
10
|
-
Then local cache for "official" repository should exist
|
11
|
-
And the stdout should contain "Hurray!"
|
12
|
-
And laravel application must be created inside "my_app" directory
|
13
|
-
|
14
|
-
@requires_repository_download
|
15
|
-
Scenario: create Laravel application using source from a non-official repo
|
16
|
-
Given local cache does not exist for "pastes" repository
|
17
|
-
When I run `laravel new my_app --remote=http://github.com/laravel/pastes`
|
18
|
-
Then local cache for "pastes" repository should exist
|
19
|
-
And the stdout should contain "Hurray!"
|
20
|
-
And laravel application must be created inside "my_app" directory
|
21
|
-
|
22
|
-
@may_require_repository_download
|
23
|
-
Scenario: create Laravel application using repository from local cache
|
24
|
-
Given local cache exists for "official" repository
|
25
|
-
When I run `laravel new my_app --remote=http://github.com/laravel/pastes`
|
26
|
-
Then the stdout should contain "Hurray!"
|
27
|
-
And laravel application must be created inside "my_app" directory
|
28
|
-
|
29
|
-
@may_require_repository_download
|
30
|
-
Scenario: create Laravel application using source from a directory
|
31
|
-
Given laravel source has already been downloaded in "laravel" directory
|
32
|
-
When I run `laravel new my_app --local=laravel`
|
33
|
-
Then the stdout should contain "Hurray!"
|
34
|
-
And laravel application must be created inside "my_app" directory
|
35
|
-
|
36
|
-
@requires_repository_download
|
37
|
-
Scenario: create Laravel application using non-laravel repository
|
38
|
-
When I run `laravel new my_app --remote=http://github.com/github/gitignore`
|
39
|
-
Then local cache for "non_laravel" repository should not be created
|
40
|
-
And the stdout should contain "source is corrupt"
|
41
|
-
And the stdout should contain "ERROR"
|
42
|
-
And laravel application must not be created inside "my_app" directory
|
43
|
-
|
44
|
-
@may_require_repository_download
|
45
|
-
Scenario: create Laravel application in the current directory
|
46
|
-
When I run `laravel new . --force`
|
47
|
-
Then the stdout should contain "Hurray!"
|
48
|
-
And laravel application must be created inside current directory
|
49
|
-
When I run `laravel new .`
|
50
|
-
Then the stdout should contain "ERROR"
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# creation of applications
|
2
|
-
Then /^laravel application must be created inside "(.*?)" directory$/ do |dir|
|
3
|
-
dir = get_relative_path_to_test_directory(dir)
|
4
|
-
Laravel::has_laravel?(dir)
|
5
|
-
end
|
6
|
-
|
7
|
-
Then /^laravel application must not be created inside "(.*?)" directory$/ do |dir|
|
8
|
-
dir = get_relative_path_to_test_directory(dir)
|
9
|
-
!File.exists?(dir)
|
10
|
-
end
|
11
|
-
|
12
|
-
Then /^laravel application must be created inside current directory$/ do
|
13
|
-
dir = File.expand_path(Dir.pwd)
|
14
|
-
Laravel::has_laravel?(dir)
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^local cache for "(.*?)" repository should not be created$/ do |repo|
|
18
|
-
repo = get_test_repo_path(repo)
|
19
|
-
!File.exists?(repo)
|
20
|
-
end
|
21
|
-
|
22
|
-
# suppress any output from Thor based shell while testing
|
23
|
-
module Laravel
|
24
|
-
def self.say(status, message = "", log_status = true)
|
25
|
-
end
|
26
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Given /^laravel application exists in "(.*?)" directory$/ do |dir|
|
2
|
-
dir = get_relative_path_to_test_directory(dir)
|
3
|
-
Laravel::Create::source(dir) unless Laravel::has_laravel?(dir)
|
4
|
-
end
|
5
|
-
|
6
|
-
Then /^application index must be set to "(.*?)" for "(.*?)" application$/ do |new_index, dir|
|
7
|
-
dir = get_relative_path_to_test_directory(dir)
|
8
|
-
config_file = File.join(dir, %w[ application config application.php ])
|
9
|
-
File.readlines(config_file).grep(/'index' => '#{new_index}'/).any?
|
10
|
-
end
|
11
|
-
|
12
|
-
# suppress any output from Thor based shell while testing
|
13
|
-
module Laravel
|
14
|
-
def self.say(status, message = "", log_status = true)
|
15
|
-
end
|
16
|
-
end
|