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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8efefadae50e7e28a9576ead9092d2d5d951349d
4
- data.tar.gz: e0a8a86b1f33019e2953ca640cb1c5d4121aeb18
3
+ metadata.gz: 3d493b2d012713f59e25fb1e6e6d7a10775b3ed3
4
+ data.tar.gz: 8e43f9b7bf5753860763814289f41d1d29672fc7
5
5
  SHA512:
6
- metadata.gz: 0b79a40a13f3301ff09c114d6ecc8e9e3624f43d2206bc3f1afe96efef323631d66e2972c8686d80479866f847a3d067ad01429b5db382e3d64e2719d3d5f4c0
7
- data.tar.gz: bde512704035dfdc76240f7cf05dede43a969c87d7be891db9162d2a2cc79fffa61a4aef7de00009f511f2ee419021314a08a0397b4cf1071668e58fb5fce36c
6
+ metadata.gz: 960cc4b82033d31b8d6276ef8dd8c6755cf5a67819d5f48dd2310eeab7b3280f622641e265eb0cd376f581de3950eaa4f1a382dd411f92dbce310f882654eac1
7
+ data.tar.gz: 4f006ad06fa68c930c788a51d8158e113e57c36960c84a2dad35d393b7283224c1c05807cfdbcbf835b8457eb7e9d39ffd2fd848116448c2403992a03e80ffa7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change log
2
2
 
3
+ ## Version 0.8.8 (Sept 28, 2016)
4
+
5
+ Minor enhancements:
6
+ * Applied subcommand grouping for better clarity
7
+ * As a result, bump up gem dependency of Luban::CLI to version 0.4.6
8
+
3
9
  ## Version 0.8.7 (Sept 27, 2016)
4
10
 
5
11
  Minor enhancements:
@@ -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::Install
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 installable?; has_packages?; end
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 Install
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 installable?; true; end
14
+ def provisionable?; true; end
15
+
16
+ def provision_tasks; commands[:provision].commands; end
15
17
 
16
18
  protected
17
19
 
18
- def setup_install_tasks
20
+ def setup_provision_tasks
19
21
  _self = self
20
- task :setup do
21
- desc "Setup #{_self.display_name} environment"
22
- action! :setup
23
- end
24
-
25
- task :build do
26
- desc "Build #{_self.display_name} environment"
27
- switch :force, "Force to build", short: :f
28
- action! :build
29
- end
30
-
31
- task :destroy do
32
- desc "Destroy #{_self.display_name} environment"
33
- switch :force, "Force to destroy", short: :f, required: true
34
- action! :destroy
35
- end
36
-
37
- task :cleanup do
38
- desc "Clean up temporary files during installation"
39
- action! :cleanup
40
- end
41
-
42
- task :binstubs do
43
- desc "Update binstubs for required packages"
44
- switch :force, "Force to update binstubs", short: :f
45
- action! :binstubs
46
- end
47
-
48
- task :version do
49
- desc "Show current version for app/required packages"
50
- action! :show_current
51
- end
52
-
53
- task :versions do
54
- desc "Show app/package installation summary"
55
- action! :show_summary
56
- end
57
-
58
- task :which do
59
- desc "Show the real path for the given executable"
60
- argument :executable, "Executable to which"
61
- action! :which
62
- end
63
-
64
- task :whence do
65
- desc "List packages with the given executable"
66
- argument :executable, "Executable to whence"
67
- action! :whence
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
- task :start do
108
- desc "Start process"
109
- action! :start_process
110
- end
111
-
112
- task :stop do
113
- desc "Stop process"
114
- action! :stop_process
115
- end
116
-
117
- task :restart do
118
- desc "Restart process"
119
- action! :restart_process
120
- end
121
-
122
- task :kill do
123
- desc "Kill process forcely"
124
- action! :kill_process
125
- end
126
-
127
- task :status do
128
- desc "Check process status"
129
- action! :check_process
130
- end
131
-
132
- task :process do
133
- desc "Show running process if any"
134
- action! :show_process
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
- task :monitor_on do
155
- desc "Turn on process monitor"
156
- action! :monitor_on
157
- end
158
-
159
- task :monitor_off do
160
- desc "Turn off process monitor"
161
- action! :monitor_off
162
- end
163
-
164
- task :monitor_reload do
165
- desc "Reload monitor configuration"
166
- action! :monitor_reload
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
- task :cronjobs_update do
208
- desc 'Update cron jobs'
209
- action! :update_cronjobs
210
- end
211
-
212
- task :cronjobs_list do
213
- desc 'List cron jobs'
214
- switch :all, "List all cron jobs"
215
- action! :list_cronjobs
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 installable?; false; end
228
- def deployable?; false; end
229
- def controllable?; false; end
230
- def monitorable?; false; end
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
- setup_install_tasks if installable?
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::Install
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
- setup_install_tasks
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 setup_install_tasks
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
- task :install do
218
- desc "Install a given version"
219
- option :version, "Version to install", short: :v, required: true,
220
- assure: ->(v){ _package.versions.include?(v) }
221
- switch :force, "Force to install", short: :f
222
- action! :install
223
- end
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
- task :install_all do
226
- desc "Install all versions"
227
- switch :force, "Force to install", short: :f
228
- action! :install_all
229
- end
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
- task :uninstall do
232
- desc "Uninstall a given version"
233
- option :version, "Version to uninstall", short: :v, required: true,
234
- assure: ->(v){ _package.versions.include?(v) }
235
- switch :force, "Force to uninstall", short: :f
236
- action! :uninstall
237
- end
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
- task :uninstall_all do
240
- desc "Uninstall all versions"
241
- switch :force, "Force to uninstall", short: :f, required: true
242
- action! :uninstall_all
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::Install
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(installable? deployable? controllable?).each do |method|
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::Install::Actions | %i(destroy_project)).each do |action|
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.installable?
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 setup_install_tasks
7
+ def setup_provision_tasks
8
8
  super
9
- commands[:install].switch :install_doc, "Install Bundler document"
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 setup_install_tasks
13
+ def setup_provision_tasks
14
14
  super
15
- commands[:install].option :openssl, "OpenSSL version"
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 setup_install_tasks
69
+ def setup_provision_tasks
70
70
  super
71
- commands[:install].switch :install_doc, "Install Ruby document"
72
- commands[:install].switch :install_tcl, "Install with Tcl"
73
- commands[:install].switch :install_tk, "Install with Tk"
74
- commands[:install].option :rubygems, "Rubygems version (effective for v1.9.2 or below)"
75
- commands[:install].option :bundler, "Bundler version"
76
- commands[:install].option :openssl, "OpenSSL version (effective for v1.9.3 or above)"
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 setup_install_tasks
7
+ def setup_provision_tasks
8
8
  super
9
- commands[:install].switch :install_doc, "Install Rubygems document"
9
+ provision_tasks[:install].switch :install_doc, "Install Rubygems document"
10
10
  end
11
11
 
12
12
  class Installer < Luban::Deployment::Package::Installer
@@ -1,5 +1,5 @@
1
1
  module Luban
2
2
  module Deployment
3
- VERSION = "0.8.7"
3
+ VERSION = "0.8.8"
4
4
  end
5
5
  end
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.5"
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.7
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.5
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.5
26
+ version: 0.4.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sshkit
29
29
  requirement: !ruby/object:Gem::Requirement