iron_worker 2.3.13 → 2.3.14
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README.markdown +3 -6
- data/VERSION.yml +1 -1
- data/lib/iron_worker/base.rb +9 -2
- data/lib/iron_worker/config.rb +3 -3
- data/lib/iron_worker/service.rb +19 -4
- metadata +61 -19
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012, Iron.io, Inc. All rights reserved.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
4
|
+
modification, are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
* Redistributions of source code must retain the above copyright notice,
|
7
|
+
this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
this list of conditions and the following disclaimer in the documentation
|
10
|
+
and/or other materials provided with the distribution.
|
11
|
+
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
13
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
14
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
15
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
16
|
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
17
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
18
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
19
|
+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
20
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
21
|
+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
22
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.markdown
CHANGED
@@ -63,10 +63,7 @@ This will send it off to the IronWorker cloud.
|
|
63
63
|
Full Documentation
|
64
64
|
-----------------
|
65
65
|
|
66
|
-
Now that you've got your first worker running, be sure to [check out the full documentation](
|
67
|
-
IronWorker can do so much more!
|
66
|
+
Now that you've got your first worker running, be sure to [check out the full documentation](https://github.com/iron-io/iron_worker_ruby/wiki).
|
67
|
+
IronWorker can do so much more!
|
68
68
|
|
69
|
-
|
70
|
-
----------------------
|
71
|
-
|
72
|
-
Join the discussion group at: https://groups.google.com/forum/#!forum/ironworker-users
|
69
|
+
And check out the [Iron.io Dev Center](http://dev.iron.io) for full IronWorker API documentation and and support for other languages.
|
data/VERSION.yml
CHANGED
data/lib/iron_worker/base.rb
CHANGED
@@ -70,9 +70,11 @@ module IronWorker
|
|
70
70
|
f2 = IronWorker::MergeHelper.check_for_file(mailer, @caller_file)
|
71
71
|
basename = File.basename(mailer, f2[:extname])
|
72
72
|
path_to_templates = params[:path_to_templates] || File.join(Rails.root, "app/views/#{basename}")
|
73
|
-
|
73
|
+
path_to_layouts = params[:path_to_layouts] || File.join(Rails.root, "app/views/layouts")
|
74
|
+
@merged_mailers[basename] = {:name => basename, :path_to_templates => path_to_templates, :path_to_layouts => path_to_layouts, :filename => f2[:path]}.merge!(params)
|
74
75
|
end
|
75
76
|
|
77
|
+
|
76
78
|
def merge_folder(path)
|
77
79
|
files = []
|
78
80
|
#puts "caller_file=" + caller_file
|
@@ -261,7 +263,12 @@ module IronWorker
|
|
261
263
|
# todo: add a :timeout option
|
262
264
|
def wait_until_complete
|
263
265
|
check_service
|
264
|
-
|
266
|
+
raise "No ID for worker!" if self.task_id.nil? && self.schedule_id.nil?
|
267
|
+
IronWorker.service.wait_until_complete(self.task_id || self.schedule_id, :schedule=>is_schedule?)
|
268
|
+
end
|
269
|
+
|
270
|
+
def is_schedule?
|
271
|
+
!self.schedule_id.nil?
|
265
272
|
end
|
266
273
|
|
267
274
|
def upload
|
data/lib/iron_worker/config.rb
CHANGED
@@ -28,7 +28,7 @@ module IronWorker
|
|
28
28
|
:unmerged,
|
29
29
|
:merged_gems,
|
30
30
|
:unmerged_gems,
|
31
|
-
:force_upload,
|
31
|
+
:force_upload, :no_upload,
|
32
32
|
:beta, # for setting beta feature flags
|
33
33
|
:skip_auto_dependencies
|
34
34
|
|
@@ -88,7 +88,7 @@ module IronWorker
|
|
88
88
|
c2.models = models
|
89
89
|
models.each { |model| c2.merge(model) }
|
90
90
|
mailers_path = File.join(Rails.root, 'app/mailers/*.rb')
|
91
|
-
Dir.glob(mailers_path).collect { |m| c2.mailers[File.basename(m)] = {:filename=>m, :name => File.basename(m), :path_to_templates=>File.join(Rails.root, "app/views/#{File.basename(m, File.extname(m))}")} }
|
91
|
+
Dir.glob(mailers_path).collect { |m| c2.mailers[File.basename(m)] = {:filename=>m, :name => File.basename(m), :path_to_layouts => File.join(Rails.root, "app/views/layouts"), :path_to_templates=>File.join(Rails.root, "app/views/#{File.basename(m, File.extname(m))}")} }
|
92
92
|
c2.extra_requires += ['active_support/core_ext', 'action_mailer']
|
93
93
|
#puts 'DB FILE=' + File.join(Rails.root, 'config', 'database.yml').to_s
|
94
94
|
if defined?(ActiveRecord) && File.exist?(File.join(Rails.root, 'config', 'database.yml'))
|
@@ -241,7 +241,7 @@ module IronWorker
|
|
241
241
|
# try relative
|
242
242
|
# p caller
|
243
243
|
f2 = File.join(File.dirname(callerr), f)
|
244
|
-
puts 'f2=' + f2
|
244
|
+
#puts 'f2=' + f2
|
245
245
|
if File.exist? f2
|
246
246
|
exists = true
|
247
247
|
f = f2
|
data/lib/iron_worker/service.rb
CHANGED
@@ -25,7 +25,7 @@ module IronWorker
|
|
25
25
|
options[:logger] = IronWorker.logger
|
26
26
|
super("worker-aws-us-east-1.iron.io", token, options)
|
27
27
|
self.host = self.config.host if self.config && self.config.host
|
28
|
-
# automerge simple worker gem and
|
28
|
+
# automerge simple worker gem and dependencies
|
29
29
|
self.config.merge_gem('zip')
|
30
30
|
self.config.merge_gem('rest-client')
|
31
31
|
self.config.merge_gem('rest')
|
@@ -38,6 +38,10 @@ module IronWorker
|
|
38
38
|
# - :callback_url
|
39
39
|
# - :merge => array of files to merge in with this file
|
40
40
|
def upload(filename, class_name, options={})
|
41
|
+
if self.config.no_upload
|
42
|
+
IronWorker.logger.debug 'NO UPLOAD!'
|
43
|
+
return
|
44
|
+
end
|
41
45
|
name = options[:name] || class_name
|
42
46
|
project_id = get_project_id(options)
|
43
47
|
tmp = Dir.tmpdir()
|
@@ -401,6 +405,11 @@ end
|
|
401
405
|
zdest = "templates/#{mailer[:name]}/#{file.sub(path+'/', '')}"
|
402
406
|
f.add(zdest, file)
|
403
407
|
end
|
408
|
+
path = mailer[:path_to_layouts]
|
409
|
+
Dir["#{path}/**/**"].each do |file|
|
410
|
+
zdest = "templates/layouts/#{file.sub(path+'/', '')}"
|
411
|
+
f.add(zdest, file)
|
412
|
+
end
|
404
413
|
end
|
405
414
|
end
|
406
415
|
end
|
@@ -450,10 +459,16 @@ end
|
|
450
459
|
status = nil
|
451
460
|
sleep 1
|
452
461
|
while tries < 100
|
453
|
-
status = status(task_id)
|
462
|
+
status = options[:schedule] ? schedule_status(task_id) : status(task_id)
|
454
463
|
puts "Waiting... status=" + status["status"]
|
455
|
-
if
|
456
|
-
|
464
|
+
if options[:schedule]
|
465
|
+
if status["status"] == "complete"
|
466
|
+
break
|
467
|
+
end
|
468
|
+
else
|
469
|
+
if status["status"] != "queued" && status["status"] != "running"
|
470
|
+
break
|
471
|
+
end
|
457
472
|
end
|
458
473
|
sleep 2
|
459
474
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: zip
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rest-client
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rest
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: bundler
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: zip
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: rest-client
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :runtime
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: rest
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ! '>='
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: '0'
|
88
118
|
type: :runtime
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: bundler
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ! '>='
|
@@ -98,12 +133,18 @@ dependencies:
|
|
98
133
|
version: '0'
|
99
134
|
type: :runtime
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
102
142
|
description: The official IronWorker gem for IronWorker by Iron.io. http://www.iron.io
|
103
143
|
email: travis@iron.io
|
104
144
|
executables: []
|
105
145
|
extensions: []
|
106
146
|
extra_rdoc_files:
|
147
|
+
- LICENSE
|
107
148
|
- README.markdown
|
108
149
|
files:
|
109
150
|
- VERSION.yml
|
@@ -120,6 +161,7 @@ files:
|
|
120
161
|
- lib/iron_worker/used_in_worker.rb
|
121
162
|
- lib/iron_worker/utils.rb
|
122
163
|
- rails/init.rb
|
164
|
+
- LICENSE
|
123
165
|
- README.markdown
|
124
166
|
homepage: http://www.iron.io
|
125
167
|
licenses: []
|
@@ -141,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
183
|
version: '0'
|
142
184
|
requirements: []
|
143
185
|
rubyforge_project:
|
144
|
-
rubygems_version: 1.8.
|
186
|
+
rubygems_version: 1.8.21
|
145
187
|
signing_key:
|
146
188
|
specification_version: 3
|
147
189
|
summary: The official IronWorker gem for IronWorker by Iron.io. http://www.iron.io
|