capistrano-confirmation 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 +15 -0
- data/.gitignore +4 -0
- data/Gemfile +2 -0
- data/LICENSE +18 -0
- data/README.md +35 -0
- data/Rakefile +1 -0
- data/capistrano-confirmation.gemspec +17 -0
- data/lib/capistrano/confirmation.rb +41 -0
- data/lib/version.rb +5 -0
- metadata +53 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTY3NGEzYWU4NmQ3OTk5N2Y1NmNmZWI3ZTg5N2U3NTQ4MGVlMWMyNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODg5OTZmNjQ4YWQyNDljMTc1YzczOTVmOWQxNzkzZGQ0ZmI3ODBiYQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTEzNzYyZDlhMmUxMjBlNTdkOGEyMjI2ZTU3YmVmMzNjZGViYjRmMDdjMGEy
|
10
|
+
OGZjMWY3N2Y5OGIzYzdhNzQzZGE4ZGEwODYzNWZkM2JmNDUxYzNhZjQ4MDQw
|
11
|
+
NDYxNzMzMDgxMjU3YWZkMGU0ZWI5YTc3YWIwNTM5YmMzZjdkZWE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OTA2MTYzZGMxZjhhZmZjMWJlNTQ1OTJhNzQzMDNkZjk5NzZiODNiYjA2YmEx
|
14
|
+
OWUyYTk5MTZhZGM4NmQxYzM4MTA3NGM2MmEyYmVjMGU1OGZmYzM4Y2ViNDk3
|
15
|
+
OWUwMjMzOGZkMmZhMWRhMjNmNzE3MjQ3ZjEyMzY2NzBlYmIyMDM=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
2
|
+
a copy of this software and associated documentation files (the
|
3
|
+
'Software'), to deal in the Software without restriction, including
|
4
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
5
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
6
|
+
permit persons to whom the Software is furnished to do so, subject to
|
7
|
+
the following conditions:
|
8
|
+
|
9
|
+
The above copyright notice and this permission notice shall be
|
10
|
+
included in all copies or substantial portions of the Software.
|
11
|
+
|
12
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
13
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
14
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
15
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
16
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
17
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
18
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Capistrano Confirmation
|
2
|
+
|
3
|
+
This gem prompts you for a confirmation before deploy.
|
4
|
+
|
5
|
+
It is a slightly modified version of [jinzhu's gem](https://github.com/jinzhu/capistrano-confirm).
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Add to your gemfile.
|
10
|
+
|
11
|
+
```
|
12
|
+
gem 'capistrano-confirmation'
|
13
|
+
```
|
14
|
+
|
15
|
+
Add to deploy.rb
|
16
|
+
|
17
|
+
```
|
18
|
+
require 'capistrano/confirmation'
|
19
|
+
set :confirm_stages, "production" # or: set :confirm_stages, [:production, :staging]
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
## Demo Output
|
24
|
+
|
25
|
+
```
|
26
|
+
==============================================================================================================
|
27
|
+
|
28
|
+
WARNING: You're about to perform actions on Yelp PRODUCTION server(s).
|
29
|
+
Current branch is set to master.
|
30
|
+
Please confirm that your mental health is stable:
|
31
|
+
|
32
|
+
What is 2 + 3?
|
33
|
+
|
34
|
+
==============================================================================================================
|
35
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "capistrano-confirmation"
|
6
|
+
s.version = CapistranoConfirmation::VERSION
|
7
|
+
s.authors = ["Jinzhu", "David Lesches"]
|
8
|
+
s.email = ["david@lesches.com"]
|
9
|
+
s.homepage = "https://github.com/davidlesches/capistrano-confirmation"
|
10
|
+
s.summary = %q{ Adds ability for Capistrano to require confirmation before deploying. }
|
11
|
+
s.description = %q{ Adds ability for Capistrano to require confirmation before deploying. }
|
12
|
+
s.rubyforge_project = "capistrano-confirmation"
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'capistrano'
|
2
|
+
|
3
|
+
def colorful(str, code="31")
|
4
|
+
"\e[#{code}m#{str}\e[0m"
|
5
|
+
end
|
6
|
+
|
7
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
8
|
+
namespace :deploy do
|
9
|
+
task :confirm do
|
10
|
+
if (Array[confirm_stages].flatten.map(&:to_s).include?(stage.to_s) rescue true)
|
11
|
+
|
12
|
+
first_num, second_num = rand(10), rand(10)
|
13
|
+
result = first_num + second_num
|
14
|
+
|
15
|
+
application_info = " #{colorful(application)}"
|
16
|
+
|
17
|
+
Capistrano::CLI.ui.say <<-WARN
|
18
|
+
|
19
|
+
#{colorful('==============================================================================================================', 36)}
|
20
|
+
|
21
|
+
WARNING: You're about to perform actions on #{colorful(application.capitalize)} #{colorful(stage.upcase)} server(s).
|
22
|
+
Current branch is set to #{colorful(branch)}.
|
23
|
+
Please confirm that your mental health is stable:
|
24
|
+
|
25
|
+
What is #{first_num} + #{second_num}?
|
26
|
+
|
27
|
+
#{colorful('==============================================================================================================', 36)}
|
28
|
+
|
29
|
+
WARN
|
30
|
+
|
31
|
+
answer = Capistrano::CLI.ui.ask("Answer: ").strip
|
32
|
+
unless (answer =~ /^\s*\d+\s*$/) && (answer.to_i == result)
|
33
|
+
Capistrano::CLI.ui.say "Actions aborted."
|
34
|
+
abort
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
before "deploy:update_code", "deploy:confirm"
|
40
|
+
end
|
41
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-confirmation
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jinzhu
|
8
|
+
- David Lesches
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! ' Adds ability for Capistrano to require confirmation before deploying. '
|
15
|
+
email:
|
16
|
+
- david@lesches.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- capistrano-confirmation.gemspec
|
27
|
+
- lib/capistrano/confirmation.rb
|
28
|
+
- lib/version.rb
|
29
|
+
homepage: https://github.com/davidlesches/capistrano-confirmation
|
30
|
+
licenses: []
|
31
|
+
metadata: {}
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
requirements: []
|
47
|
+
rubyforge_project: capistrano-confirmation
|
48
|
+
rubygems_version: 2.1.9
|
49
|
+
signing_key:
|
50
|
+
specification_version: 4
|
51
|
+
summary: Adds ability for Capistrano to require confirmation before deploying.
|
52
|
+
test_files: []
|
53
|
+
has_rdoc:
|