deputy 0.1.24 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.24
1
+ 0.1.25
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{deputy}
8
- s.version = "0.1.24"
8
+ s.version = "0.1.25"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
@@ -114,8 +114,10 @@ module Deputy
114
114
  end
115
115
 
116
116
  def self.send_report(metric, value)
117
- raise "Use with dot e.g. Mysql.status" if metric.split('.',2).size != 2
118
- get "/report/#{CGI.escape metric}?value=#{CGI.escape value.to_s}"
117
+ # TODO sheriff does not accept anything else, fix it...
118
+ metric = metric.split('.',2)
119
+ metric = metric.map{|m| m.gsub(/[^-_a-zA-Z]/, '_') } * '.'
120
+ get "/report/#{metric}?value=#{CGI.escape value.to_s}"
119
121
  end
120
122
 
121
123
  def self.get(path)
@@ -155,5 +155,11 @@ describe Deputy do
155
155
  FakeWeb.register_uri(:get, "http://sheri.ff/report/Xxx.yyy?value=123", :body => 'OK')
156
156
  Deputy.send_report('Xxx.yyy', '123').should == 'OK'
157
157
  end
158
+
159
+ it "escapes metric names" do
160
+ Deputy.stub!(:sheriff_url).and_return 'http://sheri.ff'
161
+ FakeWeb.register_uri(:get, "http://sheri.ff/report/X_xx.yy___y?value=123", :body => 'OK')
162
+ Deputy.send_report('X/xx.yy/./y', '123').should == 'OK'
163
+ end
158
164
  end
159
165
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 24
9
- version: 0.1.24
8
+ - 25
9
+ version: 0.1.25
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Grosser