luban 0.5.5 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22f7040c1da873d1aa03672d4918506c4c6eef8d
4
- data.tar.gz: 6df3eeefecd1377d4e0b6db086f57859f08cc5d1
3
+ metadata.gz: 1869e9e885d7001c5da72cb20649de3efe0373aa
4
+ data.tar.gz: 4fa710ce988a9dd6abe9b7ab099504851b25f8da
5
5
  SHA512:
6
- metadata.gz: 299133650c4099b5f8e61f45998d91388b87edfb168676eee5ad07eda8c5e2652c358984e464551bea814826ae01b87eca6326ccaf77ad881e29d63a428c3e05
7
- data.tar.gz: 9dcb174a692218a5f921af3e58c1b017ec1362b220b9bc19bfecaa13ae6fc1ecb95b6a89d64760f1cbed84bcdcb7ddac46cf3a32ad4108a436461972354b7698
6
+ metadata.gz: dc8d972f086c40b6bab462d389d685263d56bc44925ca41789ab963defe7c04a6f0348beeffeceb748d5ec8b7e298e676d3a51542ef98bb50b695a08d411862d
7
+ data.tar.gz: a657dfb9403ffaeee93f2abe34c1dee081058d7a84053422f6ec2bf700c09b1ae54a2890ec082b305374f1562f9f489e2ecd6eae739d1b005ee5b9983b236eac
data/CHANGELOG.md CHANGED
@@ -1,6 +1,33 @@
1
1
  # Change log
2
2
 
3
- ## Version 0.5.5 (WIP)
3
+ ## Version 0.6.0 (Jul 08, 2016)
4
+
5
+ New features:
6
+ * Added support for Cluster in Service::Controller
7
+ * Added control & configuration support for application if it has its own source code
8
+
9
+ Minor enhancements:
10
+ * Ensured profile updates with the updated release info passed thru task to Configurator
11
+ * Refactored and standardized the following metadata for worker task:
12
+ * :name, :full_name, :version:, :major_version, :patch_level
13
+ * Created correponding instance methods with proper prefix for worker classes:
14
+ * Worker::Base with prefix "target_"
15
+ * Package::Worker with prefix "package_"
16
+ * Service::Worker with prefix "service_"
17
+ * Application::Worker with prefix "application_"
18
+ * Updated binstubs after source code deployment in case any new bins are deployed
19
+ * Made task dispatcher method as protected
20
+ * Removed two unnecessary parameters: :log_format and :log_level
21
+ * Refactored method #default_templates_path in a DRY way
22
+ * Minor code cleanup
23
+
24
+ Bug fixes:
25
+ * Returned revision as nill if any unexpected errors occur during revision fetching for Git
26
+ * Do not create symlinks for linked_dirs when publishing application profile
27
+ * Fixed duplicate result output when output format is not blakchole
28
+ * Made task dispatcher methods as protected
29
+
30
+ ## Version 0.5.5 (Jun 29, 2016)
4
31
 
5
32
  Minor enhancements:
6
33
  * Refactored app/service profile templates initialization
@@ -15,13 +42,15 @@ Minor enhancements:
15
42
 
16
43
  ## Version 0.5.1 (Jun 24, 2016)
17
44
 
18
- Minor enhancements:
45
+ New features:
19
46
  * Added subcommands #init to initialize deployment application/service profiles
47
+
48
+ Minor enhancements:
20
49
  * Added .gitignore file to the deployment project skeleton
21
50
 
22
51
  ## Version 0.5.0 (Jun 22, 2016)
23
52
 
24
- Minor enhancements:
53
+ New features:
25
54
  * Added a series of subcommands, #init to
26
55
  * Initialize a Luban deployment project
27
56
  * Initialize a Luban deployment application
data/README.md CHANGED
@@ -30,7 +30,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
30
30
 
31
31
  ## Contributing
32
32
 
33
- 1. Fork it ( https://github.com/[my-github-username]/luban/fork )
33
+ 1. Fork it ( https://github.com/lubanrb/luban/fork )
34
34
  2. Create your feature branch (`git checkout -b my-new-feature`)
35
35
  3. Commit your changes (`git commit -am 'Add some feature'`)
36
36
  4. Push to the branch (`git push origin my-new-feature`)
@@ -69,60 +69,87 @@ module Luban
69
69
  opts[:roles] << scm_role unless scm_role.nil?
70
70
  promptless_authen!(args: args, opts: opts)
71
71
  end
72
+ dispatch_task :public_key!, to: :authenticator, as: :public_key, locally: true
73
+ dispatch_task :promptless_authen!, to: :authenticator, as: :promptless_authen
72
74
 
73
75
  def setup(args:, opts:)
74
76
  show_app_environment
75
77
  promptless_authen(args: args, opts: opts)
76
78
  setup!(args: args, opts: opts)
77
79
  end
80
+ dispatch_task :setup!, to: :constructor, as: :setup
78
81
 
79
82
  def build(args:, opts:)
80
83
  show_app_environment
81
- install_all(args: args, opts: opts)
84
+ install_all!(args: args, opts: opts)
82
85
  build_repositories(args: args, opts: opts)
83
86
  end
84
87
 
85
88
  def destroy(args:, opts:)
86
- uninstall_all(args: args, opts: opts)
89
+ uninstall_all!(args: args, opts: opts)
87
90
  destroy!(args: args, opts: opts)
88
91
  end
89
92
 
93
+ def destroy_project(args:, opts:)
94
+ show_app_environment
95
+ destroy!(args: args, opts: opts.merge(destroy_project: true))
96
+ end
97
+ dispatch_task :destroy!, to: :constructor, as: :destroy
98
+
90
99
  %i(install_all uninstall_all).each do |action|
91
- define_method(action) do |args:, opts:|
92
- packages.each_value { |p| p.send(__method__, args: args, opts: opts) }
100
+ define_method("#{action}!") do |args:, opts:|
101
+ packages.each_value { |p| p.send(action, args: args, opts: opts) }
93
102
  end
103
+ protected "#{action}!"
94
104
  end
95
105
 
96
- (Luban::Deployment::Command::Tasks::Install::Actions -
97
- %i(setup build destroy)).each do |action|
106
+ (Luban::Deployment::Command::Tasks::Install::Actions - %i(setup build destroy)).each do |action|
98
107
  define_method(action) do |args:, opts:|
99
108
  show_app_environment
100
- packages.each_value { |p| p.send(__method__, args: args, opts: opts) }
109
+ send("#{action}!", args: args, opts: opts)
101
110
  end
102
- end
103
111
 
104
- alias_method :cleanup_packages, :cleanup
105
- def cleanup(args:, opts:)
106
- cleanup_packages(args: args, opts: opts)
107
- cleanup!(args: args, opts: opts)
112
+ define_method("#{action}!") do |args:, opts:|
113
+ packages.each_value { |p| p.send(action, args: args, opts: opts) }
114
+ end
115
+ protected "#{action}!"
108
116
  end
109
117
 
110
- def destroy_project(args:, opts:)
111
- show_app_environment
112
- destroy!(args: args, opts: opts.merge(destroy_project: true))
118
+ alias_method :cleanup_packages!, :cleanup!
119
+ def cleanup!(args:, opts:)
120
+ cleanup_packages!(args: args, opts: opts)
121
+ cleanup_application!(args: args, opts: opts)
113
122
  end
123
+ protected :cleanup!
124
+ dispatch_task :cleanup_application!, to: :constructor, as: :cleanup
114
125
 
115
126
  def deploy(args:, opts:)
116
127
  show_app_environment
128
+ if has_source?
129
+ release = deploy_release(args: args, opts: opts)
130
+ opts = opts.merge(release: release)
131
+ end
117
132
  deploy_profile(args: args, opts: opts) if has_profile?
118
- deploy_release(args: args, opts: opts) if has_source?
119
133
  end
120
134
 
121
135
  Luban::Deployment::Command::Tasks::Control::Actions.each do |action|
122
136
  define_method(action) do |args:, opts:|
123
137
  show_app_environment
124
- services.each_value { |s| s.send(__method__, args: args, opts: opts) }
138
+ send("#{action}!", args: args, opts: opts)
139
+ end
140
+
141
+ define_method("#{action}!") do |args:, opts:|
142
+ send("application_#{action}!", args: args, opts: opts) if has_source?
143
+ send("service_#{action}!", args: args, opts: opts)
144
+ end
145
+ protected "#{action}!"
146
+
147
+ dispatch_task "application_#{action}!", to: :controller, as: action
148
+
149
+ define_method("service_#{action}!") do |args:, opts:|
150
+ services.each_value { |s| s.send(action, args: args, opts: opts) }
125
151
  end
152
+ protected "service_#{action}!"
126
153
  end
127
154
 
128
155
  def init_profiles(args:, opts:)
@@ -136,6 +163,7 @@ module Luban
136
163
  init_profile!(args: args, opts: opts.merge(default_templates: default_templates))
137
164
  end
138
165
  end
166
+ dispatch_task :init_profile!, to: :configurator, as: :init_profile, locally: true
139
167
 
140
168
  def init_service_profiles(args:, opts:)
141
169
  return if opts[:app]
@@ -171,6 +199,11 @@ module Luban
171
199
  set_default_profile
172
200
  end
173
201
 
202
+ def set_default_application_parameters
203
+ super
204
+ linked_dirs.push('log', 'pids')
205
+ end
206
+
174
207
  def set_default_profile
175
208
  if config_finder[:application].has_profile?
176
209
  profile(config_finder[:application].stage_profile_path, scm: :rsync)
@@ -204,7 +237,7 @@ module Luban
204
237
  end
205
238
 
206
239
  def compose_task_options(opts)
207
- super.merge(name: 'app').tap do |o|
240
+ super.merge(name: name.to_s, packages: packages).tap do |o|
208
241
  o.merge!(version: source_version) if has_source?
209
242
  end
210
243
  end
@@ -213,14 +246,11 @@ module Luban
213
246
  puts "#{display_name} in #{parent.class.name}"
214
247
  end
215
248
 
216
- %i(setup destroy cleanup).each do |task|
217
- dispatch_task "#{task}!", to: :constructor, as: task
218
- end
219
-
220
249
  def build_repositories(args:, opts:)
221
250
  build_repository!(args: args, opts: opts.merge(repository: profile)) if has_profile?
222
251
  build_repository!(args: args, opts: opts.merge(repository: source)) if has_source?
223
252
  end
253
+ dispatch_task :build_repository!, to: :repository, as: :build, locally: true
224
254
 
225
255
  def deploy_profile(args:, opts:)
226
256
  update_profile(args: args, opts: opts)
@@ -231,9 +261,12 @@ module Luban
231
261
  update_profile!(args: args, opts: opts)
232
262
  services.each_value { |s| s.send(:update_profile, args: args, opts: opts) }
233
263
  end
264
+ dispatch_task :update_profile!, to: :configurator, as: :update_profile, locally: true
234
265
 
235
266
  def deploy_release(args:, opts:)
236
- deploy_release!(args: args, opts: opts.merge(repository: source))
267
+ deploy_release!(args: args, opts: opts.merge(repository: source)).tap do
268
+ binstubs!(args: args, opts: opts)
269
+ end
237
270
  end
238
271
 
239
272
  def deploy_release!(args:, opts:)
@@ -244,12 +277,6 @@ module Luban
244
277
  end
245
278
  end
246
279
  alias_method :deploy_profile!, :deploy_release!
247
-
248
- dispatch_task :promptless_authen!, to: :authenticator, as: :promptless_authen
249
- dispatch_task :public_key!, to: :authenticator, as: :public_key, locally: true
250
- dispatch_task :init_profile!, to: :configurator, as: :init_profile, locally: true
251
- dispatch_task :update_profile!, to: :configurator, as: :update_profile, locally: true
252
- dispatch_task :build_repository!, to: :repository, as: :build, locally: true
253
280
  dispatch_task :package_release!, to: :repository, as: :package, locally: true
254
281
  dispatch_task :publish_release!, to: :publisher, as: :publish
255
282
  end
@@ -3,6 +3,13 @@ module Luban
3
3
  class Application
4
4
  class Configurator < Worker
5
5
  include Luban::Deployment::Service::Configurator::Base
6
+
7
+ def release_type; task.opts.release[:type]; end
8
+ def release_tag; task.opts.release[:tag]; end
9
+
10
+ def release_path
11
+ @release_path ||= releases_path.join(release_type, release_tag)
12
+ end
6
13
  end
7
14
  end
8
15
  end
@@ -43,11 +43,11 @@ module Luban
43
43
  end
44
44
 
45
45
  def bundle_path
46
- @bundle_path ||= shared_path.join('vendor').join('bundle')
46
+ @bundle_path ||= shared_path.join('vendor', 'bundle')
47
47
  end
48
48
 
49
49
  def gems_cache_path
50
- @gems_cache_path ||= shared_path.join('vendor').join('cache')
50
+ @gems_cache_path ||= shared_path.join('vendor', 'cache')
51
51
  end
52
52
 
53
53
  def bundle_without
@@ -118,7 +118,6 @@ module Luban
118
118
 
119
119
  def create_symlinks
120
120
  send("create_#{release_type}_symlinks")
121
- create_shared_symlinks_for(:directory, linked_dirs)
122
121
  create_shared_symlinks_for(:directory, bundle_linked_dirs) if file?(gemfile)
123
122
  end
124
123
 
@@ -129,7 +128,7 @@ module Luban
129
128
 
130
129
  def create_app_symlinks
131
130
  create_release_symlink(app_path)
132
- create_shared_symlinks_for(:directory, %w(profile))
131
+ create_shared_symlinks_for(:directory, linked_dirs | %w(profile))
133
132
  create_shared_symlinks_for(:file, linked_files)
134
133
  end
135
134
 
@@ -23,11 +23,11 @@ module Luban
23
23
  end
24
24
 
25
25
  def clone_path
26
- @clone_path ||= workspace_path.join('repositories').join(type)
26
+ @clone_path ||= workspace_path.join('repositories', type)
27
27
  end
28
28
 
29
29
  def releases_path
30
- @releases_path ||= workspace_path.join('releases').join(type)
30
+ @releases_path ||= workspace_path.join('releases', type)
31
31
  end
32
32
 
33
33
  def release_package_path
@@ -67,7 +67,7 @@ module Luban
67
67
  # release: copy the contents of cloned repository onto the release path
68
68
  [:available?, :cloned?, :fetch_revision, :clone, :update, :release].each do |method|
69
69
  define_method(method) do
70
- raise NotImplementedError, "\#{self.class.name}##{__method__} is an abstract method."
70
+ raise NotImplementedError, "#{self.class.name}##{__method__} is an abstract method."
71
71
  end
72
72
  end
73
73
 
@@ -75,12 +75,12 @@ module Luban
75
75
  assure_dirs(clone_path, releases_path)
76
76
  if cloned? and !force?
77
77
  update_revision
78
- update_result "Skipped! Local #{type} repository has been built ALREADY.", status: :skipped
78
+ update_result "Skipped! Local #{type} repository has been built ALREADY (#{revision}).", status: :skipped
79
79
  else
80
80
  if available?
81
81
  if build!
82
82
  update_revision
83
- update_result "Successfully built local #{type} repository."
83
+ update_result "Successfully built local #{type} repository (#{revision})."
84
84
  else
85
85
  update_result "FAILED to build local #{type} repository!", status: :failed, level: :error
86
86
  end
@@ -182,4 +182,4 @@ module Luban
182
182
  end
183
183
  end
184
184
  end
185
- end
185
+ end
@@ -22,7 +22,7 @@ module Luban
22
22
  end
23
23
 
24
24
  def fetch_revision
25
- within(clone_path) { capture(git_cmd, "rev-parse --short=#{rev_size} #{ref}") }
25
+ within(clone_path) { capture(git_cmd, "rev-parse --short=#{rev_size} #{ref} 2>/dev/null") }
26
26
  #within(clone_path) { capture(git_cmd, "rev-list --max-count=1 --abbrev-commit --abbrev=rev_size #{ref}") }
27
27
  end
28
28
 
@@ -5,16 +5,21 @@ module Luban
5
5
  include Luban::Deployment::Worker::Paths::Remote
6
6
  include Luban::Deployment::Service::Worker::Base
7
7
 
8
- def service_name
9
- @service_name ||= task.opts.name
8
+ %i(name full_name version major_version patch_level).each do |method|
9
+ define_method("application_#{method}") { send("target_#{method}") }
10
10
  end
11
11
 
12
- def service_version
13
- @service_version ||= task.opts.version
12
+ def packages; task.opts.packages; end
13
+
14
+ def package_version(package_name); packages[package_name.to_sym].current_version; end
15
+
16
+ def package_path(package_name)
17
+ @package_path ||= luban_install_path.join('pkg', package_name.to_s, 'versions',
18
+ package_version(package_name))
14
19
  end
15
20
 
16
- def service_full_name
17
- @service_full_name ||= "#{service_name}-#{service_version}"
21
+ def package_bin_path(package_name)
22
+ @package_bin_path ||= package_path(package_name).join('bin')
18
23
  end
19
24
  end
20
25
  end
@@ -177,6 +177,8 @@ module Luban
177
177
  run_task(cmd: as, args: args, opts: opts, locally: locally,
178
178
  worker_class: self.class.worker_class(to), &blk)
179
179
  end
180
+
181
+ protected task
180
182
  end
181
183
  end
182
184
 
@@ -204,11 +206,15 @@ module Luban
204
206
  end
205
207
  mutex.synchronize { result << r }
206
208
  end
207
- print_task_result result
209
+ print_task_result(result) if opts[:format] == :blackhole
208
210
  locally ? result.first[:__return__] : result
209
211
  end
210
212
 
211
- def default_templates_path; end
213
+ def default_templates_path(base_path = nil)
214
+ return @default_templates_path if base_path.nil?
215
+ path = Pathname.new(base_path).dirname.join('templates')
216
+ @default_templates_path ||= path.exist? ? path.realpath : nil
217
+ end
212
218
 
213
219
  def default_templates
214
220
  default_templates_path.nil? ? [] : default_templates_path.children
@@ -316,7 +322,7 @@ module Luban
316
322
  def compose_task_options(opts); opts.clone; end
317
323
 
318
324
  def run(roles: luban_roles, hosts: nil, once: false,
319
- dry_run: false, format: log_format, verbosity: log_level, **opts)
325
+ dry_run: false, format:, verbosity:, **opts)
320
326
  configure_backend(dry_run: dry_run, format: format, verbosity: verbosity)
321
327
  hosts = Array(hosts)
322
328
  servers = select_servers(roles, hosts)
@@ -49,7 +49,7 @@ module Luban
49
49
  end
50
50
 
51
51
  def install_log_path
52
- @install_log_path ||= package_path.join('log').join(package_full_name)
52
+ @install_log_path ||= package_path.join('log', package_full_name)
53
53
  end
54
54
 
55
55
  def install_log_file_path
@@ -62,4 +62,4 @@ module Luban
62
62
  end
63
63
  end
64
64
  end
65
- end
65
+ end
@@ -26,12 +26,9 @@ module Luban
26
26
  end
27
27
  end
28
28
 
29
- def package_name; File.basename(task.opts.name); end
30
- def package_full_name; "#{package_name}-#{package_version}"; end
31
-
32
- def package_version; task.opts.version; end
33
- def package_major_version; task.opts.major_version; end
34
- def package_patch_level; task.opts.patch_level; end
29
+ %i(name full_name version major_version patch_level).each do |method|
30
+ define_method("package_#{method}") { send("target_#{method}") }
31
+ end
35
32
 
36
33
  def parent; task.opts.parent; end
37
34
  def child?; !parent.nil?; end
@@ -34,8 +34,7 @@ module Luban
34
34
  end
35
35
 
36
36
  def monitor_executable
37
- @monitor_executable ||= env_path.join("#{stage}.#{process_monitor[:env]}").
38
- join('bin').join(process_monitor[:name])
37
+ @monitor_executable ||= env_path.join("#{stage}.#{process_monitor[:env]}", 'bin', process_monitor[:name])
39
38
  end
40
39
 
41
40
  def monitor_command
@@ -174,11 +173,11 @@ module Luban
174
173
 
175
174
  def check_process!
176
175
  if pid_file_missing?
177
- "#{service_full_name}: started but PID file does NOT exist - #{pid_file_path}"
176
+ "#{service_full_name}: started but PID file(s) do NOT exist in #{pids_path}"
178
177
  elsif process_started?
179
- "#{service_full_name}: started (PID #{pid})"
178
+ "#{service_full_name}: started - PID(s) #{pid})"
180
179
  elsif pid_file_orphaned?
181
- "#{service_full_name}: stopped but PID file exists - #{pid_file_path}"
180
+ "#{service_full_name}: stopped but PID file(s) exist in #{pids_path}"
182
181
  else
183
182
  "#{service_full_name}: stopped"
184
183
  end
@@ -209,6 +208,37 @@ module Luban
209
208
  end
210
209
  end
211
210
 
211
+ module Cluster
212
+ def pid_file_pattern
213
+ raise NotImplementedError, "#{self.class.name}#pid_file_pattern is an abstract method."
214
+ end
215
+
216
+ def pid_files_path
217
+ pids_path.join(pid_file_pattern)
218
+ end
219
+
220
+ def pid_files
221
+ capture(:ls, "-A #{pid_files_path} 2>/dev/null").split.map do |f|
222
+ Pathname.new(f)
223
+ end
224
+ end
225
+
226
+ def pids
227
+ pid_files.collect { |pid_file| capture(:cat, "#{pid_file} 2>/dev/null") }
228
+ end
229
+
230
+ def pid; pids; end
231
+
232
+ def pid_file_exists?
233
+ # Any pid file is NOT zero size
234
+ pid_files.any? { |pid_file| file?(pid_file, "-s") }
235
+ end
236
+
237
+ def remove_orphaned_pid_file
238
+ rm(pid_files_path) if pid_file_orphaned?
239
+ end
240
+ end
241
+
212
242
  include Base
213
243
  end
214
244
  end
@@ -3,16 +3,8 @@ module Luban
3
3
  module Service
4
4
  class Worker < Luban::Deployment::Package::Worker
5
5
  module Base
6
- def service_name
7
- @service_name ||= package_name
8
- end
9
-
10
- def service_version
11
- @service_version ||= package_version
12
- end
13
-
14
- def service_full_name
15
- @service_full_name ||= package_full_name
6
+ %i(name full_name version major_version patch_level).each do |method|
7
+ define_method("service_#{method}") { send("target_#{method}") }
16
8
  end
17
9
 
18
10
  def service_entry
@@ -20,7 +12,7 @@ module Luban
20
12
  end
21
13
 
22
14
  def profile_path
23
- @profile_path ||= shared_path.join('profile').join(service_name)
15
+ @profile_path ||= shared_path.join('profile', service_name)
24
16
  end
25
17
 
26
18
  def log_path
@@ -45,7 +45,7 @@ module Luban
45
45
 
46
46
  def skeletons_path
47
47
  @skeletons_path ||=
48
- Pathname.new(__FILE__).dirname.join('..').join('templates').realpath
48
+ Pathname.new(__FILE__).dirname.join('..', 'templates').realpath
49
49
  end
50
50
 
51
51
  def copy_dir(src_path, dst_path, stages: [], depth: 1)
@@ -123,12 +123,12 @@ module Luban
123
123
  @application_target_path ||= apps_path.join(application)
124
124
  end
125
125
 
126
- def application_name
126
+ def application_class_name
127
127
  "#{project}:#{application}".camelcase
128
128
  end
129
129
 
130
130
  def create_application_skeleton
131
- puts "Creating skeleton for #{stage} application #{application_name}"
131
+ puts "Creating skeleton for #{stage} application #{application_class_name}"
132
132
  copy_dir(application_skeleton_path, application_target_path, stages: [stage])
133
133
  end
134
134
  end
@@ -67,8 +67,6 @@ module Luban
67
67
  parameter :sshkit_backend
68
68
  parameter :authen_key_type
69
69
  parameter :default_env
70
- parameter :log_format
71
- parameter :log_level
72
70
  parameter :pty
73
71
  parameter :connection_timeout
74
72
  parameter :ssh_options
@@ -81,8 +79,6 @@ module Luban
81
79
  set_default :sshkit_backend, SSHKit::Backend::Netssh
82
80
  set_default :authen_key_type, 'rsa'
83
81
  set_default :default_env, { path: '$PATH:/usr/local/bin' }
84
- set_default :log_format, :pretty
85
- set_default :log_level, :info
86
82
  set_default :pty, false
87
83
  set_default :connection_timeout, 30 # second
88
84
  set_default :ssh_options, {}
@@ -1,4 +1,4 @@
1
- # Deployment configuration for <%= stage %> application <%= application_name %>
1
+ # Deployment configuration for <%= stage %> application <%= application_class_name %>
2
2
 
3
3
  # Application servers
4
4
  role :app, `hostname -f`.chomp
@@ -1 +1 @@
1
- # Deployment configuration for application <%= application_name %>
1
+ # Deployment configuration for application <%= application_class_name %>
@@ -1,5 +1,5 @@
1
1
  module Luban
2
2
  module Deployment
3
- VERSION = "0.5.5"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
@@ -29,6 +29,13 @@ module Luban
29
29
  @env_name ||= "#{stage}.#{project}/#{application}"
30
30
  end
31
31
 
32
+ def target_name; task.opts.name; end
33
+ def target_full_name; "#{target_name}-#{target_version}"; end
34
+
35
+ def target_version; task.opts.version; end
36
+ def target_major_version; task.opts.major_version || target_version; end
37
+ def target_patch_level; task.opts.patch_level || ''; end
38
+
32
39
  def run
33
40
  update_result(__return__: @run_blk ? run_with_block : run_with_command).to_h
34
41
  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.5.5
4
+ version: 0.6.0
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-06-29 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: luban-cli