luban 0.9.13 → 0.9.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a851ff43f9f30fc9505528691dce2583094b2df4
4
- data.tar.gz: e41e631b827d2aec83411a094fd031ab42eae1f4
3
+ metadata.gz: b48ab79759b45ca7eb28235f9fc0304494de75a1
4
+ data.tar.gz: 1fdd55e4c8908e2beeb10a3b8ac7e96a03de8de2
5
5
  SHA512:
6
- metadata.gz: 798ed949d9b1a81b56f77cbb12522da456e56fa8034d5e5685ed29b73f970996ed059ec96dd43c6cb0c5825850f314c7e4ee052351007331700b31c210c33f92
7
- data.tar.gz: 5d9562a0e1767d106f55b09d58a088aec362c6351693cb8e647049788c5af3522a97a63418363b5fe5c2a54b7e860b80c12b18d73114937c939424b488fb5ffd
6
+ metadata.gz: 48eeeed19d760c788ac0430214ff36033eaf94db0d42db075949f07fb9491ee8417fbe1d2c9fd2388883a6cf1388611eedb58a98d71edd61f13bafcd0b2c0700
7
+ data.tar.gz: 2bdc3adacaad25386a30be00d59667c41cb5c011b85e25d6bcedc0fc474b98dd5c45e8aa07c75424591e5b9894ab36a5be2c507c6a400706813ceade898ea6fb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change log
2
2
 
3
+ ## Version 0.9.14 (Oct 31, 2016)
4
+
5
+ Minor enhancements:
6
+ * Assigned cronjobs to each host after configuration is loaded
7
+
8
+ Bug fixes:
9
+ * Ensured only one controller from service or application controller can be executed
10
+ * Rolledback the last change and
11
+ * Enforced the logic in the control/monitor actions instead
12
+
3
13
  ## Version 0.9.13 (Oct 28, 2016)
4
14
 
5
15
  New features:
@@ -197,11 +197,8 @@ module Luban
197
197
  %i(show_current show_summary).each do |action|
198
198
  define_method(action) do |args:, opts:|
199
199
  show_app_environment
200
- if has_services?
201
- send("#{action}_packages!", args: args, opts: opts)
202
- elsif has_source?
203
- send("#{action}_application", args: args, opts: opts)
204
- end
200
+ send("#{action}_packages!", args: args, opts: opts)
201
+ send("#{action}_application", args: args, opts: opts) if has_source?
205
202
  end
206
203
  action_on_packages "#{action}_packages!", as: action
207
204
  end
@@ -228,8 +225,11 @@ module Luban
228
225
  Luban::Deployment::Command::Tasks::Monitor::Actions).each do |action|
229
226
  define_method(action) do |args:, opts:|
230
227
  show_app_environment
231
- send("service_#{action}!", args: args, opts: opts)
232
- send("application_#{action}", args: args, opts: opts) if has_source?
228
+ if has_services?
229
+ send("service_#{action}!", args: args, opts: opts)
230
+ elsif has_source?
231
+ send("application_#{action}", args: args, opts: opts)
232
+ end
233
233
  end
234
234
  action_on_services "service_#{action}!", as: action
235
235
  application_action "application_#{action}", dispatch_to: :controller, as: action
@@ -321,6 +321,11 @@ module Luban
321
321
  setup_crontab_tasks
322
322
  end
323
323
 
324
+ def after_configure
325
+ super
326
+ assign_cronjobs if has_cronjobs?
327
+ end
328
+
324
329
  def add_service_parameters(service)
325
330
  service.class.parameters.each_pair do |param, default|
326
331
  singleton_class.send(:parameter, param, default: default)
@@ -203,12 +203,8 @@ module Luban
203
203
 
204
204
  def has_cronjobs?; !cronjobs.empty?; end
205
205
 
206
- def cronjob(roles: luban_roles, hosts: nil, **job)
206
+ def cronjob(**job)
207
207
  validate_cronjob(job)
208
- roles = Array(roles)
209
- hosts = Array(hosts)
210
- servers = select_servers(roles, hosts)
211
- servers.each { |s| server(s, cronjob: job) }
212
208
  cronjobs << job
213
209
  end
214
210
 
@@ -228,6 +224,17 @@ module Luban
228
224
  end
229
225
  end
230
226
 
227
+ def assign_cronjobs
228
+ cronjobs.each { |job| assign_cronjob(**job) }
229
+ end
230
+
231
+ def assign_cronjob(roles: luban_roles, hosts: nil, **job)
232
+ roles = Array(roles)
233
+ hosts = Array(hosts)
234
+ servers = select_servers(roles, hosts)
235
+ servers.each { |s| server(s, cronjob: job) }
236
+ end
237
+
231
238
  def setup_crontab_tasks
232
239
  command :cronjobs do
233
240
  desc "Run crontab tasks"
@@ -1,5 +1,5 @@
1
1
  module Luban
2
2
  module Deployment
3
- VERSION = "0.9.13"
3
+ VERSION = "0.9.14"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luban
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.13
4
+ version: 0.9.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rubyist Lei
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-28 00:00:00.000000000 Z
11
+ date: 2016-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: luban-cli