iron_worker_ng 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,9 +4,9 @@ To run your code in cloud you need to do three things:
4
4
 
5
5
  - **Create code package**
6
6
  - **Upload code package**
7
- - **Queue or schedule tasks** for execution
7
+ - **Queue or schedule tasks** for execution
8
8
 
9
- While you can use [REST APIs](http://dev.iron.io/worker/reference/api) for that, it's easier to use an
9
+ While you can use [REST APIs](http://dev.iron.io/worker/reference/api) for that, it's easier to use an
10
10
  IronWorker library created specifically for your language of choice, such as this gem, IronWorkerNG.
11
11
 
12
12
  # Preparing Your Environment
@@ -21,7 +21,7 @@ gem install iron_worker_ng
21
21
 
22
22
  # Creating A Worker
23
23
 
24
- Each IronWorkerNG Ruby worker is just Ruby code. It can be as simple or as complex as you want. For example,
24
+ Each IronWorkerNG Ruby worker is just Ruby code. It can be as simple or as complex as you want. For example,
25
25
  the following is an acceptable worker:
26
26
 
27
27
  ```ruby
@@ -35,14 +35,14 @@ All output to `STDOUT` will be logged and available for your review when your wo
35
35
  # Creating The Code Package
36
36
 
37
37
  Before you can run use IronWorker, be sure you've [created a free account with Iron.io](http://www.iron.io)
38
- and [setup your Iron.io credentials on your system](http://dev.iron.io/articles/configuration/) (either in a json
39
- file or using ENV variables). You only need to do that once for your machine. If you've done that, then you can continue.
38
+ and [setup your Iron.io credentials on your system](http://dev.iron.io/articles/configuration/) (either in a json
39
+ file or using ENV variables). You only need to do that once for your machine. If you've done that, then you can continue.
40
40
 
41
- Since our worker will be executed in the cloud, you'll need to bundle all the necessary gems,
41
+ Since our worker will be executed in the cloud, you'll need to bundle all the necessary gems,
42
42
  supplementary data, and other dependencies with it. `.worker` files make it easy to define your worker.
43
43
 
44
44
  ```ruby
45
- # define the runtime language, this can be ruby, java, node, php, go, etc.
45
+ # define the runtime language, this can be ruby, java, node, php, go, etc.
46
46
  runtime "ruby"
47
47
  # exec is the file that will be executed:
48
48
  exec "hello_worker.rb"
@@ -52,7 +52,7 @@ You can read more about `.worker` files here: http://dev.iron.io/worker/referenc
52
52
 
53
53
  ## Uploading the Code Package
54
54
 
55
- If your .worker file is called `hello.worker`, then run:
55
+ If your .worker file is called `hello.worker`, then run:
56
56
 
57
57
  iron_worker upload hello
58
58
 
@@ -73,7 +73,7 @@ Most commonly you'll be queuing up tasks from code though, so you can do this:
73
73
  ```ruby
74
74
  require "iron_worker_ng"
75
75
  client = IronWorkerNG::Client.new
76
- 100.times do
76
+ 100.times do
77
77
  client.tasks.create("hello", "foo"=>"bar")
78
78
  end
79
79
  ```
@@ -167,7 +167,7 @@ code.merge_gemfile '../Gemfile', 'common', 'worker' # merges gems from common an
167
167
 
168
168
  # Upload Your Worker
169
169
 
170
- When you have your code package, you are ready to upload and run it on the IronWorker cloud.
170
+ When you have your code package, you are ready to upload and run it on the IronWorker cloud.
171
171
 
172
172
  ```ruby
173
173
  # Initialize the client
@@ -180,8 +180,8 @@ client.codes.create(code)
180
180
 
181
181
  # Queue Up Tasks for Your Worker
182
182
 
183
- Now that the code is uploaded, we can create/queue up tasks. You can call this over and over
184
- for as many tasks as you want.
183
+ Now that the code is uploaded, we can create/queue up tasks. You can call this over and over
184
+ for as many tasks as you want.
185
185
 
186
186
  ```ruby
187
187
  client.tasks.create('MyWorker', {:client => 'Joe'})
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.3
1
+ 0.8.4
data/bin/iron_worker CHANGED
@@ -4,6 +4,22 @@ require 'optparse'
4
4
  require 'time'
5
5
  require 'iron_worker_ng'
6
6
 
7
+ class IronWorkerCLILoggerFormatter < ::Logger::Formatter
8
+ def call(severity, time, proname, msg)
9
+ msg + "\n"
10
+ end
11
+ end
12
+
13
+ def create_client
14
+ client = IronWorkerNG::Client.new
15
+
16
+ project = client.projects.get
17
+
18
+ IronCore::Logger.info 'IronWorkerNG', "Working with project '#{project.name}' ('#{project.id}')"
19
+
20
+ client
21
+ end
22
+
7
23
  if $*.size == 1 && ($*[0] == '-v' || $*[0] == '--version')
8
24
  puts IronWorkerNG.full_version
9
25
  exit 0
@@ -23,7 +39,7 @@ command = 'tasks.create' if command == 'queue'
23
39
  command = 'schedules.create' if command == 'schedule'
24
40
  command = 'tasks.log' if command == 'log'
25
41
 
26
- IronCore::Logger.logger.datetime_format = ''
42
+ IronCore::Logger.logger.formatter = IronWorkerCLILoggerFormatter.new
27
43
 
28
44
  if $*.include?('--debug')
29
45
  IronCore::Logger.logger.level = ::Logger::DEBUG
@@ -59,16 +75,20 @@ if command == 'codes.create'
59
75
  exit 1
60
76
  end
61
77
 
62
- code = IronWorkerNG::Code::Base.new(name)
63
-
64
- client = IronWorkerNG::Client.new
78
+ client = create_client
65
79
 
80
+ code = IronWorkerNG::Code::Base.new(name)
81
+
82
+ IronCore::Logger.info 'IronWorkerNG', "Worker '#{code.name}' upload started"
83
+
66
84
  client.codes.create(code)
85
+
86
+ IronCore::Logger.info 'IronWorkerNG', "Worker '#{code.name}' uploaded"
67
87
  elsif command == 'tasks.create' || command == 'schedules.create'
68
88
  if $*.size > 0 && $*[0][0] != '-'
69
89
  $*.unshift('-n')
70
90
  end
71
-
91
+
72
92
  name = nil
73
93
  payload = nil
74
94
  payload_file = nil
@@ -88,7 +108,7 @@ elsif command == 'tasks.create' || command == 'schedules.create'
88
108
  opts.banner = "usage: iron_worker #{command} [OPTIONS]"
89
109
 
90
110
  opts.on('-n', '--name NAME', 'code name') do |v|
91
- name = v
111
+ name = v
92
112
  end
93
113
 
94
114
  opts.on('-p', '--payload PAYLOAD', String, 'payload to pass') do |v|
@@ -163,14 +183,18 @@ elsif command == 'tasks.create' || command == 'schedules.create'
163
183
  options[:run_every] = run_every unless run_every.nil?
164
184
  end
165
185
 
166
- client = IronWorkerNG::Client.new
186
+ client = create_client
167
187
 
168
188
  id = nil
169
189
 
170
190
  if command == 'tasks.create'
171
191
  id = client.tasks.create(name, payload, options).id
192
+
193
+ IronCore::Logger.info 'IronWorkerNG', "Worker '#{name}' queued"
172
194
  else
173
195
  id = client.schedules.create(name, payload, options).id
196
+
197
+ IronCore::Logger.info 'IronWorkerNG', "Worker '#{name}' scheduled"
174
198
  end
175
199
 
176
200
  puts id if print_id
@@ -187,7 +211,7 @@ elsif command == 'tasks.log'
187
211
  opts.banner = "usage: iron_worker #{command} [OPTIONS]"
188
212
 
189
213
  opts.on('-t', '--task-id ID', 'task id') do |v|
190
- task_id = v
214
+ task_id = v
191
215
  end
192
216
 
193
217
  opts.on('-w', '--wait', 'wait for task') do |v|
@@ -207,7 +231,7 @@ elsif command == 'tasks.log'
207
231
  exit 1
208
232
  end
209
233
 
210
- client = IronWorkerNG::Client.new
234
+ client = create_client
211
235
 
212
236
  log = ''
213
237
 
@@ -220,7 +244,7 @@ elsif command == 'tasks.log'
220
244
  if wait
221
245
  client.tasks.wait_for(task_id)
222
246
  end
223
-
247
+
224
248
  log = client.tasks.log(task_id)
225
249
  end
226
250
 
@@ -72,7 +72,7 @@ module Hashie
72
72
  value
73
73
  end
74
74
  end
75
-
75
+
76
76
  def indifferent_default(key = nil)
77
77
  return self[convert_key(key)] if key?(key)
78
78
  regular_default(key)
@@ -84,7 +84,7 @@ module Hashie
84
84
  self[k] = v
85
85
  end
86
86
  end
87
-
87
+
88
88
  def indifferent_writer(key, value); regular_writer convert_key(key), convert_value(value) end
89
89
  def indifferent_fetch(key, *args); regular_fetch convert_key(key), *args end
90
90
  def indifferent_delete(key); regular_delete convert_key(key) end
@@ -92,7 +92,7 @@ module Hashie
92
92
  def indifferent_values_at(*indices); indices.map{|i| self[i] } end
93
93
 
94
94
  def indifferent_access?; true end
95
-
95
+
96
96
  protected
97
97
 
98
98
  def hash_lacking_indifference?(other)
@@ -111,5 +111,9 @@ module IronWorkerNG
111
111
  check_id(id)
112
112
  parse_response(post("projects/#{@project_id}/schedules/#{id}/cancel"))
113
113
  end
114
+
115
+ def projects_get
116
+ parse_response(get("projects/#{@project_id}"))
117
+ end
114
118
  end
115
119
  end
@@ -49,19 +49,19 @@ module IronWorkerNG
49
49
  end
50
50
 
51
51
  def codes_list(options = {})
52
- IronCore::Logger.info 'IronWorkerNG', "Calling codes.list with options='#{options.to_s}'"
52
+ IronCore::Logger.debug 'IronWorkerNG', "Calling codes.list with options='#{options.to_s}'"
53
53
 
54
54
  @api.codes_list(options)['codes'].map { |c| OpenStruct.new(c) }
55
55
  end
56
56
 
57
57
  def codes_get(code_id)
58
- IronCore::Logger.info 'IronWorkerNG', "Calling codes.get with code_id='#{code_id}'"
58
+ IronCore::Logger.debug 'IronWorkerNG', "Calling codes.get with code_id='#{code_id}'"
59
59
 
60
60
  OpenStruct.new(@api.codes_get(code_id))
61
61
  end
62
62
 
63
63
  def codes_create(code, options = {})
64
- IronCore::Logger.info 'IronWorkerNG', "Calling codes.create with code='#{code.to_s}' and options='#{options.to_s}'"
64
+ IronCore::Logger.debug 'IronWorkerNG', "Calling codes.create with code='#{code.to_s}' and options='#{options.to_s}'"
65
65
 
66
66
  zip_file = code.create_zip
67
67
 
@@ -89,7 +89,7 @@ module IronWorkerNG
89
89
  end
90
90
 
91
91
  def codes_delete(code_id)
92
- IronCore::Logger.info 'IronWorkerNG', "Calling codes.delete with code_id='#{code_id}'"
92
+ IronCore::Logger.debug 'IronWorkerNG', "Calling codes.delete with code_id='#{code_id}'"
93
93
 
94
94
  @api.codes_delete(code_id)
95
95
 
@@ -97,31 +97,31 @@ module IronWorkerNG
97
97
  end
98
98
 
99
99
  def codes_revisions(code_id, options = {})
100
- IronCore::Logger.info 'IronWorkerNG', "Calling codes.revisions with code_id='#{code_id}' and options='#{options.to_s}'"
100
+ IronCore::Logger.debug 'IronWorkerNG', "Calling codes.revisions with code_id='#{code_id}' and options='#{options.to_s}'"
101
101
 
102
102
  @api.codes_revisions(code_id, options)['revisions'].map { |c| OpenStruct.new(c) }
103
103
  end
104
104
 
105
105
  def codes_download(code_id, options = {})
106
- IronCore::Logger.info 'IronWorkerNG', "Calling codes.download with code_id='#{code_id}' and options='#{options.to_s}'"
106
+ IronCore::Logger.debug 'IronWorkerNG', "Calling codes.download with code_id='#{code_id}' and options='#{options.to_s}'"
107
107
 
108
108
  @api.codes_download(code_id, options)
109
109
  end
110
110
 
111
111
  def tasks_list(options = {})
112
- IronCore::Logger.info 'IronWorkerNG', "Calling tasks.list with options='#{options.to_s}'"
112
+ IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.list with options='#{options.to_s}'"
113
113
 
114
114
  @api.tasks_list(options)['tasks'].map { |t| OpenStruct.new(t) }
115
115
  end
116
116
 
117
117
  def tasks_get(task_id)
118
- IronCore::Logger.info 'IronWorkerNG', "Calling tasks.get with task_id='#{task_id}'"
118
+ IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.get with task_id='#{task_id}'"
119
119
 
120
120
  OpenStruct.new(@api.tasks_get(task_id))
121
121
  end
122
122
 
123
123
  def tasks_create(code_name, params = {}, options = {})
124
- IronCore::Logger.info 'IronWorkerNG', "Calling tasks.create with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
124
+ IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.create with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
125
125
 
126
126
  res = @api.tasks_create(code_name, params.class == String ? params : params.to_json, options)
127
127
 
@@ -129,7 +129,7 @@ module IronWorkerNG
129
129
  end
130
130
 
131
131
  def tasks_create_legacy(code_name, params = {}, options = {})
132
- IronCore::Logger.info 'IronWorkerNG', "Calling tasks.create_legacy with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
132
+ IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.create_legacy with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
133
133
 
134
134
  res = @api.tasks_create(code_name, params_for_legacy(code_name, params), options)
135
135
 
@@ -137,7 +137,7 @@ module IronWorkerNG
137
137
  end
138
138
 
139
139
  def tasks_cancel(task_id)
140
- IronCore::Logger.info 'IronWorkerNG', "Calling tasks.cancel with task_id='#{task_id}'"
140
+ IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.cancel with task_id='#{task_id}'"
141
141
 
142
142
  @api.tasks_cancel(task_id)
143
143
 
@@ -145,7 +145,7 @@ module IronWorkerNG
145
145
  end
146
146
 
147
147
  def tasks_cancel_all(code_id)
148
- IronCore::Logger.info 'IronWorkerNG', "Calling tasks.cancel_all with code_id='#{code_id}'"
148
+ IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.cancel_all with code_id='#{code_id}'"
149
149
 
150
150
  @api.tasks_cancel_all(code_id)
151
151
 
@@ -153,13 +153,13 @@ module IronWorkerNG
153
153
  end
154
154
 
155
155
  def tasks_log(task_id)
156
- IronCore::Logger.info 'IronWorkerNG', "Calling tasks.log with task_id='#{task_id}'"
156
+ IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.log with task_id='#{task_id}'"
157
157
 
158
158
  @api.tasks_log(task_id)
159
159
  end
160
160
 
161
161
  def tasks_set_progress(task_id, options = {})
162
- IronCore::Logger.info 'IronWorkerNG', "Calling tasks.set_progress with task_id='#{task_id}' and options='#{options.to_s}'"
162
+ IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.set_progress with task_id='#{task_id}' and options='#{options.to_s}'"
163
163
 
164
164
  @api.tasks_set_progress(task_id, options)
165
165
 
@@ -167,7 +167,7 @@ module IronWorkerNG
167
167
  end
168
168
 
169
169
  def tasks_wait_for(task_id, options = {})
170
- IronCore::Logger.info 'IronWorkerNG', "Calling tasks.wait_for with task_id='#{task_id}' and options='#{options.to_s}'"
170
+ IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.wait_for with task_id='#{task_id}' and options='#{options.to_s}'"
171
171
 
172
172
  options[:sleep] ||= options['sleep'] || 5
173
173
 
@@ -183,19 +183,19 @@ module IronWorkerNG
183
183
  end
184
184
 
185
185
  def schedules_list(options = {})
186
- IronCore::Logger.info 'IronWorkerNG', "Calling schedules.list with options='#{options.to_s}'"
186
+ IronCore::Logger.debug 'IronWorkerNG', "Calling schedules.list with options='#{options.to_s}'"
187
187
 
188
188
  @api.schedules_list(options)['schedules'].map { |s| OpenStruct.new(s) }
189
189
  end
190
190
 
191
191
  def schedules_get(schedule_id)
192
- IronCore::Logger.info 'IronWorkerNG', "Calling schedules.get with schedule_id='#{schedule_id}"
192
+ IronCore::Logger.debug 'IronWorkerNG', "Calling schedules.get with schedule_id='#{schedule_id}"
193
193
 
194
194
  OpenStruct.new(@api.schedules_get(schedule_id))
195
195
  end
196
196
 
197
197
  def schedules_create(code_name, params = {}, options = {})
198
- IronCore::Logger.info 'IronWorkerNG', "Calling schedules.create with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
198
+ IronCore::Logger.debug 'IronWorkerNG', "Calling schedules.create with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
199
199
 
200
200
  res = @api.schedules_create(code_name, params.class == String ? params : params.to_json, options)
201
201
 
@@ -203,7 +203,7 @@ module IronWorkerNG
203
203
  end
204
204
 
205
205
  def schedules_create_legacy(code_name, params = {}, options = {})
206
- IronCore::Logger.info 'IronWorkerNG', "Calling schedules.create_legacy with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
206
+ IronCore::Logger.debug 'IronWorkerNG', "Calling schedules.create_legacy with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
207
207
 
208
208
  res = @api.schedules_create(code_name, params_for_legacy(code_name, params), options)
209
209
 
@@ -211,20 +211,28 @@ module IronWorkerNG
211
211
  end
212
212
 
213
213
  def schedules_cancel(schedule_id)
214
- IronCore::Logger.info 'IronWorkerNG', "Calling schedules.cancel with schedule_id='#{schedule_id}"
214
+ IronCore::Logger.debug 'IronWorkerNG', "Calling schedules.cancel with schedule_id='#{schedule_id}"
215
215
 
216
216
  @api.schedules_cancel(schedule_id)
217
217
 
218
218
  true
219
219
  end
220
220
 
221
+ def projects_get
222
+ IronCore::Logger.debug 'IronWorkerNG', "Calling projects.get"
223
+
224
+ res =@api.projects_get
225
+
226
+ OpenStruct.new(res)
227
+ end
228
+
221
229
  def params_for_legacy(code_name, params)
222
230
  if params.class == String
223
231
  params = JSON.parse(params)
224
232
  end
225
233
 
226
234
  attrs = {}
227
-
235
+
228
236
  params.keys.each do |k|
229
237
  attrs['@' + k.to_s] = params[k]
230
238
  end
@@ -70,7 +70,7 @@ module IronWorkerNG
70
70
  src, clean = IronWorkerNG::Fetcher.fetch(wfile)
71
71
 
72
72
  unless src.nil?
73
- IronCore::Logger.info 'IronWorkerNG', "Using workerfile #{wfile}"
73
+ IronCore::Logger.info 'IronWorkerNG', "Using workerfile '#{wfile}'"
74
74
 
75
75
  eval(src)
76
76
 
@@ -10,7 +10,7 @@ module IronWorkerNG
10
10
 
11
11
  def runtime_run_code
12
12
  classpath_array = []
13
-
13
+
14
14
  @features.each do |f|
15
15
  if f.respond_to?(:code_for_classpath)
16
16
  classpath_array << f.send(:code_for_classpath)
@@ -20,7 +20,7 @@ module IronWorkerNG
20
20
  classpath = classpath_array.join(':')
21
21
 
22
22
  IronCore::Logger.info 'IronWorkerNG', "Collected '#{classpath}' classpath"
23
-
23
+
24
24
  <<RUN_CODE
25
25
  java -cp #{classpath} #{@exec.klass.nil? ? "-jar #{File.basename(@exec.path)}" : @exec.klass} "$@"
26
26
  RUN_CODE
@@ -12,8 +12,8 @@ module IronWorkerNG
12
12
  <?php
13
13
  /* #{IronWorkerNG.full_version} */
14
14
 
15
- function getArgs() {
16
- global $argv;
15
+ function getArgs() {
16
+ global $argv;
17
17
 
18
18
  $args = array('task_id' => null, 'dir' => null, 'payload' => array());
19
19
 
@@ -24,7 +24,7 @@ module IronWorkerNG
24
24
 
25
25
  module InstanceMethods
26
26
  def merge_exec(path=nil)
27
- @exec ||= nil
27
+ @exec ||= nil
28
28
 
29
29
  return @exec unless path
30
30
 
@@ -24,7 +24,7 @@ module IronWorkerNG
24
24
 
25
25
  module InstanceMethods
26
26
  def merge_exec(path=nil)
27
- @exec ||= nil
27
+ @exec ||= nil
28
28
 
29
29
  return @exec unless path
30
30
 
@@ -30,7 +30,7 @@ module IronWorkerNG
30
30
 
31
31
  module InstanceMethods
32
32
  def merge_exec(path = nil, klass = nil)
33
- @exec ||= nil
33
+ @exec ||= nil
34
34
 
35
35
  return @exec unless path
36
36
 
@@ -24,7 +24,7 @@ module IronWorkerNG
24
24
 
25
25
  module InstanceMethods
26
26
  def merge_exec(path=nil)
27
- @exec ||= nil
27
+ @exec ||= nil
28
28
 
29
29
  return @exec unless path
30
30
 
@@ -24,7 +24,7 @@ module IronWorkerNG
24
24
 
25
25
  module InstanceMethods
26
26
  def merge_exec(path=nil)
27
- @exec ||= nil
27
+ @exec ||= nil
28
28
 
29
29
  return @exec unless path
30
30
 
@@ -24,7 +24,7 @@ module IronWorkerNG
24
24
 
25
25
  module InstanceMethods
26
26
  def merge_exec(path=nil)
27
- @exec ||= nil
27
+ @exec ||= nil
28
28
 
29
29
  return @exec unless path
30
30
 
@@ -24,7 +24,7 @@ module IronWorkerNG
24
24
 
25
25
  module InstanceMethods
26
26
  def merge_exec(path=nil)
27
- @exec ||= nil
27
+ @exec ||= nil
28
28
 
29
29
  return @exec unless path
30
30
 
@@ -24,7 +24,7 @@ module IronWorkerNG
24
24
 
25
25
  module InstanceMethods
26
26
  def merge_exec(path=nil)
27
- @exec ||= nil
27
+ @exec ||= nil
28
28
 
29
29
  return @exec unless path
30
30
 
@@ -26,7 +26,7 @@ module IronWorkerNG
26
26
 
27
27
  module InstanceMethods
28
28
  def merge_exec(path = nil, klass = nil)
29
- @exec ||= nil
29
+ @exec ||= nil
30
30
 
31
31
  return @exec unless path
32
32
 
@@ -24,7 +24,7 @@ module IronWorkerNG
24
24
  def gem_path
25
25
  path = @spec.full_gem_path
26
26
 
27
- # bundler fix
27
+ # bundler fix
28
28
 
29
29
  ['/gems/' + @spec.full_name, '/gems'].each do |bad_part|
30
30
  path.gsub!(bad_part + bad_part, bad_part)
@@ -25,7 +25,7 @@ module IronWorkerNG
25
25
  tmp_dir_name = Dir.tmpdir + '/' + Dir::Tmpname.make_tmpname("iron-worker-ng-", "http")
26
26
 
27
27
  Dir.mkdir(tmp_dir_name)
28
-
28
+
29
29
  File.open(tmp_dir_name + '/' + File.basename(url), 'wb') do |f|
30
30
  f.write(response.body)
31
31
  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.8.3
4
+ version: 0.8.4
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-07-12 00:00:00.000000000 Z
13
+ date: 2012-07-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: iron_core
@@ -147,8 +147,6 @@ files:
147
147
  - lib/iron_worker_ng/feature/ruby/merge_gemfile.rb
148
148
  - lib/iron_worker_ng/fetcher.rb
149
149
  - lib/iron_worker_ng/version.rb
150
- - ng_tests_worker.rb
151
- - remote_test.rb
152
150
  homepage: https://github.com/iron-io/iron_worker_ruby_ng
153
151
  licenses: []
154
152
  post_install_message:
@@ -163,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
161
  version: '0'
164
162
  segments:
165
163
  - 0
166
- hash: 377459699
164
+ hash: -427365489
167
165
  required_rubygems_version: !ruby/object:Gem::Requirement
168
166
  none: false
169
167
  requirements:
data/ng_tests_worker.rb DELETED
@@ -1,5 +0,0 @@
1
- Dir.chdir 'iwng'
2
- cmd = 'rake -f test/Rakefile test ' + params[:args]
3
- puts cmd
4
- STDOUT.flush
5
- exec cmd
data/remote_test.rb DELETED
@@ -1,45 +0,0 @@
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
- require_relative 'test/iron_io_config.rb'
17
-
18
- client = IronWorkerNG::Client.new
19
-
20
- code = IronWorkerNG::Code.new do
21
- runtime 'ruby'
22
-
23
- exec 'ng_tests_worker.rb'
24
- gemfile 'Gemfile'
25
- gemfile 'test/Gemfile'
26
-
27
- Dir.glob('*').each do |p|
28
- dir p, 'iwng' if File.directory? p
29
- file p, 'iwng' if File.file? p
30
- end
31
-
32
- iron_io_config 'iwng'
33
- end
34
-
35
- puts client.codes.create(code)
36
-
37
- puts code.create_zip
38
-
39
- task = client.tasks.create 'NgTestsWorker', args: $*.join(' ')
40
-
41
- client.tasks.wait_for task.id
42
-
43
- puts '-' * 80
44
-
45
- puts client.tasks.log(task.id)