iron_worker_ng 0.10.4 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/iron_worker +6 -0
- data/lib/iron_worker_ng/cli.rb +6 -2
- data/lib/iron_worker_ng/client.rb +6 -2
- data/lib/iron_worker_ng/code/base.rb +28 -27
- data/lib/iron_worker_ng/code/builder.rb +26 -11
- data/lib/iron_worker_ng/code/runtime/java.rb +2 -0
- data/lib/iron_worker_ng/code/runtime/php.rb +1 -1
- data/lib/iron_worker_ng/code/runtime/ruby.rb +16 -7
- data/lib/iron_worker_ng/feature/base.rb +5 -1
- data/lib/iron_worker_ng/feature/common/merge_dir.rb +7 -5
- data/lib/iron_worker_ng/feature/common/merge_exec.rb +7 -5
- data/lib/iron_worker_ng/feature/common/merge_file.rb +7 -5
- data/lib/iron_worker_ng/feature/java/merge_jar.rb +7 -5
- data/lib/iron_worker_ng/feature/ruby/merge_gem.rb +16 -14
- data/lib/iron_worker_ng/feature/ruby/merge_gem_dependency.rb +26 -20
- data/lib/iron_worker_ng/version.rb +1 -1
- metadata +2 -2
data/bin/iron_worker
CHANGED
data/lib/iron_worker_ng/cli.rb
CHANGED
@@ -11,7 +11,9 @@ module IronWorkerNG
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def beta?
|
14
|
-
ENV['IRON_BETA']
|
14
|
+
beta = ENV['IRON_BETA']
|
15
|
+
|
16
|
+
beta == '1' || beta == 1 || beta == 'true' || beta == true || beta == 'beta'
|
15
17
|
end
|
16
18
|
|
17
19
|
def env=(env)
|
@@ -57,12 +59,14 @@ module IronWorkerNG
|
|
57
59
|
|
58
60
|
code.name(params[:name]) unless params[:name].nil?
|
59
61
|
|
62
|
+
code.full_remote_build = params[:full_remote_build] unless params[:full_remote_build].nil?
|
63
|
+
|
60
64
|
log "Code package name is '#{code.name}'"
|
61
65
|
log "Max concurrency set to '#{options[:max_concurrency]}'" unless options[:max_concurrency].nil?
|
62
66
|
log "Retries set to '#{options[:retries]}'" unless options[:retries].nil?
|
63
67
|
log "Retries delay set to '#{options[:retries_delay]}'" unless options[:retries_delay].nil?
|
64
68
|
|
65
|
-
if code.remote_build_command
|
69
|
+
if code.remote_build_command || code.full_remote_build
|
66
70
|
log_group "Uploading and building code package '#{code.name}'"
|
67
71
|
else
|
68
72
|
log_group "Uploading code package '#{code.name}'"
|
@@ -32,6 +32,10 @@ module IronWorkerNG
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
def options
|
36
|
+
@api.options
|
37
|
+
end
|
38
|
+
|
35
39
|
def token
|
36
40
|
@api.token
|
37
41
|
end
|
@@ -85,7 +89,7 @@ module IronWorkerNG
|
|
85
89
|
|
86
90
|
container_file = code.create_container
|
87
91
|
|
88
|
-
if code.remote_build_command.nil?
|
92
|
+
if code.remote_build_command.nil? && (not code.full_remote_build)
|
89
93
|
res = @api.codes_create(code.name, container_file, 'sh', '__runner__.sh', options)
|
90
94
|
else
|
91
95
|
builder_code_name = code.name + (code.name[0].upcase == code.name[0] ? '::Builder' : '::builder')
|
@@ -117,7 +121,7 @@ module IronWorkerNG
|
|
117
121
|
|
118
122
|
container_file = code.create_container
|
119
123
|
|
120
|
-
if code.remote_build_command.nil?
|
124
|
+
if code.remote_build_command.nil? && (not code.full_remote_build)
|
121
125
|
res = @api.codes_create(code.name, container_file, 'sh', '__runner__.sh', options)
|
122
126
|
else
|
123
127
|
builder_code_name = code.name + (code.name[0].upcase == code.name[0] ? '::Builder' : '::builder')
|
@@ -17,7 +17,7 @@ module IronWorkerNG
|
|
17
17
|
attr_accessor :base_dir
|
18
18
|
attr_accessor :dest_dir
|
19
19
|
|
20
|
-
attr_accessor :
|
20
|
+
attr_accessor :full_remote_build
|
21
21
|
|
22
22
|
undef exec
|
23
23
|
undef gem
|
@@ -32,13 +32,13 @@ module IronWorkerNG
|
|
32
32
|
@base_dir = ''
|
33
33
|
@dest_dir = ''
|
34
34
|
|
35
|
+
@full_remote_build = false
|
36
|
+
|
35
37
|
@runtime = nil
|
36
38
|
|
37
39
|
@name = nil
|
38
40
|
@exec = nil
|
39
41
|
|
40
|
-
@inside_builder = false
|
41
|
-
|
42
42
|
worker_files = []
|
43
43
|
|
44
44
|
if args.length == 1 && args[0].is_a?(String)
|
@@ -104,7 +104,7 @@ module IronWorkerNG
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def guess_name_for_path(path)
|
107
|
-
File.basename(path).gsub(/#{File.extname(path)}$/, '')
|
107
|
+
File.basename(path).gsub(/#{File.extname(path)}$/, '')
|
108
108
|
end
|
109
109
|
|
110
110
|
def name(name = nil)
|
@@ -174,7 +174,7 @@ module IronWorkerNG
|
|
174
174
|
Digest::MD5.hexdigest(@features.map { |f| f.hash_string }.join)
|
175
175
|
end
|
176
176
|
|
177
|
-
def runtime_bundle(container)
|
177
|
+
def runtime_bundle(container, local = false)
|
178
178
|
end
|
179
179
|
|
180
180
|
def runtime_run_code(local = false)
|
@@ -186,7 +186,7 @@ module IronWorkerNG
|
|
186
186
|
feature.bundle(container)
|
187
187
|
end
|
188
188
|
|
189
|
-
|
189
|
+
if local || ((not remote_build_command) && (not full_remote_build))
|
190
190
|
container.get_output_stream(@dest_dir + '__runner__.sh') do |runner|
|
191
191
|
runner.write <<RUNNER
|
192
192
|
#!/bin/sh
|
@@ -208,20 +208,18 @@ cd "$(root "$@")"
|
|
208
208
|
#{runtime_run_code(local)}
|
209
209
|
RUNNER
|
210
210
|
end
|
211
|
-
end
|
212
211
|
|
213
|
-
|
212
|
+
runtime_bundle(container, local)
|
213
|
+
end
|
214
214
|
end
|
215
215
|
|
216
216
|
def create_container(local = false)
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
end
|
217
|
+
if @exec.nil?
|
218
|
+
IronCore::Logger.error 'IronWorkerNG', 'No exec specified', IronCore::Error
|
219
|
+
end
|
221
220
|
|
222
|
-
|
223
|
-
|
224
|
-
end
|
221
|
+
if @name.nil?
|
222
|
+
@name = guess_name_for_path(@exec.path)
|
225
223
|
end
|
226
224
|
|
227
225
|
fixate
|
@@ -231,27 +229,31 @@ RUNNER
|
|
231
229
|
IronCore::Logger.debug 'IronWorkerNG', "Creating #{local ? 'local ' : ''}code container '#{container.name}'"
|
232
230
|
|
233
231
|
if local
|
234
|
-
bundle(container)
|
232
|
+
bundle(container, local)
|
235
233
|
else
|
236
|
-
if @remote_build_command
|
234
|
+
if @remote_build_command || @full_remote_build
|
237
235
|
@dest_dir = '__build__/'
|
238
236
|
end
|
239
237
|
|
240
|
-
bundle(container)
|
238
|
+
bundle(container, local)
|
241
239
|
|
242
|
-
if @remote_build_command
|
240
|
+
if @remote_build_command || @full_remote_build
|
243
241
|
IronCore::Logger.info 'IronWorkerNG', 'Creating builder'
|
244
242
|
|
245
243
|
builder = IronWorkerNG::Code::Builder.new
|
246
|
-
builder.
|
244
|
+
builder.builder_remote_build_command = @remote_build_command
|
247
245
|
|
248
246
|
builder.gem('iron_worker_ng')
|
249
247
|
builder.fixate
|
250
248
|
|
251
|
-
builder.bundle(container)
|
249
|
+
builder.bundle(container, local)
|
250
|
+
|
251
|
+
container.get_output_stream(@name + '.worker') do |wf|
|
252
|
+
wf.write(workerfile)
|
253
|
+
end
|
252
254
|
end
|
253
255
|
|
254
|
-
if @remote_build_command
|
256
|
+
if @remote_build_command || @full_remote_build
|
255
257
|
@dest_dir = ''
|
256
258
|
end
|
257
259
|
end
|
@@ -277,23 +279,22 @@ RUNNER
|
|
277
279
|
FileUtils.rm_rf(container_name)
|
278
280
|
end
|
279
281
|
|
280
|
-
def install
|
282
|
+
def install(standalone = false)
|
281
283
|
end
|
282
284
|
|
283
|
-
def workerfile
|
285
|
+
def workerfile
|
284
286
|
commands = []
|
285
287
|
|
286
288
|
commands << "runtime '#{runtime}'"
|
287
289
|
commands << "name '#{name}'"
|
288
|
-
commands << "build '#{remote_build_command}'"
|
289
290
|
|
290
|
-
commands
|
291
|
+
commands += @features.map { |f| f.command }
|
291
292
|
|
292
293
|
commands.compact.join("\n")
|
293
294
|
end
|
294
295
|
|
295
296
|
def to_s
|
296
|
-
"runtime='#{@runtime}', name='#{@name}', exec='#{@
|
297
|
+
"runtime='#{@runtime}', name='#{@name}', exec='#{@exec.path}'"
|
297
298
|
end
|
298
299
|
end
|
299
300
|
end
|
@@ -3,6 +3,8 @@ require_relative '../feature/ruby/merge_gem'
|
|
3
3
|
module IronWorkerNG
|
4
4
|
module Code
|
5
5
|
class Builder < IronWorkerNG::Code::Base
|
6
|
+
attr_accessor :builder_remote_build_command
|
7
|
+
|
6
8
|
def initialize(*args, &block)
|
7
9
|
@features = []
|
8
10
|
@fixators = []
|
@@ -10,19 +12,24 @@ module IronWorkerNG
|
|
10
12
|
@base_dir = ''
|
11
13
|
@dest_dir = ''
|
12
14
|
|
15
|
+
@remote_build_command = nil
|
16
|
+
@full_remote_build = false
|
17
|
+
|
13
18
|
runtime(:ruby)
|
14
19
|
end
|
15
20
|
|
16
|
-
def bundle(container)
|
21
|
+
def bundle(container, local = false)
|
17
22
|
@exec = IronWorkerNG::Feature::Common::MergeExec::Feature.new(self, '__builder__.rb', {})
|
18
23
|
|
19
|
-
super(container)
|
24
|
+
super(container, local)
|
20
25
|
|
21
|
-
|
22
|
-
|
26
|
+
if builder_remote_build_command
|
27
|
+
container.get_output_stream(@dest_dir + '__builder__.sh') do |builder|
|
28
|
+
builder.write <<BUILDER_SH
|
23
29
|
# #{IronWorkerNG.full_version}
|
24
|
-
#{
|
30
|
+
#{builder_remote_build_command}
|
25
31
|
BUILDER_SH
|
32
|
+
end
|
26
33
|
end
|
27
34
|
|
28
35
|
container.get_output_stream(@dest_dir + '__builder__.rb') do |builder|
|
@@ -33,15 +40,23 @@ require 'json'
|
|
33
40
|
|
34
41
|
require 'iron_worker_ng'
|
35
42
|
|
36
|
-
|
43
|
+
IronWorkerNG::Feature::Ruby::MergeGem.merge_binary = true
|
44
|
+
|
45
|
+
code = IronWorkerNG::Code::Base.new(params[:code_name])
|
46
|
+
|
47
|
+
if File.exists?('__builder__.sh')
|
48
|
+
pre_build_list = Dir.glob('__build__/**/**')
|
37
49
|
|
38
|
-
|
50
|
+
exit 1 unless system('cd __build__ && sh ../__builder__.sh && cd ..')
|
39
51
|
|
40
|
-
|
41
|
-
|
52
|
+
post_build_list = Dir.glob('__build__/**/**')
|
53
|
+
|
54
|
+
(post_build_list.sort - pre_build_list.sort).each do |new_file|
|
55
|
+
code.file(new_file, File.dirname(new_file[10 .. -1])) if File.file?(new_file)
|
56
|
+
end
|
57
|
+
end
|
42
58
|
|
43
|
-
code.
|
44
|
-
code.dir '.'
|
59
|
+
code.install(true)
|
45
60
|
|
46
61
|
client = IronWorkerNG::Client.new(JSON.parse(params[:client_options]))
|
47
62
|
|
@@ -4,7 +4,7 @@ module IronWorkerNG
|
|
4
4
|
module PHP
|
5
5
|
include IronWorkerNG::Feature::Common::MergeExec::InstanceMethods
|
6
6
|
|
7
|
-
def runtime_bundle(container)
|
7
|
+
def runtime_bundle(container, local = false)
|
8
8
|
container.get_output_stream(@dest_dir + '__runner__.php') do |runner|
|
9
9
|
runner.write <<PHP_RUNNER
|
10
10
|
<?php
|
@@ -13,7 +13,7 @@ module IronWorkerNG
|
|
13
13
|
include IronWorkerNG::Feature::Ruby::MergeGemDependency::InstanceMethods
|
14
14
|
include IronWorkerNG::Feature::Ruby::MergeGemfile::InstanceMethods
|
15
15
|
|
16
|
-
def runtime_bundle(container)
|
16
|
+
def runtime_bundle(container, local = false)
|
17
17
|
container.get_output_stream(@dest_dir + '__runner__.rb') do |runner|
|
18
18
|
runner.write <<RUBY_RUNNER
|
19
19
|
# #{IronWorkerNG.full_version}
|
@@ -94,12 +94,19 @@ RUBY_RUNNER
|
|
94
94
|
RUN_CODE
|
95
95
|
end
|
96
96
|
|
97
|
-
def install
|
98
|
-
gemfile_dir =
|
97
|
+
def install(standalone = false)
|
98
|
+
gemfile_dir = nil
|
99
|
+
gemfile = nil
|
99
100
|
|
100
|
-
|
101
|
+
if standalone
|
102
|
+
gemfile = File.open('Gemfile', 'w')
|
103
|
+
else
|
104
|
+
gemfile_dir = ::Dir.tmpdir + '/' + ::Dir::Tmpname.make_tmpname('iron-worker-ng-', 'gemfile')
|
101
105
|
|
102
|
-
|
106
|
+
FileUtils.mkdir(gemfile_dir)
|
107
|
+
|
108
|
+
gemfile = File.open(gemfile_dir + '/Gemfile', 'w')
|
109
|
+
end
|
103
110
|
|
104
111
|
gemfile.puts('source :rubygems')
|
105
112
|
|
@@ -111,9 +118,11 @@ RUN_CODE
|
|
111
118
|
|
112
119
|
gemfile.close
|
113
120
|
|
114
|
-
puts `cd #{gemfile_dir} && bundle install`
|
121
|
+
puts `cd #{gemfile_dir} && bundle install#{standalone ? ' --standalone' : ''}`
|
115
122
|
|
116
|
-
|
123
|
+
unless gemfile_dir.nil?
|
124
|
+
FileUtils.rm_r(gemfile_dir)
|
125
|
+
end
|
117
126
|
end
|
118
127
|
end
|
119
128
|
end
|
@@ -6,6 +6,10 @@ module IronWorkerNG
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def rebase(path)
|
9
|
+
if IronWorkerNG::Fetcher.remote?(path) || path.start_with?('/')
|
10
|
+
return path
|
11
|
+
end
|
12
|
+
|
9
13
|
@code.base_dir + path
|
10
14
|
end
|
11
15
|
|
@@ -32,7 +36,7 @@ module IronWorkerNG
|
|
32
36
|
def bundle(container)
|
33
37
|
end
|
34
38
|
|
35
|
-
def command
|
39
|
+
def command
|
36
40
|
nil
|
37
41
|
end
|
38
42
|
end
|
@@ -26,15 +26,17 @@ module IronWorkerNG
|
|
26
26
|
def bundle(container)
|
27
27
|
IronCore::Logger.debug 'IronWorkerNG', "Bundling dir with path='#{@path}' and dest='#{@dest}'"
|
28
28
|
|
29
|
-
|
29
|
+
if (not @code.full_remote_build) || (not IronWorkerNG::Fetcher.remote?(rebase(@path)))
|
30
|
+
container_add(container, @dest + File.basename(@path), rebase(@path))
|
31
|
+
end
|
30
32
|
end
|
31
33
|
|
32
|
-
def command
|
33
|
-
if
|
34
|
-
if IronWorkerNG::Fetcher.remote?(rebase(@path))
|
34
|
+
def command
|
35
|
+
if @code.remote_build_command || @code.full_remote_build
|
36
|
+
if @code.full_remote_build && IronWorkerNG::Fetcher.remote?(rebase(@path))
|
35
37
|
"dir '#{rebase(@path)}', '#{@dest}'"
|
36
38
|
else
|
37
|
-
"dir '#{@dest}#{File.basename(@path)}', '#{@dest}'"
|
39
|
+
"dir '#{@code.dest_dir}#{@dest}#{File.basename(@path)}', '#{@dest}'"
|
38
40
|
end
|
39
41
|
else
|
40
42
|
"dir '#{@path}', '#{@dest}'"
|
@@ -30,15 +30,17 @@ module IronWorkerNG
|
|
30
30
|
def bundle(container)
|
31
31
|
IronCore::Logger.debug 'IronWorkerNG', "Bundling exec with path='#{@path}' and args='#{@args.inspect}'"
|
32
32
|
|
33
|
-
|
33
|
+
if (not @code.full_remote_build) || (not IronWorkerNG::Fetcher.remote?(rebase(@path)))
|
34
|
+
container_add(container, File.basename(@path), rebase(@path))
|
35
|
+
end
|
34
36
|
end
|
35
37
|
|
36
|
-
def command
|
37
|
-
if
|
38
|
-
if IronWorkerNG::Fetcher.remote?(rebase(@path))
|
38
|
+
def command
|
39
|
+
if @code.remote_build_command || @code.full_remote_build
|
40
|
+
if @code.full_remote_build && IronWorkerNG::Fetcher.remote?(rebase(@path))
|
39
41
|
"exec '#{rebase(@path)}', #{@args.inspect}"
|
40
42
|
else
|
41
|
-
"exec '#{File.basename(@path)}', #{@args.inspect}"
|
43
|
+
"exec '#{@code.dest_dir}#{File.basename(@path)}', #{@args.inspect}"
|
42
44
|
end
|
43
45
|
else
|
44
46
|
"exec '#{@path}', #{@args.inspect}"
|
@@ -20,15 +20,17 @@ module IronWorkerNG
|
|
20
20
|
def bundle(container)
|
21
21
|
IronCore::Logger.debug 'IronWorkerNG', "Bundling file with path='#{@path}' and dest='#{@dest}'"
|
22
22
|
|
23
|
-
|
23
|
+
if (not @code.full_remote_build) || (not IronWorkerNG::Fetcher.remote?(rebase(@path)))
|
24
|
+
container_add(container, @dest + File.basename(@path), rebase(@path))
|
25
|
+
end
|
24
26
|
end
|
25
27
|
|
26
|
-
def command
|
27
|
-
if
|
28
|
-
if IronWorkerNG::Fetcher.remote?(rebase(@path))
|
28
|
+
def command
|
29
|
+
if @code.remote_build_command || @code.full_remote_build
|
30
|
+
if @code.full_remote_build && IronWorkerNG::Fetcher.remote?(rebase(@path))
|
29
31
|
"file '#{rebase(@path)}', '#{@dest}'"
|
30
32
|
else
|
31
|
-
"file '#{@dest}#{File.basename(@path)}', '#{@dest}'"
|
33
|
+
"file '#{@code.dest_dir}#{@dest}#{File.basename(@path)}', '#{@dest}'"
|
32
34
|
end
|
33
35
|
else
|
34
36
|
"file '#{@path}', '#{@dest}'"
|
@@ -18,15 +18,17 @@ module IronWorkerNG
|
|
18
18
|
def bundle(container)
|
19
19
|
IronCore::Logger.debug 'IronWorkerNG', "Bundling java jar with path='#{@path}'"
|
20
20
|
|
21
|
-
|
21
|
+
if (not @code.full_remote_build) || (not IronWorkerNG::Fetcher.remote?(rebase(@path)))
|
22
|
+
container_add(container, File.basename(@path), rebase(@path))
|
23
|
+
end
|
22
24
|
end
|
23
25
|
|
24
|
-
def command
|
25
|
-
if
|
26
|
-
if IronWorkerNG::Fetcher.remote?(rebase(@path))
|
26
|
+
def command
|
27
|
+
if @code.remote_build_command || @code.full_remote_build
|
28
|
+
if @code.full_remote_build && IronWorkerNG::Fetcher.remote?(rebase(@path))
|
27
29
|
"jar '#{rebase(@path)}'"
|
28
30
|
else
|
29
|
-
"jar '#{File.basename(@path)}'"
|
31
|
+
"jar '#{@code.dest_dir}#{File.basename(@path)}'"
|
30
32
|
end
|
31
33
|
else
|
32
34
|
"jar '#{@path}'"
|
@@ -36,22 +36,24 @@ module IronWorkerNG
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def bundle(container)
|
39
|
-
if @
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
39
|
+
if not @code.full_remote_build
|
40
|
+
if @spec.extensions.length == 0 || IronWorkerNG::Feature::Ruby::MergeGem.merge_binary?
|
41
|
+
IronCore::Logger.debug 'IronWorkerNG', "Bundling ruby gem with name='#{@spec.name}' and version='#{@spec.version}'"
|
42
|
+
|
43
|
+
if File.exists?(@spec.full_gem_path)
|
44
|
+
container_add(container, '__gems__/gems/' + @spec.full_name, gem_path)
|
45
|
+
else
|
46
|
+
from_dir = File.dirname(@spec.loaded_from)
|
47
|
+
|
48
|
+
@spec.files.each do |fname|
|
49
|
+
container_add(container, '__gems__/gems/' + @spec.full_name + '/' + fname, from_dir + '/' + fname) if File.file?(from_dir + '/' + fname)
|
50
|
+
end
|
50
51
|
end
|
52
|
+
|
53
|
+
container_add(container, "__gems__/specifications/#{@spec.full_name}.gemspec", @spec.loaded_from)
|
54
|
+
else
|
55
|
+
IronCore::Logger.warn 'IronWorkerNG', "Skipping ruby gem with name='#{@spec.name}' and version='#{@spec.version}' as it contains native extensions"
|
51
56
|
end
|
52
|
-
container_add(container, "__gems__/specifications/#{@spec.full_name}.gemspec", @spec.loaded_from)
|
53
|
-
else
|
54
|
-
IronCore::Logger.warn 'IronWorkerNG', "Skipping ruby gem with name='#{@spec.name}' and version='#{@spec.version}' as it contains native extensions"
|
55
57
|
end
|
56
58
|
end
|
57
59
|
end
|
@@ -19,8 +19,12 @@ module IronWorkerNG
|
|
19
19
|
Digest::MD5.hexdigest(@name + @version)
|
20
20
|
end
|
21
21
|
|
22
|
-
def command
|
23
|
-
|
22
|
+
def command
|
23
|
+
if @code.full_remote_build
|
24
|
+
"gem '#{@name}', '#{@version}'"
|
25
|
+
else
|
26
|
+
nil
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
@@ -38,34 +42,36 @@ module IronWorkerNG
|
|
38
42
|
alias :gem :merge_gem
|
39
43
|
|
40
44
|
def merge_gem_dependency_fixate
|
41
|
-
|
45
|
+
if not full_remote_build
|
46
|
+
IronCore::Logger.info 'IronWorkerNG', 'Fixating gems dependencies'
|
42
47
|
|
43
|
-
|
48
|
+
@features.reject! { |f| f.class == IronWorkerNG::Feature::Ruby::MergeGem::Feature }
|
44
49
|
|
45
|
-
|
50
|
+
deps = @features.reject { |f| f.class != IronWorkerNG::Feature::Ruby::MergeGemDependency::Feature }
|
46
51
|
|
47
|
-
|
48
|
-
|
52
|
+
if deps.length > 0
|
53
|
+
deps = deps.map { |dep| Bundler::DepProxy.new(Bundler::Dependency.new(dep.name, dep.version.split(', ')), Gem::Platform::RUBY) }
|
49
54
|
|
50
|
-
|
55
|
+
source = nil
|
51
56
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
57
|
+
begin
|
58
|
+
source = Bundler::Source::Rubygems.new
|
59
|
+
rescue Bundler::GemfileNotFound
|
60
|
+
ENV['BUNDLE_GEMFILE'] = 'Gemfile'
|
61
|
+
source = Bundler::Source::Rubygems.new
|
62
|
+
end
|
58
63
|
|
59
|
-
|
64
|
+
index = Bundler::Index.build { |index| index.use source.specs }
|
60
65
|
|
61
|
-
|
66
|
+
spec_set = Bundler::Resolver.resolve(deps, index)
|
62
67
|
|
63
|
-
|
64
|
-
|
68
|
+
spec_set.to_a.each do |spec|
|
69
|
+
spec.__materialize__
|
65
70
|
|
66
|
-
|
71
|
+
IronCore::Logger.info 'IronWorkerNG', "Merging ruby gem with name='#{spec.name}' and version='#{spec.version}'"
|
67
72
|
|
68
|
-
|
73
|
+
@features << IronWorkerNG::Feature::Ruby::MergeGem::Feature.new(self, spec)
|
74
|
+
end
|
69
75
|
end
|
70
76
|
end
|
71
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_worker_ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: iron_core
|