carnivore 0.2.4 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ac834556d9171f25bda0fe15e7806a2f4f9dc9a7
4
+ data.tar.gz: 32e70f3f0d5ef57add22d7bf7f09f2a5cdb634f4
5
+ SHA512:
6
+ metadata.gz: bab0685d6d936f9daa7f37814c2bbccb2760028ed4a347a4f855af4d1efe23ae9ba10f137024ea812444a053856e4f31a457839c6092448be387791aab5883b0
7
+ data.tar.gz: 7b822a61b2eb8370c8626c242e55713eb2946a365bdd2b0e46090171ce4d324f2b433a951f51f1379a4e95ad0694889383595df5a0bec950e086ab619e6ef4d7
@@ -1,3 +1,7 @@
1
+ # v0.2.6
2
+ * Provide arguments method alias for sources (#args)
3
+ * Allow configuration via directory and file merge
4
+
1
5
  # v0.2.4
2
6
  * Move receive starts out of processing loop
3
7
  * Extract source name from arguments on setup
@@ -40,7 +40,23 @@ module Carnivore
40
40
  if(path_or_hash.is_a?(Hash))
41
41
  conf = path_or_hash
42
42
  else
43
- if(File.exists?(path_or_hash.to_s))
43
+ if(File.directory?(path_or_hash.to_s))
44
+ files = Dir.new(path_or_hash.to_s).find_all do |f|
45
+ File.extname(f) == '.json'
46
+ end.sort
47
+ conf = files.inject(Smash.new) do |memo, path|
48
+ memo.deep_merge!(
49
+ MultiJson.load(
50
+ File.read(
51
+ File.join(
52
+ path_or_hash.to_s, path
53
+ )
54
+ )
55
+ ).to_smash
56
+ )
57
+ end
58
+ self.config_path = path_or_hash
59
+ elsif(File.exists?(path_or_hash.to_s))
44
60
  conf = JSON.load(File.read(path_or_hash))
45
61
  self.config_path = path_or_hash
46
62
  else
@@ -127,6 +127,9 @@ module Carnivore
127
127
  # @return [Hash] original options hash
128
128
  attr_reader :arguments
129
129
 
130
+ # @note this is just a compat method for older sources
131
+ alias_method :args, :arguments
132
+
130
133
  # Create new Source
131
134
  #
132
135
  # @param args [Hash]
@@ -23,7 +23,11 @@ end
23
23
  # @param name [String, Symbol] fetch wait time from environment variable
24
24
  # @return [Numeric] seconds sleeping
25
25
  def source_wait(name='wait')
26
- total = ENV.fetch("CARNIVORE_SOURCE_#{name.to_s.upcase}", 1.0).to_f
26
+ if(name.is_a?(String) || name.is_a?(Symbol))
27
+ total = ENV.fetch("CARNIVORE_SOURCE_#{name.to_s.upcase}", 1.0).to_f
28
+ else
29
+ total = name.to_f
30
+ end
27
31
  if(block_given?)
28
32
  elapsed = 0.0
29
33
  until(yield || elapsed >= total)
@@ -1,7 +1,4 @@
1
1
  module Carnivore
2
- # Versioning class for library
3
- class Version < Gem::Version
4
- end
5
2
  # Current version of library
6
- VERSION = Version.new('0.2.4')
3
+ VERSION = Gem::Version.new('0.2.6')
7
4
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carnivore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
5
- prerelease:
4
+ version: 0.2.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Chris Roberts
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-06-18 00:00:00.000000000 Z
11
+ date: 2014-08-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: celluloid
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: mixlib-config
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: multi_json
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: hashie
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Message processing helper
@@ -81,51 +72,50 @@ executables: []
81
72
  extensions: []
82
73
  extra_rdoc_files: []
83
74
  files:
75
+ - CHANGELOG.md
76
+ - README.md
77
+ - carnivore.gemspec
78
+ - lib/carnivore.rb
84
79
  - lib/carnivore/callback.rb
80
+ - lib/carnivore/config.rb
81
+ - lib/carnivore/container.rb
85
82
  - lib/carnivore/errors.rb
86
- - lib/carnivore/supervisor.rb
87
- - lib/carnivore/source/test.rb
88
- - lib/carnivore/source.rb
89
- - lib/carnivore/version.rb
83
+ - lib/carnivore/message.rb
90
84
  - lib/carnivore/runner.rb
85
+ - lib/carnivore/source.rb
86
+ - lib/carnivore/source/test.rb
87
+ - lib/carnivore/source_container.rb
91
88
  - lib/carnivore/spec_helper.rb
92
- - lib/carnivore/utils/message_registry.rb
93
- - lib/carnivore/utils/smash.rb
89
+ - lib/carnivore/supervisor.rb
90
+ - lib/carnivore/utils.rb
94
91
  - lib/carnivore/utils/logging.rb
92
+ - lib/carnivore/utils/message_registry.rb
95
93
  - lib/carnivore/utils/params.rb
96
- - lib/carnivore/config.rb
97
- - lib/carnivore/message.rb
98
- - lib/carnivore/source_container.rb
99
- - lib/carnivore/utils.rb
100
- - lib/carnivore/container.rb
101
- - lib/carnivore.rb
102
- - carnivore.gemspec
103
- - README.md
104
- - CHANGELOG.md
94
+ - lib/carnivore/utils/smash.rb
95
+ - lib/carnivore/version.rb
105
96
  homepage: https://github.com/carnivore-rb/carnivore
106
97
  licenses:
107
98
  - Apache 2.0
99
+ metadata: {}
108
100
  post_install_message:
109
101
  rdoc_options: []
110
102
  require_paths:
111
103
  - lib
112
104
  required_ruby_version: !ruby/object:Gem::Requirement
113
- none: false
114
105
  requirements:
115
- - - ! '>='
106
+ - - ">="
116
107
  - !ruby/object:Gem::Version
117
108
  version: '0'
118
109
  required_rubygems_version: !ruby/object:Gem::Requirement
119
- none: false
120
110
  requirements:
121
- - - ! '>='
111
+ - - ">="
122
112
  - !ruby/object:Gem::Version
123
113
  version: '0'
124
114
  requirements: []
125
115
  rubyforge_project:
126
- rubygems_version: 1.8.24
116
+ rubygems_version: 2.2.2
127
117
  signing_key:
128
- specification_version: 3
118
+ specification_version: 4
129
119
  summary: Message processing helper
130
120
  test_files: []
131
121
  has_rdoc: