capistrano-magento2 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +31 -0
- data/capistrano-magento2.gemspec +1 -0
- data/lib/capistrano/magento2/pending.rb +57 -0
- data/lib/capistrano/magento2/version.rb +1 -1
- data/lib/capistrano/tasks/deploy.rake +12 -4
- data/lib/capistrano/tasks/magento.rake +1 -2
- data/lib/capistrano/tasks/pending.rake +40 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccafa2eeb272e5124e13f302daca97acdf41e9ad
|
4
|
+
data.tar.gz: 69888babe9fa29f97400350dc877f5897db6fe0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49a423449c33c366b55aefc12157495a9efaadf82321b5237435710fa2f5f1dc399e0d05932f8b0b3cb27819994d852f30b61eb88428f600b525c85f7137f7f2
|
7
|
+
data.tar.gz: 091d8d13cc69479a2a2965e83dda6389e6011453e3405cb6c561b2ec5dc741fe5fb1d917bbcfc61b16b4e59582f1105949861ca7c03561bd62fa1faae5c7c4e0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Capistrano::Magento2 Change Log
|
2
2
|
|
3
|
+
0.4.0
|
4
|
+
==========
|
5
|
+
|
6
|
+
* Added optional support for capistrano-pending gem.
|
7
|
+
* Added `:magento_deploy_composer` flag. See README for details.
|
8
|
+
* Added `:magento_deploy_maintenance` flag. See README for details.
|
9
|
+
* Updated `:magento_deploy_languages` definition to explicitly declare default value.
|
10
|
+
|
3
11
|
0.3.0
|
4
12
|
==========
|
5
13
|
|
data/README.md
CHANGED
@@ -107,6 +107,27 @@ Before you can use Capistrano to deploy, you must configure the `config/deploy.r
|
|
107
107
|
|
108
108
|
Refer to the "role-based syntax" comments in the `config/deploy/*.rb` files or to the [Capistrano documentation](http://capistranorb.com/documentation/getting-started/preparing-your-application/#configure-your-server-addresses-in-the-generated-files) for details on how to configure multiple application servers.
|
109
109
|
|
110
|
+
### Magento Deploy Settings
|
111
|
+
|
112
|
+
| setting | default | what it does
|
113
|
+
| ----------------------------- | ------- | ---
|
114
|
+
| `:magento_deploy_languages` | `['en_US']` | Array of languages passed to static content deploy routine |
|
115
|
+
| `:magento_deploy_composer` | `true` | Enables composer install behaviour in the built-in deploy routine |
|
116
|
+
| `:magento_deploy_production` | `true` | Enables production specific DI compilation and static content generation |
|
117
|
+
| `:magento_deploy_maintenance` | `true` | Enables use of maintenance mode while magento:setup:upgrade runs. |
|
118
|
+
|
119
|
+
#### Example Usage
|
120
|
+
|
121
|
+
Add a line similar to the following in `config/deploy.rb` to set a custom value on one of the above settings:
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
set :magento_deploy_languages, ['en_US', 'en_CA']
|
125
|
+
```
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
set :magento_deploy_composer, false
|
129
|
+
```
|
130
|
+
|
110
131
|
### Capistrano Built-Ins
|
111
132
|
|
112
133
|
For the sake of simplicity in new project setups `:linked_dirs` and `:linked_files` are pre-configured per the following.
|
@@ -179,6 +200,16 @@ This gem specifies [terminal-notifier](https://rubygems.org/gems/terminal-notifi
|
|
179
200
|
require 'capistrano/magento2/notifier'
|
180
201
|
```
|
181
202
|
|
203
|
+
## Pending Changes
|
204
|
+
|
205
|
+
This gem specifies [capistrano-pending](https://rubygems.org/gems/capistrano-pending) as a dependency and adds some (optional) custom functionality on top of that gem: Any time the `deploy` command is run, a one line summary of git commits that will be deployed will be displayed. If the server(s) you are deploying to already have the latest changes, you will be warned of this and a prompt will appear confirming that you want to continue deploying.
|
206
|
+
|
207
|
+
To add the `capistrano-pending` gem and additional functionality to you project, add the following line to your `Capfile`:
|
208
|
+
|
209
|
+
```ruby
|
210
|
+
require 'capistrano/magento2/pending'
|
211
|
+
```
|
212
|
+
|
182
213
|
## Development
|
183
214
|
|
184
215
|
After checking out the repo, run `bundle install` to install dependencies. Make the necessary changes, then run `bundle exec rake install` to install a modified version of the gem on your local system.
|
data/capistrano-magento2.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_dependency 'capistrano', '~> 3.1'
|
31
31
|
spec.add_dependency 'terminal-notifier', '~> 1.6'
|
32
|
+
spec.add_dependency 'capistrano-pending', '~> 0.1'
|
32
33
|
|
33
34
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
34
35
|
spec.add_development_dependency 'rake', '~> 10.0'
|
@@ -0,0 +1,57 @@
|
|
1
|
+
##
|
2
|
+
# Copyright © 2016 by David Alger. All rights reserved
|
3
|
+
#
|
4
|
+
# Licensed under the Open Software License 3.0 (OSL-3.0)
|
5
|
+
# See included LICENSE file for full text of OSL-3.0
|
6
|
+
#
|
7
|
+
# http://davidalger.com/contact/
|
8
|
+
##
|
9
|
+
|
10
|
+
require 'capistrano/deploy'
|
11
|
+
require 'capistrano/pending/scm/base'
|
12
|
+
|
13
|
+
module Capistrano
|
14
|
+
module Pending
|
15
|
+
module SCM
|
16
|
+
class Git < Base
|
17
|
+
|
18
|
+
# Enhance capistrano-pending gem's native deploy:pending:log command by updating repository and then
|
19
|
+
# showing the actual changes that will be deployed. Also changes log output to oneline for easy reading
|
20
|
+
#
|
21
|
+
# Params:
|
22
|
+
# +from+ - commit-ish to compare from
|
23
|
+
# +to+ - commit-ish to compare to
|
24
|
+
# +returnOutput+ - whether to return or print the output
|
25
|
+
#
|
26
|
+
def log(from, to, returnOutput=false)
|
27
|
+
run_locally do
|
28
|
+
execute :git, :fetch, :origin # update repository to ensure accuracy of pending changes report
|
29
|
+
|
30
|
+
# Since the :branch to deploy from may be behind the upstream branch, get name of upstream branch
|
31
|
+
# and use it for comparison. We are using the test command in case the :branch is set to a specific
|
32
|
+
# commit hash, in which case there is no upstream branch.
|
33
|
+
|
34
|
+
if test(:git, 'rev-parse', '--abbrev-ref', '--symbolic-full-name', to + '@{u}')
|
35
|
+
to = capture(:git, 'rev-parse', '--abbrev-ref', '--symbolic-full-name', to + '@{u}')
|
36
|
+
end
|
37
|
+
|
38
|
+
output = capture(
|
39
|
+
:git,
|
40
|
+
:log,
|
41
|
+
"#{from}..#{to}",
|
42
|
+
'--pretty="format:%C(yellow)%h %Cblue%>(12)%ad %Cgreen%<(7)%aN%Cred%d %Creset%s"'
|
43
|
+
)
|
44
|
+
|
45
|
+
if returnOutput
|
46
|
+
return output
|
47
|
+
else
|
48
|
+
puts output
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
load File.expand_path('../../tasks/pending.rake', __FILE__)
|
@@ -13,7 +13,7 @@ namespace :deploy do
|
|
13
13
|
task :updated do
|
14
14
|
on release_roles :all do
|
15
15
|
invoke 'magento:deploy:verify'
|
16
|
-
invoke 'magento:composer:install'
|
16
|
+
invoke 'magento:composer:install' if fetch(:magento_deploy_composer)
|
17
17
|
invoke 'magento:setup:permissions'
|
18
18
|
if fetch(:magento_deploy_production)
|
19
19
|
invoke 'magento:setup:static-content:deploy'
|
@@ -25,7 +25,7 @@ namespace :deploy do
|
|
25
25
|
execute :magento, 'maintenance:enable'
|
26
26
|
end
|
27
27
|
end
|
28
|
-
invoke 'magento:maintenance:enable'
|
28
|
+
invoke 'magento:maintenance:enable' if fetch(:magento_deploy_maintenance)
|
29
29
|
invoke 'magento:setup:upgrade'
|
30
30
|
end
|
31
31
|
end
|
@@ -34,15 +34,23 @@ namespace :deploy do
|
|
34
34
|
on release_roles :all do
|
35
35
|
invoke 'magento:cache:flush'
|
36
36
|
invoke 'magento:cache:varnish:ban'
|
37
|
-
invoke 'magento:maintenance:disable'
|
37
|
+
invoke 'magento:maintenance:disable' if fetch(:magento_deploy_maintenance)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
task :reverted do
|
42
42
|
on release_roles :all do
|
43
|
-
invoke 'magento:maintenance:disable'
|
43
|
+
invoke 'magento:maintenance:disable' if fetch(:magento_deploy_maintenance)
|
44
44
|
invoke 'magento:cache:flush'
|
45
45
|
invoke 'magento:cache:varnish:ban'
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
|
+
|
50
|
+
namespace :load do
|
51
|
+
task :defaults do
|
52
|
+
set :magento_deploy_composer, fetch(:magento_deploy_composer, true)
|
53
|
+
set :magento_deploy_production, fetch(:magento_deploy_production, true)
|
54
|
+
set :magento_deploy_maintenance, fetch(:magento_deploy_maintenance, true)
|
55
|
+
end
|
56
|
+
end
|
@@ -304,7 +304,6 @@ namespace :load do
|
|
304
304
|
'var/tmp'
|
305
305
|
)
|
306
306
|
|
307
|
-
set :
|
308
|
-
set :magento_deploy_languages, fetch(:magento_deploy_languages, []) # TODO: Document deploy lang setting
|
307
|
+
set :magento_deploy_languages, fetch(:magento_deploy_languages, ['en_US'])
|
309
308
|
end
|
310
309
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
##
|
2
|
+
# Copyright © 2016 by David Alger. All rights reserved
|
3
|
+
#
|
4
|
+
# Licensed under the Open Software License 3.0 (OSL-3.0)
|
5
|
+
# See included LICENSE file for full text of OSL-3.0
|
6
|
+
#
|
7
|
+
# http://davidalger.com/contact/
|
8
|
+
##
|
9
|
+
|
10
|
+
require 'capistrano-pending'
|
11
|
+
|
12
|
+
namespace :deploy do
|
13
|
+
before :starting, 'deploy:pending:check_changes'
|
14
|
+
|
15
|
+
namespace :pending do
|
16
|
+
# Check for pending changes and notify user of incoming changes or warn them that there are no changes
|
17
|
+
task :check_changes => :setup do
|
18
|
+
on roles fetch(:capistrano_pending_role, :app) do |host|
|
19
|
+
# check for pending changes only if REVISION file exists to prevent error
|
20
|
+
if test "[ -f #{current_path}/REVISION ]"
|
21
|
+
from = fetch(:revision)
|
22
|
+
to = fetch(:branch)
|
23
|
+
|
24
|
+
output = _scm.log(from, to, true)
|
25
|
+
if output.to_s.strip.empty?
|
26
|
+
puts "\e[0;31m"
|
27
|
+
puts " No changes to deploy (from and to are the same: #{from}..#{to})"
|
28
|
+
print " Are you sure you want to continue deploying? [y/n] \e[0m"
|
29
|
+
|
30
|
+
proceed = STDIN.gets[0..0] rescue nil
|
31
|
+
exit unless proceed == 'y' || proceed == 'Y'
|
32
|
+
else
|
33
|
+
puts "Deploying changes between #{from}..#{to}"
|
34
|
+
puts output
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-magento2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Alger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: capistrano-pending
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,10 +99,12 @@ files:
|
|
85
99
|
- lib/capistrano/magento2.rb
|
86
100
|
- lib/capistrano/magento2/deploy.rb
|
87
101
|
- lib/capistrano/magento2/notifier.rb
|
102
|
+
- lib/capistrano/magento2/pending.rb
|
88
103
|
- lib/capistrano/magento2/version.rb
|
89
104
|
- lib/capistrano/tasks/deploy.rake
|
90
105
|
- lib/capistrano/tasks/magento.rake
|
91
106
|
- lib/capistrano/tasks/notifier.rake
|
107
|
+
- lib/capistrano/tasks/pending.rake
|
92
108
|
homepage: https://github.com/davidalger/capistrano-magento2
|
93
109
|
licenses:
|
94
110
|
- OSL-3.0
|