capistrano-laravel 0.0.4 → 1.0.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.
- checksums.yaml +4 -4
- data/.editorconfig +18 -0
- data/.gitignore +9 -1
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +1 -1
- data/LICENSE +15 -14
- data/README.md +136 -47
- data/Rakefile +6 -1
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/capistrano-laravel.gemspec +19 -14
- data/lib/capistrano/laravel.rb +1 -0
- data/lib/capistrano/laravel/version.rb +1 -1
- data/lib/capistrano/tasks/laravel.rake +141 -94
- metadata +28 -10
- data/lib/capistrano/laravel/helpers.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57361f1218c72a8688d1ea371db0bfe54f623b11
|
4
|
+
data.tar.gz: 890442201a4da38920b92499ecd834c19944add2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/LICENSE
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
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
|
6
|
-
this software and associated documentation files (the "Software"), to deal
|
7
|
-
the Software without restriction, including without limitation the rights
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
the Software, and to permit persons to whom the Software is
|
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
|
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,
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
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::
|
1
|
+
# Capistrano::Laravel
|
2
2
|
|
3
3
|
Deploy Laravel applications with Capistrano v3.*
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
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
|
-
|
16
|
+
```shell
|
17
|
+
bundle
|
18
|
+
```
|
17
19
|
|
18
20
|
Or install it yourself as:
|
19
21
|
|
20
|
-
|
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
|
60
|
+
# Which roles to consider as laravel roles
|
36
61
|
set :laravel_roles, :all
|
37
62
|
|
38
|
-
#
|
39
|
-
|
40
|
-
|
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
|
-
#
|
43
|
-
|
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
|
-
#
|
47
|
-
set :
|
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
|
-
#
|
50
|
-
set :laravel_set_linked_dirs,
|
84
|
+
# Link the directores in laravel_linked_dirs?
|
85
|
+
set :laravel_set_linked_dirs, true
|
51
86
|
|
52
|
-
#
|
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
|
-
#
|
56
|
-
set :
|
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
|
130
|
+
The following tasks are added to your deploy automagically when adding capistrano/laravel to your deploy.
|
62
131
|
|
63
132
|
```ruby
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
-
#
|
80
|
-
invoke
|
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
|
-
#
|
83
|
-
|
161
|
+
# Execute a provided artisan command.
|
162
|
+
# Replace :command_name with the command to execute
|
163
|
+
invoke 'laravel:artisan[:command_name]'
|
84
164
|
|
85
|
-
#
|
86
|
-
invoke
|
165
|
+
# Create a cache file for faster configuration loading
|
166
|
+
invoke 'laravel:config_cache'
|
87
167
|
|
88
|
-
#
|
89
|
-
invoke
|
168
|
+
# Create a route cache file for faster route registration
|
169
|
+
invoke 'laravel:route_cache'
|
90
170
|
|
91
|
-
#
|
92
|
-
invoke
|
171
|
+
# Optimize the framework for better performance.
|
172
|
+
invoke 'laravel:optimize'
|
93
173
|
|
94
|
-
# Create
|
95
|
-
invoke
|
174
|
+
# Create a symbolic link from "public/storage" to "storage/app/public"
|
175
|
+
invoke 'laravel:storage_link'
|
96
176
|
|
97
|
-
# Run
|
98
|
-
invoke
|
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
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
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
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
data/capistrano-laravel.gemspec
CHANGED
@@ -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 =
|
7
|
-
spec.version =
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
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.
|
16
|
-
spec.
|
17
|
-
spec.
|
18
|
-
spec.
|
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
|
25
|
-
spec.add_development_dependency
|
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
|
data/lib/capistrano/laravel.rb
CHANGED
@@ -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
|
-
|
10
|
-
|
11
|
-
set :
|
12
|
-
|
13
|
-
|
14
|
-
set :
|
15
|
-
|
16
|
-
|
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
|
-
#
|
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
|
-
#
|
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 '
|
63
|
-
task :
|
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
|
-
|
66
|
-
|
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 '
|
89
|
-
task :
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
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
|
-
#
|
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
|
-
#
|
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 '
|
140
|
-
task :
|
141
|
-
|
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 '
|
145
|
-
task :
|
146
|
-
|
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
|
150
|
-
task :
|
151
|
-
|
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 '
|
155
|
-
task :
|
156
|
-
|
157
|
-
|
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 '
|
164
|
-
task :
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
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:
|
173
|
-
|
174
|
-
after
|
175
|
-
after
|
176
|
-
|
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
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Mitchell
|
8
8
|
- Andrew Miller
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
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.
|
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.
|
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.
|
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.
|
84
|
-
|
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: []
|