iron_worker_ng 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.3.0
@@ -1,6 +1,7 @@
1
1
  require 'rest-client'
2
2
  require 'rest'
3
3
  require 'json'
4
+ require 'yaml'
4
5
  require 'time'
5
6
 
6
7
  require_relative 'api_client_error'
@@ -19,7 +20,33 @@ module IronWorkerNG
19
20
 
20
21
  def initialize(options = {})
21
22
  @token = options[:token] || options['token']
23
+ @token ||= ENV['IRON_IO_TOKEN']
24
+ @token ||= ENV['IRON_TOKEN']
25
+
22
26
  @project_id = options[:project_id] || options['project_id']
27
+ @project_id ||= ENV['IRON_IO_PROJECT_ID']
28
+ @project_id ||= ENV['IRON_PROJECT_ID']
29
+
30
+ if @token.nil? || @project_id.nil?
31
+ [ENV['IRON_IO_CONFIG'], ENV['IRON_IO_CONFIG_FILE'], ENV['IRON_CONFIG'], ENV['IRON_CONFIG_FILE'], '~/.iron', '/etc/iron.conf'].each do |config_file|
32
+ if (not config_file.nil?) && File.exists?(File.expand_path(config_file))
33
+ config = YAML.load_file(File.expand_path(config_file))
34
+
35
+ unless config['iron_io'].nil?
36
+ @token ||= config['iron_io']['token']
37
+ @project_id ||= config['iron_io']['project_id']
38
+ end
39
+
40
+ unless config['iron'].nil?
41
+ @token ||= config['iron']['token']
42
+ @project_id ||= config['iron']['project_id']
43
+ end
44
+
45
+ @token ||= config['token']
46
+ @project_id ||= config['project_id']
47
+ end
48
+ end
49
+ end
23
50
 
24
51
  if (not @token) || (not @project_id)
25
52
  IronWorkerNG::Logger.error 'Both iron.io token and project_id must be specified'
@@ -42,6 +42,7 @@ $:.unshift("\#{root}")
42
42
  require 'json'
43
43
 
44
44
  @iron_worker_task_id = task_id
45
+ @iron_task_id = task_id
45
46
 
46
47
  @payload = File.read(payload_file)
47
48
 
@@ -52,7 +53,9 @@ rescue
52
53
  end
53
54
 
54
55
  @iron_io_token = parsed_payload['token'] || nil
56
+ @iron_token = @iron_io_token
55
57
  @iron_io_project_id = parsed_payload['project_id'] || nil
58
+ @iron_project_id = @iron_io_project_id
56
59
  @params = parsed_payload['params'] || {}
57
60
 
58
61
  keys = @params.keys
@@ -68,14 +71,26 @@ def iron_worker_task_id
68
71
  @iron_worker_task_id
69
72
  end
70
73
 
74
+ def iron_task_id
75
+ @iron_task_id
76
+ end
77
+
71
78
  def iron_io_token
72
79
  @iron_io_token
73
80
  end
74
81
 
82
+ def iron_token
83
+ @iron_token
84
+ end
85
+
75
86
  def iron_io_project_id
76
87
  @iron_io_project_id
77
88
  end
78
89
 
90
+ def iron_project_id
91
+ @iron_project_id
92
+ end
93
+
79
94
  def params
80
95
  @params
81
96
  end
@@ -46,6 +46,8 @@ module IronWorkerNG
46
46
  @features << @exec
47
47
  end
48
48
 
49
+ alias :merge_worker :merge_exec
50
+
49
51
  def self.included(base)
50
52
  IronWorkerNG::Code::Base.register_feature(:name => 'merge_exec', :for_klass => base, :args => 'PATH[,CLASS]')
51
53
  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.2.7
4
+ version: 0.3.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-04-21 00:00:00.000000000 Z
13
+ date: 2012-04-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: zip
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  segments:
174
174
  - 0
175
- hash: -383095743
175
+ hash: -806070963
176
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  none: false
178
178
  requirements: