errand 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/Gemfile.lock +15 -0
- data/Rakefile +5 -3
- data/VERSION +1 -1
- data/lib/errand.rb +10 -29
- metadata +31 -13
- data/.gitignore +0 -10
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/Rakefile
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'rubygems'
|
4
|
+
|
3
5
|
begin
|
4
6
|
require 'jeweler'
|
5
7
|
Jeweler::Tasks.new do |gemspec|
|
@@ -14,13 +16,13 @@ rescue LoadError
|
|
14
16
|
puts "Jeweler not available. Install it with: gem install jeweler"
|
15
17
|
end
|
16
18
|
|
17
|
-
begin
|
19
|
+
begin
|
18
20
|
require 'spec/rake/spectask'
|
19
|
-
|
21
|
+
|
20
22
|
Spec::Rake::SpecTask.new do |t|
|
21
23
|
t.spec_opts = ["--options", "spec/spec.opts"]
|
22
24
|
end
|
23
25
|
rescue LoadError
|
24
26
|
puts "RSpec not available. Install it with: gem install rspec"
|
25
27
|
end
|
26
|
-
|
28
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.3
|
data/lib/errand.rb
CHANGED
@@ -1,30 +1,11 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Attempt to load the native RRD library provided by the operating system.
|
4
|
-
|
5
|
-
# Ruby Enterprise Edition will try to load everything from /usr/local/lib/ruby.
|
6
|
-
# As the distribution generally installs the RRD bindings in /usr/lib/ruby, we
|
7
|
-
# have to explicitly hack the load path so REE knows where to find the Ruby
|
8
|
-
# RRD bindings.
|
9
|
-
case RUBY_VERSION[/^1\.\d/]
|
10
|
-
when /^1\.8/
|
11
|
-
version = "1.8"
|
12
|
-
when /^1\.9/
|
13
|
-
version = RUBY_VERSION
|
14
|
-
end
|
15
|
-
|
16
|
-
Dir.glob("/usr/lib/ruby/#{version}/*-linux").each do |dir|
|
17
|
-
$: << dir
|
18
|
-
end
|
19
|
-
|
20
|
-
require 'RRD'
|
21
|
-
rescue LoadError
|
22
|
-
exit 1
|
23
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Attempt to load the native RRD library provided by the operating system.
|
4
|
+
require 'RRD'
|
24
5
|
|
25
6
|
# Errand:
|
26
|
-
# Wraps the RRD Ruby library provided by your distribution's package manager,
|
27
|
-
# exposing a more Ruby-like and accessible interface.
|
7
|
+
# Wraps the RRD Ruby library provided by your distribution's package manager,
|
8
|
+
# exposing a more Ruby-like and accessible interface.
|
28
9
|
|
29
10
|
class Errand
|
30
11
|
def initialize(opts={})
|
@@ -113,7 +94,7 @@ class Errand
|
|
113
94
|
source[:name]
|
114
95
|
}.join(':')
|
115
96
|
|
116
|
-
case
|
97
|
+
case
|
117
98
|
when time_specified && times.size == 1
|
118
99
|
values = "#{times.first}:" + opts[:sources].map { |s|
|
119
100
|
s[:value]
|
@@ -124,7 +105,7 @@ class Errand
|
|
124
105
|
when time_specified && times.size > 1
|
125
106
|
times.each do |t|
|
126
107
|
points = opts[:sources].find_all { |source| source[:time] == t }
|
127
|
-
|
108
|
+
|
128
109
|
sources = points.map { |p|
|
129
110
|
p[:name]
|
130
111
|
}.join(':')
|
@@ -145,7 +126,7 @@ class Errand
|
|
145
126
|
args = ["--template", sources, values]
|
146
127
|
@backend.update(@filename, *args)
|
147
128
|
end
|
148
|
-
|
129
|
+
|
149
130
|
true
|
150
131
|
end
|
151
132
|
|
@@ -155,7 +136,7 @@ class Errand
|
|
155
136
|
|
156
137
|
# ordered array of data sources as defined in rrd
|
157
138
|
def data_sources
|
158
|
-
self.info.keys.grep(/^ds\[/).map { |ds| ds[3..-1].split(']').first}.uniq
|
139
|
+
self.info.keys.grep(/^ds\[/).map { |ds| ds[3..-1].split(']').first}.uniq
|
159
140
|
end
|
160
141
|
|
161
142
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: errand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 7
|
8
|
+
- 3
|
9
|
+
version: 0.7.3
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Lindsay Holmwood
|
@@ -9,10 +14,21 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2011-05-11 00:00:00 +10:00
|
13
18
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: jeweler
|
22
|
+
type: :development
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
requirement: *id001
|
31
|
+
prerelease: false
|
16
32
|
description: Errand provides Ruby bindings for RRD functions (via librrd), and a concise DSL for interacting with RRDs.
|
17
33
|
email: lindsay@holmwood.id.au
|
18
34
|
executables: []
|
@@ -23,8 +39,9 @@ extra_rdoc_files:
|
|
23
39
|
- README.md
|
24
40
|
files:
|
25
41
|
- .cvsignore
|
26
|
-
- .gitignore
|
27
42
|
- AUTHORS
|
43
|
+
- Gemfile
|
44
|
+
- Gemfile.lock
|
28
45
|
- README.md
|
29
46
|
- Rakefile
|
30
47
|
- VERSION
|
@@ -37,29 +54,30 @@ homepage: http://auxesis.github.com/errand
|
|
37
54
|
licenses: []
|
38
55
|
|
39
56
|
post_install_message:
|
40
|
-
rdoc_options:
|
41
|
-
|
57
|
+
rdoc_options: []
|
58
|
+
|
42
59
|
require_paths:
|
43
60
|
- lib
|
44
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
45
62
|
requirements:
|
46
63
|
- - ">="
|
47
64
|
- !ruby/object:Gem::Version
|
65
|
+
segments:
|
66
|
+
- 0
|
48
67
|
version: "0"
|
49
|
-
version:
|
50
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
69
|
requirements:
|
52
70
|
- - ">="
|
53
71
|
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
54
74
|
version: "0"
|
55
|
-
version:
|
56
75
|
requirements: []
|
57
76
|
|
58
77
|
rubyforge_project:
|
59
|
-
rubygems_version: 1.3.
|
78
|
+
rubygems_version: 1.3.6
|
60
79
|
signing_key:
|
61
80
|
specification_version: 3
|
62
81
|
summary: Ruby language binding for RRD tool version 1.2+
|
63
|
-
test_files:
|
64
|
-
|
65
|
-
- test/test_rrdtool.rb
|
82
|
+
test_files: []
|
83
|
+
|