capistrano_confirm_branch 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +2 -0
- data/lib/capistrano/confirm_branch/version.rb +2 -2
- data/lib/capistrano/confirm_branch.rb +1 -41
- data/lib/capistrano/tasks/confirm_branch.rake +45 -0
- metadata +28 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 56936370eac87071bb1bc202fab5c4414d266ce1
|
4
|
+
data.tar.gz: 636423935938dd6ab4674d2a983b3f9d2a61778d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d7391e7fdd1ebb83e34bde455f7fbd18eb810f762ac8b38660cc09b778f6194715ddbbaa787de6304ab27f40266a64eec0771c98ec5b270cce3ee6989c30373
|
7
|
+
data.tar.gz: 89784d6a0e836cd38230f236ee4028093a5a030c54fe53236a21a0cfb5e34d3f05b2ee9f1a2318cf79e6bd7e527adc61280c44182c6c1ba8adf8224282903b0c
|
data/README.md
CHANGED
@@ -1,41 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Capistrano::Configuration.instance(:must_exist).load do
|
4
|
-
before "deploy:update_code", "deploy:confirm_branch"
|
5
|
-
after "deploy", "deploy:update_current_branch"
|
6
|
-
|
7
|
-
namespace :deploy do
|
8
|
-
desc 'Confirms deployment when switching deployed branches'
|
9
|
-
task :confirm_branch do
|
10
|
-
deployed_branch = nil
|
11
|
-
pending_deploy_branch = fetch(:branch)
|
12
|
-
|
13
|
-
branch_file = "#{shared_path}/current_branch"
|
14
|
-
|
15
|
-
run %{touch #{branch_file} && cat #{branch_file}} do |ch, stream, out|
|
16
|
-
deployed_branch = out.strip
|
17
|
-
end
|
18
|
-
|
19
|
-
if deployed_branch != pending_deploy_branch
|
20
|
-
deployed_branch ||= "unknown"
|
21
|
-
|
22
|
-
Capistrano::CLI.ui.say %{
|
23
|
-
============ Changing deployed branches ============
|
24
|
-
Deployed Branch: #{deployed_branch}
|
25
|
-
Pending Deploy Branch: #{pending_deploy_branch}
|
26
|
-
====================================================
|
27
|
-
|
28
|
-
}
|
29
|
-
|
30
|
-
abort unless Capistrano::CLI.ui.agree(
|
31
|
-
"Do you wish to continue deploying #{pending_deploy_branch}?"
|
32
|
-
)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
desc 'Updates the file which tracks the currently deployed branch'
|
37
|
-
task :update_current_branch do
|
38
|
-
run %{echo "#{fetch(:branch)}" > #{shared_path}/current_branch}
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
1
|
+
load File.expand_path("../tasks/confirm_branch.rake", __FILE__)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
namespace :confirm_branch do
|
2
|
+
desc 'Confirms deployment when switching deployed branches'
|
3
|
+
task :check_deployed_branch do
|
4
|
+
ui = HighLine.new
|
5
|
+
deployed_branch = nil
|
6
|
+
pending_deploy_branch = fetch(:branch)
|
7
|
+
current_branch_path = shared_path + "current_branch"
|
8
|
+
|
9
|
+
on release_roles(:all) do
|
10
|
+
within shared_path do
|
11
|
+
deployed_branch = capture(
|
12
|
+
%{touch #{current_branch_path} && cat #{current_branch_path}}
|
13
|
+
).strip
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
if deployed_branch != pending_deploy_branch
|
18
|
+
deployed_branch = "<UNKNOWN>" if deployed_branch == ""
|
19
|
+
|
20
|
+
ui.say %{
|
21
|
+
============ Changing deployed branches ============
|
22
|
+
Deployed Branch: #{deployed_branch}
|
23
|
+
Pending Deploy Branch: #{pending_deploy_branch}
|
24
|
+
====================================================
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
abort unless ui.agree(
|
29
|
+
"Do you wish to continue deploying #{pending_deploy_branch}?"
|
30
|
+
)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Updates the file which tracks the currently deployed branch'
|
35
|
+
task :update_current_branch do
|
36
|
+
on release_roles(:all) do
|
37
|
+
within shared_path do
|
38
|
+
execute :echo, %{"#{fetch(:branch)}" > current_branch}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
before 'deploy', 'confirm_branch:check_deployed_branch'
|
45
|
+
after 'deploy', 'confirm_branch:update_current_branch'
|
metadata
CHANGED
@@ -1,30 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_confirm_branch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jordan Byron
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: capistrano
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: highline
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
20
32
|
- !ruby/object:Gem::Version
|
21
33
|
version: '0'
|
22
34
|
type: :runtime
|
23
35
|
prerelease: false
|
24
36
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
37
|
requirements:
|
27
|
-
- -
|
38
|
+
- - ">="
|
28
39
|
- !ruby/object:Gem::Version
|
29
40
|
version: '0'
|
30
41
|
description: Requires confirmation before switching deployed branches
|
@@ -34,39 +45,33 @@ executables: []
|
|
34
45
|
extensions: []
|
35
46
|
extra_rdoc_files: []
|
36
47
|
files:
|
37
|
-
- lib/capistrano/confirm_branch/version.rb
|
38
|
-
- lib/capistrano/confirm_branch.rb
|
39
|
-
- Rakefile
|
40
|
-
- README.md
|
41
48
|
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- lib/capistrano/confirm_branch.rb
|
52
|
+
- lib/capistrano/confirm_branch/version.rb
|
53
|
+
- lib/capistrano/tasks/confirm_branch.rake
|
42
54
|
homepage: https://github.com/elm-city-craftworks/capistrano_confirm_branch
|
43
55
|
licenses: []
|
56
|
+
metadata: {}
|
44
57
|
post_install_message:
|
45
58
|
rdoc_options: []
|
46
59
|
require_paths:
|
47
60
|
- lib
|
48
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
62
|
requirements:
|
51
|
-
- -
|
63
|
+
- - ">="
|
52
64
|
- !ruby/object:Gem::Version
|
53
65
|
version: '0'
|
54
|
-
segments:
|
55
|
-
- 0
|
56
|
-
hash: 4438465456247255133
|
57
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
67
|
requirements:
|
60
|
-
- -
|
68
|
+
- - ">="
|
61
69
|
- !ruby/object:Gem::Version
|
62
70
|
version: '0'
|
63
|
-
segments:
|
64
|
-
- 0
|
65
|
-
hash: 4438465456247255133
|
66
71
|
requirements: []
|
67
72
|
rubyforge_project:
|
68
|
-
rubygems_version:
|
73
|
+
rubygems_version: 2.2.2
|
69
74
|
signing_key:
|
70
|
-
specification_version:
|
75
|
+
specification_version: 4
|
71
76
|
summary: Requires confirmation before switching deployed branches
|
72
77
|
test_files: []
|