instrument 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +0 -0
- data/LICENSE +20 -0
- data/README +97 -0
- data/Rakefile +45 -0
- data/lib/instrument.rb +27 -0
- data/lib/instrument/control.rb +269 -0
- data/lib/instrument/control_builder.rb +71 -0
- data/lib/instrument/errors.rb +35 -0
- data/lib/instrument/version.rb +35 -0
- data/spec/control_templates/image_control.xhtml.haml +1 -0
- data/spec/control_templates/select_control.atom.rxml +19 -0
- data/spec/control_templates/select_control.directory.haml/explanation.txt +2 -0
- data/spec/control_templates/select_control.html.mab +5 -0
- data/spec/control_templates/select_control.json.erb +14 -0
- data/spec/control_templates/select_control.txt.bogus +2 -0
- data/spec/control_templates/select_control.xhtml.haml +4 -0
- data/spec/control_templates/select_control.xml.haml +2 -0
- data/spec/instrument/control_builder_spec.rb +37 -0
- data/spec/instrument/control_spec.rb +179 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +13 -0
- data/tasks/browse.rake +43 -0
- data/tasks/clobber.rake +2 -0
- data/tasks/gem.rake +62 -0
- data/tasks/git.rake +27 -0
- data/tasks/metrics.rake +22 -0
- data/tasks/rdoc.rake +29 -0
- data/tasks/rubyforge.rake +77 -0
- data/tasks/spec.rake +43 -0
- data/website/index.html +95 -0
- metadata +104 -0
data/tasks/clobber.rake
ADDED
data/tasks/gem.rake
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require "rake/gempackagetask"
|
2
|
+
|
3
|
+
namespace :gem do
|
4
|
+
GEM_SPEC = Gem::Specification.new do |s|
|
5
|
+
s.name = PKG_NAME
|
6
|
+
s.version = PKG_VERSION
|
7
|
+
s.summary = PKG_SUMMARY
|
8
|
+
s.description = PKG_DESCRIPTION
|
9
|
+
|
10
|
+
s.files = PKG_FILES.to_a
|
11
|
+
|
12
|
+
s.has_rdoc = true
|
13
|
+
s.extra_rdoc_files = %w( README )
|
14
|
+
s.rdoc_options.concat ["--main", "README"]
|
15
|
+
|
16
|
+
s.add_dependency("rake", ">= 0.7.3")
|
17
|
+
s.add_dependency("rspec", ">= 1.0.8")
|
18
|
+
|
19
|
+
s.require_path = "lib"
|
20
|
+
|
21
|
+
s.author = "Bob Aman"
|
22
|
+
s.email = "bob@sporkmonger.com"
|
23
|
+
s.homepage = "http://sporkmonger.com/"
|
24
|
+
s.rubyforge_project = RUBY_FORGE_PROJECT
|
25
|
+
end
|
26
|
+
|
27
|
+
Rake::GemPackageTask.new(GEM_SPEC) do |p|
|
28
|
+
p.gem_spec = GEM_SPEC
|
29
|
+
p.need_tar = true
|
30
|
+
p.need_zip = true
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Show information about the gem"
|
34
|
+
task :debug do
|
35
|
+
puts GEM_SPEC.to_ruby
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Install the gem"
|
39
|
+
task :install => ["clobber", "gem:package"] do
|
40
|
+
sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Uninstall the gem"
|
44
|
+
task :uninstall do
|
45
|
+
installed_list = Gem.source_index.find_name(PKG_NAME)
|
46
|
+
if installed_list &&
|
47
|
+
(installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
|
48
|
+
sh(
|
49
|
+
"#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
|
50
|
+
"--ignore-dependencies --executables #{PKG_NAME}"
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Reinstall the gem"
|
56
|
+
task :reinstall => [:uninstall, :install]
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Alias to gem:package"
|
60
|
+
task "gem" => "gem:package"
|
61
|
+
|
62
|
+
task "clobber" => ["gem:clobber_package"]
|
data/tasks/git.rake
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
namespace :git do
|
2
|
+
namespace :tag do
|
3
|
+
desc "List tags from the Git repository"
|
4
|
+
task :list do
|
5
|
+
tags = `git tag -l`
|
6
|
+
tags.gsub!("\r", "")
|
7
|
+
tags = tags.split("\n").sort {|a, b| b <=> a }
|
8
|
+
puts tags.join("\n")
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "Create a new tag in the Git repository"
|
12
|
+
task :create do
|
13
|
+
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
|
14
|
+
abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
|
15
|
+
|
16
|
+
tag = "#{PKG_NAME}-#{PKG_VERSION}"
|
17
|
+
msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
|
18
|
+
|
19
|
+
puts "Creating git tag '#{tag}'..."
|
20
|
+
unless system "git tag -a -m \"#{msg}\" #{tag}"
|
21
|
+
abort "Tag creation failed."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
task "gem:release" => "git:tag:create"
|
data/tasks/metrics.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :metrics do
|
2
|
+
task :lines do
|
3
|
+
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
4
|
+
for file_name in FileList["lib/**/*.rb"]
|
5
|
+
f = File.open(file_name)
|
6
|
+
while line = f.gets
|
7
|
+
lines += 1
|
8
|
+
next if line =~ /^\s*$/
|
9
|
+
next if line =~ /^\s*#/
|
10
|
+
codelines += 1
|
11
|
+
end
|
12
|
+
puts "L: #{sprintf("%4d", lines)}, " +
|
13
|
+
"LOC #{sprintf("%4d", codelines)} | #{file_name}"
|
14
|
+
total_lines += lines
|
15
|
+
total_codelines += codelines
|
16
|
+
|
17
|
+
lines, codelines = 0, 0
|
18
|
+
end
|
19
|
+
|
20
|
+
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
21
|
+
end
|
22
|
+
end
|
data/tasks/rdoc.rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "rake/rdoctask"
|
2
|
+
|
3
|
+
namespace :doc do
|
4
|
+
desc "Generate RDoc documentation"
|
5
|
+
Rake::RDocTask.new do |rdoc|
|
6
|
+
rdoc.rdoc_dir = "doc"
|
7
|
+
rdoc.title = "#{PKG_NAME}-#{PKG_VERSION} Documentation"
|
8
|
+
rdoc.options << "--line-numbers" << "--inline-source" <<
|
9
|
+
"--accessor" << "cattr_accessor=object" << "--charset" << "utf-8"
|
10
|
+
rdoc.template = "#{ENV["template"]}.rb" if ENV["template"]
|
11
|
+
rdoc.rdoc_files.include("README", "CHANGELOG", "LICENSE")
|
12
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Generate ri locally for testing"
|
16
|
+
task :ri do
|
17
|
+
sh "rdoc --ri -o ri ."
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Remove ri products"
|
21
|
+
task :clobber_ri do
|
22
|
+
rm_r "ri" rescue nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Alias to doc:rdoc"
|
27
|
+
task "doc" => "doc:rdoc"
|
28
|
+
|
29
|
+
task "clobber" => ["doc:clobber_rdoc", "doc:clobber_ri"]
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'rubyforge'
|
2
|
+
require 'rake/contrib/sshpublisher'
|
3
|
+
|
4
|
+
namespace :gem do
|
5
|
+
desc 'Package and upload to RubyForge'
|
6
|
+
task :release => ["gem:package"] do |t|
|
7
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
8
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PKG_VERSION
|
9
|
+
pkg = "pkg/#{GEM_SPEC.full_name}"
|
10
|
+
|
11
|
+
rf = RubyForge.new
|
12
|
+
puts 'Logging in...'
|
13
|
+
rf.login
|
14
|
+
|
15
|
+
c = rf.userconfig
|
16
|
+
changelog = File.open("CHANGELOG") { |file| file.read }
|
17
|
+
c['release_changes'] = changelog
|
18
|
+
c['preformatted'] = true
|
19
|
+
|
20
|
+
files = ["#{pkg}.tgz", "#{pkg}.zip", "#{pkg}.gem"]
|
21
|
+
|
22
|
+
puts "Releasing #{PKG_NAME} v. #{PKG_VERSION}"
|
23
|
+
rf.add_release RUBY_FORGE_PROJECT, PKG_NAME, PKG_VERSION, *files
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
namespace :doc do
|
28
|
+
desc "Publish RDoc to RubyForge"
|
29
|
+
task :release => ["doc:rdoc"] do
|
30
|
+
config = YAML.load(
|
31
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
32
|
+
)
|
33
|
+
host = "#{config['username']}@rubyforge.org"
|
34
|
+
remote_dir = RUBY_FORGE_PATH + "/api"
|
35
|
+
local_dir = "doc"
|
36
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
namespace :spec do
|
41
|
+
desc "Publish specdoc to RubyForge"
|
42
|
+
task :release => ["spec:specdoc"] do
|
43
|
+
config = YAML.load(
|
44
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
45
|
+
)
|
46
|
+
host = "#{config['username']}@rubyforge.org"
|
47
|
+
remote_dir = RUBY_FORGE_PATH + "/specdoc"
|
48
|
+
local_dir = "specdoc"
|
49
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
50
|
+
end
|
51
|
+
|
52
|
+
namespace :rcov do
|
53
|
+
desc "Publish coverage report to RubyForge"
|
54
|
+
task :release => ["spec:rcov"] do
|
55
|
+
config = YAML.load(
|
56
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
57
|
+
)
|
58
|
+
host = "#{config['username']}@rubyforge.org"
|
59
|
+
remote_dir = RUBY_FORGE_PATH + "/coverage"
|
60
|
+
local_dir = "coverage"
|
61
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
namespace :website do
|
67
|
+
desc "Publish website to RubyForge"
|
68
|
+
task :release => ["doc:release", "spec:release", "spec:rcov:release"] do
|
69
|
+
config = YAML.load(
|
70
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
71
|
+
)
|
72
|
+
host = "#{config['username']}@rubyforge.org"
|
73
|
+
remote_dir = RUBY_FORGE_PATH
|
74
|
+
local_dir = "website"
|
75
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
76
|
+
end
|
77
|
+
end
|
data/tasks/spec.rake
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec/rake/verify_rcov'
|
2
|
+
|
3
|
+
namespace :spec do
|
4
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
5
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
6
|
+
t.spec_opts = ['--color', '--format', 'specdoc']
|
7
|
+
t.rcov = true
|
8
|
+
t.rcov_opts = [
|
9
|
+
'--exclude', 'spec',
|
10
|
+
'--exclude', '1\\.8\\/gems',
|
11
|
+
'--exclude', '1\\.9\\/gems'
|
12
|
+
]
|
13
|
+
end
|
14
|
+
|
15
|
+
RCov::VerifyTask.new(:verify) do |t|
|
16
|
+
t.threshold = 100.0
|
17
|
+
t.index_html = 'coverage/index.html'
|
18
|
+
end
|
19
|
+
|
20
|
+
task :verify => :rcov
|
21
|
+
|
22
|
+
desc "Generate HTML Specdocs for all specs"
|
23
|
+
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
24
|
+
specdoc_path = File.expand_path(
|
25
|
+
File.join(File.dirname(__FILE__), '../specdoc/'))
|
26
|
+
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
|
27
|
+
|
28
|
+
output_file = File.join(specdoc_path, 'index.html')
|
29
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
30
|
+
t.spec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
|
31
|
+
t.fail_on_error = false
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Browse the code coverage report."
|
35
|
+
task :rcov_browse => :rcov do
|
36
|
+
Rake.browse("coverage/index.html")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Alias to spec:verify"
|
41
|
+
task "spec" => "spec:verify"
|
42
|
+
|
43
|
+
task "clobber" => ["spec:clobber_rcov"]
|
data/website/index.html
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8"/>
|
5
|
+
<title>Instrument</title>
|
6
|
+
<style type="text/css">
|
7
|
+
* {
|
8
|
+
font-size: 100%;
|
9
|
+
margin: 0;
|
10
|
+
padding: 0;
|
11
|
+
}
|
12
|
+
|
13
|
+
body {
|
14
|
+
font-family: lucida grande, verdana, sans-serif;
|
15
|
+
margin: 1em;
|
16
|
+
}
|
17
|
+
|
18
|
+
a {
|
19
|
+
color: #880000;
|
20
|
+
}
|
21
|
+
|
22
|
+
a:visited {
|
23
|
+
color: #333333;
|
24
|
+
}
|
25
|
+
|
26
|
+
h1 {
|
27
|
+
font-size: 2em;
|
28
|
+
margin: 0 0 0.8em 0;
|
29
|
+
text-align: center;
|
30
|
+
}
|
31
|
+
|
32
|
+
h2 {
|
33
|
+
font-size: 1em;
|
34
|
+
margin: 0.8em 0;
|
35
|
+
}
|
36
|
+
|
37
|
+
p {
|
38
|
+
margin: 0.8em 0;
|
39
|
+
}
|
40
|
+
|
41
|
+
ul {
|
42
|
+
font-size: 0.9em;
|
43
|
+
margin: 0 0 0 1.5em;
|
44
|
+
}
|
45
|
+
|
46
|
+
div {
|
47
|
+
width: 50%;
|
48
|
+
margin: 0 auto;
|
49
|
+
padding: 0.8em;
|
50
|
+
background-color: #AA5852;
|
51
|
+
border: 2px solid #C2645D;
|
52
|
+
}
|
53
|
+
|
54
|
+
@media print {
|
55
|
+
body {
|
56
|
+
font-size: 0.9em;
|
57
|
+
}
|
58
|
+
|
59
|
+
a {
|
60
|
+
text-decoration: none;
|
61
|
+
color: #000;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
</style>
|
65
|
+
</head>
|
66
|
+
<body>
|
67
|
+
<h1>Instrument</h1>
|
68
|
+
<div>
|
69
|
+
<p>
|
70
|
+
Instrument is a simple library for producing dynamically generated
|
71
|
+
"controls" with various templating languages.
|
72
|
+
</p>
|
73
|
+
<ul>
|
74
|
+
<li>
|
75
|
+
<a href="http://rubyforge.org/projects/instrument/">
|
76
|
+
Project Page
|
77
|
+
</a>
|
78
|
+
</li>
|
79
|
+
<li><a href="/api/">API</a></li>
|
80
|
+
<li><a href="/specdoc/">Specifications</a></li>
|
81
|
+
<li><a href="/coverage/">Code Coverage</a></li>
|
82
|
+
</ul>
|
83
|
+
<p>
|
84
|
+
You know what to do:
|
85
|
+
</p>
|
86
|
+
<p>
|
87
|
+
<code>sudo gem install instrument</code><br />
|
88
|
+
<code>sudo gem install haml</code> (optional)<br />
|
89
|
+
<code>sudo gem install erubis</code> (optional)<br />
|
90
|
+
<code>sudo gem install markaby</code> (optional)<br />
|
91
|
+
<code>sudo gem install builder</code> (optional)
|
92
|
+
</p>
|
93
|
+
</div>
|
94
|
+
</body>
|
95
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: instrument
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bob Aman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-05-19 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.7.3
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: rspec
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.0.8
|
32
|
+
version:
|
33
|
+
description: Instrument is a simple library for producing dynamically generated "controls" with various templating languages.
|
34
|
+
email: bob@sporkmonger.com
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- README
|
41
|
+
files:
|
42
|
+
- lib/instrument
|
43
|
+
- lib/instrument/control.rb
|
44
|
+
- lib/instrument/control_builder.rb
|
45
|
+
- lib/instrument/errors.rb
|
46
|
+
- lib/instrument/version.rb
|
47
|
+
- lib/instrument.rb
|
48
|
+
- spec/control_templates
|
49
|
+
- spec/control_templates/image_control.xhtml.haml
|
50
|
+
- spec/control_templates/select_control.atom.rxml
|
51
|
+
- spec/control_templates/select_control.directory.haml
|
52
|
+
- spec/control_templates/select_control.directory.haml/explanation.txt
|
53
|
+
- spec/control_templates/select_control.html.mab
|
54
|
+
- spec/control_templates/select_control.json.erb
|
55
|
+
- spec/control_templates/select_control.txt.bogus
|
56
|
+
- spec/control_templates/select_control.xhtml.haml
|
57
|
+
- spec/control_templates/select_control.xml.haml
|
58
|
+
- spec/instrument
|
59
|
+
- spec/instrument/control_builder_spec.rb
|
60
|
+
- spec/instrument/control_spec.rb
|
61
|
+
- spec/spec.opts
|
62
|
+
- spec/spec_helper.rb
|
63
|
+
- tasks/browse.rake
|
64
|
+
- tasks/clobber.rake
|
65
|
+
- tasks/gem.rake
|
66
|
+
- tasks/git.rake
|
67
|
+
- tasks/metrics.rake
|
68
|
+
- tasks/rdoc.rake
|
69
|
+
- tasks/rubyforge.rake
|
70
|
+
- tasks/spec.rake
|
71
|
+
- website/index.html
|
72
|
+
- CHANGELOG
|
73
|
+
- LICENSE
|
74
|
+
- Rakefile
|
75
|
+
- README
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://sporkmonger.com/
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options:
|
80
|
+
- --main
|
81
|
+
- README
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
89
|
+
version:
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: "0"
|
95
|
+
version:
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project: instrument
|
99
|
+
rubygems_version: 1.1.1
|
100
|
+
signing_key:
|
101
|
+
specification_version: 2
|
102
|
+
summary: Template-based Controls
|
103
|
+
test_files: []
|
104
|
+
|