capistrano-laravel 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee0bf90a7ab76849e5fff0041f634edd9af8c4ca
4
- data.tar.gz: f6a48eb6e13f4db01ef2e5893fc754bbfba8e066
3
+ metadata.gz: 57361f1218c72a8688d1ea371db0bfe54f623b11
4
+ data.tar.gz: 890442201a4da38920b92499ecd834c19944add2
5
5
  SHA512:
6
- metadata.gz: 969abed753e724cd4647d719f9c40af8a04465fe0ceb8d20a2c6a4c927b9ad121b29e1c184c9981f491f526641548b2b3c38e4b1fd0147ede5da4ed8f9cf46d5
7
- data.tar.gz: 1a4ec1e40ac6a1626f13357fa47339468a712072999349da5dcb6b4f1a6fdc41144a3a7eb997644d0c7f042e22843e5d5c84438fd52353f313004a34a460a2c9
6
+ metadata.gz: ac6d6633fc5775870b924db24a641ae518e1624d5d8f9eb26d77312e1108debf3a9e3612a3aff586148320f68b584129655accd8101af65df9dbc0d4cf88b505
7
+ data.tar.gz: f921771e5647e2c368437499def0972b1b6fa4ee5e2a232fb24fff35baef7e25771732c34a11757001a6749981c116ecf62f2b216add54044867ea3d99abe828
data/.editorconfig ADDED
@@ -0,0 +1,18 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+
11
+ [*.md]
12
+ trim_trailing_whitespace = false
13
+
14
+ [*.rake]
15
+ indent_size = 2
16
+
17
+ [*.rb]
18
+ indent_size = 2
data/.gitignore CHANGED
@@ -1 +1,9 @@
1
- *.gem
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.13.2
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in capistrano-bundler.gemspec
3
+ # Specify your gem's dependencies in capistrano-laravel.gemspec
4
4
  gemspec
data/LICENSE CHANGED
@@ -1,20 +1,21 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013 Peter Mitchell (peterjmit@gmail.com)
3
+ Copyright (c) 2016 Peter Mitchell (peterjmit@gmail.com)
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # Capistrano::laravel
1
+ # Capistrano::Laravel
2
2
 
3
3
  Deploy Laravel applications with Capistrano v3.*
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ If managing your Capistrano deploy as a ruby project, add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
10
  gem 'capistrano', '~> 3.0.0'
@@ -13,11 +13,36 @@ gem 'capistrano-laravel'
13
13
 
14
14
  And then execute:
15
15
 
16
- $ bundle
16
+ ```shell
17
+ bundle
18
+ ```
17
19
 
18
20
  Or install it yourself as:
19
21
 
20
- $ gem install capistrano-laravel
22
+ ```shell
23
+ gem install capistrano-laravel
24
+ ```
25
+
26
+ ## Setting up Capistrano
27
+
28
+ After installing Capistrano, you can use it to initialize a skeleton configuration. To setup Capistrano, please follow the documentation provided on their website:
29
+
30
+ http://capistranorb.com/documentation/getting-started/preparing-your-application/
31
+
32
+ This will generate the following files:
33
+
34
+ ```
35
+ .
36
+ ├── Capfile # Used to manage Capistrano and its dependencies
37
+ ├── config
38
+ │   ├── deploy
39
+ │   │   ├── production.rb # Configuration for production environment
40
+ │   │   └── staging.rb # Configuration for staging environment
41
+ │   └── deploy.rb # Common configuration for all environments
42
+ └── lib
43
+ └── capistrano
44
+ └── tasks # Customized Capistrano tasks for your project
45
+ ```
21
46
 
22
47
  ## Usage
23
48
 
@@ -32,76 +57,140 @@ require 'capistrano/laravel'
32
57
  The gem makes the following configuration variables available (shown with defaults).
33
58
 
34
59
  ```ruby
35
- # Which roles to execute commands on.
60
+ # Which roles to consider as laravel roles
36
61
  set :laravel_roles, :all
37
62
 
38
- # Determines which operations to perform based on which version
39
- # of the Laravel framework your project is using.
40
- set :laravel_version, 5.1
63
+ # The artisan flags to include on artisan commands by default
64
+ set :laravel_artisan_flags, "--env=#{fetch(:stage)}"
65
+
66
+ # Which roles to use for running migrations
67
+ set :laravel_migration_roles, :all
41
68
 
42
- # If using Laravel 5+, a dotenv file is used for environment configuration.
43
- # This variable uploads the given file from the the host to the guest.
69
+ # The artisan flags to include on artisan commands by default when running migrations
70
+ set :laravel_migration_artisan_flags, "--force --env=#{fetch(:stage)}"
71
+
72
+ # The version of laravel being deployed
73
+ set :laravel_version, 5.3
74
+
75
+ # Which dotenv file to transfer to the server
44
76
  set :laravel_dotenv_file, './.env'
45
77
 
46
- # Flags to add to artisan calls.
47
- set :laravel_artisan_flags, "--env=production"
78
+ # The user that the server is running under (used for ACLs)
79
+ set :laravel_server_user, 'www-data'
80
+
81
+ # Ensure the dirs in :linked_dirs exist?
82
+ set :laravel_ensure_linked_dirs_exist, true
48
83
 
49
- # Will set linked folders based on your Laravel version
50
- set :laravel_set_linked_dirs, false
84
+ # Link the directores in laravel_linked_dirs?
85
+ set :laravel_set_linked_dirs, true
51
86
 
52
- # Will set ACL paths based on your Laravel version
87
+ # Linked directories for a standard Laravel 4 application
88
+ set :laravel_4_linked_dirs, [
89
+ 'app/storage'
90
+ ]
91
+
92
+ # Linked directories for a standard Laravel 5 application
93
+ set :laravel_5_linked_dirs, [
94
+ 'storage'
95
+ ]
96
+
97
+ # Ensure the paths in :file_permissions_paths exist?
98
+ set :laravel_ensure_acl_paths_exist, true
99
+
100
+ # Set ACLs for the paths in laravel_acl_paths?
53
101
  set :laravel_set_acl_paths, true
54
102
 
55
- # Which user to set ACL permissions for.
56
- set :laravel_server_user, "www-data"
103
+ # Paths that should have ACLs set for a standard Laravel 4 application
104
+ set :laravel_4_acl_paths, [
105
+ 'app/storage',
106
+ 'app/storage/public',
107
+ 'app/storage/cache',
108
+ 'app/storage/logs',
109
+ 'app/storage/meta',
110
+ 'app/storage/sessions',
111
+ 'app/storage/views'
112
+ ]
113
+
114
+ # Paths that should have ACLs set for a standard Laravel 5 application
115
+ set :laravel_5_acl_paths, [
116
+ 'bootstrap/cache',
117
+ 'storage',
118
+ 'storage/app',
119
+ 'storage/app/public',
120
+ 'storage/framework',
121
+ 'storage/framework/cache',
122
+ 'storage/framework/sessions',
123
+ 'storage/framework/views',
124
+ 'storage/logs'
125
+ ]
57
126
  ```
58
127
 
59
128
  ### Tasks
60
129
 
61
- The tasks are more or less automatic and are executed as follows:
130
+ The following tasks are added to your deploy automagically when adding capistrano/laravel to your deploy.
62
131
 
63
132
  ```ruby
64
- before "deploy:starting", :prepare_laravel do
65
- invoke "laravel:configure_folders"
66
- end
67
-
68
- before "deploy:updated", :laravel_tasks do
69
- invoke "laravel:upload_dotenv_file"
70
- invoke "laravel:optimize_release"
71
- invoke "laravel:create_acl_paths"
72
- invoke "deploy:set_permissions:acl"
73
- end
133
+ before 'deploy:starting', 'laravel:resolve_linked_dirs'
134
+ before 'deploy:starting', 'laravel:resolve_acl_paths'
135
+ after 'deploy:starting', 'laravel:ensure_linked_dirs_exist'
136
+ after 'deploy:starting', 'laravel:ensure_acl_paths_exist'
137
+ after 'deploy:updating', 'deploy:set_permissions:acl'
138
+ before 'composer:run', 'laravel:upload_dotenv_file'
139
+ after 'composer:run', 'laravel:storage_link'
140
+ after 'composer:run', 'laravel:optimize'
74
141
  ```
75
142
 
76
143
  #### Task Descriptions
77
144
 
78
145
  ```ruby
79
- # Execute an artisan command
80
- invoke "laravel:artisan", "command"
146
+ # Determine which folders, if any, to use for linked directories.
147
+ invoke 'laravel:resolve_linked_dirs'
148
+
149
+ # Determine which paths, if any, to have ACL permissions set.
150
+ invoke 'laravel:resolve_acl_paths'
151
+
152
+ # Ensure that linked dirs exist.
153
+ invoke 'laravel:ensure_linked_dirs_exist'
154
+
155
+ # Ensure that ACL paths exist.
156
+ invoke 'laravel:ensure_acl_paths_exist'
157
+
158
+ # Upload dotenv file for release.
159
+ invoke 'laravel:upload_dotenv_file'
81
160
 
82
- # Run any optimization commands
83
- invoke "laravel:optimize_release"
161
+ # Execute a provided artisan command.
162
+ # Replace :command_name with the command to execute
163
+ invoke 'laravel:artisan[:command_name]'
84
164
 
85
- # Configure linked dirs/acl dirs
86
- invoke "laravel:configure_folders"
165
+ # Create a cache file for faster configuration loading
166
+ invoke 'laravel:config_cache'
87
167
 
88
- # Upload the dotenv file from local to remote
89
- invoke "laravel:upload_dotenv_file"
168
+ # Create a route cache file for faster route registration
169
+ invoke 'laravel:route_cache'
90
170
 
91
- # Seed the database
92
- invoke "laravel:seed_db"
171
+ # Optimize the framework for better performance.
172
+ invoke 'laravel:optimize'
93
173
 
94
- # Create any missing folders for ACL
95
- invoke "laravel:create_acl_paths"
174
+ # Create a symbolic link from "public/storage" to "storage/app/public"
175
+ invoke 'laravel:storage_link'
96
176
 
97
- # Run migrations for the database
98
- invoke "laravel:migrate_db"
177
+ # Run the database migrations.
178
+ invoke 'laravel:migrate'
179
+
180
+ # Rollback the last database migration.
181
+ invoke 'laravel:migrate_rollback'
99
182
  ```
100
183
 
184
+ ## Development
185
+
186
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
187
+
188
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
189
+
101
190
  ## Contributing
102
191
 
103
- 1. Fork it
104
- 2. Create your feature branch (`git checkout -b my-new-feature`)
105
- 3. Commit your changes (`git commit -am 'Add some feature'`)
106
- 4. Push to the branch (`git push origin my-new-feature`)
107
- 5. Create new Pull Request
192
+ Bug reports and pull requests are welcome on GitHub at https://github.com/capistrano/laravel.
193
+
194
+ ## License
195
+
196
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "capistrano/laravel"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,26 +1,31 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/laravel/version'
4
5
 
5
6
  Gem::Specification.new do |spec|
6
- spec.name = 'capistrano-laravel'
7
- spec.version = '0.0.4'
8
- spec.authors = ['Peter Mitchell', 'Andrew Miller']
9
- spec.email = ['peterjmit@gmail.com', 'ikari7789@yahoo.com']
10
- spec.description = %q{Laravel specific deployment options for Capistrano 3.x}
11
- spec.summary = %q{Laravel deployment for Capistrano 3.x}
12
- spec.homepage = 'https://github.com/capistrano/laravel'
13
- spec.license = 'MIT'
7
+ spec.name = "capistrano-laravel"
8
+ spec.version = Capistrano::Laravel::VERSION
9
+ spec.authors = ["Peter Mitchell", "Andrew Miller"]
10
+ spec.email = ["peterjmit@gmail.com", "ikari7789@yahoo.com"]
14
11
 
15
- spec.files = `git ls-files`.split($/)
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ['lib']
12
+ spec.summary = %q{Laravel specific deployment options for Capistrano 3.x}
13
+ spec.description = %q{Laravel deployment for Capistrano 3.x}
14
+ spec.homepage = "https://github.com/capistrano/laravel"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
19
23
 
20
24
  spec.add_dependency 'capistrano', '~> 3.0'
21
25
  spec.add_dependency 'capistrano-composer', '~> 0.0.6'
22
26
  spec.add_dependency 'capistrano-file-permissions', '~> 1.0'
23
27
 
24
- spec.add_development_dependency 'bundler', '~> 1.3'
25
- spec.add_development_dependency 'rake', '~> 10.4'
28
+ spec.add_development_dependency "bundler", "~> 1.13"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rspec", "~> 3.0"
26
31
  end
@@ -1,4 +1,5 @@
1
1
  require "capistrano/composer"
2
2
  require "capistrano/file-permissions"
3
+ require "capistrano/laravel/version"
3
4
 
4
5
  load File.expand_path("../tasks/laravel.rake", __FILE__)
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Laravel
3
- VERSION = "0.0.4"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -1,54 +1,67 @@
1
- require 'capistrano/laravel/helpers'
2
-
3
1
  include Comparable
4
- include Capistrano::Laravel::Helpers
5
2
 
6
3
  namespace :load do
7
4
  task :defaults do
5
+ # Which roles to consider as laravel roles
8
6
  set :laravel_roles, :all
9
- set :laravel_migrate_roles, :all
10
- set :laravel_version, 5.1
11
- set :laravel_dotenv_file, './.env'
12
- set :laravel_artisan_flags, '--env=production'
13
- set :laravel_artisan_migrate_flags, '--env=production'
14
- set :laravel_set_linked_dirs, true
15
- set :laravel_set_acl_paths, true
16
- set :laravel_create_linked_acl_paths, true
7
+
8
+ # The artisan flags to include on artisan commands by default
9
+ set :laravel_artisan_flags, "--env=#{fetch(:stage)}"
10
+
11
+ # Which roles to use for running migrations
12
+ set :laravel_migration_roles, :all
13
+
14
+ # The artisan flags to include on artisan commands by default when running migrations
15
+ set :laravel_migration_artisan_flags, "--force --env=#{fetch(:stage)}"
16
+
17
+ # The version of laravel being deployed
18
+ set :laravel_version, 5.3
19
+
20
+ # Which dotenv file to transfer to the server
21
+ set :laravel_dotenv_file, '.env'
22
+
23
+ # The user that the server is running under (used for ACLs)
17
24
  set :laravel_server_user, 'www-data'
18
25
 
19
- # Folders to link between releases
26
+ # Ensure the dirs in :linked_dirs exist?
27
+ set :laravel_ensure_linked_dirs_exist, true
28
+
29
+ # Link the directores in laravel_linked_dirs?
30
+ set :laravel_set_linked_dirs, true
31
+
32
+ # Linked directories for a standard Laravel 4 application
20
33
  set :laravel_4_linked_dirs, [
21
34
  'app/storage'
22
35
  ]
36
+
37
+ # Linked directories for a standard Laravel 5 application
23
38
  set :laravel_5_linked_dirs, [
24
39
  'storage'
25
40
  ]
26
- set :laravel_5_1_linked_dirs, [
27
- 'storage'
28
- ]
29
41
 
30
- # Folders to set permissions on based on laravel version
42
+ # Ensure the paths in :file_permissions_paths exist?
43
+ set :laravel_ensure_acl_paths_exist, true
44
+
45
+ # Set ACLs for the paths in laravel_acl_paths?
46
+ set :laravel_set_acl_paths, true
47
+
48
+ # Paths that should have ACLs set for a standard Laravel 4 application
31
49
  set :laravel_4_acl_paths, [
32
50
  'app/storage',
51
+ 'app/storage/public',
33
52
  'app/storage/cache',
34
53
  'app/storage/logs',
35
54
  'app/storage/meta',
36
55
  'app/storage/sessions',
37
56
  'app/storage/views'
38
57
  ]
58
+
59
+ # Paths that should have ACLs set for a standard Laravel 5 application
39
60
  set :laravel_5_acl_paths, [
40
- 'storage',
41
- 'storage/app',
42
- 'storage/framework',
43
- 'storage/framework/cache',
44
- 'storage/framework/sessions',
45
- 'storage/framework/views',
46
- 'storage/logs'
47
- ]
48
- set :laravel_5_1_acl_paths, [
49
61
  'bootstrap/cache',
50
62
  'storage',
51
63
  'storage/app',
64
+ 'storage/app/public',
52
65
  'storage/framework',
53
66
  'storage/framework/cache',
54
67
  'storage/framework/sessions',
@@ -59,51 +72,58 @@ namespace :load do
59
72
  end
60
73
 
61
74
  namespace :laravel do
62
- desc 'Set the ACL for the web user based on Laravel version.'
63
- task :configure_folders do
75
+ desc 'Determine which folders, if any, to use for linked directories.'
76
+ task :resolve_linked_dirs do
64
77
  laravel_version = fetch(:laravel_version)
65
- laravel_linked_dirs = []
66
- laravel_acl_paths = []
78
+
79
+ # Use Laravel 5 linked dirs by default
80
+ laravel_linked_dirs = fetch(:laravel_5_linked_dirs)
67
81
  if laravel_version < 5 # Laravel 4
68
82
  laravel_linked_dirs = fetch(:laravel_4_linked_dirs)
69
- laravel_acl_paths = fetch(:laravel_4_acl_paths)
70
- elsif laravel_version < 5.1 # Laravel 5
71
- laravel_linked_dirs = fetch(:laravel_5_linked_dirs)
72
- laravel_acl_paths = fetch(:laravel_5_acl_paths)
73
- else # Laravel 5.1 or greater
74
- laravel_linked_dirs = fetch(:laravel_5_1_linked_dirs)
75
- laravel_acl_paths = fetch(:laravel_5_1_acl_paths)
76
83
  end
77
84
 
78
85
  if fetch(:laravel_set_linked_dirs)
79
86
  set :linked_dirs, fetch(:linked_dirs, []).push(*laravel_linked_dirs)
80
87
  end
88
+ end
89
+
90
+ desc 'Determine which paths, if any, to have ACL permissions set.'
91
+ task :resolve_acl_paths do
92
+ laravel_version = fetch(:laravel_version)
93
+
94
+ # Use Laravel 5 ACL paths by default
95
+ laravel_acl_paths = fetch(:laravel_5_acl_paths)
96
+ if laravel_version < 5 # Laravel 4
97
+ laravel_acl_paths = fetch(:laravel_4_acl_paths)
98
+ end
81
99
 
82
100
  if fetch(:laravel_set_acl_paths)
83
- set :file_permissions_paths, fetch(:file_permissions_paths, []).push(*laravel_acl_paths)
84
- set :file_permissions_users, [fetch(:laravel_server_user)]
101
+ set :file_permissions_paths, fetch(:file_permissions_paths, []).push(*laravel_acl_paths).uniq
102
+ set :file_permissions_users, fetch(:file_permissions_users, []).push(fetch(:laravel_server_user)).uniq
85
103
  end
86
104
  end
87
105
 
88
- desc 'Create missing directories.'
89
- task :create_linked_acl_paths do
90
- if fetch(:laravel_create_linked_acl_paths)
91
- if fetch(:laravel_version) < 5
92
- laravel_acl_paths = fetch(:laravel_4_acl_paths)
93
- elsif fetch(:laravel_version) < 5.1
94
- laravel_acl_paths = fetch(:laravel_5_acl_paths)
95
- else
96
- laravel_acl_paths = fetch(:laravel_5_1_acl_paths)
106
+ desc 'Ensure that linked dirs exist.'
107
+ task :ensure_linked_dirs_exist do
108
+ next unless fetch(:laravel_ensure_linked_dirs_exist)
109
+
110
+ on roles fetch(:laravel_roles) do
111
+ fetch(:linked_dirs).each do |path|
112
+ within release_path do
113
+ execute :mkdir, '-p', path
114
+ end
97
115
  end
116
+ end
117
+ end
118
+
119
+ desc 'Ensure that ACL paths exist.'
120
+ task :ensure_acl_paths_exist do
121
+ next unless fetch(:laravel_ensure_acl_paths_exist)
98
122
 
99
- on roles fetch(:laravel_roles) do
100
- laravel_acl_paths.each do |path|
101
- acl_path = release_path.join(path)
102
- if test("[ ! -e '#{acl_path}' ]")
103
- execute :mkdir, '-vp', acl_path
104
- else
105
- info "#{acl_path} already exists."
106
- end
123
+ on roles fetch(:laravel_roles) do
124
+ fetch(:file_permissions_paths).each do |path|
125
+ within release_path do
126
+ execute :mkdir, '-p', path
107
127
  end
108
128
  end
109
129
  end
@@ -111,19 +131,25 @@ namespace :laravel do
111
131
 
112
132
  desc 'Upload dotenv file for release.'
113
133
  task :upload_dotenv_file do
114
- if fetch(:laravel_version) >= 5
115
- on roles fetch(:laravel_roles) do
116
- unless fetch(:laravel_dotenv_file).empty?
117
- upload! fetch(:laravel_dotenv_file), "#{release_path}/.env"
118
- end
134
+ # Dotenv was introduced in Laravel 5
135
+ next if fetch(:laravel_version) < 5
136
+
137
+ dotenv_file = fetch(:laravel_dotenv_file)
138
+
139
+ run_locally do
140
+ if dotenv_file.empty? || test("[ ! -e #{dotenv_file} ]")
141
+ raise Capistrano::ValidationError, "Must prepare dotenv file [#{dotenv_file}] locally before deploy!"
119
142
  end
120
143
  end
144
+
145
+ on roles fetch(:laravel_roles) do
146
+ upload! dotenv_file, "#{release_path}/.env"
147
+ end
121
148
  end
122
149
 
123
- desc 'Execute a provided artisan command'
124
- task :artisan, :command_name do |_t, args|
125
- # ask only runs if argument is not provided
126
- ask(:cmd, 'list')
150
+ desc 'Execute a provided artisan command.'
151
+ task :artisan, [:command_name] do |_t, args|
152
+ ask(:cmd, 'list') # Ask only runs if argument is not provided
127
153
  command = args[:command_name] || fetch(:cmd)
128
154
 
129
155
  on roles fetch(:laravel_roles) do
@@ -131,47 +157,68 @@ namespace :laravel do
131
157
  execute :php, :artisan, command, *args.extras, fetch(:laravel_artisan_flags)
132
158
  end
133
159
  end
134
-
135
- # enable task artisan to be ran twice
160
+
161
+ # Enable task artisan to be ran more than once
136
162
  Rake::Task['laravel:artisan'].reenable
137
163
  end
138
164
 
139
- desc 'Optimize the configuration'
140
- task :optimize_config do
141
- invoke 'laravel:artisan', 'config:cache' if fetch(:laravel_version) >= 5
165
+ desc 'Create a cache file for faster configuration loading.'
166
+ task :config_cache do
167
+ next if fetch(:laravel_version) < 5
168
+ Rake::Task['laravel:artisan'].invoke('config:cache')
142
169
  end
143
170
 
144
- desc 'Optimize the routing file'
145
- task :optimize_route do
146
- invoke 'laravel:artisan', 'route:cache' if fetch(:laravel_version) >= 5
171
+ desc 'Create a route cache file for faster route registration.'
172
+ task :route_cache do
173
+ next if fetch(:laravel_version) < 5
174
+ Rake::Task['laravel:artisan'].invoke('route:cache')
147
175
  end
148
176
 
149
- desc 'Optimize a Laravel installation for optimimum performance in production.'
150
- task :optimize_release do
151
- invoke 'laravel:artisan', :optimize, :'--force'
177
+ desc 'Optimize the framework for better performance.'
178
+ task :optimize do
179
+ Rake::Task['laravel:artisan'].invoke(:optimize, '--force')
152
180
  end
153
181
 
154
- desc 'Run migrations against the database using Artisan.'
155
- task :migrate_db do |_t, args|
156
- on roles fetch(:laravel_migrate_roles) do
157
- within release_path do
158
- execute :php, :artisan, :migrate, *args.extras, fetch(:laravel_artisan_migrate_flags)
159
- end
160
- end
182
+ desc 'Create a symbolic link from "public/storage" to "storage/app/public."'
183
+ task :storage_link do
184
+ next if fetch(:laravel_version) < 5
185
+ Rake::Task['laravel:artisan'].invoke('storage:link')
161
186
  end
162
187
 
163
- desc 'Rollback migrations against the database using Artisan.'
164
- task :rollback_db do
165
- on roles fetch(:laravel_roles) do
166
- within release_path do
167
- execute :php, :artisan, 'migrate:rollback', *args.extras, fetch(:laravel_artisan_migrate_flags)
168
- end
169
- end
188
+ desc 'Run the database migrations.'
189
+ task :migrate do
190
+ laravel_roles = fetch(:laravel_roles)
191
+ laravel_artisan_flags = fetch(:laravel_artisan_flags)
192
+
193
+ set(:laravel_roles, fetch(:laravel_migration_roles))
194
+ set(:laravel_artisan_flags, fetch(:laravel_migration_artisan_flags))
195
+
196
+ Rake::Task['laravel:artisan'].invoke(:migrate)
197
+
198
+ set(:laravel_roles, laravel_roles)
199
+ set(:laravel_artisan_flags, laravel_artisan_flags)
200
+ end
201
+
202
+ desc 'Rollback the last database migration.'
203
+ task :migrate_rollback do
204
+ laravel_roles = fetch(:laravel_roles)
205
+ laravel_artisan_flags = fetch(:laravel_artisan_flags)
206
+
207
+ set(:laravel_roles, fetch(:laravel_migration_roles))
208
+ set(:laravel_artisan_flags, fetch(:laravel_migration_artisan_flags))
209
+
210
+ Rake::Task['laravel:artisan'].invoke('migrate:rollback')
211
+
212
+ set(:laravel_roles, laravel_roles)
213
+ set(:laravel_artisan_flags, laravel_artisan_flags)
170
214
  end
171
215
 
172
- before 'deploy:starting', 'laravel:configure_folders'
173
- after 'deploy:symlink:shared', 'laravel:create_linked_acl_paths'
174
- after 'deploy:symlink:shared', 'deploy:set_permissions:acl'
175
- after 'deploy:symlink:shared', 'laravel:upload_dotenv_file'
176
- before 'deploy:updated', 'laravel:optimize_release'
216
+ before 'deploy:starting', 'laravel:resolve_linked_dirs'
217
+ before 'deploy:starting', 'laravel:resolve_acl_paths'
218
+ after 'deploy:starting', 'laravel:ensure_linked_dirs_exist'
219
+ after 'deploy:starting', 'laravel:ensure_acl_paths_exist'
220
+ after 'deploy:updating', 'deploy:set_permissions:acl'
221
+ before 'composer:run', 'laravel:upload_dotenv_file'
222
+ after 'composer:run', 'laravel:storage_link'
223
+ after 'composer:run', 'laravel:optimize'
177
224
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-laravel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mitchell
8
8
  - Andrew Miller
9
9
  autorequire:
10
- bindir: bin
10
+ bindir: exe
11
11
  cert_chain: []
12
- date: 2016-10-02 00:00:00.000000000 Z
12
+ date: 2016-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -59,29 +59,43 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '1.3'
62
+ version: '1.13'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '1.3'
69
+ version: '1.13'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rake
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '10.4'
76
+ version: '10.0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '10.4'
84
- description: Laravel specific deployment options for Capistrano 3.x
83
+ version: '10.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '3.0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '3.0'
98
+ description: Laravel deployment for Capistrano 3.x
85
99
  email:
86
100
  - peterjmit@gmail.com
87
101
  - ikari7789@yahoo.com
@@ -89,15 +103,19 @@ executables: []
89
103
  extensions: []
90
104
  extra_rdoc_files: []
91
105
  files:
106
+ - ".editorconfig"
92
107
  - ".gitignore"
108
+ - ".rspec"
109
+ - ".travis.yml"
93
110
  - Gemfile
94
111
  - LICENSE
95
112
  - README.md
96
113
  - Rakefile
114
+ - bin/console
115
+ - bin/setup
97
116
  - capistrano-laravel.gemspec
98
117
  - lib/capistrano-laravel.rb
99
118
  - lib/capistrano/laravel.rb
100
- - lib/capistrano/laravel/helpers.rb
101
119
  - lib/capistrano/laravel/version.rb
102
120
  - lib/capistrano/tasks/laravel.rake
103
121
  homepage: https://github.com/capistrano/laravel
@@ -123,5 +141,5 @@ rubyforge_project:
123
141
  rubygems_version: 2.5.1
124
142
  signing_key:
125
143
  specification_version: 4
126
- summary: Laravel deployment for Capistrano 3.x
144
+ summary: Laravel specific deployment options for Capistrano 3.x
127
145
  test_files: []
@@ -1,6 +0,0 @@
1
- module Capistrano
2
- module Laravel
3
- module Helpers
4
- end
5
- end
6
- end