graphite_builder 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1 @@
1
+ rvm: 1.9.2
data/Gemfile CHANGED
@@ -5,9 +5,11 @@ source "http://rubygems.org"
5
5
 
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
- group :development do
8
+ group :test do
9
9
  gem "minitest", ">= 0"
10
- gem "bundler", "~> 1.1.rc"
10
+ end
11
+
12
+ group :development do
11
13
  gem "jeweler", "~> 1.6.4"
12
14
  gem "rcov", ">= 0"
13
15
  end
data/Gemfile.lock CHANGED
@@ -6,15 +6,14 @@ GEM
6
6
  bundler (~> 1.0)
7
7
  git (>= 1.2.5)
8
8
  rake
9
- minitest (2.6.1)
10
- rake (0.9.2)
11
- rcov (0.9.10)
9
+ minitest (2.8.1)
10
+ rake (0.9.2.2)
11
+ rcov (0.9.11)
12
12
 
13
13
  PLATFORMS
14
14
  ruby
15
15
 
16
16
  DEPENDENCIES
17
- bundler (~> 1.1.rc)
18
17
  jeweler (~> 1.6.4)
19
18
  minitest
20
19
  rcov
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "graphite_builder"
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Edward Muller"]
12
- s.date = "2011-11-18"
12
+ s.date = "2013-01-16"
13
13
  s.description = "A DSL for generating graphite graph urls. Meant to enable copy-and-paste from the graphite UI + simple substitution."
14
14
  s.email = "edward@heroku.com"
15
15
  s.extra_rdoc_files = [
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
+ ".travis.yml",
21
22
  "Gemfile",
22
23
  "Gemfile.lock",
23
24
  "LICENSE.txt",
@@ -32,26 +33,20 @@ Gem::Specification.new do |s|
32
33
  s.homepage = "http://github.com/freeformz/graphite_builder"
33
34
  s.licenses = ["MIT"]
34
35
  s.require_paths = ["lib"]
35
- s.rubygems_version = "1.8.10"
36
+ s.rubygems_version = "1.8.23"
36
37
  s.summary = "A DSL: for generating graphite graph urls."
37
38
 
38
39
  if s.respond_to? :specification_version then
39
40
  s.specification_version = 3
40
41
 
41
42
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
- s.add_development_dependency(%q<minitest>, [">= 0"])
43
- s.add_development_dependency(%q<bundler>, ["~> 1.1.rc"])
44
43
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
45
44
  s.add_development_dependency(%q<rcov>, [">= 0"])
46
45
  else
47
- s.add_dependency(%q<minitest>, [">= 0"])
48
- s.add_dependency(%q<bundler>, ["~> 1.1.rc"])
49
46
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
50
47
  s.add_dependency(%q<rcov>, [">= 0"])
51
48
  end
52
49
  else
53
- s.add_dependency(%q<minitest>, [">= 0"])
54
- s.add_dependency(%q<bundler>, ["~> 1.1.rc"])
55
50
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
56
51
  s.add_dependency(%q<rcov>, [">= 0"])
57
52
  end
@@ -29,6 +29,10 @@ module Graphite
29
29
  @targets << value
30
30
  end
31
31
 
32
+ def format(value)
33
+ @args[:format] = value
34
+ end
35
+
32
36
  def sumSeries(*args)
33
37
  array_argument_wrapper('sumSeries', args)
34
38
  end
@@ -61,17 +65,20 @@ module Graphite
61
65
  def render
62
66
  raise ::Graphite::Builder::NoTargetsDefined.new if @targets.empty?
63
67
  '<img ' <<
64
- (@args.has_key?(:height) ? "height=\"#{@args[:height]}\" " : '') <<
65
- (@args.has_key?(:width) ? "width=\"#{@args[:width]}\" " : '') <<
66
- 'src="' <<
67
- @args.delete(:base_url) << '?' <<
68
- (@args.map do |k ,v|
69
- if v.is_a?(Array)
70
- v.map { |item| url_param(k, item) }.join("&")
71
- else
72
- url_param(k, v)
73
- end
74
- end + @targets.map {|target| "target=#{target}" }).join('&') << '"/>'
68
+ (@args.has_key?(:height) ? "height=\"#{@args[:height]}\" " : '') <<
69
+ (@args.has_key?(:width) ? "width=\"#{@args[:width]}\" " : '') <<
70
+ 'src="' <<
71
+ @args.delete(:base_url) <<
72
+ '?' <<
73
+ (@args.map do |k ,v|
74
+ if v.is_a?(Array)
75
+ v.map { |item| url_param(k, item) }.join("&")
76
+ else
77
+ url_param(k, v)
78
+ end
79
+ end <<
80
+ @targets.map {|target| "target=#{target}" }).join('&') <<
81
+ '"/>'
75
82
  end
76
83
 
77
84
  private
@@ -16,6 +16,15 @@ describe Graphite::Builder do
16
16
  end
17
17
  end
18
18
 
19
+ describe 'when a format is defined' do
20
+ it 'should render the correct <img/> tag' do
21
+ Graphite::Builder.new(base_url: 'http://localhost/render') do
22
+ target :bar
23
+ format :svg
24
+ end.render.must_equal '<img src="http://localhost/render?format=svg&target=bar"/>'
25
+ end
26
+ end
27
+
19
28
  describe 'when a target is defined' do
20
29
 
21
30
  describe 'whithout using data' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphite_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,44 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-18 00:00:00.000000000Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: minitest
16
- requirement: &70132731132300 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: *70132731132300
25
- - !ruby/object:Gem::Dependency
26
- name: bundler
27
- requirement: &70132731131460 !ruby/object:Gem::Requirement
15
+ name: jeweler
16
+ requirement: !ruby/object:Gem::Requirement
28
17
  none: false
29
18
  requirements:
30
19
  - - ~>
31
20
  - !ruby/object:Gem::Version
32
- version: 1.1.rc
21
+ version: 1.6.4
33
22
  type: :development
34
23
  prerelease: false
35
- version_requirements: *70132731131460
36
- - !ruby/object:Gem::Dependency
37
- name: jeweler
38
- requirement: &70132731105220 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
39
25
  none: false
40
26
  requirements:
41
27
  - - ~>
42
28
  - !ruby/object:Gem::Version
43
29
  version: 1.6.4
44
- type: :development
45
- prerelease: false
46
- version_requirements: *70132731105220
47
30
  - !ruby/object:Gem::Dependency
48
31
  name: rcov
49
- requirement: &70132731096200 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
50
33
  none: false
51
34
  requirements:
52
35
  - - ! '>='
@@ -54,7 +37,12 @@ dependencies:
54
37
  version: '0'
55
38
  type: :development
56
39
  prerelease: false
57
- version_requirements: *70132731096200
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
58
46
  description: A DSL for generating graphite graph urls. Meant to enable copy-and-paste
59
47
  from the graphite UI + simple substitution.
60
48
  email: edward@heroku.com
@@ -65,6 +53,7 @@ extra_rdoc_files:
65
53
  - README.rdoc
66
54
  files:
67
55
  - .document
56
+ - .travis.yml
68
57
  - Gemfile
69
58
  - Gemfile.lock
70
59
  - LICENSE.txt
@@ -90,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
79
  version: '0'
91
80
  segments:
92
81
  - 0
93
- hash: -854690039685430798
82
+ hash: -3379704314844363115
94
83
  required_rubygems_version: !ruby/object:Gem::Requirement
95
84
  none: false
96
85
  requirements:
@@ -99,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
88
  version: '0'
100
89
  requirements: []
101
90
  rubyforge_project:
102
- rubygems_version: 1.8.10
91
+ rubygems_version: 1.8.23
103
92
  signing_key:
104
93
  specification_version: 3
105
94
  summary: ! 'A DSL: for generating graphite graph urls.'