copperegg 0.6.0 → 0.6.1.pre

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## 0.6.0.pre (January 3, 2013)
1
+ ## 0.6.0 (January 3, 2013)
2
2
 
3
3
  Changes:
4
4
 
@@ -14,4 +14,10 @@ Features:
14
14
 
15
15
  Bugfixes:
16
16
 
17
- - Metric group versioning is encorporated and recognized.
17
+ - Metric group versioning is encorporated and recognized.
18
+
19
+ ## 0.6.1 (January 14, 2013)
20
+
21
+ Changes:
22
+
23
+ - Existing metric groups are used rather than automatically versioning metric group name upon creation.
data/Gemfile.lock ADDED
@@ -0,0 +1,16 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ copperegg (0.6.0.pre)
5
+ json_pure (~> 1.7.6)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ json_pure (1.7.6)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ copperegg!
data/README.md CHANGED
@@ -55,20 +55,20 @@ metric_group.metrics << {"type"=>"ce_gauge", "name"=>"waiting",
55
55
  metric_group.save
56
56
  ```
57
57
 
58
- If a metric group by the same name already exists, a new one will be created with a "versioned" name. For example:
58
+ If a metric group by the same name already exists, that one will rather than creating a new one. For example:
59
59
 
60
60
  ```ruby
61
61
  metric_group2 = CopperEgg::MetricGroup.new(:name => "my_new_metric_group", :label => "New Group Version 2", :frequency => 60)
62
- metric_group2.metrics << {"type"=>"ce_gauge", "name"=>"active_connections", "unit"=>"Connections"}
63
- metric_group2.save
62
+ metric_group2.metrics << {"type"=>"ce_counter", "name"=>"active_connections", "unit"=>"Connections"}
63
+ metric_group2.save # this will perform an update to change the type of the metric 'active_connections' from 'ce_gauge' to 'ce_counter'
64
64
 
65
65
  metric_group2.name
66
- # => "my_metric_group_v2"
66
+ # => "my_metric_group"
67
67
  ```
68
68
 
69
69
  ### Updating a metric group:
70
70
 
71
- Labels, frequency, and units can be updated and additional metrics can be added. All other changes will be ignored.
71
+ Labels, frequency, metric types and metric units can be updated and additional metrics can be added. Changes to the metric group name or names of metrics within will be ignored.
72
72
 
73
73
  ```ruby
74
74
  metric_group.name = "this_will_be_ignored"
File without changes
@@ -56,6 +56,25 @@ module CopperEgg
56
56
  @error.nil?
57
57
  end
58
58
 
59
+ private
60
+
61
+ def create
62
+ response = self.class.request(:request_type => "get", :id => self.name, :show_hidden => true)
63
+ if response.code == "200"
64
+ json = JSON.parse(response.body)
65
+ metric_group = self.class.new(json)
66
+ @id = self.name
67
+ needs_update = self.label != metric_group.label || self.frequency != metric_group.frequency || self.metrics.length != metric_group.metrics.length || self.metrics.map(&:name).sort != metric_group.metrics.map(&:name).sort
68
+ if needs_update
69
+ self.class.request(self.to_hash.merge(:id => @id, :request_type => "put"))
70
+ else
71
+ response
72
+ end
73
+ else
74
+ self.class.request(self.to_hash.merge(:request_type => "post"))
75
+ end
76
+ end
77
+
59
78
  class Metric
60
79
  TYPES = %w(ce_gauge ce_gauge_f ce_counter ce_counter_f)
61
80
 
data/lib/copperegg/ver.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CopperEgg
2
- GEM_VERSION = '0.6.0'
2
+ GEM_VERSION = '0.6.1.pre'
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copperegg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
5
- prerelease:
4
+ version: 0.6.1.pre
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Eric Anderson
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-08 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json_pure
@@ -34,11 +34,10 @@ extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
36
  - ./CHANGELOG.md
37
- - ./Gemfile
38
- - ./LICENSE
39
- - ./README.md
40
- - ./Rakefile
37
+ - ./copperegg-0.6.1.pre.gem
41
38
  - ./copperegg.gemspec
39
+ - ./Gemfile
40
+ - ./Gemfile.lock
42
41
  - ./lib/copperegg/api.rb
43
42
  - ./lib/copperegg/custom_dashboard.rb
44
43
  - ./lib/copperegg/metric_group.rb
@@ -46,6 +45,9 @@ files:
46
45
  - ./lib/copperegg/mixins/persistence.rb
47
46
  - ./lib/copperegg/ver.rb
48
47
  - ./lib/copperegg.rb
48
+ - ./LICENSE
49
+ - ./Rakefile
50
+ - ./README.md
49
51
  - ./test/custom_dashboard_test.rb
50
52
  - ./test/metric_group_test.rb
51
53
  - ./test/metric_sample_test.rb
@@ -74,9 +76,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
76
  required_rubygems_version: !ruby/object:Gem::Requirement
75
77
  none: false
76
78
  requirements:
77
- - - ! '>='
79
+ - - ! '>'
78
80
  - !ruby/object:Gem::Version
79
- version: '0'
81
+ version: 1.3.1
80
82
  requirements: []
81
83
  rubyforge_project:
82
84
  rubygems_version: 1.8.24