capistrano_banner 0.0.4 → 0.1.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 +33 -28
- data/capistrano_banner.gemspec +5 -5
- data/lib/capistrano/banner.rb +3 -0
- data/lib/capistrano/tasks/banner.rake +14 -0
- data/lib/capistrano_banner/base.rb +13 -17
- data/lib/capistrano_banner/version.rb +1 -1
- data/lib/capistrano_banner.rb +0 -3
- metadata +22 -27
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 68e22bb02144e977f49d7ae355b53a3511d0cbf8
|
4
|
+
data.tar.gz: a5d368282895419acc92e8a81c63b73018e16c76
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9056944f37f628f0d766d1362be58572a82e07777baabe6ff4cef58b89d5836d83f0251b8b3f10a10428c3f0bf2b127da04197ee2c73c814b70bbc0f70556da2
|
7
|
+
data.tar.gz: 322d117f4d36669319147611456d18dfe68c587228c627d255264138d89bc7671bf4b8c3191509cb34447393d469c9b832fb74a7b4caf5a189fba99e2d5b3b81
|
data/README.md
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
#
|
1
|
+
# capistrano_banner
|
2
2
|
|
3
|
-
|
3
|
+
`capistrano_banner` displays application banner, and pause in production stage
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Gemfile:
|
8
8
|
|
9
9
|
gem 'capistrano_banner'
|
10
10
|
|
11
|
-
|
11
|
+
Then:
|
12
12
|
|
13
13
|
$ bundle
|
14
14
|
|
15
|
-
|
15
|
+
### Note
|
16
16
|
|
17
|
-
|
17
|
+
After version 0.1.0, `capistrano_banner` works well just with capistrano >= 3.
|
18
|
+
|
19
|
+
If you're using capistrano =< 2, please use this gem versioned 0.0.x
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
@@ -29,23 +31,18 @@ $ artii --font=banner3-D yourapp > config/banner.txt
|
|
29
31
|
|
30
32
|
(about artii: https://github.com/miketierney/artii )
|
31
33
|
|
32
|
-
Then
|
34
|
+
Then enable in Capfile:
|
33
35
|
|
34
|
-
|
35
|
-
require 'capistrano_banner' # if you wouldn't use bundle exec
|
36
|
-
set :rails_env, 'production' # rails_env or rack_env must be fixed before call banner
|
37
|
-
set :deploy_to, '/u/apps/yourapp'
|
36
|
+
require 'capistrano/banner'
|
38
37
|
|
39
|
-
|
40
|
-
# :
|
38
|
+
This line hooks `deploy:banner` task just before `deploy:starting`.
|
41
39
|
|
42
|
-
|
43
|
-
```
|
40
|
+
See also [capistrano(3) flow](http://capistranorb.com/documentation/getting-started/flow/).
|
44
41
|
|
45
|
-
|
42
|
+
After all, let's execute cap!
|
46
43
|
|
47
44
|
```
|
48
|
-
$ cap
|
45
|
+
$ cap production deploy
|
49
46
|
'##:::'##::'#######::'##::::'##:'########:::::'###::::'########::'########::
|
50
47
|
. ##:'##::'##.... ##: ##:::: ##: ##.... ##:::'## ##::: ##.... ##: ##.... ##:
|
51
48
|
:. ####::: ##:::: ##: ##:::: ##: ##:::: ##::'##:. ##:: ##:::: ##: ##:::: ##:
|
@@ -55,26 +52,34 @@ $ cap shell
|
|
55
52
|
::: ##::::. #######::. #######:: ##:::. ##: ##:::: ##: ##:::::::: ##::::::::
|
56
53
|
:::..::::::.......::::.......:::..:::::..::..:::::..::..:::::::::..:::::::::
|
57
54
|
|
58
|
-
This is production
|
55
|
+
This is production stage. Are you ready? (y/N) >
|
59
56
|
```
|
60
57
|
|
61
|
-
In production
|
58
|
+
In production stage, capistarano pauses and waits your input.
|
62
59
|
|
63
|
-
|
60
|
+
### Custom banner hook
|
64
61
|
|
65
|
-
banner method
|
62
|
+
In another way, you can call banner method in your task:
|
66
63
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
64
|
+
```
|
65
|
+
task :foobar do
|
66
|
+
CapistranoBanner.banner("./config/custom.txt")
|
67
|
+
end
|
68
|
+
```
|
69
|
+
|
70
|
+
## Options
|
71
71
|
|
72
|
+
`capistrano_banner` respects some capistrano settings:
|
72
73
|
|
73
|
-
|
74
|
+
- `:banner_path` : A path to banner source file. Default to `"./config/banner.txt"`
|
75
|
+
- `:banner_options` : Set specifc banner options with Hash:
|
76
|
+
- `:color => :colorname'` banner color (e.g. :red, :green and :blue ... see https://github.com/flori/term-ansicolor )
|
77
|
+
- `:pause => true` anyway pause
|
78
|
+
- `:force => true` don't pause even if production env
|
74
79
|
|
75
|
-
|
80
|
+
## LICENSE
|
76
81
|
|
77
|
-
|
82
|
+
See LICENSE.txt.
|
78
83
|
|
79
84
|
## Contributing
|
80
85
|
|
data/capistrano_banner.gemspec
CHANGED
@@ -6,10 +6,10 @@ require 'capistrano_banner/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "capistrano_banner"
|
8
8
|
gem.version = CapistranoBanner::VERSION
|
9
|
-
gem.authors = ["HORII Keima"]
|
10
|
-
gem.email = ["holysugar@gmail.com"]
|
9
|
+
gem.authors = ["HORII Keima", "KONDO Uchio"]
|
10
|
+
gem.email = ["holysugar@gmail.com", "udzura@udzura.jp"]
|
11
11
|
gem.description = %q{capistrano application banner}
|
12
|
-
gem.summary = %q{
|
12
|
+
gem.summary = %q{provides a task to display application banner}
|
13
13
|
gem.homepage = "https://github.com/holysugar/capistrano_banner"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_runtime_dependency 'capistrano'
|
20
|
+
gem.add_runtime_dependency 'capistrano', '>= 3.0.0'
|
21
21
|
gem.add_runtime_dependency 'term-ansicolor'
|
22
|
-
gem.add_runtime_dependency '
|
22
|
+
gem.add_runtime_dependency 'highline'
|
23
23
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'capistrano_banner/base'
|
2
|
+
|
3
|
+
namespace :deploy do
|
4
|
+
desc 'Show banner of service'
|
5
|
+
task :banner do
|
6
|
+
path = fetch(:banner_path, "./config/banner.txt")
|
7
|
+
stage = fetch(:stage, :development)
|
8
|
+
options = fetch(:banner_options, {})
|
9
|
+
|
10
|
+
CapistranoBanner::Base.new(stage, path).print_banner(options)
|
11
|
+
end
|
12
|
+
|
13
|
+
before :starting, :banner
|
14
|
+
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'term/ansicolor'
|
2
|
-
require '
|
2
|
+
require 'highline'
|
3
3
|
|
4
4
|
module CapistranoBanner
|
5
5
|
class Base
|
6
|
-
def initialize(
|
7
|
-
@
|
6
|
+
def initialize(stage, path)
|
7
|
+
@stage = stage
|
8
8
|
@path = path
|
9
|
+
@ui = HighLine.new
|
9
10
|
end
|
10
11
|
|
11
12
|
def banner
|
@@ -17,20 +18,20 @@ module CapistranoBanner
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def pause
|
20
|
-
exit unless
|
21
|
+
exit unless @ui.agree(prompt)
|
21
22
|
end
|
22
23
|
|
23
|
-
def
|
24
|
-
"This is #{Term::ANSIColor.
|
24
|
+
def prompt
|
25
|
+
"This is #{Term::ANSIColor.send(color, @stage.to_s)} stage. Are you ready? (y/N) >"
|
25
26
|
end
|
26
27
|
|
27
28
|
def color(overwrite = nil)
|
28
29
|
return overwrite if overwrite
|
29
30
|
|
30
|
-
case @
|
31
|
-
when
|
32
|
-
when
|
33
|
-
else
|
31
|
+
case @stage
|
32
|
+
when :production ; :red
|
33
|
+
when :staging ; :yellow
|
34
|
+
else :green ; :green
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
@@ -48,12 +49,7 @@ module CapistranoBanner
|
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
path = self[:banner_path] || "./config/banner.txt"
|
54
|
-
env = self[:rack_env] || self[:rails_env] || (raise "rails_env or rack_env is required.") # FIXME: or anything else?
|
55
|
-
|
56
|
-
Base.new(env, path).print_banner(options)
|
57
|
-
end
|
52
|
+
def self.banner(banner_path = "./config/banner.txt", stage = fetch(:stage), options = {})
|
53
|
+
Base.new(stage, banner_path).print_banner(options)
|
58
54
|
end
|
59
55
|
end
|
data/lib/capistrano_banner.rb
CHANGED
metadata
CHANGED
@@ -1,103 +1,98 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_banner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- HORII Keima
|
8
|
+
- KONDO Uchio
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
17
|
requirements:
|
19
|
-
- -
|
18
|
+
- - ">="
|
20
19
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
20
|
+
version: 3.0.0
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
|
-
- -
|
25
|
+
- - ">="
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
27
|
+
version: 3.0.0
|
30
28
|
- !ruby/object:Gem::Dependency
|
31
29
|
name: term-ansicolor
|
32
30
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
31
|
requirements:
|
35
|
-
- -
|
32
|
+
- - ">="
|
36
33
|
- !ruby/object:Gem::Version
|
37
34
|
version: '0'
|
38
35
|
type: :runtime
|
39
36
|
prerelease: false
|
40
37
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
38
|
requirements:
|
43
|
-
- -
|
39
|
+
- - ">="
|
44
40
|
- !ruby/object:Gem::Version
|
45
41
|
version: '0'
|
46
42
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
43
|
+
name: highline
|
48
44
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
45
|
requirements:
|
51
|
-
- -
|
46
|
+
- - ">="
|
52
47
|
- !ruby/object:Gem::Version
|
53
48
|
version: '0'
|
54
49
|
type: :runtime
|
55
50
|
prerelease: false
|
56
51
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
52
|
requirements:
|
59
|
-
- -
|
53
|
+
- - ">="
|
60
54
|
- !ruby/object:Gem::Version
|
61
55
|
version: '0'
|
62
56
|
description: capistrano application banner
|
63
57
|
email:
|
64
58
|
- holysugar@gmail.com
|
59
|
+
- udzura@udzura.jp
|
65
60
|
executables: []
|
66
61
|
extensions: []
|
67
62
|
extra_rdoc_files: []
|
68
63
|
files:
|
69
|
-
- .gitignore
|
64
|
+
- ".gitignore"
|
70
65
|
- Gemfile
|
71
66
|
- LICENSE.txt
|
72
67
|
- README.md
|
73
68
|
- Rakefile
|
74
69
|
- capistrano_banner.gemspec
|
70
|
+
- lib/capistrano/banner.rb
|
71
|
+
- lib/capistrano/tasks/banner.rake
|
75
72
|
- lib/capistrano_banner.rb
|
76
73
|
- lib/capistrano_banner/base.rb
|
77
74
|
- lib/capistrano_banner/version.rb
|
78
75
|
homepage: https://github.com/holysugar/capistrano_banner
|
79
76
|
licenses: []
|
77
|
+
metadata: {}
|
80
78
|
post_install_message:
|
81
79
|
rdoc_options: []
|
82
80
|
require_paths:
|
83
81
|
- lib
|
84
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
83
|
requirements:
|
87
|
-
- -
|
84
|
+
- - ">="
|
88
85
|
- !ruby/object:Gem::Version
|
89
86
|
version: '0'
|
90
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
88
|
requirements:
|
93
|
-
- -
|
89
|
+
- - ">="
|
94
90
|
- !ruby/object:Gem::Version
|
95
91
|
version: '0'
|
96
92
|
requirements: []
|
97
93
|
rubyforge_project:
|
98
|
-
rubygems_version:
|
94
|
+
rubygems_version: 2.2.0
|
99
95
|
signing_key:
|
100
|
-
specification_version:
|
101
|
-
summary:
|
96
|
+
specification_version: 4
|
97
|
+
summary: provides a task to display application banner
|
102
98
|
test_files: []
|
103
|
-
has_rdoc:
|