instrument 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Rakefile +6 -1
- data/lib/instrument/control.rb +49 -30
- data/lib/instrument/control_builder.rb +8 -8
- data/lib/instrument/version.rb +1 -1
- data/spec/control_templates/select_control.atom.rxml +1 -1
- data/spec/instrument/control_builder_spec.rb +7 -7
- data/spec/instrument/control_spec.rb +18 -18
- data/tasks/gem.rake +1 -1
- data/tasks/git.rake +3 -3
- data/tasks/metrics.rake +1 -1
- data/tasks/rdoc.rake +1 -1
- data/tasks/rubyforge.rake +15 -4
- data/tasks/spec.rake +28 -11
- data/website/index.html +7 -7
- metadata +5 -3
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -37,7 +37,12 @@ PKG_FILES = FileList[
|
|
37
37
|
"[A-Z]*", "Rakefile"
|
38
38
|
].exclude(/database\.yml/).exclude(/[_\.]git$/)
|
39
39
|
|
40
|
-
|
40
|
+
RCOV_ENABLED = (RUBY_PLATFORM != "java" && RUBY_VERSION =~ /^1\.8/)
|
41
|
+
if RCOV_ENABLED
|
42
|
+
task :default => "spec:verify"
|
43
|
+
else
|
44
|
+
task :default => "spec"
|
45
|
+
end
|
41
46
|
|
42
47
|
WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false
|
43
48
|
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
|
data/lib/instrument/control.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ++
|
2
2
|
# Instrument, Copyright (c) 2008 Day Automation Systems, Inc.
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
6
6
|
# "Software"), to deal in the Software without restriction, including
|
@@ -8,10 +8,10 @@
|
|
8
8
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
9
|
# permit persons to whom the Software is furnished to do so, subject to
|
10
10
|
# the following conditions:
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# The above copyright notice and this permission notice shall be
|
13
13
|
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
16
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
17
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -52,15 +52,20 @@ module Instrument
|
|
52
52
|
# execution context and returns the rendered template output as a
|
53
53
|
# String. The block should ensure that all necessary libraries are
|
54
54
|
# loaded.
|
55
|
-
#
|
56
|
-
# @param [Array] type_list
|
57
|
-
# @yield
|
58
|
-
# @yieldparam [String]
|
59
|
-
#
|
55
|
+
#
|
56
|
+
# @param [Array] type_list The template types being registered.
|
57
|
+
# @yield The block generates the template output.
|
58
|
+
# @yieldparam [String] input
|
59
|
+
# The template input.
|
60
|
+
# @yieldparam [Hash] options
|
61
|
+
# Additional parameters.
|
62
|
+
# :context - The execution context for the template, which will be set
|
63
|
+
# to the control object.
|
64
|
+
# :filename - The filename of the template being rendered.
|
60
65
|
def self.register_type(*type_list, &block)
|
61
66
|
# Ensure the @@type_map is initialized.
|
62
67
|
self.types
|
63
|
-
|
68
|
+
|
64
69
|
for type in type_list
|
65
70
|
# Normalize to symbol
|
66
71
|
type = type.to_s.to_sym
|
@@ -68,7 +73,7 @@ module Instrument
|
|
68
73
|
end
|
69
74
|
return nil
|
70
75
|
end
|
71
|
-
|
76
|
+
|
72
77
|
##
|
73
78
|
# Returns a list of registered template types.
|
74
79
|
#
|
@@ -107,14 +112,12 @@ module Instrument
|
|
107
112
|
#
|
108
113
|
# @param [Class] klass the subclass that is extending Control
|
109
114
|
def self.inherited(klass)
|
110
|
-
|
111
|
-
@@control_subclasses = []
|
112
|
-
end
|
115
|
+
@@control_subclasses ||= []
|
113
116
|
@@control_subclasses << klass
|
114
117
|
@@control_subclasses.uniq!
|
115
118
|
super
|
116
119
|
end
|
117
|
-
|
120
|
+
|
118
121
|
##
|
119
122
|
# Looks up a Control by name.
|
120
123
|
#
|
@@ -122,14 +125,15 @@ module Instrument
|
|
122
125
|
# @return [Instrument::Control, NilClass] the desired control or nil
|
123
126
|
# @see Instrument::Control.control_name
|
124
127
|
def self.lookup(control_name)
|
125
|
-
|
128
|
+
@@control_subclasses ||= []
|
129
|
+
for control_subclass in @@control_subclasses
|
126
130
|
if control_subclass.control_name == control_name
|
127
131
|
return control_subclass
|
128
132
|
end
|
129
133
|
end
|
130
134
|
return nil
|
131
135
|
end
|
132
|
-
|
136
|
+
|
133
137
|
##
|
134
138
|
# Creates a new Control object. Subclasses should not override this.
|
135
139
|
#
|
@@ -140,19 +144,19 @@ module Instrument
|
|
140
144
|
@options = options
|
141
145
|
@block = block
|
142
146
|
end
|
143
|
-
|
147
|
+
|
144
148
|
##
|
145
149
|
# Returns the options that were used to create the Control.
|
146
150
|
#
|
147
151
|
# @return [Hash] a set of options required by the control
|
148
152
|
attr_reader :options
|
149
|
-
|
153
|
+
|
150
154
|
##
|
151
155
|
# Returns the block that was supplied when the Control was created.
|
152
156
|
#
|
153
157
|
# @return [Proc] the block used to create the Control
|
154
158
|
attr_reader :block
|
155
|
-
|
159
|
+
|
156
160
|
##
|
157
161
|
# Returns the Control's name. By default, this is the control's class
|
158
162
|
# name, tranformed into This method may be overridden by a Control.
|
@@ -167,7 +171,7 @@ module Instrument
|
|
167
171
|
tr("-", "_").
|
168
172
|
downcase
|
169
173
|
end
|
170
|
-
|
174
|
+
|
171
175
|
##
|
172
176
|
# Returns a list of formats that this control may be rendered as.
|
173
177
|
#
|
@@ -244,7 +248,7 @@ module Instrument
|
|
244
248
|
end
|
245
249
|
end
|
246
250
|
end
|
247
|
-
|
251
|
+
|
248
252
|
##
|
249
253
|
# Renders a control in a specific format.
|
250
254
|
#
|
@@ -264,7 +268,7 @@ module Instrument
|
|
264
268
|
next if full_name.index(File.expand_path(load_path)) != 0
|
265
269
|
|
266
270
|
templates = Dir.glob(full_name + ".#{format}.*")
|
267
|
-
|
271
|
+
|
268
272
|
# Select the first template matched. If there's more than one,
|
269
273
|
# the extras will be ignored.
|
270
274
|
template = templates.first
|
@@ -295,7 +299,9 @@ module Instrument
|
|
295
299
|
end
|
296
300
|
|
297
301
|
begin
|
298
|
-
return self.class.processor(type).call(
|
302
|
+
return self.class.processor(type).call(
|
303
|
+
raw_content, {:context => self, :filename => path}
|
304
|
+
)
|
299
305
|
rescue Exception => e
|
300
306
|
e.message <<
|
301
307
|
"\nError occurred while rendering " +
|
@@ -307,23 +313,36 @@ module Instrument
|
|
307
313
|
end
|
308
314
|
|
309
315
|
# Register the default types.
|
310
|
-
Instrument::Control.register_type(:haml) do |input,
|
316
|
+
Instrument::Control.register_type(:haml) do |input, options|
|
311
317
|
require "haml"
|
312
|
-
|
318
|
+
context = options[:context]
|
319
|
+
filename = options[:filename]
|
320
|
+
Haml::Engine.new(
|
321
|
+
input, :attr_wrapper => "\"", :filename => filename
|
322
|
+
).render(context)
|
313
323
|
end
|
314
|
-
Instrument::Control.register_type(:erb, :rhtml) do |input,
|
324
|
+
Instrument::Control.register_type(:erb, :rhtml) do |input, options|
|
315
325
|
begin; require "erubis"; rescue LoadError; require "erb"; end
|
326
|
+
context = options[:context]
|
327
|
+
filename = options[:filename]
|
328
|
+
binding = context.instance_eval { (lambda {}).binding }
|
316
329
|
erb = Erubis::Eruby.new(input) rescue ERB.new(input)
|
317
|
-
erb.
|
330
|
+
if erb.respond_to?(:filename=)
|
331
|
+
erb.filename = filename
|
332
|
+
end
|
333
|
+
erb.result(binding)
|
318
334
|
end
|
319
|
-
Instrument::Control.register_type(:mab) do |input,
|
335
|
+
Instrument::Control.register_type(:mab) do |input, options|
|
320
336
|
require "markaby"
|
337
|
+
context = options[:context]
|
321
338
|
Markaby::Builder.new({}, context).capture do
|
322
339
|
eval(input)
|
323
340
|
end
|
324
341
|
end
|
325
|
-
Instrument::Control.register_type(:rxml) do |input,
|
342
|
+
Instrument::Control.register_type(:rxml) do |input, options|
|
326
343
|
require "builder"
|
344
|
+
context = options[:context]
|
327
345
|
xml = Builder::XmlMarkup.new(:indent => 2)
|
328
|
-
|
346
|
+
binding = context.instance_eval { (lambda {}).binding }
|
347
|
+
eval(input, binding)
|
329
348
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# ++
|
2
2
|
# Instrument, Copyright (c) 2008 Day Automation Systems, Inc.
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
6
6
|
# "Software"), to deal in the Software without restriction, including
|
@@ -8,10 +8,10 @@
|
|
8
8
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
9
|
# permit persons to whom the Software is furnished to do so, subject to
|
10
10
|
# the following conditions:
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# The above copyright notice and this permission notice shall be
|
13
13
|
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
16
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
17
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -31,13 +31,13 @@ module Instrument
|
|
31
31
|
# == Example
|
32
32
|
#
|
33
33
|
# include Instrument::ControlBuilder
|
34
|
-
#
|
34
|
+
#
|
35
35
|
# select_control(:name => "base", :selections => [
|
36
36
|
# {:label => "One", :value => "1"},
|
37
37
|
# {:label => "Two", :value => "2"},
|
38
38
|
# {:label => "Three", :value => "3"},
|
39
39
|
# {:label => "Four", :value => "4"}
|
40
|
-
# ]).to_xhtml
|
40
|
+
# ]).to_xhtml
|
41
41
|
module ControlBuilder
|
42
42
|
##
|
43
43
|
# Prevents Kernel#select from being accidentally called.
|
@@ -59,9 +59,9 @@ module Instrument
|
|
59
59
|
super
|
60
60
|
end
|
61
61
|
|
62
|
-
##
|
62
|
+
##
|
63
63
|
# Initializes Instrument::Control subclasses by name.
|
64
|
-
#
|
64
|
+
#
|
65
65
|
# @param [Symbol] method the method being called
|
66
66
|
# @param [Array] params the method's parameters
|
67
67
|
# @param [Proc] block the block being passed to the method
|
@@ -76,6 +76,6 @@ module Instrument
|
|
76
76
|
"undefined method `#{method}' for " +
|
77
77
|
"#{self.inspect}:#{self.class.name}"
|
78
78
|
end
|
79
|
-
end
|
79
|
+
end
|
80
80
|
end
|
81
81
|
end
|
data/lib/instrument/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "uuidtools"
|
2
2
|
require "time"
|
3
|
-
xml.instruct! :xml, :version=>"1.0"
|
3
|
+
xml.instruct! :xml, :version=>"1.0"
|
4
4
|
xml.feed("xmlns" => "http://www.w3.org/2005/Atom", "xml:lang" => "en_US") do
|
5
5
|
xml.id("urn:uuid:4a11e26e-239c-11dd-adf9-001ec2186a45")
|
6
6
|
xml.title("Select Control")
|
@@ -19,34 +19,34 @@ describe Instrument::ControlBuilder, "extending another object" do
|
|
19
19
|
class ExtendedObject
|
20
20
|
include Instrument::ControlBuilder
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
before :all do
|
24
24
|
@extended_object = ExtendedObject.new
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
it "should enable mixins to function" do
|
28
28
|
@extended_object.image_control.class.should == ImageControl
|
29
29
|
@extended_object.select.class.should == Select
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
it "should still raise an Exception for non-existent methods" do
|
33
33
|
(lambda do
|
34
34
|
@extended_object.bogus
|
35
35
|
end).should raise_error(NoMethodError)
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it "should respond to a normal message" do
|
39
39
|
@extended_object.should respond_to(:to_s)
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
it "should not respond to a bogus message" do
|
43
43
|
@extended_object.should_not respond_to(:bogus)
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
it "should respond to a valid control name message" do
|
47
47
|
@extended_object.should respond_to(:image_control)
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
it "should not respond to an invalid control name message" do
|
51
51
|
@extended_object.should_not respond_to(:bogus_control)
|
52
52
|
end
|
@@ -6,11 +6,11 @@ class SelectControl < Instrument::Control
|
|
6
6
|
def initialize(label, value)
|
7
7
|
@label, @value = label, value
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
attr_accessor :label
|
11
11
|
attr_accessor :value
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def element_id
|
15
15
|
return self.options[:id] || self.options[:name]
|
16
16
|
end
|
@@ -18,7 +18,7 @@ class SelectControl < Instrument::Control
|
|
18
18
|
def element_name
|
19
19
|
return self.options[:name]
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def selections
|
23
23
|
if !defined?(@selections) || @selections == nil
|
24
24
|
@selections = []
|
@@ -70,7 +70,7 @@ describe Instrument::Control do
|
|
70
70
|
control = Instrument::Control.new(&proc)
|
71
71
|
control.block.should eql(proc)
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
it "should still raise an Exception for non-existent methods" do
|
75
75
|
(lambda do
|
76
76
|
Instrument::Control.new.bogus
|
@@ -100,25 +100,25 @@ describe Instrument::Control do
|
|
100
100
|
SelectControl.new.to_xml
|
101
101
|
end).should raise_error(ZeroDivisionError)
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
it "should correctly delegate messages to the delegate object" do
|
105
105
|
SelectControl.new(:delegate => [1,2,3]).size.should == 3
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
it "should have the correct list of formats" do
|
109
109
|
SelectControl.formats.sort.should == [
|
110
110
|
"atom", "html", "json", "txt", "xhtml", "xml"
|
111
111
|
]
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
it "should have no formats listed for the base class" do
|
115
115
|
Instrument::Control.formats.should == []
|
116
116
|
end
|
117
|
-
|
117
|
+
|
118
118
|
it "should respond to a normal message" do
|
119
119
|
SelectControl.new.should respond_to(:render)
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
it "should not respond to a bogus message" do
|
123
123
|
SelectControl.new.should_not respond_to(:bogus)
|
124
124
|
end
|
@@ -127,25 +127,25 @@ describe Instrument::Control do
|
|
127
127
|
Instrument::Control.new.should respond_to(:select_control)
|
128
128
|
SelectControl.new.should respond_to(:select_control)
|
129
129
|
end
|
130
|
-
|
130
|
+
|
131
131
|
it "should not respond to invalid subclass messages" do
|
132
132
|
SelectControl.new.should_not respond_to(:bogus_control)
|
133
133
|
end
|
134
|
-
|
134
|
+
|
135
135
|
it "should respond to a valid format conversion message" do
|
136
136
|
SelectControl.new.should respond_to(:to_atom)
|
137
137
|
end
|
138
|
-
|
138
|
+
|
139
139
|
it "should not respond to an invalid format conversion message" do
|
140
140
|
SelectControl.new.should_not respond_to(:to_bogus)
|
141
141
|
end
|
142
|
-
|
142
|
+
|
143
143
|
it "should respond to messages available on a delegated object" do
|
144
144
|
SelectControl.new(:delegate => []).should respond_to(:<<)
|
145
145
|
SelectControl.new(:delegate => 42).should respond_to(:>>)
|
146
146
|
SelectControl.new(:delegate => 42).should respond_to(:<<)
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
it "should not respond to messages unavailable on a delegated object" do
|
150
150
|
SelectControl.new(:delegate => []).should_not respond_to(:>>)
|
151
151
|
end
|
@@ -162,7 +162,7 @@ describe Instrument::Control, "when rendered as XHTML with Haml" do
|
|
162
162
|
it "should have the correct id and name" do
|
163
163
|
@xhtml.should match(/<select id="base" name="base">/)
|
164
164
|
end
|
165
|
-
|
165
|
+
|
166
166
|
it "should have options for all of the given selections" do
|
167
167
|
@xhtml.should match(/<option value="First"/)
|
168
168
|
@xhtml.should match(/<option value="Second"/)
|
@@ -185,7 +185,7 @@ describe Instrument::Control, "when rendered as HTML with Markaby" do
|
|
185
185
|
@html.should match(/id="base"/)
|
186
186
|
@html.should match(/name="base"/)
|
187
187
|
end
|
188
|
-
|
188
|
+
|
189
189
|
it "should have options for all of the given selections" do
|
190
190
|
@html.should match(/<option value="First"/)
|
191
191
|
@html.should match(/<option value="Second"/)
|
@@ -205,7 +205,7 @@ describe Instrument::Control, "when rendered as Atom with XML Builder" do
|
|
205
205
|
it "should have the correct id and name" do
|
206
206
|
@atom.should match(/<title>Select Control<\/title>/)
|
207
207
|
end
|
208
|
-
|
208
|
+
|
209
209
|
it "should have options for all of the given selections" do
|
210
210
|
@atom.should match(/<title>First<\/title>/)
|
211
211
|
@atom.should match(/<title>Second<\/title>/)
|
@@ -226,7 +226,7 @@ describe Instrument::Control, "when rendered as JSON with Erubis" do
|
|
226
226
|
@atom.should match(/"id": "base"/)
|
227
227
|
@atom.should match(/"name": "base"/)
|
228
228
|
end
|
229
|
-
|
229
|
+
|
230
230
|
it "should have options for all of the given selections" do
|
231
231
|
@atom.should match(/"label": "First"/)
|
232
232
|
@atom.should match(/"value": "First"/)
|
data/tasks/gem.rake
CHANGED
data/tasks/git.rake
CHANGED
@@ -22,16 +22,16 @@ namespace :git do
|
|
22
22
|
tag = "#{PKG_NAME}-#{PKG_VERSION}"
|
23
23
|
msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
|
24
24
|
|
25
|
-
existing_tags = `git tag -l
|
25
|
+
existing_tags = `git tag -l #{PKG_NAME}-*`.split("\n")
|
26
26
|
if existing_tags.include?(tag)
|
27
27
|
warn("Tag already exists, deleting...")
|
28
28
|
unless system "git tag -d #{tag}"
|
29
|
-
abort "Tag deletion failed."
|
29
|
+
abort "Tag deletion failed."
|
30
30
|
end
|
31
31
|
end
|
32
32
|
puts "Creating git tag '#{tag}'..."
|
33
33
|
unless system "git tag -a -m \"#{msg}\" #{tag}"
|
34
|
-
abort "Tag creation failed."
|
34
|
+
abort "Tag creation failed."
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/tasks/metrics.rake
CHANGED
data/tasks/rdoc.rake
CHANGED
data/tasks/rubyforge.rake
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
require 'rubyforge'
|
2
|
-
require 'rake/contrib/sshpublisher'
|
3
|
-
|
4
1
|
namespace :gem do
|
5
2
|
desc 'Package and upload to RubyForge'
|
6
3
|
task :release => ["gem:package"] do |t|
|
4
|
+
require 'rubyforge'
|
5
|
+
|
7
6
|
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
8
7
|
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PKG_VERSION
|
9
8
|
pkg = "pkg/#{GEM_SPEC.full_name}"
|
@@ -28,6 +27,9 @@ end
|
|
28
27
|
namespace :doc do
|
29
28
|
desc "Publish RDoc to RubyForge"
|
30
29
|
task :release => ["doc:rdoc"] do
|
30
|
+
require "rake/contrib/sshpublisher"
|
31
|
+
require "yaml"
|
32
|
+
|
31
33
|
config = YAML.load(
|
32
34
|
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
33
35
|
)
|
@@ -41,6 +43,9 @@ end
|
|
41
43
|
namespace :spec do
|
42
44
|
desc "Publish specdoc to RubyForge"
|
43
45
|
task :release => ["spec:specdoc"] do
|
46
|
+
require "rake/contrib/sshpublisher"
|
47
|
+
require "yaml"
|
48
|
+
|
44
49
|
config = YAML.load(
|
45
50
|
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
46
51
|
)
|
@@ -49,10 +54,13 @@ namespace :spec do
|
|
49
54
|
local_dir = "specdoc"
|
50
55
|
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
51
56
|
end
|
52
|
-
|
57
|
+
|
53
58
|
namespace :rcov do
|
54
59
|
desc "Publish coverage report to RubyForge"
|
55
60
|
task :release => ["spec:rcov"] do
|
61
|
+
require "rake/contrib/sshpublisher"
|
62
|
+
require "yaml"
|
63
|
+
|
56
64
|
config = YAML.load(
|
57
65
|
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
58
66
|
)
|
@@ -67,6 +75,9 @@ end
|
|
67
75
|
namespace :website do
|
68
76
|
desc "Publish website to RubyForge"
|
69
77
|
task :release => ["doc:release", "spec:release", "spec:rcov:release"] do
|
78
|
+
require "rake/contrib/sshpublisher"
|
79
|
+
require "yaml"
|
80
|
+
|
70
81
|
config = YAML.load(
|
71
82
|
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
72
83
|
)
|
data/tasks/spec.rake
CHANGED
@@ -4,7 +4,11 @@ namespace :spec do
|
|
4
4
|
Spec::Rake::SpecTask.new(:rcov) do |t|
|
5
5
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
6
6
|
t.spec_opts = ['--color', '--format', 'specdoc']
|
7
|
-
|
7
|
+
if RCOV_ENABLED
|
8
|
+
t.rcov = true
|
9
|
+
else
|
10
|
+
t.rcov = false
|
11
|
+
end
|
8
12
|
t.rcov_opts = [
|
9
13
|
'--exclude', 'spec',
|
10
14
|
'--exclude', '1\\.8\\/gems',
|
@@ -12,24 +16,32 @@ namespace :spec do
|
|
12
16
|
]
|
13
17
|
end
|
14
18
|
|
15
|
-
|
16
|
-
t.
|
17
|
-
t.
|
19
|
+
Spec::Rake::SpecTask.new(:normal) do |t|
|
20
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
+
t.spec_opts = ['--color', '--format', 'specdoc']
|
22
|
+
t.rcov = false
|
18
23
|
end
|
19
24
|
|
20
|
-
|
25
|
+
if RCOV_ENABLED
|
26
|
+
RCov::VerifyTask.new(:verify) do |t|
|
27
|
+
t.threshold = 100.0
|
28
|
+
t.index_html = 'coverage/index.html'
|
29
|
+
end
|
30
|
+
|
31
|
+
task :verify => :rcov
|
32
|
+
end
|
21
33
|
|
22
34
|
desc "Generate HTML Specdocs for all specs"
|
23
35
|
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
24
36
|
specdoc_path = File.expand_path(
|
25
37
|
File.join(File.dirname(__FILE__), '../specdoc/'))
|
26
38
|
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
|
27
|
-
|
39
|
+
|
28
40
|
output_file = File.join(specdoc_path, 'index.html')
|
29
41
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
30
42
|
t.spec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
|
31
43
|
t.fail_on_error = false
|
32
|
-
end
|
44
|
+
end
|
33
45
|
|
34
46
|
namespace :rcov do
|
35
47
|
desc "Browse the code coverage report."
|
@@ -39,8 +51,13 @@ namespace :spec do
|
|
39
51
|
end
|
40
52
|
end
|
41
53
|
|
42
|
-
|
43
|
-
|
54
|
+
if RCOV_ENABLED
|
55
|
+
desc "Alias to spec:verify"
|
56
|
+
task "spec" => "spec:verify"
|
57
|
+
else
|
58
|
+
desc "Alias to spec:normal"
|
59
|
+
task "spec" => "spec:normal"
|
60
|
+
end
|
44
61
|
|
45
62
|
task "clobber" => ["spec:clobber_rcov"]
|
46
63
|
|
@@ -74,12 +91,12 @@ module Rake
|
|
74
91
|
success =
|
75
92
|
!(`gnome-open #{filepath} 2>&1` =~ /There is no default action/)
|
76
93
|
if !success
|
77
|
-
opened = try_browsers.call()
|
94
|
+
opened = try_browsers.call()
|
78
95
|
else
|
79
96
|
opened = true
|
80
97
|
end
|
81
98
|
else
|
82
|
-
opened = try_browsers.call()
|
99
|
+
opened = try_browsers.call()
|
83
100
|
end
|
84
101
|
if !opened
|
85
102
|
puts "Don't know how to browse to location."
|
data/website/index.html
CHANGED
@@ -9,12 +9,12 @@
|
|
9
9
|
margin: 0;
|
10
10
|
padding: 0;
|
11
11
|
}
|
12
|
-
|
12
|
+
|
13
13
|
body {
|
14
14
|
font-family: lucida grande, verdana, sans-serif;
|
15
15
|
margin: 1em;
|
16
16
|
}
|
17
|
-
|
17
|
+
|
18
18
|
a {
|
19
19
|
color: #880000;
|
20
20
|
}
|
@@ -22,18 +22,18 @@
|
|
22
22
|
a:visited {
|
23
23
|
color: #333333;
|
24
24
|
}
|
25
|
-
|
25
|
+
|
26
26
|
h1 {
|
27
27
|
font-size: 2em;
|
28
28
|
margin: 0 0 0.8em 0;
|
29
29
|
text-align: center;
|
30
30
|
}
|
31
|
-
|
31
|
+
|
32
32
|
h2 {
|
33
33
|
font-size: 1em;
|
34
34
|
margin: 0.8em 0;
|
35
35
|
}
|
36
|
-
|
36
|
+
|
37
37
|
p {
|
38
38
|
margin: 0.8em 0;
|
39
39
|
}
|
@@ -42,7 +42,7 @@
|
|
42
42
|
font-size: 0.9em;
|
43
43
|
margin: 0 0 0 1.5em;
|
44
44
|
}
|
45
|
-
|
45
|
+
|
46
46
|
div {
|
47
47
|
width: 50%;
|
48
48
|
margin: 0 auto;
|
@@ -55,7 +55,7 @@
|
|
55
55
|
body {
|
56
56
|
font-size: 0.9em;
|
57
57
|
}
|
58
|
-
|
58
|
+
|
59
59
|
a {
|
60
60
|
text-decoration: none;
|
61
61
|
color: #000;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instrument
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Aman
|
@@ -9,11 +9,12 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-10-23 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -23,6 +24,7 @@ dependencies:
|
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: rspec
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|
@@ -95,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
97
|
requirements: []
|
96
98
|
|
97
99
|
rubyforge_project: instrument
|
98
|
-
rubygems_version: 1.
|
100
|
+
rubygems_version: 1.2.0
|
99
101
|
signing_key:
|
100
102
|
specification_version: 2
|
101
103
|
summary: Template-based Controls
|