luban 0.8.7 → 0.8.8
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/CHANGELOG.md +6 -0
- data/lib/luban/deployment/cli/application/base.rb +2 -2
- data/lib/luban/deployment/cli/command.rb +122 -117
- data/lib/luban/deployment/cli/package/base.rb +31 -29
- data/lib/luban/deployment/cli/project.rb +5 -5
- data/lib/luban/deployment/packages/bundler.rb +2 -2
- data/lib/luban/deployment/packages/git.rb +2 -2
- data/lib/luban/deployment/packages/ruby.rb +8 -7
- data/lib/luban/deployment/packages/rubygems.rb +2 -2
- data/lib/luban/deployment/version.rb +1 -1
- data/luban.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d493b2d012713f59e25fb1e6e6d7a10775b3ed3
|
4
|
+
data.tar.gz: 8e43f9b7bf5753860763814289f41d1d29672fc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 960cc4b82033d31b8d6276ef8dd8c6755cf5a67819d5f48dd2310eeab7b3280f622641e265eb0cd376f581de3950eaa4f1a382dd411f92dbce310f882654eac1
|
7
|
+
data.tar.gz: 4f006ad06fa68c930c788a51d8158e113e57c36960c84a2dad35d393b7283224c1c05807cfdbcbf835b8457eb7e9d39ffd2fd848116448c2403992a03e80ffa7
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,7 @@ module Luban
|
|
4
4
|
using Luban::CLI::CoreRefinements
|
5
5
|
include Luban::Deployment::Parameters::Project
|
6
6
|
include Luban::Deployment::Parameters::Application
|
7
|
-
include Luban::Deployment::Command::Tasks::
|
7
|
+
include Luban::Deployment::Command::Tasks::Provision
|
8
8
|
include Luban::Deployment::Command::Tasks::Deploy
|
9
9
|
include Luban::Deployment::Command::Tasks::Control
|
10
10
|
include Luban::Deployment::Command::Tasks::Monitor
|
@@ -55,7 +55,7 @@ module Luban
|
|
55
55
|
def has_packages?; !packages.empty?; end
|
56
56
|
def has_services?; !services.empty?; end
|
57
57
|
|
58
|
-
def
|
58
|
+
def provisionable?; has_packages?; end
|
59
59
|
def deployable?; has_source? or has_profile? end
|
60
60
|
def controllable?; has_source? or has_services?; end
|
61
61
|
|
@@ -2,7 +2,7 @@ module Luban
|
|
2
2
|
module Deployment
|
3
3
|
class Command < Luban::CLI::Command
|
4
4
|
module Tasks
|
5
|
-
module
|
5
|
+
module Provision
|
6
6
|
Actions = %i(setup build destroy cleanup binstubs
|
7
7
|
show_current show_summary which whence)
|
8
8
|
Actions.each do |action|
|
@@ -11,60 +11,64 @@ module Luban
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def provisionable?; true; end
|
15
|
+
|
16
|
+
def provision_tasks; commands[:provision].commands; end
|
15
17
|
|
16
18
|
protected
|
17
19
|
|
18
|
-
def
|
20
|
+
def setup_provision_tasks
|
19
21
|
_self = self
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
22
|
+
command :provision do
|
23
|
+
task :setup do
|
24
|
+
desc "Setup #{_self.display_name} environment"
|
25
|
+
action! :setup
|
26
|
+
end
|
27
|
+
|
28
|
+
task :build do
|
29
|
+
desc "Build #{_self.display_name} environment"
|
30
|
+
switch :force, "Force to build", short: :f
|
31
|
+
action! :build
|
32
|
+
end
|
33
|
+
|
34
|
+
task :destroy do
|
35
|
+
desc "Destroy #{_self.display_name} environment"
|
36
|
+
switch :force, "Force to destroy", short: :f, required: true
|
37
|
+
action! :destroy
|
38
|
+
end
|
39
|
+
|
40
|
+
task :cleanup do
|
41
|
+
desc "Clean up temporary files during installation"
|
42
|
+
action! :cleanup
|
43
|
+
end
|
44
|
+
|
45
|
+
task :binstubs do
|
46
|
+
desc "Update binstubs for required packages"
|
47
|
+
switch :force, "Force to update binstubs", short: :f
|
48
|
+
action! :binstubs
|
49
|
+
end
|
50
|
+
|
51
|
+
task :version do
|
52
|
+
desc "Show current version for app/required packages"
|
53
|
+
action! :show_current
|
54
|
+
end
|
55
|
+
|
56
|
+
task :versions do
|
57
|
+
desc "Show app/package installation summary"
|
58
|
+
action! :show_summary
|
59
|
+
end
|
60
|
+
|
61
|
+
task :which do
|
62
|
+
desc "Show the real path for the given executable"
|
63
|
+
argument :executable, "Executable to which"
|
64
|
+
action! :which
|
65
|
+
end
|
66
|
+
|
67
|
+
task :whence do
|
68
|
+
desc "List packages with the given executable"
|
69
|
+
argument :executable, "Executable to whence"
|
70
|
+
action! :whence
|
71
|
+
end
|
68
72
|
end
|
69
73
|
end
|
70
74
|
end
|
@@ -101,37 +105,41 @@ module Luban
|
|
101
105
|
|
102
106
|
def controllable?; true; end
|
103
107
|
|
108
|
+
def control_tasks; commands[:control].commands; end
|
109
|
+
|
104
110
|
protected
|
105
111
|
|
106
112
|
def setup_control_tasks
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
113
|
+
command :control do
|
114
|
+
task :start do
|
115
|
+
desc "Start process"
|
116
|
+
action! :start_process
|
117
|
+
end
|
118
|
+
|
119
|
+
task :stop do
|
120
|
+
desc "Stop process"
|
121
|
+
action! :stop_process
|
122
|
+
end
|
123
|
+
|
124
|
+
task :restart do
|
125
|
+
desc "Restart process"
|
126
|
+
action! :restart_process
|
127
|
+
end
|
128
|
+
|
129
|
+
task :kill do
|
130
|
+
desc "Kill process forcely"
|
131
|
+
action! :kill_process
|
132
|
+
end
|
133
|
+
|
134
|
+
task :status do
|
135
|
+
desc "Check process status"
|
136
|
+
action! :check_process
|
137
|
+
end
|
138
|
+
|
139
|
+
task :process do
|
140
|
+
desc "Show running process if any"
|
141
|
+
action! :show_process
|
142
|
+
end
|
135
143
|
end
|
136
144
|
end
|
137
145
|
end
|
@@ -148,22 +156,26 @@ module Luban
|
|
148
156
|
controllable? and monitor_defined? and !monitor_itself?
|
149
157
|
end
|
150
158
|
|
159
|
+
def monitor_tasks; commands[:monitor].commands; end
|
160
|
+
|
151
161
|
protected
|
152
162
|
|
153
163
|
def setup_monitor_tasks
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
command :monitor do
|
165
|
+
task :on do
|
166
|
+
desc "Turn on process monitor"
|
167
|
+
action! :monitor_on
|
168
|
+
end
|
169
|
+
|
170
|
+
task :off do
|
171
|
+
desc "Turn off process monitor"
|
172
|
+
action! :monitor_off
|
173
|
+
end
|
174
|
+
|
175
|
+
task :reload do
|
176
|
+
desc "Reload monitor configuration"
|
177
|
+
action! :monitor_reload
|
178
|
+
end
|
167
179
|
end
|
168
180
|
end
|
169
181
|
end
|
@@ -189,6 +201,8 @@ module Luban
|
|
189
201
|
cronjobs << job
|
190
202
|
end
|
191
203
|
|
204
|
+
def crontab_tasks; commands[:conjobs].commands; end
|
205
|
+
|
192
206
|
protected
|
193
207
|
|
194
208
|
def validate_cronjob(job)
|
@@ -204,15 +218,17 @@ module Luban
|
|
204
218
|
end
|
205
219
|
|
206
220
|
def setup_crontab_tasks
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
221
|
+
command :cronjobs do
|
222
|
+
task :update do
|
223
|
+
desc 'Update cron jobs'
|
224
|
+
action! :update_cronjobs
|
225
|
+
end
|
226
|
+
|
227
|
+
task :list do
|
228
|
+
desc 'List cron jobs'
|
229
|
+
switch :all, "List all cron jobs"
|
230
|
+
action! :list_cronjobs
|
231
|
+
end
|
216
232
|
end
|
217
233
|
end
|
218
234
|
end
|
@@ -224,21 +240,10 @@ module Luban
|
|
224
240
|
|
225
241
|
def display_name; @display_name ||= name.camelcase; end
|
226
242
|
|
227
|
-
def
|
228
|
-
def deployable?;
|
229
|
-
def controllable?;
|
230
|
-
def monitorable?;
|
231
|
-
|
232
|
-
def task(cmd, **opts, &blk)
|
233
|
-
command(cmd, **opts, &blk).tap do |c|
|
234
|
-
add_common_task_options(c)
|
235
|
-
if !c.summary.nil? and c.description.empty?
|
236
|
-
c.long_desc "#{c.summary} in #{self.class.name}"
|
237
|
-
end
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
alias_method :undef_task, :undef_command
|
243
|
+
def provisionable?; false; end
|
244
|
+
def deployable?; false; end
|
245
|
+
def controllable?; false; end
|
246
|
+
def monitorable?; false; end
|
242
247
|
|
243
248
|
class << self
|
244
249
|
def inherited(subclass)
|
@@ -368,7 +373,7 @@ module Luban
|
|
368
373
|
def setup_descriptions; end
|
369
374
|
|
370
375
|
def setup_tasks
|
371
|
-
|
376
|
+
setup_provision_tasks if provisionable?
|
372
377
|
setup_deploy_tasks if deployable?
|
373
378
|
setup_control_tasks if controllable?
|
374
379
|
setup_monitor_tasks if monitorable?
|
@@ -69,7 +69,7 @@ module Luban
|
|
69
69
|
|
70
70
|
include Luban::Deployment::Parameters::Project
|
71
71
|
include Luban::Deployment::Parameters::Application
|
72
|
-
include Luban::Deployment::Command::Tasks::
|
72
|
+
include Luban::Deployment::Command::Tasks::Provision
|
73
73
|
|
74
74
|
def monitorable?; false; end
|
75
75
|
|
@@ -188,7 +188,7 @@ module Luban
|
|
188
188
|
|
189
189
|
def setup_tasks
|
190
190
|
super
|
191
|
-
|
191
|
+
setup_provision_tasks
|
192
192
|
end
|
193
193
|
|
194
194
|
def compose_task_options(opts)
|
@@ -206,40 +206,42 @@ module Luban
|
|
206
206
|
long_desc "Manage the deployment of package #{display_name} in #{parent.class.name}"
|
207
207
|
end
|
208
208
|
|
209
|
-
def
|
209
|
+
def setup_provision_tasks
|
210
210
|
super
|
211
211
|
|
212
|
-
undef_task :setup
|
213
|
-
undef_task :build
|
214
|
-
undef_task :destroy
|
212
|
+
commands[:provision].undef_task :setup
|
213
|
+
commands[:provision].undef_task :build
|
214
|
+
commands[:provision].undef_task :destroy
|
215
215
|
|
216
216
|
_package = self
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
217
|
+
commands[:provision].alter do
|
218
|
+
task :install do
|
219
|
+
desc "Install a given version"
|
220
|
+
option :version, "Version to install", short: :v, required: true,
|
221
|
+
assure: ->(v){ _package.versions.include?(v) }
|
222
|
+
switch :force, "Force to install", short: :f
|
223
|
+
action! :install
|
224
|
+
end
|
224
225
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
226
|
+
task :install_all do
|
227
|
+
desc "Install all versions"
|
228
|
+
switch :force, "Force to install", short: :f
|
229
|
+
action! :install_all
|
230
|
+
end
|
230
231
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
232
|
+
task :uninstall do
|
233
|
+
desc "Uninstall a given version"
|
234
|
+
option :version, "Version to uninstall", short: :v, required: true,
|
235
|
+
assure: ->(v){ _package.versions.include?(v) }
|
236
|
+
switch :force, "Force to uninstall", short: :f
|
237
|
+
action! :uninstall
|
238
|
+
end
|
238
239
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
240
|
+
task :uninstall_all do
|
241
|
+
desc "Uninstall all versions"
|
242
|
+
switch :force, "Force to uninstall", short: :f, required: true
|
243
|
+
action! :uninstall_all
|
244
|
+
end
|
243
245
|
end
|
244
246
|
end
|
245
247
|
|
@@ -3,7 +3,7 @@ module Luban
|
|
3
3
|
class Project < Luban::Deployment::Command
|
4
4
|
using Luban::CLI::CoreRefinements
|
5
5
|
include Luban::Deployment::Parameters::Project
|
6
|
-
include Luban::Deployment::Command::Tasks::
|
6
|
+
include Luban::Deployment::Command::Tasks::Provision
|
7
7
|
include Luban::Deployment::Command::Tasks::Deploy
|
8
8
|
include Luban::Deployment::Command::Tasks::Control
|
9
9
|
|
@@ -30,16 +30,16 @@ module Luban
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
%i(
|
33
|
+
%i(provisionable? deployable? controllable?).each do |method|
|
34
34
|
define_method(method) do
|
35
35
|
apps.values.any? { |app| app.send(__method__) }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
(Luban::Deployment::Command::Tasks::
|
39
|
+
(Luban::Deployment::Command::Tasks::Provision::Actions | %i(destroy_project)).each do |action|
|
40
40
|
define_method(action) do |args:, opts:|
|
41
41
|
apps.each_value do |app|
|
42
|
-
app.send(__method__, args: args, opts: opts) if app.
|
42
|
+
app.send(__method__, args: args, opts: opts) if app.provisionable?
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -145,4 +145,4 @@ module Luban
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
148
|
-
end
|
148
|
+
end
|
@@ -4,9 +4,9 @@ module Luban
|
|
4
4
|
class Bundler < Luban::Deployment::Package::Base
|
5
5
|
protected
|
6
6
|
|
7
|
-
def
|
7
|
+
def setup_provision_tasks
|
8
8
|
super
|
9
|
-
|
9
|
+
provision_tasks[:install].switch :install_doc, "Install Bundler document"
|
10
10
|
end
|
11
11
|
|
12
12
|
class Installer < Luban::Deployment::Package::Installer
|
@@ -10,9 +10,9 @@ module Luban
|
|
10
10
|
|
11
11
|
protected
|
12
12
|
|
13
|
-
def
|
13
|
+
def setup_provision_tasks
|
14
14
|
super
|
15
|
-
|
15
|
+
provision_tasks[:install].option :openssl, "OpenSSL version"
|
16
16
|
end
|
17
17
|
|
18
18
|
class Installer < Luban::Deployment::Package::Installer
|
@@ -66,14 +66,15 @@ module Luban
|
|
66
66
|
|
67
67
|
protected
|
68
68
|
|
69
|
-
def
|
69
|
+
def setup_provision_tasks
|
70
70
|
super
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
|
72
|
+
provision_tasks[:install].switch :install_doc, "Install Ruby document"
|
73
|
+
provision_tasks[:install].switch :install_tcl, "Install with Tcl"
|
74
|
+
provision_tasks[:install].switch :install_tk, "Install with Tk"
|
75
|
+
provision_tasks[:install].option :rubygems, "Rubygems version (effective for v1.9.2 or below)"
|
76
|
+
provision_tasks[:install].option :bundler, "Bundler version"
|
77
|
+
provision_tasks[:install].option :openssl, "OpenSSL version (effective for v1.9.3 or above)"
|
77
78
|
end
|
78
79
|
|
79
80
|
class Installer < Luban::Deployment::Package::Installer
|
@@ -4,9 +4,9 @@ module Luban
|
|
4
4
|
class Rubygems < Luban::Deployment::Package::Base
|
5
5
|
protected
|
6
6
|
|
7
|
-
def
|
7
|
+
def setup_provision_tasks
|
8
8
|
super
|
9
|
-
|
9
|
+
provision_tasks[:install].switch :install_doc, "Install Rubygems document"
|
10
10
|
end
|
11
11
|
|
12
12
|
class Installer < Luban::Deployment::Package::Installer
|
data/luban.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.required_ruby_version = ">= 2.1.0"
|
23
|
-
spec.add_runtime_dependency 'luban-cli', ">=0.4.
|
23
|
+
spec.add_runtime_dependency 'luban-cli', ">=0.4.6"
|
24
24
|
spec.add_runtime_dependency 'sshkit'
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.9"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rubyist Lei
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.4.
|
19
|
+
version: 0.4.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.4.
|
26
|
+
version: 0.4.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sshkit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|