vayacondios-client 0.0.11 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,10 @@
1
1
  class Vayacondios
2
2
  class HttpClient
3
- include Gorillib::Builder
3
+ include Gorillib::Model
4
4
 
5
- field :host, String, :default => 'localhost'
6
- field :port, Integer, :default => 8000
7
- field :organization, String, :default => 'infochimps'
5
+ field :host, String, :default => 'localhost'
6
+ field :port, String, :default => '8000'
7
+ field :organization, String, :default => 'infochimps'
8
8
 
9
9
  class Error < StandardError; end
10
10
 
@@ -20,6 +20,11 @@ class Vayacondios
20
20
  end
21
21
  end
22
22
 
23
+ class NullNotifier < Notifier
24
+ def notify topic, cargo={}
25
+ end
26
+ end
27
+
23
28
  class LogNotifier < Notifier
24
29
 
25
30
  def initialize(options = {})
@@ -53,27 +58,36 @@ class Vayacondios
53
58
  def self.receive(attrs = {})
54
59
  type = attrs.delete(:type)
55
60
  case type
56
- when 'http' then HttpNotifier.new(attrs)
57
- when 'log' then LogNotifier.new(attrs)
61
+ when 'http' then HttpNotifier.new(attrs)
62
+ when 'log' then LogNotifier.new(attrs)
63
+ when 'none','null' then NullNotifier.new(attrs)
58
64
  else
59
65
  raise ArgumentError, "<#{type}> is not a valid build option"
60
66
  end
61
67
  end
62
68
  end
63
69
 
64
- def self.default_notifier() NotifierFactory.receive(type: 'http') ; end
70
+ def self.default_notifier(log = nil) NotifierFactory.receive(type: 'log', log: log) ; end
65
71
 
66
72
  module Notifications
67
- extend Gorillib::Concern
68
- include Gorillib::Configurable
69
73
 
70
74
  def notify(topic, cargo = {})
71
75
  notifier.notify(topic, cargo)
72
76
  end
73
77
 
74
- included do
75
- class_eval do
76
- config(:notifier, Vayacondios::NotifierFactory, default: Vayacondios.default_notifier)
78
+ def self.included klass
79
+ if klass.ancestors.include? Gorillib::Model
80
+ klass.class_eval do
81
+ field :notifier, Vayacondios::NotifierFactory, default: Vayacondios.default_notifier
82
+
83
+ def receive_notifier params
84
+ params.merge!(log: try(:log)) if params[:type] == 'log'
85
+ @notifier = Vayacondios::NotifierFactory.receive(params)
86
+ end
87
+ end
88
+ else
89
+ klass.class_attribute :notifier
90
+ klass.notifier = Vayacondios.default_notifier try(:log)
77
91
  end
78
92
  end
79
93
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vayacondios-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,11 +12,11 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-09-24 00:00:00.000000000 Z
15
+ date: 2012-12-05 00:00:00.000000000Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: configliere
19
- requirement: &70096037720540 !ruby/object:Gem::Requirement
19
+ requirement: &2165992860 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: 0.4.16
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70096037720540
27
+ version_requirements: *2165992860
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: multi_json
30
- requirement: &70096037720020 !ruby/object:Gem::Requirement
30
+ requirement: &2165991540 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ~>
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: '1.1'
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *70096037720020
38
+ version_requirements: *2165991540
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: gorillib
41
- requirement: &70096037719500 !ruby/object:Gem::Requirement
41
+ requirement: &2165990440 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ~>
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: 0.4.2
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *70096037719500
49
+ version_requirements: *2165990440
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rake
52
- requirement: &70096037719080 !ruby/object:Gem::Requirement
52
+ requirement: &2165989840 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ! '>='
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: '0'
58
58
  type: :development
59
59
  prerelease: false
60
- version_requirements: *70096037719080
60
+ version_requirements: *2165989840
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: yard
63
- requirement: &70096037718540 !ruby/object:Gem::Requirement
63
+ requirement: &2165988960 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ! '>='
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: '0.7'
69
69
  type: :development
70
70
  prerelease: false
71
- version_requirements: *70096037718540
71
+ version_requirements: *2165988960
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: rspec
74
- requirement: &70096037718020 !ruby/object:Gem::Requirement
74
+ requirement: &2165988040 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ! '>='
@@ -79,7 +79,7 @@ dependencies:
79
79
  version: '2.8'
80
80
  type: :development
81
81
  prerelease: false
82
- version_requirements: *70096037718020
82
+ version_requirements: *2165988040
83
83
  description: Simple enough to use in a shell script, performant enough to use everywhere.
84
84
  Dios mío! Record that metric, ese!
85
85
  email:
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: -1084220644018223161
111
+ hash: -4324806093736775033
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
@@ -117,10 +117,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  segments:
119
119
  - 0
120
- hash: -1084220644018223161
120
+ hash: -4324806093736775033
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 1.8.11
123
+ rubygems_version: 1.8.15
124
124
  signing_key:
125
125
  specification_version: 3
126
126
  summary: Data goes in. The right thing happens