iron_worker_ng 0.5.0 → 0.5.1
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.
- data/VERSION +1 -1
- data/lib/iron_worker_ng/api_client.rb +2 -2
- data/lib/iron_worker_ng/client.rb +2 -2
- data/lib/iron_worker_ng/code/base.rb +7 -10
- data/lib/iron_worker_ng/code/creator.rb +2 -6
- data/lib/iron_worker_ng/code/initializer.rb +5 -3
- data/lib/iron_worker_ng/feature/binary/merge_exec.rb +0 -2
- data/lib/iron_worker_ng/feature/java/merge_exec.rb +0 -2
- data/lib/iron_worker_ng/feature/node/merge_exec.rb +0 -2
- data/lib/iron_worker_ng/feature/ruby/merge_exec.rb +0 -2
- data/ng_tests_worker.rb +3 -0
- data/remote_test.rb +36 -0
- metadata +5 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
@@ -29,8 +29,8 @@ module IronWorkerNG
|
|
29
29
|
parse_response(get("projects/#{@project_id}/codes/#{id}"))
|
30
30
|
end
|
31
31
|
|
32
|
-
def codes_create(name, file, runtime, runner)
|
33
|
-
parse_response(post_file("projects/#{@project_id}/codes", File.new(file, 'rb'), {:name => name, :runtime => runtime, :file_name => runner}))
|
32
|
+
def codes_create(name, file, runtime, runner, options)
|
33
|
+
parse_response(post_file("projects/#{@project_id}/codes", File.new(file, 'rb'), {:name => name, :runtime => runtime, :file_name => runner}.merge(options)))
|
34
34
|
end
|
35
35
|
|
36
36
|
def codes_delete(id)
|
@@ -55,9 +55,9 @@ module IronWorkerNG
|
|
55
55
|
OpenStruct.new(@api.codes_get(code_id))
|
56
56
|
end
|
57
57
|
|
58
|
-
def codes_create(code)
|
58
|
+
def codes_create(code, options = {})
|
59
59
|
zip_file = code.create_zip
|
60
|
-
res = @api.codes_create(code.name, zip_file, 'sh', '__runner__.sh')
|
60
|
+
res = @api.codes_create(code.name, zip_file, 'sh', '__runner__.sh', options)
|
61
61
|
File.unlink(zip_file)
|
62
62
|
|
63
63
|
OpenStruct.new(res)
|
@@ -45,8 +45,13 @@ module IronWorkerNG
|
|
45
45
|
initialize_code(*args, &block)
|
46
46
|
end
|
47
47
|
|
48
|
-
def name(
|
49
|
-
@name =
|
48
|
+
def name(code_name = nil)
|
49
|
+
@name = code_name if code_name
|
50
|
+
|
51
|
+
if @name.nil? and @exec
|
52
|
+
@name = IronWorkerNG::Code::Base.guess_name_for_path(@exec.path)
|
53
|
+
IronCore::Logger.info 'IronWorkerNG', "defaulting name to #{@name}"
|
54
|
+
end
|
50
55
|
|
51
56
|
@name
|
52
57
|
end
|
@@ -61,12 +66,6 @@ module IronWorkerNG
|
|
61
66
|
def runtime=(runtime)
|
62
67
|
end
|
63
68
|
|
64
|
-
def guess_name
|
65
|
-
if @name.nil? && (not @exec.nil?)
|
66
|
-
@name = IronWorkerNG::Code::Base.guess_name_for_path(@exec.path)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
69
|
def fixate
|
71
70
|
IronWorkerNG::Code::Base.registered_features.each do |rf|
|
72
71
|
if rf[:for_klass] == self.class && respond_to?(rf[:name] + '_fixate')
|
@@ -95,8 +94,6 @@ module IronWorkerNG
|
|
95
94
|
|
96
95
|
fixate
|
97
96
|
|
98
|
-
@name ||= guess_name(@exec.path)
|
99
|
-
|
100
97
|
zip_name = Dir.tmpdir + '/' + Dir::Tmpname.make_tmpname("iron-worker-ng-", "code.zip")
|
101
98
|
|
102
99
|
IronCore::Logger.debug 'IronWorkerNG', "Creating code zip '#{zip_name}'"
|
@@ -20,8 +20,8 @@ module IronWorkerNG
|
|
20
20
|
initialize_code(*args, &block)
|
21
21
|
end
|
22
22
|
|
23
|
-
def name(
|
24
|
-
@name =
|
23
|
+
def name(code_name = nil)
|
24
|
+
@name = code_name if code_name
|
25
25
|
|
26
26
|
@name
|
27
27
|
end
|
@@ -42,10 +42,6 @@ module IronWorkerNG
|
|
42
42
|
|
43
43
|
def merge_exec(path, *args)
|
44
44
|
@exec = path
|
45
|
-
|
46
|
-
if @name.nil? && (not @exec.nil?)
|
47
|
-
@name = IronWorkerNG::Code::Base.guess_name_for_path(@exec)
|
48
|
-
end
|
49
45
|
end
|
50
46
|
|
51
47
|
alias :exec :merge_exec
|
@@ -16,18 +16,20 @@ module IronWorkerNG
|
|
16
16
|
end
|
17
17
|
|
18
18
|
if args.length == 1 and (opts = args[0]).is_a? Hash and wfile = opts[:workerfile] || opts['workerfile']
|
19
|
+
IronCore::Logger.info 'IronWorkerNG', "Processing workerfile #{wfile}"
|
19
20
|
eval(File.read(File.expand_path wfile))
|
20
21
|
end
|
21
22
|
|
22
23
|
wfiles = ['Workerfile']
|
23
24
|
|
24
|
-
unless
|
25
|
-
wfiles <<
|
26
|
-
wfiles <<
|
25
|
+
unless name.nil?
|
26
|
+
wfiles << name + '.worker'
|
27
|
+
wfiles << name + '.workerfile'
|
27
28
|
end
|
28
29
|
|
29
30
|
wfiles.each do |wfile|
|
30
31
|
if File.exists?(wfile)
|
32
|
+
IronCore::Logger.info 'IronWorkerNG', "Processing workerfile #{wfile}"
|
31
33
|
eval(File.read(wfile))
|
32
34
|
end
|
33
35
|
end
|
data/ng_tests_worker.rb
ADDED
data/remote_test.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
tmpdir = Dir.mktmpdir
|
5
|
+
File.open(tmpdir + '/Gemfile', 'w') do |f|
|
6
|
+
f << File.read('Gemfile')
|
7
|
+
f << File.read('test/Gemfile')
|
8
|
+
end
|
9
|
+
Dir.chdir tmpdir do
|
10
|
+
Bundler.setup
|
11
|
+
end
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift 'lib'
|
14
|
+
|
15
|
+
require 'iron_worker_ng'
|
16
|
+
|
17
|
+
client = IronWorkerNG::Client.new
|
18
|
+
|
19
|
+
code = IronWorkerNG::Code::Ruby.new do
|
20
|
+
exec 'ng_tests_worker.rb'
|
21
|
+
gemfile 'Gemfile'
|
22
|
+
gemfile 'test/Gemfile'
|
23
|
+
dir '.', 'iwng'
|
24
|
+
end
|
25
|
+
|
26
|
+
puts client.codes.create(code)
|
27
|
+
|
28
|
+
puts code.create_zip
|
29
|
+
|
30
|
+
task = client.tasks.create 'NgTestsWorker'
|
31
|
+
|
32
|
+
client.tasks.wait_for task.id
|
33
|
+
|
34
|
+
puts '-' * 80
|
35
|
+
|
36
|
+
puts client.tasks.log(task.id)
|
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.5.
|
4
|
+
version: 0.5.1
|
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-05-
|
13
|
+
date: 2012-05-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: iron_core
|
@@ -128,6 +128,8 @@ files:
|
|
128
128
|
- lib/iron_worker_ng/feature/ruby/merge_gem.rb
|
129
129
|
- lib/iron_worker_ng/feature/ruby/merge_gemfile.rb
|
130
130
|
- lib/iron_worker_ng/version.rb
|
131
|
+
- ng_tests_worker.rb
|
132
|
+
- remote_test.rb
|
131
133
|
homepage: https://github.com/iron-io/iron_worker_ruby_ng
|
132
134
|
licenses: []
|
133
135
|
post_install_message:
|
@@ -142,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
144
|
version: '0'
|
143
145
|
segments:
|
144
146
|
- 0
|
145
|
-
hash:
|
147
|
+
hash: 257115443
|
146
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
149
|
none: false
|
148
150
|
requirements:
|