laravel 0.3.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/bin/commands/config.rb +11 -2
- data/bin/commands/install.rb +6 -1
- data/bin/commands/new.rb +10 -1
- data/features/S_1_new_online.feature +34 -0
- data/features/S_2_new_offline.feature +32 -0
- data/features/S_3_new_customized.feature +14 -0
- data/features/S_4_config.feature +17 -0
- data/features/S_5_install.feature +13 -0
- data/features/step_definitions/config_steps.rb +30 -0
- data/features/step_definitions/install_steps.rb +9 -0
- data/features/step_definitions/laravel.rb +2 -112
- data/features/step_definitions/new_steps.rb +47 -0
- data/features/step_definitions/requirements.rb +20 -0
- data/features/support/env.rb +1 -13
- data/features/support/laravel_helpers.rb +8 -24
- data/lib/laravel.rb +3 -0
- data/lib/laravel/app.rb +2 -7
- data/lib/laravel/app_support.rb +14 -93
- data/lib/laravel/configuration.rb +8 -11
- data/lib/laravel/errors.rb +65 -0
- data/lib/laravel/helpers.rb +142 -0
- data/lib/laravel/settings.yml +43 -0
- data/lib/laravel/version.rb +1 -1
- metadata +25 -12
- data/features/S_1_new.feature +0 -59
- data/features/S_2_generate_key.feature +0 -16
- data/features/S_3_update_index.feature +0 -16
- data/features/S_4_generator.feature +0 -16
data/README.md
CHANGED
data/bin/commands/config.rb
CHANGED
@@ -5,6 +5,7 @@ module Laravel
|
|
5
5
|
# This class inherits from thor and can be used to configure
|
6
6
|
# various options in the application/config/application.php file.
|
7
7
|
class Config < Thor
|
8
|
+
class_option :debug, :type => :boolean
|
8
9
|
|
9
10
|
# This class-wide option specifies the application directory to use.
|
10
11
|
# By default, this is the path to the current directory.
|
@@ -16,7 +17,11 @@ module Laravel
|
|
16
17
|
desc "index [NEW_INDEX]", "modify the Application Index for Laravel application"
|
17
18
|
def index(new_index)
|
18
19
|
@config = Laravel::Configuration.new(options[:app])
|
19
|
-
|
20
|
+
begin
|
21
|
+
@config.update_index new_index
|
22
|
+
rescue StandardError => e
|
23
|
+
Laravel::handle_error e, options[:debug]
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
# This task generates a new key for our application.
|
@@ -24,7 +29,11 @@ module Laravel
|
|
24
29
|
desc "key", "generate a new key for Laravel application"
|
25
30
|
def key(value=nil)
|
26
31
|
@config = Laravel::Configuration.new(options[:app])
|
27
|
-
|
32
|
+
begin
|
33
|
+
@config.update_key
|
34
|
+
rescue StandardError => e
|
35
|
+
Laravel::handle_error e, options[:debug]
|
36
|
+
end
|
28
37
|
end
|
29
38
|
|
30
39
|
end
|
data/bin/commands/install.rb
CHANGED
@@ -4,6 +4,7 @@ module Laravel
|
|
4
4
|
# This class is responsible for the various installation tasks
|
5
5
|
# e.g. installing the bundles or other goodies.
|
6
6
|
class Install < Thor
|
7
|
+
class_option :debug, :type => :boolean
|
7
8
|
|
8
9
|
# This option specifies the application directory to use.
|
9
10
|
# By default, this is the path to the current directory.
|
@@ -25,7 +26,11 @@ module Laravel
|
|
25
26
|
desc "generator", "download the Laravel Generator by Jeffrey Way"
|
26
27
|
def generator
|
27
28
|
@installer = Laravel::Installer.new(options[:app])
|
28
|
-
|
29
|
+
begin
|
30
|
+
@installer.task_generator
|
31
|
+
rescue StandardError => e
|
32
|
+
Laravel::handle_error e, options[:debug]
|
33
|
+
end
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
data/bin/commands/new.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Laravel
|
2
2
|
class CLI < Thor
|
3
|
+
class_option :debug, :type => :boolean
|
4
|
+
|
3
5
|
# This task creates a new application based on Laravel framework. By
|
4
6
|
# default, it simply copies a Laravel source to the path specified as the
|
5
7
|
# argument. However, this method is heavily customizable and allows us to
|
@@ -38,7 +40,14 @@ module Laravel
|
|
38
40
|
method_option :generator, :type => :boolean, :aliases => "-g",
|
39
41
|
:desc => "get the Laravel generator by Jeffrey Way"
|
40
42
|
def new(app_name)
|
41
|
-
Laravel::App.new(app_name, options)
|
43
|
+
app = Laravel::App.new(app_name, options)
|
44
|
+
begin
|
45
|
+
app.create
|
46
|
+
rescue StandardError => e
|
47
|
+
Laravel::handle_error e, options[:debug]
|
48
|
+
rescue Exception => e
|
49
|
+
Laravel::handle_error e, options[:debug]
|
50
|
+
end
|
42
51
|
end
|
43
52
|
|
44
53
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Feature: Create a new application based on Laravel framework for PHP when online
|
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 using online sources
|
5
|
+
|
6
|
+
Scenario: create Laravel application with default settings
|
7
|
+
Given no application has been created using "http://github.com/laravel/laravel" as source
|
8
|
+
And I want to create a new application
|
9
|
+
When I create this application
|
10
|
+
Then application should be ready for development
|
11
|
+
|
12
|
+
Scenario: create Laravel application in the current directory
|
13
|
+
Given I want to create a new application forcefully
|
14
|
+
When I create this application
|
15
|
+
Then application should be ready for development
|
16
|
+
Given I, again, want to create a new application
|
17
|
+
When I, now, create this application
|
18
|
+
Then I should get an error
|
19
|
+
|
20
|
+
Scenario: create Laravel application using source from a non-official repo
|
21
|
+
Given no application has been created using "http://github.com/laravel/pastes" as source
|
22
|
+
And I want to create a new application
|
23
|
+
And I want to use "http://github.com/laravel/pastes" as source
|
24
|
+
When I create an application with above requirements
|
25
|
+
Then application should be ready for development
|
26
|
+
|
27
|
+
Scenario: create Laravel application using non-laravel repository
|
28
|
+
Given I want to create a new application
|
29
|
+
And I want to use "http://github.com/github/gitignore" as source
|
30
|
+
When I create an application with above requirements
|
31
|
+
Then local cache should not exist
|
32
|
+
And I should get an error
|
33
|
+
And the stdout should contain "corrupt"
|
34
|
+
And application should not be created
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Feature: Create a new application based on Laravel framework for PHP when offline
|
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 when not online
|
5
|
+
|
6
|
+
Background: we have created some applications using this gem in the past
|
7
|
+
Given applications have been created using "http://github.com/laravel/laravel" as source
|
8
|
+
And applications have been created using "http://github.com/laravel/pastes" as source
|
9
|
+
|
10
|
+
Scenario: create Laravel application using repository from local cache
|
11
|
+
Given I want to create a new application
|
12
|
+
And I want to use "http://github.com/laravel/laravel" as source
|
13
|
+
When I create an application with above requirements
|
14
|
+
Then application should be ready for development
|
15
|
+
|
16
|
+
Scenario: create Laravel application using source from a directory
|
17
|
+
# Given laravel framework exists in "./laravel" directory
|
18
|
+
# And I want to create a new application
|
19
|
+
# And I want to use "./laravel/" as source
|
20
|
+
#
|
21
|
+
# following is the encrypted path to local cache of default repo - makes test go faster
|
22
|
+
Given I want to create a new application
|
23
|
+
And I want to use "~/.laravel/repos/d07cf9818b8fb1e073f23901b58505f6" as source
|
24
|
+
When I create an application with above requirements
|
25
|
+
Then application should be ready for development
|
26
|
+
|
27
|
+
Scenario: create Laravel application but do not update permissions on storage/ directory
|
28
|
+
Given I want to create a new application
|
29
|
+
And I do not want to update file permissions for storage
|
30
|
+
When I create an application with above requirements
|
31
|
+
Then application should be created
|
32
|
+
But file permissions on storage should not be updated
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Create a new application with maximum customizations
|
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 a new application with maximum customizations
|
5
|
+
|
6
|
+
Scenario: create Laravel application with maximum customizations
|
7
|
+
Given I want to create an application forcefully
|
8
|
+
And I want to use "http://github.com/laravel/pastes" as source
|
9
|
+
And I want to generate a new key
|
10
|
+
And I want to use "home.php" as application index
|
11
|
+
When I create an application with above requirements
|
12
|
+
Then application should be ready for development
|
13
|
+
And a new application key should be generated
|
14
|
+
And the application index should be updated to "home.php"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Configure an existing Laravel application
|
2
|
+
In order to customize the application to my needs
|
3
|
+
As a PHP developer acquinted with ruby
|
4
|
+
I want to use Laravel gem to configure this application
|
5
|
+
|
6
|
+
Background: An application based on Laravel framework exists
|
7
|
+
Given I want to create a new application
|
8
|
+
When I create this application
|
9
|
+
Then the application should be ready for development
|
10
|
+
|
11
|
+
Scenario: generate a new key for a Laravel application
|
12
|
+
When I generate a new key for this application
|
13
|
+
Then a new application key should be generated
|
14
|
+
|
15
|
+
Scenario: update Application Index in a Laravel application
|
16
|
+
When I udpate application index to "home.php"
|
17
|
+
Then the application index should be updated to "home.php"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Download Laravel Generator by Jeffrey Way
|
2
|
+
In order to generate code for my application quickly using :generate tasks
|
3
|
+
As a PHP developer acquinted with ruby
|
4
|
+
I want to use Laravel gem to download Laravel Generator by Jeffrey Way
|
5
|
+
|
6
|
+
Background: An application based on Laravel framework exists
|
7
|
+
Given I want to create a new application
|
8
|
+
When I create this application
|
9
|
+
Then the application should be ready for development
|
10
|
+
|
11
|
+
Scenario: download Laravel generator
|
12
|
+
When I install generator for this application
|
13
|
+
Then a task should be installed as "generate.php"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Then /^configuration: "(.*?)" should be updated to "(.*?)"$/ do |config, value|
|
2
|
+
value = '.*' if value == "__something__"
|
3
|
+
@app_tester.validate_configuration("'#{config}' => '#{value}'")
|
4
|
+
step "the stdout should contain \"Updated configuration: #{config}\""
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
Given /^I( do not)? want to generate a new key$/ do |negate|
|
10
|
+
@args = "#{@args} #{negate ? "--no-key" : "--key"}"
|
11
|
+
end
|
12
|
+
When /^(?:|I |we )generate a new key(?:| for this application)$/ do
|
13
|
+
step "I run `laravel config key --app=#{@app_path}`"
|
14
|
+
end
|
15
|
+
Then /^a new application key should be generated$/ do
|
16
|
+
step "configuration: \"key\" should be updated to \"__something__\""
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
Given /^I want to use "(.*?)" as application index$/ do |index|
|
22
|
+
@args = "#{@args} --index=#{index}"
|
23
|
+
end
|
24
|
+
When /^.*udpate application index to "(.*?)"$/ do |index|
|
25
|
+
step "I run `laravel config index #{index} --app=#{@app_path}`"
|
26
|
+
end
|
27
|
+
Then /^the application index should be updated to "(.*?)"$/ do |index|
|
28
|
+
step "configuration: \"index\" should be updated to \"#{index}\""
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
When /install generator for this application$/ do
|
2
|
+
step "I run `laravel install generator --app=#{@app_path}`"
|
3
|
+
end
|
4
|
+
|
5
|
+
Then /^(?:|a )tasks? should be installed as "(.*?)"$/ do |filename|
|
6
|
+
filepath = @app_tester.app.tasks_file(filename)
|
7
|
+
@app_tester.raise_error?(File.exists?(filepath))
|
8
|
+
step "the stdout should contain \"Installed task\""
|
9
|
+
end
|
@@ -1,116 +1,6 @@
|
|
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
|
-
|
9
|
-
# This test setups a given condition where the local cache may or may not exist
|
10
|
-
# for a given source repository. It does so by removing the cache directory, and
|
11
|
-
# then recreating it, if not negated, by downloading the repository from github.
|
12
|
-
#
|
13
|
-
Given /^local cache( does not)? exists? for "(.*?)" repository$/ do |negation, repo|
|
14
|
-
@app_tester = Laravel::AppTests.new(nil, repo)
|
15
|
-
|
16
|
-
if negation
|
17
|
-
FileUtils.rm_rf @app_tester.app.cache
|
18
|
-
elsif not @app_tester.app.has_cache?
|
19
|
-
# easiest method to ensure local cache exists is to clone repo from github
|
20
|
-
FileUtils.rm_rf @app_tester.app.cache
|
21
|
-
`git clone #{@app_tester.app.source} #{@app_tester.app.cache} &>/dev/null`
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# This test setups a given condition where the Laravel application exists in a
|
26
|
-
# given directory. It does so by removing the directory if it exists and then,
|
27
|
-
# creating a new Laravel application there.
|
28
|
-
#
|
29
|
-
Given /^laravel application exists in "(.*?)" directory$/ do |dir|
|
30
|
-
FileUtils.rm_rf(dir) if File.directory?(dir)
|
31
|
-
@app_tester = Laravel::AppTests.new(dir)
|
32
|
-
@app_tester.app.merge_options(:force => true, :quiet => true)
|
33
|
-
@app_tester.app.create unless @app_tester.app.has_laravel?
|
34
|
-
end
|
35
|
-
|
36
|
-
# This test setups a given condition where the Laravel framework source has
|
37
|
-
# been download in a given directory, which is essentially the same as testing
|
38
|
-
# whether a Laravel application existing in a given directory.
|
39
|
-
#
|
40
|
-
Given /^laravel source has already been downloaded in "(.*?)" directory$/ do |dir|
|
41
|
-
# creating laravel in directory is virtually same as it being downloaded there
|
42
|
-
step "laravel application exists in \"#{dir}\" directory"
|
43
|
-
end
|
44
|
-
|
45
|
-
#### THEN ####
|
46
1
|
|
47
|
-
# This test checks whether the Laravel application we created is ready to use in
|
48
|
-
# a given directory, which is to say whether we can readily use Laravel after
|
49
|
-
# the command 'new' has been issued. This test assumes that the source repository
|
50
|
-
# is the official Laravel repository.
|
51
|
-
#
|
52
|
-
Then /^laravel application should be ready to use in "(.*?)" directory$/ do |dir|
|
53
|
-
step "local cache for \"official\" repository should exist"
|
54
|
-
step "the stdout should contain \"Hurray!\""
|
55
|
-
step "laravel application must exist in \"#{dir}\" directory"
|
56
|
-
step "permissions should be updated on \"#{dir}/storage\" directory"
|
57
|
-
end
|
58
|
-
|
59
|
-
# This test checks whether the Laravel application we created is ready to use
|
60
|
-
# in a given directory using a given source repository, which is to say whether
|
61
|
-
# we can readily use Laravel after the command 'new' has been issued.
|
62
|
-
#
|
63
|
-
Then /^laravel application should be ready to use in "(.*?)" directory using "(.*?)" repository$/ do |dir, repo|
|
64
|
-
step "local cache for \"#{repo}\" repository should exist"
|
65
|
-
step "the stdout should contain \"Hurray!\""
|
66
|
-
step "laravel application must exist in \"#{dir}\" directory"
|
67
|
-
step "permissions should be updated on \"#{dir}/storage\" directory"
|
68
|
-
end
|
69
|
-
|
70
|
-
# This test checks whether the local cache exists for a given repository. It
|
71
|
-
# does so by calling the 'has_cache?' method on the application.
|
72
|
-
#
|
73
|
-
Then /^local cache for "(.*?)" repository should( not)? exist$/ do |repo, negation|
|
74
|
-
@app_tester = Laravel::AppTests.new(nil, repo)
|
75
|
-
@app_tester.raise_error?(@app_tester.app.has_cache?, negation)
|
76
|
-
end
|
77
2
|
|
78
|
-
|
79
|
-
|
80
|
-
#
|
81
|
-
Then /^laravel application must( not)? exist in "(.*?)" directory$/ do |negation, dir|
|
82
|
-
@app_tester = Laravel::AppTests.new(dir)
|
83
|
-
@app_tester.raise_error?(@app_tester.app.has_laravel?, negation)
|
3
|
+
Then /^I should get an error$/ do
|
4
|
+
step "the stdout should contain \"ERROR\""
|
84
5
|
end
|
85
6
|
|
86
|
-
# This test checks if valid permissions were set on the "storage/" directory
|
87
|
-
# This test checks if the valid permissions were set on the "storage/" directory
|
88
|
-
# of the application.
|
89
|
-
#
|
90
|
-
Then /^permissions should( not)? be updated on "(.*?)" directory$/ do |negation, dir|
|
91
|
-
@app_tester = Laravel::AppTests.new(dir)
|
92
|
-
step "the stdout should contain \"Updated permissions\"" unless negation
|
93
|
-
world_bit = sprintf("%o", File.stat(@app_tester.app_dir).mode).to_s[-1,1].to_i
|
94
|
-
is_world_writable = [2,3,6,7].include?(world_bit)
|
95
|
-
@app_tester.raise_error?(is_world_writable, negation)
|
96
|
-
end
|
97
|
-
|
98
|
-
# This test checks if the given configuration setting has been updated to a given
|
99
|
-
# value for the specified application.
|
100
|
-
#
|
101
|
-
Then /^configuration: "(.*?)" must be updated to "(.*?)" for "(.*?)" application$/ do |config, value, app_dir|
|
102
|
-
value = '.*' if value == "__something__"
|
103
|
-
@app_tester = Laravel::AppTests.new(app_dir)
|
104
|
-
@app_tester.validate_configuration("'#{config}' => '#{value}'")
|
105
|
-
step "the stdout should contain \"Updated configuration: #{config}\""
|
106
|
-
end
|
107
|
-
|
108
|
-
# This test checks if the given resource has been installed in the specified
|
109
|
-
# application.
|
110
|
-
#
|
111
|
-
Then /^(.*?): "(.*?)" should be installed (?:as|in) "(.*?)" for "(.*?)" application$/ do |type, name, filename, app_dir|
|
112
|
-
@app_tester = Laravel::AppTests.new(app_dir)
|
113
|
-
filepath = @app_tester.app.tasks_file(filename) if type == "task"
|
114
|
-
@app_tester.raise_error?(File.exists?(filepath))
|
115
|
-
step "the stdout should contain \"Installed #{type}: #{name.capitalize}\""
|
116
|
-
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Given /^laravel (?:framework|application)( does not)? exists? in "(.*?)" directory$/ do |negate, dir|
|
2
|
+
dir = File.expand_path(dir, Laravel::AppTests::TestDirectory)
|
3
|
+
FileUtils.rm_rf(dir)
|
4
|
+
# easiest way to do this is to download github repository at this location
|
5
|
+
`git clone -q http://github.com/laravel/laravel #{dir}` unless negate
|
6
|
+
end
|
7
|
+
|
8
|
+
Given /^local cache for "(.*?)" (does not )?exists?$/ do |repo, negate|
|
9
|
+
tester = Laravel::AppTests.new(".", repo)
|
10
|
+
if negate
|
11
|
+
FileUtils.rm_rf tester.app.cache
|
12
|
+
elsif not tester.app.has_cache?
|
13
|
+
# easiest method to ensure local cache exists is to clone repo from github
|
14
|
+
FileUtils.rm_rf tester.app.cache
|
15
|
+
`git clone #{tester.app.source} #{tester.app.cache} &>/dev/null`
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Given /^(no )?applications? (?:has|have) been created using "(.*?)" as source$/ do |negate, repo|
|
20
|
+
step "local cache for \"#{repo}\" #{negate ? "does not exist" : "exists"}"
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
When /^.*create (?:an|this) application(?:| with above requirements)( in the current directory)?$/ do |current_dir|
|
26
|
+
dir = current_dir ? "." : "my_app"
|
27
|
+
@source ||= "http://github.com/laravel/laravel"
|
28
|
+
@app_tester = Laravel::AppTests.new(dir, @source)
|
29
|
+
@app = @app_tester.app
|
30
|
+
@app_path = @app_tester.app_path
|
31
|
+
@cache = @app_tester.app.cache
|
32
|
+
|
33
|
+
step "I run `laravel new #{dir} #{@args}`"
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
Then /^(?:|this |the )application should be ready for development$/ do
|
38
|
+
step "local cache should exist"
|
39
|
+
step "application should be created"
|
40
|
+
end
|
41
|
+
Then /^local cache should( not)? exist$/ do |negate|
|
42
|
+
@app_tester.raise_error?(@app.has_cache?, negate)
|
43
|
+
end
|
44
|
+
Then /^application should( not)? be created$/ do |negate|
|
45
|
+
step "the stdout should contain \"Hurray!\"" unless negate
|
46
|
+
@app_tester.raise_error?(@app.has_laravel?, negate)
|
47
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Given /.*want to create (?:an|the|a new) application( forcefully)?$/ do |force|
|
2
|
+
@args = force ? "--force" : ""
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^I want to use( local cache for)? "(.*?)" as source$/ do |use_cache, source|
|
6
|
+
@source = source
|
7
|
+
@args = "#{@args} --source=#{source}"
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
Given /^I( do not)? want to update file permissions for storage$/ do |negate|
|
13
|
+
@args = "#{@args} #{negate ? "--no-perms" : "--perms"}"
|
14
|
+
end
|
15
|
+
Then /^file permissions on storage should( not)? be updated$/ do |negate|
|
16
|
+
step "the stdout should contain \"Updated permissions\"" unless negate
|
17
|
+
world_bit = sprintf("%o", File.stat(@app_path).mode).to_s[-1,1].to_i
|
18
|
+
is_world_writable = [2,3,6,7].include?(world_bit)
|
19
|
+
@app_tester.raise_error?(is_world_writable, negate)
|
20
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -9,18 +9,6 @@ After do
|
|
9
9
|
FileUtils.rm_rf(File.join(test_directory, "current"))
|
10
10
|
end
|
11
11
|
|
12
|
-
Before
|
12
|
+
Before do
|
13
13
|
@aruba_timeout_seconds = 300
|
14
14
|
end
|
15
|
-
|
16
|
-
Before('@requires_repository_download') do
|
17
|
-
@aruba_timeout_seconds = 300
|
18
|
-
end
|
19
|
-
|
20
|
-
Before('@may_require_repository_download') do
|
21
|
-
@aruba_timeout_seconds = 300
|
22
|
-
end
|
23
|
-
|
24
|
-
Before('@slow') do
|
25
|
-
@aruba_timeout_seconds = 60
|
26
|
-
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Laravel
|
2
2
|
# a means to test the gem
|
3
3
|
class AppTests
|
4
|
-
attr_reader :app, :
|
4
|
+
attr_reader :app, :app_path, :aruba
|
5
|
+
TestDirectory = File.expand_path(File.join(File.dirname(__FILE__), %w[ .. .. tmp aruba]))
|
5
6
|
|
6
7
|
# create a new object that handles the tests for us
|
7
8
|
#
|
@@ -10,20 +11,17 @@ module Laravel
|
|
10
11
|
# +repo+ :: repository URL/directory for source
|
11
12
|
#
|
12
13
|
def initialize(dir = nil, repo = nil)
|
13
|
-
@repo = repo
|
14
|
-
@aruba = File.expand_path(File.join(File.dirname(__FILE__), %w[ .. .. tmp aruba]))
|
15
|
-
|
16
14
|
# Store absolute path to the directory
|
17
|
-
@
|
15
|
+
@app_path = dir || Dir.pwd
|
18
16
|
convert_to_relative_path
|
19
17
|
|
20
18
|
options = {
|
21
19
|
:force => false, :quiet => false,
|
22
|
-
:perms => true, :source =>
|
20
|
+
:perms => true, :source => repo
|
23
21
|
}
|
24
22
|
|
25
23
|
# create a new Laravel App instance for given options
|
26
|
-
@app = Laravel::App.new(@
|
24
|
+
@app = Laravel::App.new(@app_path, options)
|
27
25
|
end
|
28
26
|
|
29
27
|
# get the relative path of a directory relative to the temporary path aruba creates
|
@@ -33,22 +31,8 @@ module Laravel
|
|
33
31
|
# By default, it is the path to the aruba tmp directory
|
34
32
|
#
|
35
33
|
def convert_to_relative_path(relative_to = nil)
|
36
|
-
relative_to =
|
37
|
-
@
|
38
|
-
end
|
39
|
-
|
40
|
-
# get the url to a repository by a given alias/name
|
41
|
-
#
|
42
|
-
# ==== Return
|
43
|
-
# +string+ :: URL for the repository
|
44
|
-
#
|
45
|
-
def get_source_url
|
46
|
-
case @repo
|
47
|
-
when nil, "", "official", "default" then Laravel::App::LaravelRepo
|
48
|
-
when "pastes" then "http://github.com/laravel/pastes"
|
49
|
-
when "non_laravel" then "http://github.com/github/gitignore"
|
50
|
-
else @repo
|
51
|
-
end
|
34
|
+
relative_to = TestDirectory unless relative_to
|
35
|
+
@app_path = File.expand_path(@app_path, relative_to)
|
52
36
|
end
|
53
37
|
|
54
38
|
# checks if the configuration file contains a particular string
|
@@ -71,7 +55,7 @@ module Laravel
|
|
71
55
|
# this condition raises an error if it evaluates to false.
|
72
56
|
# +negate+ :: negate the default behaviour
|
73
57
|
def raise_error?(condition, negate = nil)
|
74
|
-
raise
|
58
|
+
raise ExpectationNotMetError if condition == !negate.nil?
|
75
59
|
end
|
76
60
|
end
|
77
61
|
end
|
data/lib/laravel.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# require dependencies
|
2
2
|
require "thor"
|
3
|
+
require "yaml"
|
3
4
|
|
4
5
|
# require laravel files
|
5
6
|
require "laravel/version"
|
7
|
+
require "laravel/errors"
|
8
|
+
require "laravel/helpers"
|
6
9
|
require "laravel/app_support"
|
7
10
|
require "laravel/app"
|
8
11
|
require "laravel/configuration"
|
data/lib/laravel/app.rb
CHANGED
@@ -5,17 +5,12 @@ module Laravel
|
|
5
5
|
#
|
6
6
|
class App
|
7
7
|
# include the AppSupport module which has all the methods defined.
|
8
|
+
include Laravel::Helpers
|
8
9
|
include Laravel::AppSupport
|
9
10
|
|
10
11
|
# these attributes must be available as: object.attribute
|
11
12
|
attr_reader :cache_folder, :laravel_repo, :app_path, :source, :cache, :options
|
12
13
|
|
13
|
-
# the path to the folder where the sources will be locally cached.
|
14
|
-
CacheFolder = File.expand_path(File.join(ENV['HOME'], %w[ .laravel repos ]))
|
15
|
-
|
16
|
-
# the official Laravel repository URL which is also the default source for us.
|
17
|
-
LaravelRepo = "http://github.com/laravel/laravel.git"
|
18
|
-
|
19
14
|
# This method initializes a new App object for us, on which we can apply
|
20
15
|
# our changes. Logically, this new App object represents an application
|
21
16
|
# based on Laravel.
|
@@ -74,7 +69,7 @@ module Laravel
|
|
74
69
|
say_failed "Downloaded source is not Laravel framework or a possible fork."
|
75
70
|
show_info "Cleaning up.."
|
76
71
|
clean_up
|
77
|
-
|
72
|
+
raise InvalidSourceRepositoryError
|
78
73
|
end
|
79
74
|
end
|
80
75
|
|
data/lib/laravel/app_support.rb
CHANGED
@@ -3,20 +3,7 @@ require 'digest/md5'
|
|
3
3
|
module Laravel
|
4
4
|
# various methods that help with various classes defined for the Laravel module
|
5
5
|
module AppSupport
|
6
|
-
|
7
|
-
# convert a string to MD5 hash - useful to generate quick random strings.
|
8
|
-
#
|
9
|
-
# ==== Parameters
|
10
|
-
# +string+ :: optional, the input string to be hashed
|
11
|
-
# :: a random string will be used for hashing, if this string is not provided
|
12
|
-
#
|
13
|
-
# ==== Return
|
14
|
-
# +string+ :: a 32-character long MD5'ed string
|
15
|
-
#
|
16
|
-
def make_md5(string = nil)
|
17
|
-
string ||= (0...32).map{ ('a'..'z').to_a[rand(26)] }.join
|
18
|
-
(Digest::MD5.new << string).to_s
|
19
|
-
end
|
6
|
+
include Laravel::Helpers
|
20
7
|
|
21
8
|
# Return the path to the local cache directory for a given Source
|
22
9
|
#
|
@@ -34,8 +21,8 @@ module Laravel
|
|
34
21
|
# ==== Return
|
35
22
|
# +boolean+ :: True, if the app directory is the current directory.
|
36
23
|
#
|
37
|
-
def
|
38
|
-
|
24
|
+
def create_in_current_directory?
|
25
|
+
is_current_directory?(@app_path)
|
39
26
|
end
|
40
27
|
|
41
28
|
# Check whether the app directory is empty?
|
@@ -46,8 +33,8 @@ module Laravel
|
|
46
33
|
# ==== Return
|
47
34
|
# +boolean+ :: True, if the app directory is an empty one.
|
48
35
|
#
|
49
|
-
def
|
50
|
-
|
36
|
+
def create_in_empty_directory?
|
37
|
+
is_empty_directory?(@app_path)
|
51
38
|
end
|
52
39
|
|
53
40
|
# Check whether the specified source is a local directory or a URL?
|
@@ -92,31 +79,6 @@ module Laravel
|
|
92
79
|
File.expand_path(File.join(@app_path, %w[ application tasks ], name))
|
93
80
|
end
|
94
81
|
|
95
|
-
# Download a given resource at a particular path
|
96
|
-
#
|
97
|
-
# ==== Parameters
|
98
|
-
# +path+ :: Path where the downloaded content will be saved.
|
99
|
-
# This can either be the path to a single file or a directory.
|
100
|
-
# If this is a directory, git will be used to download the source,
|
101
|
-
# otherwise, curl will be used for the same. Therefore, please, make
|
102
|
-
# sure that the source is a git repository when +path+ is a directory,
|
103
|
-
# and that the source is an online file when +path+ is a file.
|
104
|
-
# +source+ :: Source URL/directory from where the content of the resource will be
|
105
|
-
# downloaded. Please, read information about +path+
|
106
|
-
#
|
107
|
-
# ==== Return
|
108
|
-
# +boolean+ :: true, if the resource was downloaded successfully.
|
109
|
-
#
|
110
|
-
def download_resource(path, source, using)
|
111
|
-
using = "wget" if using == "curl" and `which curl`.empty? and not `which wget`.empty?
|
112
|
-
case using
|
113
|
-
when "git" then system("git clone -q #{source} #{path}")
|
114
|
-
when "curl" then system("curl -s #{source} > #{path}")
|
115
|
-
when "wget" then system("wget #{source} -O #{path}")
|
116
|
-
else false
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
82
|
# check if laravel framework exists in the current application's directory
|
121
83
|
# currently, this is performed by looking for the presence of 'artisan' file
|
122
84
|
# and the 'laravel' subdirectory.
|
@@ -139,26 +101,6 @@ module Laravel
|
|
139
101
|
laravel_exists_in_directory?(@cache)
|
140
102
|
end
|
141
103
|
|
142
|
-
# check if laravel framework exists in a specified directory
|
143
|
-
# this method is in turn called by the instance methods: 'has_cache?'
|
144
|
-
# and the 'has_laravel?'
|
145
|
-
#
|
146
|
-
# ==== Parameters
|
147
|
-
# +directory+ :: directory to check for the existance of laravel framework
|
148
|
-
# this can be the relative path to the current app directory
|
149
|
-
# or the absolute path of the directory.
|
150
|
-
#
|
151
|
-
# ==== Return
|
152
|
-
# +boolean+ :: true, if laravel exists in the given directory
|
153
|
-
#
|
154
|
-
def laravel_exists_in_directory?(directory = "")
|
155
|
-
return false unless directory
|
156
|
-
directory = File.expand_path(directory, @app_path)
|
157
|
-
return false unless File.exists? File.join(directory, "artisan")
|
158
|
-
return false unless File.directory? File.join(directory, "laravel")
|
159
|
-
true
|
160
|
-
end
|
161
|
-
|
162
104
|
# This method first checks if the given application path requires
|
163
105
|
# the 'force' option, and then checks if the 'force' option is provided
|
164
106
|
# by the user.
|
@@ -172,11 +114,11 @@ module Laravel
|
|
172
114
|
#
|
173
115
|
def required_force_is_missing?
|
174
116
|
# we need force if path exists and is not the current directory
|
175
|
-
check_force = (File.exists?(@app_path) and not
|
117
|
+
check_force = (File.exists?(@app_path) and not create_in_current_directory?)
|
176
118
|
# we need force if path is current directory but is not empty
|
177
|
-
check_force ||= (
|
119
|
+
check_force ||= (create_in_current_directory? and not create_in_empty_directory?)
|
178
120
|
# raise an error when we need to force and we have not been supplied with enforcements
|
179
|
-
|
121
|
+
raise RequiredForceMissingError if check_force and not @options[:force]
|
180
122
|
end
|
181
123
|
|
182
124
|
# Depending on whether the 'force' parameter is provided, this method
|
@@ -201,7 +143,7 @@ module Laravel
|
|
201
143
|
#
|
202
144
|
def download_or_update_local_cache
|
203
145
|
return if source_is_local?
|
204
|
-
|
146
|
+
raise RequiredLibraryMissingError, "git" if `which git`.empty?
|
205
147
|
FileUtils.mkdir_p @cache
|
206
148
|
Dir.chdir(@cache) do
|
207
149
|
if has_cache?
|
@@ -245,38 +187,17 @@ module Laravel
|
|
245
187
|
# Keeping the local cache does not make sense, since we anyways can not create
|
246
188
|
# applications based on these 'corrupt' repositories.
|
247
189
|
def clean_up
|
248
|
-
FileUtils.rm_rf "#{@app_path}" unless
|
190
|
+
FileUtils.rm_rf "#{@app_path}" unless create_in_current_directory?
|
249
191
|
FileUtils.rm_rf "#{@cache}"
|
250
192
|
end
|
251
193
|
|
252
|
-
# This method, simply, imitates the 'say' method that the Thor gem provides us.
|
253
|
-
# I preferred to use this method, since it gives us a very nice UI at the CLI :)
|
254
|
-
#
|
255
|
-
def say(status, message = "", log_status = true)
|
256
|
-
shell = Thor::Shell::Color.new
|
257
|
-
log_status = false if @options and @options[:quiet]
|
258
|
-
shell.say_status(status, message, log_status)
|
259
|
-
end
|
260
|
-
|
261
|
-
# Show some information to the user in Cyan.
|
262
|
-
def show_info(message)
|
263
|
-
say "Information", message, :cyan
|
264
|
-
end
|
265
|
-
|
266
|
-
# Show a success message to the user in Green.
|
267
|
-
def say_success(message)
|
268
|
-
say "Success", message, :green
|
269
|
-
end
|
270
194
|
|
271
|
-
|
272
|
-
|
273
|
-
self.say "Failed!!", message, :yellow
|
195
|
+
def read_gem_settings
|
196
|
+
read_yaml GemSettings
|
274
197
|
end
|
275
198
|
|
276
|
-
|
277
|
-
|
278
|
-
self.say "!!ERROR!!", message, :red
|
279
|
-
exit
|
199
|
+
def write_gem_settings(data)
|
200
|
+
write_yaml data, GemSettings
|
280
201
|
end
|
281
202
|
end
|
282
203
|
end
|
@@ -40,7 +40,7 @@ module Laravel
|
|
40
40
|
response = case action
|
41
41
|
when "read" then __read_config(setting)
|
42
42
|
when "update" then __update_config(setting, new_value)
|
43
|
-
else
|
43
|
+
else raise InvalidArgumentError
|
44
44
|
end
|
45
45
|
|
46
46
|
# let the user know when we set the value to an empty string
|
@@ -101,18 +101,15 @@ module Laravel
|
|
101
101
|
|
102
102
|
# try to change configuration only if this is a Laravel application
|
103
103
|
# otherwise, raise an error
|
104
|
-
|
104
|
+
raise LaravelNotFoundError unless has_laravel?
|
105
105
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
# make the required substitution in the configuration file
|
107
|
+
text = File.read conf
|
108
|
+
text = text.gsub(/'#{key}' => '.*'/, "'#{key}' => '#{new_value}'")
|
109
|
+
File.open(conf, "w") {|file| file.puts text}
|
110
110
|
|
111
|
-
|
112
|
-
|
113
|
-
else
|
114
|
-
show_error "Is this a valid Laravel application?"
|
115
|
-
end
|
111
|
+
# check to ensure we were able to update configuration
|
112
|
+
File.readlines(conf).grep(/'#{key}' => '#{new_value}'/).any?
|
116
113
|
end
|
117
114
|
|
118
115
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Laravel
|
2
|
+
|
3
|
+
class InvalidArgumentError < StandardError
|
4
|
+
def initialize(message = "Invalid arguments specified!")
|
5
|
+
super(message)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class LaravelNotFoundError < StandardError
|
10
|
+
def initialize(message = "Is this a valid Laravel application?")
|
11
|
+
super(message)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class InvalidSourceRepositoryError < StandardError
|
16
|
+
def initialize(message = "Source for downloading Laravel repository is corrupt!")
|
17
|
+
super(message)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class LaravelError < StandardError
|
22
|
+
def initialize(message = "A general error occurred while processing the command!")
|
23
|
+
super(message)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class RequiredForceMissingError < StandardError
|
28
|
+
def initialize(message = "You must pass in --force parameter to force an overwrite!")
|
29
|
+
super(message)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class RequiredLibraryMissingError < StandardError
|
34
|
+
def initialize(message = nil)
|
35
|
+
message = message ? "#{message} is required! Please, install it." : "One of the required library is missing, e.g. git, curl, etc.!"
|
36
|
+
super(message)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class ExpectationNotMetError < StandardError
|
41
|
+
def initialize(message = "Test failed because expectation was not met!")
|
42
|
+
super(message)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class FileNotFoundError < StandardError
|
47
|
+
def initialize(message = nil)
|
48
|
+
message = message ? "File not found: #{message}" : "Could not find the specified file!"
|
49
|
+
super(message)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Show an error the user in Red, and exit the script, since this is an error!
|
54
|
+
def self.handle_error(error, debug = false)
|
55
|
+
shell = Thor::Shell::Color.new
|
56
|
+
shell.say_status("!!ERROR!!", error.message, :red)
|
57
|
+
if debug
|
58
|
+
puts
|
59
|
+
puts "--"
|
60
|
+
puts error.backtrace
|
61
|
+
end
|
62
|
+
exit
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
module Laravel
|
2
|
+
module Helpers
|
3
|
+
|
4
|
+
# the path to the folder where the sources will be locally cached.
|
5
|
+
CacheFolder = File.join(ENV['HOME'], %w[ .laravel repos ])
|
6
|
+
|
7
|
+
# the official Laravel repository URL which is also the default source for us.
|
8
|
+
LaravelRepo = "http://github.com/laravel/laravel"
|
9
|
+
|
10
|
+
# the path to the setting.yml file for this gem
|
11
|
+
GemSettings = File.join(File.dirname(__FILE__), "settings.yml")
|
12
|
+
|
13
|
+
# convert a string to MD5 hash - useful to generate quick random strings.
|
14
|
+
#
|
15
|
+
# ==== Parameters
|
16
|
+
# +string+ :: optional, the input string to be hashed
|
17
|
+
# :: a random string will be used for hashing, if this string is not provided
|
18
|
+
#
|
19
|
+
# ==== Return
|
20
|
+
# +string+ :: a 32-character long MD5'ed string
|
21
|
+
#
|
22
|
+
def make_md5(string = nil)
|
23
|
+
string ||= (0...32).map{ ('a'..'z').to_a[rand(26)] }.join
|
24
|
+
(Digest::MD5.new << string).to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
# Check whether the given directory is the current directory.
|
28
|
+
#
|
29
|
+
# ==== Return
|
30
|
+
# +boolean+ :: True, if the app directory is the current directory.
|
31
|
+
#
|
32
|
+
def is_current_directory?(dir = nil)
|
33
|
+
dir ||= Dir.pwd
|
34
|
+
dir = File.expand_path(dir)
|
35
|
+
File.directory?(dir) and (dir == File.expand_path(Dir.pwd))
|
36
|
+
end
|
37
|
+
|
38
|
+
# Check whether the given directory is empty?
|
39
|
+
#
|
40
|
+
# ==== Return
|
41
|
+
# +boolean+ :: True, if the app directory is an empty one.
|
42
|
+
#
|
43
|
+
def is_empty_directory?(dir = nil)
|
44
|
+
dir ||= Dir.pwd
|
45
|
+
dir = File.expand_path(dir)
|
46
|
+
File.directory?(dir) and (Dir.entries(dir).size == 2)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Download a given resource at a particular path
|
50
|
+
#
|
51
|
+
# ==== Parameters
|
52
|
+
# +path+ :: Path where the downloaded content will be saved.
|
53
|
+
# This can either be the path to a single file or a directory.
|
54
|
+
# If this is a directory, git will be used to download the source,
|
55
|
+
# otherwise, curl will be used for the same. Therefore, please, make
|
56
|
+
# sure that the +source+ is a git repository when +path+ is a directory,
|
57
|
+
# and that the +source+ is an online file when +path+ is a file.
|
58
|
+
# +source+ :: Source URL/directory from where the content of the resource will be
|
59
|
+
# downloaded. Please, read information about +path+
|
60
|
+
#
|
61
|
+
# ==== Return
|
62
|
+
# +boolean+ :: true, if the resource was downloaded successfully.
|
63
|
+
#
|
64
|
+
def download_resource(path, source, using)
|
65
|
+
raise RequiredLibraryMissingError, "curl" if using == "curl" and `which curl`.empty? and `which wget`.empty?
|
66
|
+
raise RequiredLibraryMissingError, "git" if using == "git"
|
67
|
+
|
68
|
+
using = "wget" if using == "curl" and `which curl`.empty? and not `which wget`.empty?
|
69
|
+
case using
|
70
|
+
when "git" then system("git clone -q #{source} #{path}")
|
71
|
+
when "curl" then system("curl -s #{source} > #{path}")
|
72
|
+
when "wget" then system("wget #{source} -O #{path}")
|
73
|
+
else raise RequiredLibraryMissingError
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# check if laravel framework exists in a specified directory
|
78
|
+
#
|
79
|
+
# ==== Parameters
|
80
|
+
# +directory+ :: directory to check for the existance of laravel framework
|
81
|
+
# this can be the relative path to the current app directory
|
82
|
+
# or the absolute path of the directory.
|
83
|
+
# +relative_to+ :: if the +directory+ is a relative path, we can define the
|
84
|
+
# base directory here.
|
85
|
+
#
|
86
|
+
# ==== Return
|
87
|
+
# +boolean+ :: true, if laravel exists in the given directory
|
88
|
+
#
|
89
|
+
def laravel_exists_in_directory?(directory = nil, relative_to = nil)
|
90
|
+
return false unless directory
|
91
|
+
directory = File.expand_path(directory, relative_to)
|
92
|
+
return false unless File.exists? File.join(directory, "artisan")
|
93
|
+
return false unless File.directory? File.join(directory, "laravel")
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
# read the yaml configuration from a file
|
98
|
+
#
|
99
|
+
def read_yaml(file)
|
100
|
+
raise FileNotFoundError, file unless File.exists?(file)
|
101
|
+
data = YAML.load(File.open(file))
|
102
|
+
# adjust the 'config' hash by making substitutions
|
103
|
+
data["config"].each do |setting, matrix|
|
104
|
+
data["config"].delete(setting) if matrix.has_key?("supported") and not matrix["supported"]
|
105
|
+
data["config"][setting]["default"] = matrix["factory"] if matrix["default"] == "__factory__"
|
106
|
+
end
|
107
|
+
data
|
108
|
+
end
|
109
|
+
|
110
|
+
# write the configuration to a yaml file
|
111
|
+
#
|
112
|
+
def write_yaml(data, file)
|
113
|
+
raise FileNotFoundError, file unless File.exists?(file)
|
114
|
+
File.open(file, "w") {|f| f.write(data.to_yaml) }
|
115
|
+
end
|
116
|
+
|
117
|
+
# This method, simply, imitates the 'say' method that the Thor gem provides us.
|
118
|
+
# I preferred to use this method, since it gives us a very nice UI at the CLI :)
|
119
|
+
#
|
120
|
+
def say(status, message = "", log_status = true)
|
121
|
+
shell = Thor::Shell::Color.new
|
122
|
+
log_status = false if @options and @options[:quiet]
|
123
|
+
shell.say_status(status, message, log_status)
|
124
|
+
end
|
125
|
+
|
126
|
+
# Show some information to the user in Cyan.
|
127
|
+
def show_info(message)
|
128
|
+
say "Information", message, :cyan
|
129
|
+
end
|
130
|
+
|
131
|
+
# Show a success message to the user in Green.
|
132
|
+
def say_success(message)
|
133
|
+
say "Success", message, :green
|
134
|
+
end
|
135
|
+
|
136
|
+
# Show a failed message to the user in Yellow.
|
137
|
+
def say_failed(message)
|
138
|
+
say "Failed!!", message, :yellow
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
config:
|
2
|
+
url:
|
3
|
+
factory: ""
|
4
|
+
default: __factory__
|
5
|
+
type: url
|
6
|
+
asset_url:
|
7
|
+
factory: ""
|
8
|
+
default: __factory__
|
9
|
+
type: url
|
10
|
+
index:
|
11
|
+
factory: index.php
|
12
|
+
default: ""
|
13
|
+
type: string
|
14
|
+
key:
|
15
|
+
factory: "YourSecretKeyGoesHere!"
|
16
|
+
default: __random__
|
17
|
+
type: string
|
18
|
+
profiler:
|
19
|
+
factory: false
|
20
|
+
default: __factory__
|
21
|
+
type: boolean
|
22
|
+
encoding:
|
23
|
+
factory: UTF-8
|
24
|
+
default: __factory__
|
25
|
+
type: string
|
26
|
+
language:
|
27
|
+
factory: en
|
28
|
+
default: __factory__
|
29
|
+
type: string
|
30
|
+
langauges:
|
31
|
+
supported: false
|
32
|
+
type: array
|
33
|
+
ssl:
|
34
|
+
factory: false
|
35
|
+
default: __factory__
|
36
|
+
type: boolean
|
37
|
+
timezone:
|
38
|
+
factory: UTC
|
39
|
+
default: __factory__
|
40
|
+
type: string
|
41
|
+
aliases:
|
42
|
+
supported: false
|
43
|
+
type: array
|
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.
|
4
|
+
version: 0.5.1
|
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-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -77,11 +77,16 @@ files:
|
|
77
77
|
- bin/commands/install.rb
|
78
78
|
- bin/commands/new.rb
|
79
79
|
- bin/laravel
|
80
|
-
- features/
|
81
|
-
- features/
|
82
|
-
- features/
|
83
|
-
- features/
|
80
|
+
- features/S_1_new_online.feature
|
81
|
+
- features/S_2_new_offline.feature
|
82
|
+
- features/S_3_new_customized.feature
|
83
|
+
- features/S_4_config.feature
|
84
|
+
- features/S_5_install.feature
|
85
|
+
- features/step_definitions/config_steps.rb
|
86
|
+
- features/step_definitions/install_steps.rb
|
84
87
|
- features/step_definitions/laravel.rb
|
88
|
+
- features/step_definitions/new_steps.rb
|
89
|
+
- features/step_definitions/requirements.rb
|
85
90
|
- features/support/env.rb
|
86
91
|
- features/support/laravel_helpers.rb
|
87
92
|
- laravel.gemspec
|
@@ -89,7 +94,10 @@ files:
|
|
89
94
|
- lib/laravel/app.rb
|
90
95
|
- lib/laravel/app_support.rb
|
91
96
|
- lib/laravel/configuration.rb
|
97
|
+
- lib/laravel/errors.rb
|
98
|
+
- lib/laravel/helpers.rb
|
92
99
|
- lib/laravel/installer.rb
|
100
|
+
- lib/laravel/settings.yml
|
93
101
|
- lib/laravel/version.rb
|
94
102
|
homepage: https://github.com/nikhgupta/laravel
|
95
103
|
licenses: []
|
@@ -105,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
113
|
version: '0'
|
106
114
|
segments:
|
107
115
|
- 0
|
108
|
-
hash:
|
116
|
+
hash: 2758462782054416537
|
109
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
118
|
none: false
|
111
119
|
requirements:
|
@@ -114,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
122
|
version: '0'
|
115
123
|
segments:
|
116
124
|
- 0
|
117
|
-
hash:
|
125
|
+
hash: 2758462782054416537
|
118
126
|
requirements: []
|
119
127
|
rubyforge_project:
|
120
128
|
rubygems_version: 1.8.24
|
@@ -124,10 +132,15 @@ summary: This gem is a wrapper around the Laravel framework for PHP. Initially,
|
|
124
132
|
gem would allow to create new laravel apps along with options to modify the default
|
125
133
|
behavior for these new installations.
|
126
134
|
test_files:
|
127
|
-
- features/
|
128
|
-
- features/
|
129
|
-
- features/
|
130
|
-
- features/
|
135
|
+
- features/S_1_new_online.feature
|
136
|
+
- features/S_2_new_offline.feature
|
137
|
+
- features/S_3_new_customized.feature
|
138
|
+
- features/S_4_config.feature
|
139
|
+
- features/S_5_install.feature
|
140
|
+
- features/step_definitions/config_steps.rb
|
141
|
+
- features/step_definitions/install_steps.rb
|
131
142
|
- features/step_definitions/laravel.rb
|
143
|
+
- features/step_definitions/new_steps.rb
|
144
|
+
- features/step_definitions/requirements.rb
|
132
145
|
- features/support/env.rb
|
133
146
|
- features/support/laravel_helpers.rb
|
data/features/S_1_new.feature
DELETED
@@ -1,59 +0,0 @@
|
|
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 @online
|
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 @online
|
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 --source=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 @online
|
26
|
-
Scenario: create Laravel application using non-laravel repository
|
27
|
-
When I run `laravel new my_app --source=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 --source=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 --source=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 "my_app/storage" directory
|
51
|
-
|
52
|
-
@may_require_repository_download
|
53
|
-
Scenario: create Laravel application with maximum customizations
|
54
|
-
When I run `laravel new -kgi 'home.php' -s http://github.com/laravel/pastes my_app --force`
|
55
|
-
Then laravel application should be ready to use in "my_app" directory using "pastes" repository
|
56
|
-
And the stdout should contain "Creating application forcefully"
|
57
|
-
And configuration: "key" must be updated to "__something__" for "my_app" application
|
58
|
-
And configuration: "index" must be updated to "home.php" for "my_app" application
|
59
|
-
And task: "generator" should be installed as "generate.php" for "my_app" application
|
@@ -1,16 +0,0 @@
|
|
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
|
-
When I run `laravel config key --app=my_app`
|
10
|
-
Then configuration: "key" must be updated to "__something__" for "my_app" application
|
11
|
-
|
12
|
-
@may_require_repository_download
|
13
|
-
Scenario: create Laravel application and generate a key for it
|
14
|
-
When I run `laravel new my_app --key`
|
15
|
-
Then laravel application should be ready to use in "my_app" directory
|
16
|
-
And configuration: "key" must be updated to "__something__" for "my_app" application
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Feature: Update Application Index for a Laravel based application
|
2
|
-
In order to have pretty links in my web application
|
3
|
-
As a PHP developer acquinted with ruby
|
4
|
-
I want to use Laravel gem to update Application Index for this application
|
5
|
-
|
6
|
-
@may_require_repository_download
|
7
|
-
Scenario: update Application Index in a Laravel application
|
8
|
-
Given laravel application exists in "my_app" directory
|
9
|
-
When I run `laravel config index 'home.php' --app=my_app`
|
10
|
-
Then configuration: "index" must be updated to "home.php" for "my_app" application
|
11
|
-
|
12
|
-
@may_require_repository_download
|
13
|
-
Scenario: create Laravel application without an Application Index
|
14
|
-
When I run `laravel new my_app --index=''`
|
15
|
-
Then laravel application should be ready to use in "my_app" directory
|
16
|
-
And configuration: "index" must be updated to "" for "my_app" application
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Feature: Download Laravel Generator by Jeffrey Way
|
2
|
-
In order to generate code for my application quickly using :generate tasks
|
3
|
-
As a PHP developer acquinted with ruby
|
4
|
-
I want to use Laravel gem to download Laravel Generator by Jeffrey Way
|
5
|
-
|
6
|
-
@may_require_repository_download
|
7
|
-
Scenario: download Laravel generator
|
8
|
-
Given laravel application exists in "my_app" directory
|
9
|
-
When I run `laravel install generator --app=my_app`
|
10
|
-
Then task: "generator" should be installed as "generate.php" for "my_app" application
|
11
|
-
|
12
|
-
@may_require_repository_download
|
13
|
-
Scenario: download Laravel generator while creating an application
|
14
|
-
When I run `laravel new my_app --generator`
|
15
|
-
Then laravel application should be ready to use in "my_app" directory
|
16
|
-
And task: "generator" should be installed as "generate.php" for "my_app" application
|