iron_worker_ng 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/iron_worker_ng/code/base.rb +23 -11
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
@@ -9,7 +9,6 @@ module IronWorkerNG
9
9
  module Code
10
10
  class Base
11
11
  attr_reader :features
12
- attr_accessor :name
13
12
 
14
13
  @@registered_types = []
15
14
 
@@ -43,28 +42,31 @@ module IronWorkerNG
43
42
  elsif args.length == 1 && args[0].class == Hash
44
43
  @name = args[0][:name] || args[0]['name']
45
44
 
46
- exec = args[0][:exec] || args[0]['exec'] || args[0][:worker] || args[0]['worker']
45
+ exec = args[0][:exec] || args[0]['exec'] ||
46
+ args[0][:worker] || args[0]['worker']
47
47
  merge_exec(exec) unless exec.nil?
48
48
  end
49
49
 
50
- if args.length == 1 && args[0].class == Hash && ((not args[0][:workerfile].nil?) || (not args[0]['workerfile'].nil?))
51
- eval(File.read(File.expand_path(args[0][:workerfile] || args[0]['workerfile'])))
50
+ if args.length == 1 and (opts = args[0]).is_a? Hash and wfile = opts[:workerfile] || opts['workerfile']
51
+ eval(File.read(File.expand_path wfile))
52
52
  end
53
53
 
54
54
  unless @exec.nil?
55
55
  @name ||= guess_name(@exec.path)
56
56
  end
57
57
 
58
- if (not @name.nil?) && File.exists?(@name + '.worker')
59
- eval(File.read(@name + '.worker'))
60
- end
58
+ wfiles = ['Workerfile']
61
59
 
62
- if (not @name.nil?) && File.exists?(@name + '.workerfile')
63
- eval(File.read(@name + '.workerfile'))
60
+ unless @name.nil?
61
+ wfiles << @name + '.worker'
62
+ wfiles << @name + '.workerfile'
64
63
  end
65
64
 
66
- if File.exists?('Workerfile')
67
- eval(File.read('Workerfile'))
65
+ wfiles.each do |wfile|
66
+ if File.exists? wfile
67
+ eval(File.read wfile)
68
+ IronCore::Logger.info 'IronWorkerNG', "Processing workerfile #{wfile}"
69
+ end
68
70
  end
69
71
 
70
72
  unless block.nil?
@@ -76,6 +78,16 @@ module IronWorkerNG
76
78
  end
77
79
  end
78
80
 
81
+ def name(*args)
82
+ @name = args[0] if args.length == 1
83
+
84
+ @name
85
+ end
86
+
87
+ def name=(name)
88
+ @name = name
89
+ end
90
+
79
91
  def guess_name(path)
80
92
  File.basename(path).gsub(/\..*$/, '').capitalize.gsub(/_./) { |x| x[1].upcase }
81
93
  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.2
4
+ version: 0.4.3
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-18 00:00:00.000000000 Z
13
+ date: 2012-05-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: iron_core
@@ -124,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  segments:
126
126
  - 0
127
- hash: -641630419
127
+ hash: -200243437
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements: