laravel 0.2.1 → 0.3.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- # Laravel
1
+ [[#]] Laravel
2
2
 
3
3
  A wrapper around Laravel framework for PHP.
4
4
  Currently, is only capable of downloading Laravel source from
@@ -76,12 +76,15 @@ cached!
76
76
  ### In an existing Laravel application
77
77
 
78
78
  # update Application Index for the application
79
- laravel update_index '' # removes application index for app in current directory
80
- laravel update_index 'home.php' --app=./new_app # update for app in specified directory
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
81
81
 
82
82
  # generate a new key for the application
83
- laravel generate_key # generates key for app in current directory
84
- laravel generate_key --app=./new_app # generate key for app in specified directory
83
+ laravel config key # generates key for app in current directory
84
+ laravel config key --app=./new_app # generate key for app in specified directory
85
+
86
+ # download the Laravel generator by Jeffrey Way
87
+ laravel install generator --app=./new_app
85
88
 
86
89
  ### Help
87
90
 
@@ -90,9 +93,9 @@ cached!
90
93
  ## Coming Soon..
91
94
  # create and customize a new Laravel application
92
95
  <del>laravel new my_app --index='' # set application index to blank</del>
93
- <del>laravel new my_app --key # generate a new key<del>
96
+ <del>laravel new my_app --key # generate a new key</del>
97
+ <del>laravel new my_app --[no-]generator # download the Laravel Generator by Jeffrey Way</del>
94
98
  laravel new my_app --database=db_my_app # create a database, defaults to app name
95
- laravel new my_app --[no-]generator # download the Laravel Generator by Jeffrey Way
96
99
  laravel new my_app --bundles=sentry,bob # install the provided bundles
97
100
 
98
101
  ## Contributing
@@ -0,0 +1,33 @@
1
+ module Laravel
2
+ # This module handles the subcommands used by this gem.
3
+ module Commands
4
+ # Handle config subcommands.
5
+ # This class inherits from thor and can be used to configure
6
+ # various options in the application/config/application.php file.
7
+ class Config < Thor
8
+
9
+ # This class-wide option specifies the application directory to use.
10
+ # By default, this is the path to the current directory.
11
+ class_option :app, :type => :string, :aliases => "-a",
12
+ :desc => "use the specified Laravel application instead of current directory"
13
+
14
+ # This task updates the Application Index for an application.
15
+ #
16
+ desc "index [NEW_INDEX]", "modify the Application Index for Laravel application"
17
+ def index(new_index)
18
+ @config = Laravel::Configuration.new(options[:app])
19
+ @config.update_index new_index
20
+ end
21
+
22
+ # This task generates a new key for our application.
23
+ #
24
+ desc "key", "generate a new key for Laravel application"
25
+ def key(value=nil)
26
+ @config = Laravel::Configuration.new(options[:app])
27
+ @config.update_key
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,32 @@
1
+ module Laravel
2
+ # This module handles the subcommands used by this gem.
3
+ module Commands
4
+ # This class is responsible for the various installation tasks
5
+ # e.g. installing the bundles or other goodies.
6
+ class Install < Thor
7
+
8
+ # This option specifies the application directory to use.
9
+ # By default, this is the path to the current directory.
10
+ class_option :app, :type => :string, :aliases => "-a",
11
+ :desc => "use the specified Laravel application instead of current directory"
12
+
13
+ # This option specifies whether we want to forcefully install
14
+ # the resource by overwriting already existing files.
15
+ # Virtually, this is the same as reinstalling a certain resource.
16
+ class_option :force, :type => :boolean,
17
+ :desc => "force an installation - same as reinstall"
18
+
19
+ # This task downloads the Laravel Generator by Jeffrey Way and creates
20
+ # a file called 'generate.php' in the tasks folder.
21
+ #
22
+ # Once done, we can use `php artisan generate` to get an overview of the
23
+ # different actions this laravel-task can perform.
24
+ #
25
+ desc "generator", "download the Laravel Generator by Jeffrey Way"
26
+ def generator
27
+ @installer = Laravel::Installer.new(options[:app])
28
+ @installer.task_generator
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,45 @@
1
+ module Laravel
2
+ class CLI < Thor
3
+ # This task creates a new application based on Laravel framework. By
4
+ # default, it simply copies a Laravel source to the path specified as the
5
+ # argument. However, this method is heavily customizable and allows us to
6
+ # create a ready to use Laravel application by handling tasks such as
7
+ # updating the Application Index, generating a new key, updating
8
+ # permissions on the storage/ directory, and even creating migration tables
9
+ # for us in one go.
10
+ #
11
+ # ==== Options
12
+ # +source+ :: [STRING] Specifies the source repository for downloading Laravel. This can
13
+ # either be an absolute/relative path from the current directory,
14
+ # or a URL to a git based repository we have access to. This can be
15
+ # very handy since it allows us to create new application based on a
16
+ # fork of the Laravel framework that we may have been working on.
17
+ # Furthermore, since we cache these source URLs, it speeds up future
18
+ # app creations using this method.
19
+ # +perms+ :: [BOOLEAN] By default, it updates the permissions on the storage/ directory
20
+ # The permissions update can be skipped, by passing a '--no-perms' parameter.
21
+ # +force+ :: [BOOLEAN] If we can not create an application at the specified path since it
22
+ # already exists or is not empty, passing this parameter will force us to create
23
+ # a new application, by first removing all the files inside the specified path.
24
+ # +index+ :: [STRING] If provided, updates the Application Index to this string.
25
+ # +key+ :: [BOOLEAN] If provided, generates a new key for our application.
26
+ # +generator+:: [BOOLEAN] If provided, this downloads the Laravel Generator by Jeffrey Way.
27
+ #
28
+ desc "new [MY_APP]", "create a new Laravel application"
29
+ method_option :force, :type => :boolean, :desc => "force overwrite"
30
+ method_option :source, :type => :string, :aliases => "-s", :banner => "GIT_REPO",
31
+ :desc => "use this git repository - can be a directory or a URL"
32
+ method_option :perms, :type => :boolean, :default => true,
33
+ :desc => "default | update permissions on storage/ directory"
34
+ method_option :index, :type => :string, :aliases => "-i",
35
+ :desc => "change the Application Index"
36
+ method_option :key, :type => :boolean, :aliases => "-k",
37
+ :desc => "generate a new key for this application"
38
+ method_option :generator, :type => :boolean, :aliases => "-g",
39
+ :desc => "get the Laravel generator by Jeffrey Way"
40
+ def new(app_name)
41
+ Laravel::App.new(app_name, options).create
42
+ end
43
+
44
+ end
45
+ end
@@ -5,80 +5,55 @@
5
5
  require "pathname"
6
6
  bin_file = Pathname.new(__FILE__).realpath
7
7
 
8
- # add self to libpath
8
+ # add 'lib' and 'bin' folders to the load path.
9
9
  $:.unshift File.expand_path(File.join(%w[ .. .. lib]), bin_file)
10
+ $:.unshift File.expand_path(File.join(%w[ .. .. bin]), bin_file)
10
11
 
11
12
  require "laravel" # which indirectly requires 'thor'
12
13
 
14
+ # require our commands
15
+ require "commands/new"
16
+ require "commands/config"
17
+ require "commands/install"
18
+
13
19
  module Laravel
20
+ # A means to create and manage applications based on the Laravel
21
+ # framework for PHP. This has a neat command-subcommand structure
22
+ # which imitates Git. This is run when we invoke Laravel over CLI.
14
23
  class CLI < Thor
15
24
 
16
- # display version/information about this gem
17
- # default => display usage information for the gem
18
- # --version => display current Laravel version
19
- desc "info", "displays usage information about this gem."
20
- method_options %w( version -v) => :boolean
21
- def info
22
- puts options[:version] ? "Laravel v#{Laravel::VERSION}" : Laravel::INFO
25
+ # choose a default task to run
26
+ default_task :version
27
+
28
+ # map some inputs to tasks
29
+ map "-T" => "help", "-C" => "config", "-I" => "install", "-N" => "new"
30
+
31
+ # config subcommand that manipulates app configuration
32
+ #
33
+ # +command+ :: subcommand to run.
34
+ #
35
+ desc "config [COMMAND]", "configure an existing application"
36
+ subcommand "config", Laravel::Commands::Config
37
+
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
+ # display version information for this gem but is a hidden task,
46
+ # which means that it will not be shown in the 'help' overview.
47
+ #
48
+ # +version+ :: display current Laravel version, aliased as '-v'
49
+ #
50
+ desc "version", "displays usage information about this gem.", :hide => true
51
+ method_option :version, :type => :boolean, :aliases => "-v"
52
+ def version
53
+ puts "Laravel v#{Laravel::VERSION}"
23
54
  # puts "Made possible by efforts of Laravel Community"
24
55
  end
25
56
 
26
- # create a new laravel application
27
- # default => create a bare bone Laravel application
28
- # --local => use a local directory for source
29
- # --remote => use a remote git repository for source
30
- # --force => overwrite target directory, if it exists
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"
35
- method_option :local, :type => :string, :aliases => "-l", :banner => "DIRECTORY",
36
- :desc => "use laravel source from a local directory"
37
- method_option :remote, :type => :string, :aliases => "-r", :banner => "GIT_REPO",
38
- :desc => "use this git repository instead (useful when working with forks, e.g.)"
39
- method_option :force, :type => :boolean, :desc => "force overwrite"
40
- method_option :index, :type => :string, :aliases => "-i",
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 :perms, :type => :boolean, :default => true,
45
- :desc => "default | update permissions on storage/ directory"
46
- method_option :generator, :type => :boolean, :aliases => "-g",
47
- :desc => "get the Laravel generator by Jeffrey Way"
48
- def new(app_name)
49
- Laravel::Create::source app_name, options
50
- end
51
-
52
- # allow the user to modify Application Index
53
- # --app => use the given directory instead of pwd
54
- desc "update_index [NEW_INDEX]", "modify the Application Index for Laravel application"
55
- method_option :app, :type => :string, :aliases => "-a",
56
- :desc => "use the specified Laravel application instead of current directory"
57
- def update_index(new_index)
58
- Laravel::Manage::update_index new_index, options[:app]
59
- end
60
-
61
- # allow the user to generate a new key
62
- # --app => use the given directory instead of pwd
63
- desc "generate_key", "generate a new key for Laravel application"
64
- method_option :app, :type => :string, :aliases => "-a",
65
- :desc => "use the specified Laravel application instead of current directory"
66
- def generate_key
67
- Laravel::Manage::generate_key options[:app]
68
- end
69
-
70
- # allow the user to download the generator from Jeffrey Way
71
- # --app => use the given directory instead of pwd
72
- desc "get_generator", "download the Laravel Generator by Jeffrey Way"
73
- method_option :app, :type => :string, :aliases => "-a",
74
- :desc => "use the specified Laravel application instead of current directory"
75
- def get_generator
76
- Laravel::Manage::get_generator options[:app]
77
- end
78
-
79
- # choose a default task to run
80
- default_task :info
81
-
82
57
  end
83
58
  end
84
59
 
@@ -3,28 +3,28 @@ Feature: Create a new application based on Laravel framework for PHP
3
3
  As a PHP developer acquinted with ruby
4
4
  I want to use Laravel gem to setup Laravel framework
5
5
 
6
- @requires_repository_download @very_slow @online
6
+ @requires_repository_download @very_slow @online
7
7
  Scenario: create Laravel application with default settings
8
8
  Given local cache does not exist for "official" repository
9
9
  When I run `laravel new my_app`
10
10
  Then laravel application should be ready to use in "my_app" directory
11
11
 
12
- @may_require_repository_download
12
+ @may_require_repository_download
13
13
  Scenario: create Laravel application in the current directory
14
14
  When I run `laravel new . --force`
15
15
  Then laravel application should be ready to use in "." directory
16
16
  When I run `laravel new .`
17
17
  Then the stdout should contain "ERROR"
18
18
 
19
- @requires_repository_download @online
19
+ @requires_repository_download @online
20
20
  Scenario: create Laravel application using source from a non-official repo
21
21
  Given local cache does not exist for "pastes" repository
22
- When I run `laravel new my_app --remote=http://github.com/laravel/pastes`
22
+ When I run `laravel new my_app --source=http://github.com/laravel/pastes`
23
23
  Then laravel application should be ready to use in "my_app" directory using "pastes" repository
24
24
 
25
25
  @requires_repository_download @online
26
26
  Scenario: create Laravel application using non-laravel repository
27
- When I run `laravel new my_app --remote=http://github.com/github/gitignore`
27
+ When I run `laravel new my_app --source=http://github.com/github/gitignore`
28
28
  Then local cache for "non_laravel" repository should not exist
29
29
  And the stdout should contain "source is corrupt"
30
30
  And the stdout should contain "ERROR"
@@ -33,13 +33,13 @@ Feature: Create a new application based on Laravel framework for PHP
33
33
  @may_require_repository_download
34
34
  Scenario: create Laravel application using repository from local cache
35
35
  Given local cache exists for "pastes" repository
36
- When I run `laravel new my_app --remote=http://github.com/laravel/pastes`
36
+ When I run `laravel new my_app --source=http://github.com/laravel/pastes`
37
37
  Then laravel application should be ready to use in "my_app" directory using "pastes" repository
38
38
 
39
- @may_require_repository_download
39
+ @may_require_repository_download
40
40
  Scenario: create Laravel application using source from a directory
41
41
  Given laravel source has already been downloaded in "laravel" directory
42
- When I run `laravel new my_app --local=laravel`
42
+ When I run `laravel new my_app --source=laravel`
43
43
  Then laravel application should be ready to use in "my_app" directory
44
44
 
45
45
  @may_require_repository_download
@@ -51,9 +51,9 @@ Feature: Create a new application based on Laravel framework for PHP
51
51
 
52
52
  @may_require_repository_download
53
53
  Scenario: create Laravel application with maximum customizations
54
- When I run `laravel new -kgi 'home.php' -r http://github.com/laravel/pastes my_app --force`
55
- Then laravel application should be ready to use in "my_app" directory
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
56
  And the stdout should contain "Creating application forcefully"
57
- And application key must be set for "my_app" application
58
- And application index must be set to "home.php" for "my_app" application
59
- And generator tasks should be setup for "my_app" application
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
@@ -6,12 +6,11 @@ Feature: Generate a new key for Laravel application
6
6
  @may_require_repository_download
7
7
  Scenario: generate a new key for a Laravel application
8
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 application key must be set for "my_app" application
9
+ When I run `laravel config key --app=my_app`
10
+ Then configuration: "key" must be updated to "__something__" for "my_app" application
12
11
 
13
12
  @may_require_repository_download
14
13
  Scenario: create Laravel application and generate a key for it
15
14
  When I run `laravel new my_app --key`
16
15
  Then laravel application should be ready to use in "my_app" directory
17
- And application key must be set for "my_app" application
16
+ And configuration: "key" must be updated to "__something__" for "my_app" application
@@ -6,11 +6,11 @@ Feature: Update Application Index for a Laravel based application
6
6
  @may_require_repository_download
7
7
  Scenario: update Application Index in a Laravel application
8
8
  Given laravel application exists in "my_app" directory
9
- When I run `laravel update_index 'home.php' --app=my_app`
10
- Then application index must be set to "home.php" for "my_app" application
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
11
 
12
12
  @may_require_repository_download
13
13
  Scenario: create Laravel application without an Application Index
14
14
  When I run `laravel new my_app --index=''`
15
15
  Then laravel application should be ready to use in "my_app" directory
16
- And application index must be set to "" for "my_app" application
16
+ And configuration: "index" must be updated to "" for "my_app" application
@@ -3,14 +3,14 @@ Feature: Download Laravel Generator by Jeffrey Way
3
3
  As a PHP developer acquinted with ruby
4
4
  I want to use Laravel gem to download Laravel Generator by Jeffrey Way
5
5
 
6
- @may_require_repository_download
6
+ @may_require_repository_download
7
7
  Scenario: download Laravel generator
8
8
  Given laravel application exists in "my_app" directory
9
- When I run `laravel get_generator --app=my_app`
10
- Then generator tasks should be setup for "my_app" application
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
11
 
12
- @may_require_repository_download
12
+ @may_require_repository_download
13
13
  Scenario: download Laravel generator while creating an application
14
14
  When I run `laravel new my_app --generator`
15
15
  Then laravel application should be ready to use in "my_app" directory
16
- And generator tasks should be setup for "my_app" application
16
+ And task: "generator" should be installed as "generate.php" for "my_app" application
@@ -5,35 +5,50 @@ module Laravel
5
5
  end
6
6
 
7
7
  #### GIVEN ####
8
- # local cache exists
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
+ #
9
13
  Given /^local cache( does not)? exists? for "(.*?)" repository$/ do |negation, repo|
10
- repo_url = get_test_repo_url(repo)
11
- repo_path = get_test_repo_path(repo, repo_url)
14
+ @app_tester = Laravel::AppTests.new(nil, repo)
15
+
12
16
  if negation
13
- FileUtils.rm_rf repo_path
14
- else
17
+ FileUtils.rm_rf @app_tester.app.cache
18
+ elsif not @app_tester.app.has_cache?
15
19
  # 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
20
+ FileUtils.rm_rf @app_tester.app.cache
21
+ `git clone #{@app_tester.app.source} #{@app_tester.app.cache} &>/dev/null`
20
22
  end
21
23
  end
22
24
 
23
- # laravel exists in directory
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
+ #
24
29
  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)
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?
27
34
  end
28
35
 
29
- # laravel has been downloaded in directory
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
+ #
30
40
  Given /^laravel source has already been downloaded in "(.*?)" directory$/ do |dir|
31
41
  # creating laravel in directory is virtually same as it being downloaded there
32
42
  step "laravel application exists in \"#{dir}\" directory"
33
43
  end
34
44
 
35
45
  #### THEN ####
36
- # check if we have a running Laravel instance using 'Official' repository
46
+
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
+ #
37
52
  Then /^laravel application should be ready to use in "(.*?)" directory$/ do |dir|
38
53
  step "local cache for \"official\" repository should exist"
39
54
  step "the stdout should contain \"Hurray!\""
@@ -41,7 +56,10 @@ Then /^laravel application should be ready to use in "(.*?)" directory$/ do |dir
41
56
  step "permissions should be updated on \"#{dir}/storage\" directory"
42
57
  end
43
58
 
44
- # check if we have a running Laravel instance using 'non-official' repository
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
+ #
45
63
  Then /^laravel application should be ready to use in "(.*?)" directory using "(.*?)" repository$/ do |dir, repo|
46
64
  step "local cache for \"#{repo}\" repository should exist"
47
65
  step "the stdout should contain \"Hurray!\""
@@ -49,50 +67,50 @@ Then /^laravel application should be ready to use in "(.*?)" directory using "(.
49
67
  step "permissions should be updated on \"#{dir}/storage\" directory"
50
68
  end
51
69
 
52
- # check if local cache exists
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
+ #
53
73
  Then /^local cache for "(.*?)" repository should( not)? exist$/ do |repo, negation|
54
- repo_path = get_test_repo_path(repo)
55
- raise_error_based_on_condition(Laravel::has_laravel?(repo_path), negation)
74
+ @app_tester = Laravel::AppTests.new(nil, repo)
75
+ @app_tester.raise_error?(@app_tester.app.has_cache?, negation)
56
76
  end
57
77
 
58
- # check if laravel application exists in the given directory
78
+ # This test checks if a Laravel application exists (or was created) in the given
79
+ # directory. It does so by calling the 'has_laravel?' method on the application.
80
+ #
59
81
  Then /^laravel application must( not)? exist in "(.*?)" directory$/ do |negation, dir|
60
- dir = get_relative_path_to_test_directory(dir)
61
- raise_error_based_on_condition(Laravel::has_laravel?(dir), negation)
82
+ @app_tester = Laravel::AppTests.new(dir)
83
+ @app_tester.raise_error?(@app_tester.app.has_laravel?, negation)
62
84
  end
63
85
 
64
- # check if valid permissions were set on the "storage/" directory
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
+ #
65
90
  Then /^permissions should( not)? be updated on "(.*?)" directory$/ do |negation, dir|
91
+ @app_tester = Laravel::AppTests.new(dir)
66
92
  step "the stdout should contain \"Updated permissions\"" unless negation
67
- dir = get_relative_path_to_test_directory(dir)
68
- world_bit = sprintf("%o", File.stat(dir).mode).to_s[-1,1].to_i
93
+ world_bit = sprintf("%o", File.stat(@app_tester.app_dir).mode).to_s[-1,1].to_i
69
94
  is_world_writable = [2,3,6,7].include?(world_bit)
70
- raise_error_based_on_condition(is_world_writable, negation)
95
+ @app_tester.raise_error?(is_world_writable, negation)
71
96
  end
72
97
 
73
- # check if application index was set
74
- Then /^application index must be set to "(.*?)" for "(.*?)" application$/ do |new_index, app_directory|
75
- step "the stdout should contain \"Changed Application Index\""
76
- check_config_file_for_string("'index' => '#{new_index}'", app_directory)
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}\""
77
106
  end
78
107
 
79
- # check if application key was set
80
- Then /^application key must(| not) be set for "(.*?)" application$/ do |negation, app_directory|
81
- step "the stdout should contain \"Generated a new key\"" unless negation
82
- key_regex = negation.empty? ? "[0-9a-f]{32}" : "YourSecretKeyGoesHere!"
83
- check_config_file_for_string("'key' => '#{key_regex}'", app_directory)
84
- end
85
-
86
- # check if generator tasks were setup
87
- Then /^generator tasks should be setup for "(.*?)" application$/ do |dir|
88
- step "the stdout should contain \"Downloaded Laravel Generator by Jeffrey Way\""
89
- dir = get_relative_path_to_test_directory(dir)
90
- generator_tasks_file = File.join(dir, %w[ application tasks generate.php])
91
- raise_error_based_on_condition(File.exists?(generator_tasks_file))
92
- unless `which php`.empty?
93
- artisan = File.join(dir, "artisan")
94
- step "I run `php #{artisan} generate`"
95
- step "the stdout should contain \"generate\""
96
- step "the stdout should not contain \"Sorry\""
97
- end
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}\""
98
116
  end