luban 0.8.3 → 0.8.4

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: a1386501b0b0e2a9483089453c5c009650655097
4
- data.tar.gz: fa8b1ffbe8e0e553d5b9e0f8f4ddae622b334b25
3
+ metadata.gz: b6c8d8264eb67e64d12b8898d1d3f6be9d9bae49
4
+ data.tar.gz: ac0c9be4be0449a4f4d8d0460785b3aef5fd98f3
5
5
  SHA512:
6
- metadata.gz: 5ee4acb1e7cd29517bbedef6c53db64e1d8ec84712427779287974178b53658dd96df0fb3e600fef79c29f78d42d4c1ae2e64a17f522c648e1f04b15be2f59f9
7
- data.tar.gz: 169b0790ec7a43078499ae14d1e73c153625a0d6b31cebedd950456baa54836599b8607a81295287f1a723d950a2b53a9d9fcaf3dd10477ab399f0e252850e14
6
+ metadata.gz: 4e8cca593188e1ed1eaec53681f13e0ba51fa7119ee616a02e0f58e4d9b9fd3793d2fb0f1ee525e250de0b40d81910e48844c8bad4018f93eeeaafaf3a7af584
7
+ data.tar.gz: a5885b65c1431c4f5a35b8dc62226b27e88c59cd0c50da0fd3dc4928dcc7b4674de82e4c86fe55c20c7d2a5c71a60409a20bf959c5373678766da2d74765f06e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Change log
2
2
 
3
+ ## Version 0.8.4 (Sept 22, 2016)
4
+
5
+ Minor enhancements:
6
+ * Added #bundle_via to specify Ruby version to bundle gems with
7
+ * This is useful for bundling gems that requires specific Ruby version
8
+ * Forced bundler using the gems already present in vendor/cache thru option "--local"
9
+
10
+ Bug fixes:
11
+ * Added source release to cronjob deployment if source is provided
12
+ * Properly update cronjob if the crontab contains other unrelated entries
13
+
3
14
  ## Version 0.8.3 (Sept 21, 2016)
4
15
 
5
16
  Minor enhancements:
@@ -84,6 +84,12 @@ module Luban
84
84
  end
85
85
  alias_method :require_package, :package
86
86
 
87
+ def bundle_via(ruby:)
88
+ bundle_cmd = luban_root_path.join("env", "#{stage}.#{project}", ".luban", "pkg",
89
+ "ruby", "versions", ruby.to_s.downcase, 'bin', 'bundle')
90
+ set :bundle_via, bundle_cmd
91
+ end
92
+
87
93
  def profile(from = nil, **opts)
88
94
  from.nil? ? @profile : (@profile = opts.merge(type: 'profile', from: from))
89
95
  end
@@ -194,7 +200,6 @@ module Luban
194
200
  deploy_profile(args: args, opts: opts) if has_profile?
195
201
  deploy_cronjobs(args: args, opts: opts)
196
202
  end
197
- dispatch_task :deploy_cronjobs, to: :crontab, as: :deploy_cronjobs
198
203
 
199
204
  Luban::Deployment::Command::Tasks::Control::Actions.each do |action|
200
205
  define_method(action) do |args:, opts:|
@@ -379,6 +384,12 @@ module Luban
379
384
  dispatch_task :deprecate_packaged_release!, to: :repository, as: :deprecate, locally: true
380
385
  dispatch_task :deprecate_published_release!, to: :publisher, as: :deprecate
381
386
 
387
+ def deploy_cronjobs(args:, opts:)
388
+ opts = opts.merge(version: current_app) if has_source?
389
+ deploy_cronjobs!(args: args, opts: opts)
390
+ end
391
+ dispatch_task :deploy_cronjobs!, to: :crontab, as: :deploy_cronjobs
392
+
382
393
  def print_summary(result)
383
394
  result.each do |entry|
384
395
  s = entry[:summary]
@@ -109,21 +109,18 @@ module Luban
109
109
  def update_cronjobs!
110
110
  crontab = capture(:crontab, "-l")
111
111
  new_crontab = capture(:cat, crontab_file_path, "2>/dev/null")
112
- old = false
112
+ found = false
113
113
  crontab = crontab.split("\n").inject([]) do |lines, line|
114
- if old || line == crontab_open
115
- lines << new_crontab unless (old = line != crontab_close)
114
+ if found || line == crontab_open
115
+ lines << new_crontab unless (found = line != crontab_close)
116
116
  else
117
117
  lines << line
118
118
  end
119
119
  lines
120
120
  end
121
- if crontab.empty?
122
- test(:crontab, crontab_file_path, "2>&1")
123
- else
124
- upload!(StringIO.new(crontab.join("\n")), tmp_crontab_file_path)
125
- test(:crontab, tmp_crontab_file_path, "2>&1")
126
- end
121
+ crontab << new_crontab unless found
122
+ upload!(StringIO.new(crontab.join("\n")), tmp_crontab_file_path)
123
+ test(:crontab, tmp_crontab_file_path, "2>&1")
127
124
  ensure
128
125
  rm(tmp_crontab_file_path)
129
126
  end
@@ -132,11 +129,11 @@ module Luban
132
129
  crontab = capture(:crontab, "-l")
133
130
  return crontab if all
134
131
 
135
- old = false
132
+ found = false
136
133
  crontab.split("\n").inject([]) do |lines, line|
137
- if old || line == crontab_open
134
+ if found || line == crontab_open
138
135
  lines << line
139
- old = line != crontab_close
136
+ found = line != crontab_close
140
137
  end
141
138
  lines
142
139
  end.join("\n")
@@ -198,6 +198,7 @@ module Luban
198
198
  options << "--gemfile #{gemfile}"
199
199
  options << "--path #{bundle_path}"
200
200
  unless test(bundle_executable, :check, *options)
201
+ options << "--local"
201
202
  unless bundle_without.include?(stage.to_s)
202
203
  options << "--without #{bundle_without.join(' ')}"
203
204
  end
@@ -162,6 +162,7 @@ module Luban
162
162
  end
163
163
 
164
164
  def bundle_gems
165
+ bundle_cmd = fetch(:bundle_via, :bundle)
165
166
  gemfile_path = Pathname.new(release_tag).join('Gemfile')
166
167
  gems_cache = Pathname.new('vendor').join('cache')
167
168
  bundle_path = Pathname.new('vendor').join('bundle')
@@ -173,14 +174,14 @@ module Luban
173
174
  execute(:tar, "--strip-components=1 -xzf #{release_package_path} #{paths_to_extract.join(' ')} > /dev/null 2>&1; true")
174
175
  options = []
175
176
  options << "--path #{bundle_path}"
176
- unless test(:bundle, :check, *options)
177
+ unless test(bundle_cmd, :check, *options)
177
178
  unless bundle_without.include?(stage.to_s)
178
179
  options << "--without #{bundle_without.join(' ')}"
179
180
  end
180
181
  options << "--quiet"
181
- execute(:bundle, :install, *options)
182
+ execute(bundle_cmd, :install, *options)
182
183
  info "Package gems bundled in Gemfile"
183
- execute(:bundle, :package, "--all --quiet")
184
+ execute(bundle_cmd, :package, "--all --quiet")
184
185
  end
185
186
  gem_files = capture(:ls, '-xt', gems_cache.join('*.gem')).split
186
187
  gem_files.each do |gem_file|
@@ -1,5 +1,5 @@
1
1
  module Luban
2
2
  module Deployment
3
- VERSION = "0.8.3"
3
+ VERSION = "0.8.4"
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.8.3
4
+ version: 0.8.4
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-09-21 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: luban-cli