laravel 0.5.1 → 0.7.0
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/.gitignore +0 -3
- data/README.md +29 -35
- data/Rakefile +2 -1
- data/bin/commands/config.rb +37 -12
- data/bin/commands/new.rb +6 -12
- data/bin/laravel +19 -9
- data/features/S_0__release.feature +13 -0
- data/features/S_3_new_customized.feature +26 -4
- data/features/S_4_config.feature +71 -5
- data/features/S_5_do.feature +14 -0
- data/features/step_definitions/app_steps.rb +72 -0
- data/features/step_definitions/config_steps.rb +29 -18
- data/features/step_definitions/new_steps.rb +54 -23
- data/features/support/env.rb +3 -1
- data/features/support/spec_helpers.rb +74 -0
- data/laravel.gemspec +4 -6
- data/lib/laravel.rb +0 -2
- data/lib/laravel/app.rb +58 -24
- data/lib/laravel/app_support.rb +46 -44
- data/lib/laravel/configuration.rb +230 -70
- data/lib/laravel/errors.rb +7 -35
- data/lib/laravel/helpers.rb +30 -25
- data/lib/laravel/version.rb +1 -1
- metadata +16 -21
- data/bin/commands/install.rb +0 -37
- data/features/S_5_install.feature +0 -13
- data/features/step_definitions/install_steps.rb +0 -9
- data/features/step_definitions/laravel.rb +0 -6
- data/features/step_definitions/requirements.rb +0 -20
- data/features/support/laravel_helpers.rb +0 -63
- data/lib/laravel/installer.rb +0 -61
- data/lib/laravel/settings.yml +0 -43
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -29,11 +29,11 @@ Or install it yourself as:
|
|
29
29
|
### Create a new Laravel application
|
30
30
|
|
31
31
|
Laravel gem has a caching mechanism in-built, which allows to keep a local
|
32
|
-
copy when you use
|
33
|
-
|
32
|
+
copy when you use a repository for the first time. After this, whenever you
|
33
|
+
use that repository again, it will only update the local copy of the
|
34
34
|
repository (as opposed to a fresh git clone, which is considerably slow for
|
35
|
-
certain connections). This will,
|
36
|
-
|
35
|
+
certain connections). This will, allow you to install Laravel applications
|
36
|
+
even when you are not connected to the Internet.
|
37
37
|
|
38
38
|
Since, you can specify which git repository to use to fetch the Laravel
|
39
39
|
source, you can create new Laravel application based on your own or someone
|
@@ -42,61 +42,55 @@ cached!
|
|
42
42
|
|
43
43
|
# use default settings (fetches source from http://github.com/laravel/laravel.git)
|
44
44
|
laravel new my_app
|
45
|
+
laravel new my_app --[no-]force # force overwrite
|
46
|
+
laravel new my_app --[no-]perms # (default) make "storage" directory world-writable
|
45
47
|
|
46
|
-
#
|
47
|
-
laravel new my_app --
|
48
|
+
# use a specified repository
|
49
|
+
laravel new my_app --sourec=./src/laravel # relative directory
|
50
|
+
laravel new my_app --source=/usr/src/local # absolute directory
|
51
|
+
laravel new my_app --source="http://github.com/user/my_laravel_fork # a git repository
|
48
52
|
|
49
|
-
|
50
|
-
laravel new my_app --local=/usr/src/laravel
|
53
|
+
### Create a customized Laravel application
|
51
54
|
|
52
|
-
|
53
|
-
|
55
|
+
When creating a new Laravel application, we can define configuration settings
|
56
|
+
using the '--config' flag. We can pass a comma-separated list of
|
57
|
+
`setting:value` pairs, like the following. Note that, you can generate a new
|
58
|
+
application key by, simply, passing `key` instead of `key:some_fixed_key`.
|
54
59
|
|
55
|
-
#
|
56
|
-
laravel new my_app --index
|
57
|
-
|
58
|
-
# use
|
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
|
-
|
64
|
-
# use default settings and download Laravel Generator by Jeffrey Way
|
65
|
-
laravel new my_app --generator
|
60
|
+
# generate a new key, set index to empty and turn on the profiler
|
61
|
+
laravel new my_app --config=key,index:'',profiler:on
|
62
|
+
|
63
|
+
# use a key, set index to "home.php", and update application's language to 'hi'
|
64
|
+
laravel new my_app --config=key:fixed_string,index:home.php,language:hi
|
66
65
|
|
67
66
|
# the settings I use:
|
68
|
-
laravel new my_app --key
|
67
|
+
laravel new my_app --config=key,index:''
|
69
68
|
## this creates a Laravel application from the official repository,
|
70
69
|
## sets the Application Index to blank, makes the storage directory
|
71
|
-
## world-writable, generates a new key for the application
|
72
|
-
## sets up the :generate tasks by downloading Laravel Generator.
|
70
|
+
## world-writable, generates a new key for the application.
|
73
71
|
## Furthermore, this creates the local cache for the official repository
|
74
72
|
## which makes the future installs quite faster :)
|
75
73
|
|
76
74
|
### In an existing Laravel application
|
77
75
|
|
78
76
|
# update Application Index for the application
|
79
|
-
laravel config index '' # removes application index for app in current directory
|
80
|
-
laravel config index 'home.php' --app=./new_app # update for app in specified directory
|
77
|
+
laravel config update index '' # removes application index for app in current directory
|
78
|
+
laravel config update index 'home.php' --app=./new_app # update for app in specified directory
|
81
79
|
|
82
80
|
# generate a new key for the application
|
83
|
-
laravel config key # generates key for app in current directory
|
84
|
-
laravel config key --app=./new_app #
|
81
|
+
laravel config update key # generates key for app in current directory
|
82
|
+
laravel config update key 'fixed_string' --app=./new_app # set a key for app in specified directory
|
85
83
|
|
86
|
-
# download the Laravel generator by Jeffrey Way
|
87
|
-
laravel install generator --app=./new_app
|
88
|
-
|
89
84
|
### Help
|
90
85
|
|
91
86
|
laravel help
|
92
87
|
|
93
88
|
## Coming Soon..
|
94
89
|
# create and customize a new Laravel application
|
95
|
-
<del>laravel new my_app --index='' # set application index to blank</del>
|
96
|
-
<del>laravel new my_app --key # generate a new key</del>
|
97
|
-
|
90
|
+
<del>laravel new my_app --config:index='' # set application index to blank</del>
|
91
|
+
<del>laravel new my_app --config:key # generate a new key</del>
|
92
|
+
laravel new my_app --[no-]generator # download the Laravel Generator by Jeffrey Way
|
98
93
|
laravel new my_app --database=db_my_app # create a database, defaults to app name
|
99
|
-
laravel new my_app --bundles=sentry,bob # install the provided bundles
|
100
94
|
|
101
95
|
## Contributing
|
102
96
|
|
data/Rakefile
CHANGED
@@ -2,8 +2,9 @@ require "bundler/gem_tasks"
|
|
2
2
|
require 'cucumber'
|
3
3
|
require 'cucumber/rake/task'
|
4
4
|
|
5
|
+
# setup some default rake tasks using cucumber
|
5
6
|
Cucumber::Rake::Task.new(:features) do |t|
|
6
|
-
t.cucumber_opts = "features --format
|
7
|
+
t.cucumber_opts = "features --format progress --tags=~@php"
|
7
8
|
end
|
8
9
|
|
9
10
|
task :default => :features
|
data/bin/commands/config.rb
CHANGED
@@ -5,32 +5,57 @@ 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
|
9
|
-
|
10
8
|
# This class-wide option specifies the application directory to use.
|
11
9
|
# By default, this is the path to the current directory.
|
12
10
|
class_option :app, :type => :string, :aliases => "-a",
|
13
11
|
:desc => "use the specified Laravel application instead of current directory"
|
14
12
|
|
15
|
-
#
|
13
|
+
# Enable debugger by passing this switch
|
14
|
+
class_option :debug, :type => :boolean
|
15
|
+
|
16
|
+
# This task update a configuration setting for an existing application.
|
17
|
+
# By default, it updates configuration for the application in the current
|
18
|
+
# directory, but this can be overridden by passing +app+ option. It takes
|
19
|
+
# a KEY and a VALUE pair and updates the configuration specified by KEY
|
20
|
+
# to VALUE.
|
16
21
|
#
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
# ==== Parameters
|
23
|
+
# +key+ :: [STRING] name of a configuration setting found in the
|
24
|
+
# application/config/application.php file. It can be one of the
|
25
|
+
# following values: url, asset_url, index, key, profiler,
|
26
|
+
# encoding, language, or ssl.
|
27
|
+
# Settings: languages and aliases are not supported.
|
28
|
+
# +value+ :: [STRING] updated value for this configuration setting.
|
29
|
+
# Configurations that take a boolean value (currently, profiler
|
30
|
+
# and ssl) can take one of the following values to specify truth:
|
31
|
+
# active, on, activated, enable, enabled, true or 1 - everything
|
32
|
+
# else specifies a falsy value.
|
33
|
+
desc "update [KEY] [VALUE]", "update the configuration [KEY] to [VALUE]"
|
34
|
+
def update(key, value="")
|
20
35
|
begin
|
21
|
-
|
36
|
+
config = Laravel::Configuration.new(options[:app])
|
37
|
+
config.update key, value
|
22
38
|
rescue StandardError => e
|
23
39
|
Laravel::handle_error e, options[:debug]
|
24
40
|
end
|
25
41
|
end
|
26
42
|
|
27
|
-
# This task
|
43
|
+
# This task reads the current value of a configuration setting for an
|
44
|
+
# existing application. By default, it reads configuration for the
|
45
|
+
# application in the current directory, but this can be overridden by
|
46
|
+
# passing +app+ option.
|
28
47
|
#
|
29
|
-
|
30
|
-
|
31
|
-
|
48
|
+
# ==== Parameters
|
49
|
+
# +key+ :: [STRING] name of a configuration setting found in the
|
50
|
+
# application/config/application.php file. It can be one of the
|
51
|
+
# following values: url, asset_url, index, key, profiler,
|
52
|
+
# encoding, language, or ssl.
|
53
|
+
# Settings: languages and aliases are not supported.
|
54
|
+
desc "get [KEY]", "retrieve the configuration [KEY]"
|
55
|
+
def get(key)
|
32
56
|
begin
|
33
|
-
|
57
|
+
config = Laravel::Configuration.new(options[:app])
|
58
|
+
config.read key
|
34
59
|
rescue StandardError => e
|
35
60
|
Laravel::handle_error e, options[:debug]
|
36
61
|
end
|
data/bin/commands/new.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module Laravel
|
2
2
|
class CLI < Thor
|
3
|
-
class_option :debug, :type => :boolean
|
4
|
-
|
5
3
|
# This task creates a new application based on Laravel framework. By
|
6
4
|
# default, it simply copies a Laravel source to the path specified as the
|
7
5
|
# argument. However, this method is heavily customizable and allows us to
|
@@ -23,8 +21,7 @@ module Laravel
|
|
23
21
|
# +force+ :: [BOOLEAN] If we can not create an application at the specified path since it
|
24
22
|
# already exists or is not empty, passing this parameter will force us to create
|
25
23
|
# a new application, by first removing all the files inside the specified path.
|
26
|
-
# +
|
27
|
-
# +key+ :: [BOOLEAN] If provided, generates a new key for our application.
|
24
|
+
# +config+ :: [STRING] A comma-separated list of `key-value` pairs - read docs for more information
|
28
25
|
# +generator+:: [BOOLEAN] If provided, this downloads the Laravel Generator by Jeffrey Way.
|
29
26
|
#
|
30
27
|
desc "new [MY_APP]", "create a new Laravel application"
|
@@ -33,20 +30,17 @@ module Laravel
|
|
33
30
|
:desc => "use this git repository - can be a directory or a URL"
|
34
31
|
method_option :perms, :type => :boolean, :default => true,
|
35
32
|
:desc => "default | update permissions on storage/ directory"
|
36
|
-
method_option :
|
37
|
-
:desc => "
|
38
|
-
method_option :key, :type => :boolean, :aliases => "-k",
|
39
|
-
:desc => "generate a new key for this application"
|
33
|
+
method_option :config, :type => :string, :aliases => "-c",
|
34
|
+
:desc => "configure the application using semi-colon separated list (read docs)"
|
40
35
|
method_option :generator, :type => :boolean, :aliases => "-g",
|
41
36
|
:desc => "get the Laravel generator by Jeffrey Way"
|
37
|
+
method_option :debug, :type => :boolean
|
38
|
+
|
42
39
|
def new(app_name)
|
43
|
-
app = Laravel::App.new(app_name, options)
|
44
40
|
begin
|
45
|
-
|
41
|
+
Laravel::App.new(app_name, options).create
|
46
42
|
rescue StandardError => e
|
47
43
|
Laravel::handle_error e, options[:debug]
|
48
|
-
rescue Exception => e
|
49
|
-
Laravel::handle_error e, options[:debug]
|
50
44
|
end
|
51
45
|
end
|
52
46
|
|
data/bin/laravel
CHANGED
@@ -14,7 +14,6 @@ require "laravel" # which indirectly requires 'thor'
|
|
14
14
|
# require our commands
|
15
15
|
require "commands/new"
|
16
16
|
require "commands/config"
|
17
|
-
require "commands/install"
|
18
17
|
|
19
18
|
module Laravel
|
20
19
|
# A means to create and manage applications based on the Laravel
|
@@ -26,7 +25,7 @@ module Laravel
|
|
26
25
|
default_task :version
|
27
26
|
|
28
27
|
# map some inputs to tasks
|
29
|
-
map "-T" => "help", "-C" => "config"
|
28
|
+
map "-T" => "help", "-C" => "config"
|
30
29
|
|
31
30
|
# config subcommand that manipulates app configuration
|
32
31
|
#
|
@@ -35,13 +34,6 @@ module Laravel
|
|
35
34
|
desc "config [COMMAND]", "configure an existing application"
|
36
35
|
subcommand "config", Laravel::Commands::Config
|
37
36
|
|
38
|
-
# install subcommand that gets us some bundles and goodies
|
39
|
-
#
|
40
|
-
# +command+ :: subcommand to run.
|
41
|
-
#
|
42
|
-
desc "install [COMMAND]", "install bundles and other goodies"
|
43
|
-
subcommand "install", Laravel::Commands::Install
|
44
|
-
|
45
37
|
# display version information for this gem but is a hidden task,
|
46
38
|
# which means that it will not be shown in the 'help' overview.
|
47
39
|
#
|
@@ -54,6 +46,24 @@ module Laravel
|
|
54
46
|
# puts "Made possible by efforts of Laravel Community"
|
55
47
|
end
|
56
48
|
|
49
|
+
# run an artisan command using this gem
|
50
|
+
#
|
51
|
+
# +command+ :: command to run using artisan
|
52
|
+
#
|
53
|
+
method_option :app, :type => :string, :aliases => "-a",
|
54
|
+
:desc => "use the specified Laravel application instead of curernt directory"
|
55
|
+
method_option :debug, :type => :boolean
|
56
|
+
desc "do [COMMAND]", "run an 'artisan' command"
|
57
|
+
def do(*args)
|
58
|
+
begin
|
59
|
+
command = args.join ' '
|
60
|
+
app = Laravel::App.new options[:app]
|
61
|
+
app.artisan command
|
62
|
+
rescue StandardError => e
|
63
|
+
Laravel::handle_error e, options[:debug]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
57
67
|
end
|
58
68
|
end
|
59
69
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Basic configurations and testing
|
2
|
+
In order to release the gem
|
3
|
+
As an author of this gem
|
4
|
+
I want to test basic configuration for this gem
|
5
|
+
|
6
|
+
@release
|
7
|
+
Scenario: Release the gem
|
8
|
+
Given I want to make sure everything runs before releasing the gem
|
9
|
+
Then the working directory should not be dirty
|
10
|
+
And the version should be updated
|
11
|
+
And the readme should be updated with new information
|
12
|
+
And the directory with laravel data should not exist
|
13
|
+
And snapshotted git commits should not exist
|
@@ -4,11 +4,33 @@ Feature: Create a new application with maximum customizations
|
|
4
4
|
I want to use Laravel gem to setup a new application with maximum customizations
|
5
5
|
|
6
6
|
Scenario: create Laravel application with maximum customizations
|
7
|
-
Given
|
8
|
-
And I want to
|
7
|
+
Given no application has been created using "http://github.com/laravel/laravel" as source
|
8
|
+
And I want to create an application forcefully
|
9
|
+
And I want to use "http://github.com/laravel/laravel" as source
|
9
10
|
And I want to generate a new key
|
10
|
-
And I want to use "home.php" as application index
|
11
|
+
And I want to use "home.php" as application "index"
|
12
|
+
And I want to "enable" the "profiler"
|
13
|
+
And I want to "disable" the "ssl"
|
14
|
+
And I want to use "hi" as the "language"
|
15
|
+
And I want to use "http://pastes.laravel.com" as the application "url"
|
11
16
|
When I create an application with above requirements
|
12
17
|
Then application should be ready for development
|
13
18
|
And a new application key should be generated
|
14
|
-
And the application index should be updated to "home.php"
|
19
|
+
And the application "index" should be updated to "home.php"
|
20
|
+
And the application "url" should be updated to "http://pastes.laravel.com"
|
21
|
+
And the "ssl" should be turned off
|
22
|
+
And the "profiler" should be turned on
|
23
|
+
And the "language" should be updated to "hi"
|
24
|
+
|
25
|
+
Scenario: CLI UI
|
26
|
+
Given applications have been created using "http://github.com/laravel/laravel" as source
|
27
|
+
When I run `laravel new my_app --force --config=index:'',key --source=http://github.com/laravel/laravel`
|
28
|
+
Then I should not fail while doing so
|
29
|
+
And I should see "forcefully"
|
30
|
+
And I should see "exists in local cache"
|
31
|
+
And I should see "Updating local cache"
|
32
|
+
And I should see "Cloned"
|
33
|
+
And I should see "Updated permissions"
|
34
|
+
And I should see "Updated configuration: index => __empty_string"
|
35
|
+
And I should see "Updated configuration: key"
|
36
|
+
And I should see "Hurray!"
|
data/features/S_4_config.feature
CHANGED
@@ -8,10 +8,76 @@ Feature: Configure an existing Laravel application
|
|
8
8
|
When I create this application
|
9
9
|
Then the application should be ready for development
|
10
10
|
|
11
|
+
Scenario: update Application's URL
|
12
|
+
When I run `laravel config update url "http://laravel.com"` inside this application
|
13
|
+
Then the application "url" should be updated to "http://laravel.com"
|
14
|
+
|
15
|
+
Scenario: update Application's asset URL
|
16
|
+
When I run `laravel config update asset_url "http://laravel.com"` inside this application
|
17
|
+
Then "asset_url" should be updated to "http://laravel.com"
|
18
|
+
|
19
|
+
Scenario: update Application Index
|
20
|
+
When I run `laravel config update index "home.php"` inside this application
|
21
|
+
Then the application "index" should be updated to "home.php"
|
22
|
+
|
11
23
|
Scenario: generate a new key for a Laravel application
|
12
|
-
When I
|
13
|
-
Then
|
24
|
+
When I run `laravel config update key` inside this application
|
25
|
+
Then an application key should be generated
|
26
|
+
|
27
|
+
Scenario: set a fixed key for a Laravel application
|
28
|
+
When I run `laravel config update key my_special_key` inside this application
|
29
|
+
Then the application "key" should be updated to "my_special_key"
|
30
|
+
|
31
|
+
Scenario: turn on/off the profiler for the application
|
32
|
+
When I run `laravel config update profiler active` inside this application
|
33
|
+
Then the "profiler" should be turned on
|
34
|
+
|
35
|
+
Scenario: turn on/off the ssl
|
36
|
+
When I run `laravel config update ssl enabled` inside this application
|
37
|
+
Then the "ssl" should be turned on
|
38
|
+
|
39
|
+
Scenario: update Application's language
|
40
|
+
When I run `laravel config update language hi` inside this application
|
41
|
+
Then the "language" should be updated to "hi"
|
42
|
+
|
43
|
+
Scenario: update Application's encoding
|
44
|
+
When I run `laravel config update encoding "US-ASCII"` inside this application
|
45
|
+
Then the "encoding" should be updated to "US-ASCII"
|
46
|
+
|
47
|
+
Scenario: update Application's timezone
|
48
|
+
When I run `laravel config update timezone "UTC+5:30"` inside this application
|
49
|
+
Then the "timezone" should be updated to "UTC+5:30"
|
50
|
+
|
51
|
+
Scenario: update supported languages
|
52
|
+
When I run `laravel config update languages "array('hi', 'en')"` inside this application
|
53
|
+
Then I should fail while doing so
|
54
|
+
|
55
|
+
Scenario: configuration that are boolean can take multiple arguments
|
56
|
+
# on/off
|
57
|
+
When I run `laravel config update profiler on` inside this application
|
58
|
+
Then the "profiler" should be turned on
|
59
|
+
When I run `laravel config update ssl off` inside this application
|
60
|
+
Then the "ssl" should be turned off
|
61
|
+
# yes/no
|
62
|
+
When I run `laravel config update ssl yes` inside this application
|
63
|
+
Then the "ssl" should be turned on
|
64
|
+
When I run `laravel config update profiler no` inside this application
|
65
|
+
Then the "profiler" should be turned off
|
66
|
+
# active/inactive
|
67
|
+
When I run `laravel config update ssl active` inside this application
|
68
|
+
Then the "ssl" should be turned on
|
69
|
+
When I run `laravel config update profiler inactive` inside this application
|
70
|
+
Then the "profiler" should be turned off
|
71
|
+
# enabled/disabled
|
72
|
+
When I run `laravel config update profiler enabled` inside this application
|
73
|
+
Then the "profiler" should be turned on
|
74
|
+
When I run `laravel config update ssl disabled` inside this application
|
75
|
+
Then the "ssl" should be turned off
|
14
76
|
|
15
|
-
Scenario:
|
16
|
-
When I
|
17
|
-
|
77
|
+
Scenario: can read configuration settings
|
78
|
+
When I run `laravel config update url "http://laravel.com"` inside this application
|
79
|
+
And I run `laravel config get url` inside this application
|
80
|
+
Then I should see "Configuration: url => 'http://laravel.com'"
|
81
|
+
When I run `laravel config update profiler false` inside this application
|
82
|
+
And I run `laravel config get profiler` inside this application
|
83
|
+
Then I should see "Configuration: profiler => false"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Run artisan commands via gem
|
2
|
+
In order to use the artisan command-line tool
|
3
|
+
As a PHP developer acquinted with ruby
|
4
|
+
I want to use the Laravel gem to call artisan commands
|
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
|
+
@php
|
12
|
+
Scenario: run application tests using artisan
|
13
|
+
When I run `laravel do test` inside this application
|
14
|
+
Then I should see "PHPUnit"
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# failure?
|
2
|
+
Then /^I should( not)? fail (?:in|when|while|for) doing so$/ do |negate|
|
3
|
+
step "the stdout should#{negate} contain \"Failed\""
|
4
|
+
step "the stdout should not contain \"ERROR\"" if negate
|
5
|
+
end
|
6
|
+
|
7
|
+
# error?
|
8
|
+
Then /^I should( not)? (?:get|see) an error$/ do |negate|
|
9
|
+
step "the stdout should#{negate} contain \"ERROR\""
|
10
|
+
end
|
11
|
+
|
12
|
+
# CLI output
|
13
|
+
Then /^I should see "(.*?)"$/ do |string|
|
14
|
+
step "the stdout should contain \"#{string}\""
|
15
|
+
end
|
16
|
+
|
17
|
+
# S_0__release
|
18
|
+
# These tests are only run when we plan for releasing the gem, and hence,
|
19
|
+
# we are running the full test suite.
|
20
|
+
Given /^I want to make sure everything runs before releasing (?:|the |this )gem$/ do
|
21
|
+
data_dir = File.expand_path(File.join(ENV['HOME'], ".laravel"))
|
22
|
+
FileUtils.rm_rf data_dir
|
23
|
+
end
|
24
|
+
|
25
|
+
# remind me if I have not updated the README.md before a release
|
26
|
+
# I create 'feature' branches, which I then merge with 'develop' branch.
|
27
|
+
# Hence, README.md should be updated with details of the new feature.
|
28
|
+
Then /^the readme should( not)? be updated with new information$/ do |negate|
|
29
|
+
last_tag = `git tag | tail -1`.strip
|
30
|
+
actual = `git diff #{last_tag}..HEAD -- README.md`.strip
|
31
|
+
expected = !negate
|
32
|
+
message = "README.md to be updated with new information"
|
33
|
+
unexpected? actual, expected, message
|
34
|
+
end
|
35
|
+
|
36
|
+
# remind me if I have not updated the version string before a release
|
37
|
+
Then /^the version should be updated$/ do
|
38
|
+
current = "v#{Laravel::VERSION}"
|
39
|
+
all_tags = `git tag`.split("\n").map {|t| t.strip}
|
40
|
+
exists = all_tags.include? current
|
41
|
+
message = "laravel version to be #{current} for this release"
|
42
|
+
unexpected_if exists, message
|
43
|
+
end
|
44
|
+
|
45
|
+
# make sure no local cache exists before we run the full test suite
|
46
|
+
Then /^the directory with laravel data should( not)? exist$/ do |negate|
|
47
|
+
data_dir = File.expand_path(File.join(ENV['HOME'], ".laravel"))
|
48
|
+
actual = File.directory?(data_dir)
|
49
|
+
expected = !negate
|
50
|
+
message = "#{data_dir} to exist"
|
51
|
+
unexpected? actual, expected, message
|
52
|
+
end
|
53
|
+
|
54
|
+
# remind me if the working directory is not clean
|
55
|
+
Then /^the working directory should( not)? be dirty$/ do |negate|
|
56
|
+
actual = `git status --porcelain`.strip
|
57
|
+
expected = !negate
|
58
|
+
message = "working directory to be dirty"
|
59
|
+
unexpected? actual, expected, message
|
60
|
+
end
|
61
|
+
|
62
|
+
# I have a habit of making quick commits marked by 'snapped' or 'snapshot(|s|ing)'
|
63
|
+
# whenever I leave my desk for some personal work.
|
64
|
+
# This quickly reminds me if such commits are present in the commit history.
|
65
|
+
Then /^snapshotted git commits should( not)? exist$/ do |negate|
|
66
|
+
snapped = `git log develop.. | grep 'snapped'`.strip
|
67
|
+
snapshot = `git log develop.. | grep 'snapshot'`.strip
|
68
|
+
actual = snapped || snapshot
|
69
|
+
expected = !negate
|
70
|
+
message = "commit history to contain snapshots"
|
71
|
+
unexpected? actual, expected, message
|
72
|
+
end
|