windmill 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/LICENSE +20 -0
- data/README +5 -0
- data/Rakefile +50 -0
- data/lib/windmill/version.rb +11 -0
- data/lib/windmill.rb +81 -0
- data/spec/windmill_spec.rb +159 -0
- data/tasks/clobber.rake +2 -0
- data/tasks/gem.rake +68 -0
- data/tasks/git.rake +40 -0
- data/tasks/metrics.rake +22 -0
- data/tasks/rdoc.rake +29 -0
- data/tasks/rubyforge.rake +89 -0
- data/tasks/spec.rake +63 -0
- metadata +101 -0
data/CHANGELOG
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Windmill Ruby driver, Copyright (c) 2008 Dirkjan Bussink
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "lib"))
|
2
|
+
$:.unshift(lib_dir)
|
3
|
+
$:.uniq!
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
require 'rake/packagetask'
|
10
|
+
require 'rake/gempackagetask'
|
11
|
+
require 'rake/contrib/rubyforgepublisher'
|
12
|
+
require 'spec/rake/spectask'
|
13
|
+
|
14
|
+
require File.join(File.dirname(__FILE__), 'lib/windmill', 'version')
|
15
|
+
|
16
|
+
PKG_DISPLAY_NAME = 'Windmill'
|
17
|
+
PKG_NAME = PKG_DISPLAY_NAME.downcase
|
18
|
+
PKG_VERSION = Windmill::VERSION::STRING
|
19
|
+
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
20
|
+
|
21
|
+
RELEASE_NAME = "REL #{PKG_VERSION}"
|
22
|
+
|
23
|
+
RUBY_FORGE_PROJECT = PKG_NAME
|
24
|
+
RUBY_FORGE_USER = "dbussink"
|
25
|
+
RUBY_FORGE_PATH = "/var/www/gforge-projects/#{RUBY_FORGE_PROJECT}"
|
26
|
+
RUBY_FORGE_URL = "http://#{RUBY_FORGE_PROJECT}.rubyforge.org/"
|
27
|
+
|
28
|
+
PKG_SUMMARY = "Windmill Ruby driver"
|
29
|
+
PKG_DESCRIPTION = <<-TEXT
|
30
|
+
Basic Ruby Windmill client so it's easy to integrate with
|
31
|
+
for example Cucumber features.
|
32
|
+
TEXT
|
33
|
+
|
34
|
+
PKG_FILES = FileList[
|
35
|
+
"lib/**/*", "spec/**/*", "vendor/**/*",
|
36
|
+
"tasks/**/*", "website/**/*",
|
37
|
+
"[A-Z]*", "Rakefile"
|
38
|
+
].exclude(/database\.yml/).exclude(/[_\.]git$/)
|
39
|
+
|
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
|
46
|
+
|
47
|
+
WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false
|
48
|
+
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
|
49
|
+
|
50
|
+
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
data/lib/windmill.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
gem 'jsonrpc'
|
2
|
+
|
3
|
+
require 'jsonrpc'
|
4
|
+
|
5
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'windmill', 'version'))
|
6
|
+
|
7
|
+
module Windmill
|
8
|
+
|
9
|
+
class Client
|
10
|
+
|
11
|
+
def initialize(url)
|
12
|
+
@jsonrpc = JsonRPC::Client.new(url)
|
13
|
+
# Retrieve all available API methods
|
14
|
+
|
15
|
+
result = execute_command(:method => "commands.getControllerMethods")
|
16
|
+
if result["status"]
|
17
|
+
result["result"].each do |full_method|
|
18
|
+
method = full_method
|
19
|
+
if loc = method.index('.')
|
20
|
+
method = method[(loc + 1) .. method.size]
|
21
|
+
end
|
22
|
+
if method =~ /command/
|
23
|
+
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
24
|
+
def #{method}(*args)
|
25
|
+
if args.empty?
|
26
|
+
args = {}
|
27
|
+
elsif args.size == 1
|
28
|
+
args = args.first
|
29
|
+
end
|
30
|
+
execute_command(:method => "#{full_method}", :params => args)
|
31
|
+
end
|
32
|
+
RUBY
|
33
|
+
else
|
34
|
+
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
35
|
+
def #{method}(*args)
|
36
|
+
if args.empty?
|
37
|
+
args = {}
|
38
|
+
elsif args.size == 1
|
39
|
+
args = args.first
|
40
|
+
end
|
41
|
+
execute_test(:method => "#{full_method}", :params => args)
|
42
|
+
end
|
43
|
+
RUBY
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def execute_command(action_object = {})
|
50
|
+
action_object[:params] ||= {}
|
51
|
+
result = @jsonrpc.request("execute_command", :action_object => action_object)
|
52
|
+
result["result"]
|
53
|
+
end
|
54
|
+
|
55
|
+
def execute_test(action_object = {})
|
56
|
+
action_object[:params] ||= {}
|
57
|
+
result = @jsonrpc.request("execute_test", :action_object => action_object)
|
58
|
+
result["result"]
|
59
|
+
end
|
60
|
+
|
61
|
+
def waits
|
62
|
+
self
|
63
|
+
end
|
64
|
+
|
65
|
+
def asserts
|
66
|
+
self
|
67
|
+
end
|
68
|
+
|
69
|
+
def start_suite(suite_name)
|
70
|
+
result = @jsonrpc.request("start_suite", :suite_name => suite_name)
|
71
|
+
result["result"]
|
72
|
+
end
|
73
|
+
|
74
|
+
def stop_suite
|
75
|
+
result = @jsonrpc.request("stop_suite", {})
|
76
|
+
result["result"]
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
require 'jsonrpc'
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'windmill'))
|
3
|
+
|
4
|
+
# Mock around Net::HTTP so we don't need a real connection.
|
5
|
+
# We just verify whether the correct data is posted and return
|
6
|
+
# know test data
|
7
|
+
|
8
|
+
class Net::HTTP < Net::Protocol
|
9
|
+
def connect
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Net::HTTPResponse
|
14
|
+
def body=(content)
|
15
|
+
@body = content
|
16
|
+
@read = true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Net::HTTP < Net::Protocol
|
21
|
+
|
22
|
+
def self.raw_response_data
|
23
|
+
@raw_response_data
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.raw_response_data=(data)
|
27
|
+
@raw_response_data = data
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.raw_post_body=(body)
|
31
|
+
@raw_post_body = body
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.raw_post_body
|
35
|
+
@raw_post_body
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.raw_post_path=(path)
|
39
|
+
@raw_post_path = path
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.raw_post_path
|
43
|
+
@raw_post_path
|
44
|
+
end
|
45
|
+
|
46
|
+
def post(path, body, headers = [])
|
47
|
+
res = Net::HTTPSuccess.new('1.2', '200', 'OK')
|
48
|
+
self.class.raw_post_path = path
|
49
|
+
self.class.raw_post_body = body
|
50
|
+
res.body = self.class.raw_response_data
|
51
|
+
res
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe Windmill::Client do
|
56
|
+
|
57
|
+
before do
|
58
|
+
Net::HTTP.raw_response_data = '{"result": {"status": true, "version": "0.1", "suite_name": "__main__",
|
59
|
+
"result": ["click","waits.forJS","asserts.assertText"],
|
60
|
+
"params": {"uuid":"123"},
|
61
|
+
"method": "commands.getControllerMethods"}, "id": "1"}'
|
62
|
+
@windmill = Windmill::Client.new("http://localhost:4444/api")
|
63
|
+
end
|
64
|
+
|
65
|
+
# Not supported atm
|
66
|
+
it { @windmill.should respond_to(:start_suite) }
|
67
|
+
it { @windmill.should respond_to(:stop_suite) }
|
68
|
+
#it { @windmill.should respond_to(:add_object) }
|
69
|
+
#it { @windmill.should respond_to(:add_json_test) }
|
70
|
+
#it { @windmill.should respond_to(:add_test) }
|
71
|
+
#it { @windmill.should respond_to(:add_json_command) }
|
72
|
+
#it { @windmill.should respond_to(:add_command) }
|
73
|
+
#it { @windmill.should respond_to(:execute_object) }
|
74
|
+
#it { @windmill.should respond_to(:execute_json_command) }
|
75
|
+
#it { @windmill.should respond_to(:execute_json_test) }
|
76
|
+
|
77
|
+
it { @windmill.should respond_to(:execute_command) }
|
78
|
+
it { @windmill.should respond_to(:execute_test) }
|
79
|
+
|
80
|
+
# It should also respond to methods defined in the API
|
81
|
+
it { @windmill.should respond_to(:waits) }
|
82
|
+
it { @windmill.should respond_to(:asserts) }
|
83
|
+
it { @windmill.should respond_to(:click) }
|
84
|
+
it { @windmill.waits.should respond_to(:forJS) }
|
85
|
+
it { @windmill.asserts.should respond_to(:assertText) }
|
86
|
+
|
87
|
+
describe 'execute_command' do
|
88
|
+
|
89
|
+
before do
|
90
|
+
Net::HTTP.raw_response_data = '{"result": {"status": true, "version": "0.1", "suite_name": "__main__",
|
91
|
+
"result": ["click","waits.forJS","asserts.assertText"],
|
92
|
+
"params": {"uuid":"123"},
|
93
|
+
"method": "commands.getControllerMethods"}, "id": "1"}'
|
94
|
+
@windmill = Windmill::Client.new("http://localhost:4444/api")
|
95
|
+
@result = @windmill.execute_command(:method => "commands.getControllerMethods")
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'should correctly run the command' do
|
99
|
+
@result.should == {"status" => true, "version" => "0.1", "suite_name" => "__main__", "result" => ["click","waits.forJS","asserts.assertText"],
|
100
|
+
"params" => {"uuid" => "123"},
|
101
|
+
"method" => "commands.getControllerMethods"}
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
describe 'start_suite' do
|
107
|
+
|
108
|
+
before do
|
109
|
+
Net::HTTP.raw_response_data = '{"result": {"status": true, "version": "0.1", "suite_name": "__main__",
|
110
|
+
"result": ["click","waits.forJS","asserts.assertText"],
|
111
|
+
"params": {"uuid":"123"},
|
112
|
+
"method": "commands.getControllerMethods"}, "id": "1"}'
|
113
|
+
@windmill = Windmill::Client.new("http://localhost:4444/api")
|
114
|
+
@result = @windmill.start_suite('test_suite')
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should correctly run the command' do
|
118
|
+
JSON.parse(Net::HTTP.raw_post_body).should == JSON.parse('{"method":"start_suite","params":{"suite_name":"test_suite"}}')
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
describe 'stop_suite' do
|
125
|
+
|
126
|
+
before do
|
127
|
+
Net::HTTP.raw_response_data = '{"result": {"status": true, "version": "0.1", "suite_name": "__main__",
|
128
|
+
"result": ["click","waits.forJS","asserts.assertText"],
|
129
|
+
"params": {"uuid":"123"},
|
130
|
+
"method": "commands.getControllerMethods"}, "id": "1"}'
|
131
|
+
@windmill = Windmill::Client.new("http://localhost:4444/api")
|
132
|
+
@result = @windmill.stop_suite
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'should correctly run the command' do
|
136
|
+
JSON.parse(Net::HTTP.raw_post_body).should == JSON.parse('{"method":"stop_suite","params":{}}')
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
|
141
|
+
describe 'executing a generated method' do
|
142
|
+
|
143
|
+
before do
|
144
|
+
Net::HTTP.raw_response_data = '{"result": {"version": "0.1", "suite_name": "__main__", "result": true,
|
145
|
+
"starttime": "2008-11-19T14:29:48.658Z",
|
146
|
+
"params": {"link": "People", "uuid": "1b38d526-cdd1-11dd-87e4-001ec20a547b"},
|
147
|
+
"endtime": "2008-11-19T14:29:48.661Z", "method": "click"},
|
148
|
+
"id": "1"}'
|
149
|
+
@windmill = Windmill::Client.new("http://localhost:4444/api")
|
150
|
+
@result = @windmill.click(:link => "People")
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'should generate the correct JSON request' do
|
154
|
+
JSON.parse(Net::HTTP.raw_post_body).should == JSON.parse('{"method":"execute_test","params":{"action_object":{"method":"click","params":{"link":"People"}}}}')
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
data/tasks/clobber.rake
ADDED
data/tasks/gem.rake
ADDED
@@ -0,0 +1,68 @@
|
|
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
|
+
if !s.respond_to?(:add_development_dependency)
|
17
|
+
puts "Cannot build Gem with this version of RubyGems."
|
18
|
+
exit(1)
|
19
|
+
end
|
20
|
+
|
21
|
+
s.add_development_dependency("rake", ">= 0.7.3")
|
22
|
+
s.add_development_dependency("rspec", ">= 1.0.8")
|
23
|
+
s.add_development_dependency("launchy", ">= 0.3.2")
|
24
|
+
|
25
|
+
s.require_path = "lib"
|
26
|
+
|
27
|
+
s.author = "Bob Aman"
|
28
|
+
s.email = "bob@sporkmonger.com"
|
29
|
+
s.homepage = RUBY_FORGE_URL
|
30
|
+
s.rubyforge_project = RUBY_FORGE_PROJECT
|
31
|
+
end
|
32
|
+
|
33
|
+
Rake::GemPackageTask.new(GEM_SPEC) do |p|
|
34
|
+
p.gem_spec = GEM_SPEC
|
35
|
+
p.need_tar = true
|
36
|
+
p.need_zip = true
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Show information about the gem"
|
40
|
+
task :debug do
|
41
|
+
puts GEM_SPEC.to_ruby
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Install the gem"
|
45
|
+
task :install => ["clobber", "gem:package"] do
|
46
|
+
sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Uninstall the gem"
|
50
|
+
task :uninstall do
|
51
|
+
installed_list = Gem.source_index.find_name(PKG_NAME)
|
52
|
+
if installed_list &&
|
53
|
+
(installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
|
54
|
+
sh(
|
55
|
+
"#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
|
56
|
+
"--ignore-dependencies --executables #{PKG_NAME}"
|
57
|
+
)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "Reinstall the gem"
|
62
|
+
task :reinstall => [:uninstall, :install]
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "Alias to gem:package"
|
66
|
+
task "gem" => "gem:package"
|
67
|
+
|
68
|
+
task "clobber" => ["gem:clobber_package"]
|
data/tasks/git.rake
ADDED
@@ -0,0 +1,40 @@
|
|
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
|
+
changelog = File.open("CHANGELOG", "r") { |file| file.read }
|
14
|
+
puts "-" * 80
|
15
|
+
puts changelog
|
16
|
+
puts "-" * 80
|
17
|
+
puts
|
18
|
+
|
19
|
+
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
|
20
|
+
abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
|
21
|
+
|
22
|
+
tag = "#{PKG_NAME}-#{PKG_VERSION}"
|
23
|
+
msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
|
24
|
+
|
25
|
+
existing_tags = `git tag -l instrument-*`.split("\n")
|
26
|
+
if existing_tags.include?(tag)
|
27
|
+
warn("Tag already exists, deleting...")
|
28
|
+
unless system "git tag -d #{tag}"
|
29
|
+
abort "Tag deletion failed."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
puts "Creating git tag '#{tag}'..."
|
33
|
+
unless system "git tag -a -m \"#{msg}\" #{tag}"
|
34
|
+
abort "Tag creation failed."
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
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,89 @@
|
|
1
|
+
namespace :gem do
|
2
|
+
desc 'Package and upload to RubyForge'
|
3
|
+
task :release => ["gem:package"] do |t|
|
4
|
+
require 'rubyforge'
|
5
|
+
|
6
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
7
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PKG_VERSION
|
8
|
+
pkg = "pkg/#{GEM_SPEC.full_name}"
|
9
|
+
|
10
|
+
rf = RubyForge.new
|
11
|
+
rf.configure
|
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
|
+
require "rake/contrib/sshpublisher"
|
31
|
+
require "yaml"
|
32
|
+
|
33
|
+
config = YAML.load(
|
34
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
35
|
+
)
|
36
|
+
host = "#{config['username']}@rubyforge.org"
|
37
|
+
remote_dir = RUBY_FORGE_PATH + "/api"
|
38
|
+
local_dir = "doc"
|
39
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
namespace :spec do
|
44
|
+
desc "Publish specdoc to RubyForge"
|
45
|
+
task :release => ["spec:specdoc"] do
|
46
|
+
require "rake/contrib/sshpublisher"
|
47
|
+
require "yaml"
|
48
|
+
|
49
|
+
config = YAML.load(
|
50
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
51
|
+
)
|
52
|
+
host = "#{config['username']}@rubyforge.org"
|
53
|
+
remote_dir = RUBY_FORGE_PATH + "/specdoc"
|
54
|
+
local_dir = "specdoc"
|
55
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
56
|
+
end
|
57
|
+
|
58
|
+
namespace :rcov do
|
59
|
+
desc "Publish coverage report to RubyForge"
|
60
|
+
task :release => ["spec:rcov"] do
|
61
|
+
require "rake/contrib/sshpublisher"
|
62
|
+
require "yaml"
|
63
|
+
|
64
|
+
config = YAML.load(
|
65
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
66
|
+
)
|
67
|
+
host = "#{config['username']}@rubyforge.org"
|
68
|
+
remote_dir = RUBY_FORGE_PATH + "/coverage"
|
69
|
+
local_dir = "coverage"
|
70
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
namespace :website do
|
76
|
+
desc "Publish website to RubyForge"
|
77
|
+
task :release => ["doc:release", "spec:release", "spec:rcov:release"] do
|
78
|
+
require "rake/contrib/sshpublisher"
|
79
|
+
require "yaml"
|
80
|
+
|
81
|
+
config = YAML.load(
|
82
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
83
|
+
)
|
84
|
+
host = "#{config['username']}@rubyforge.org"
|
85
|
+
remote_dir = RUBY_FORGE_PATH
|
86
|
+
local_dir = "website"
|
87
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
88
|
+
end
|
89
|
+
end
|
data/tasks/spec.rake
ADDED
@@ -0,0 +1,63 @@
|
|
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
|
+
if RCOV_ENABLED
|
8
|
+
t.rcov = true
|
9
|
+
else
|
10
|
+
t.rcov = false
|
11
|
+
end
|
12
|
+
t.rcov_opts = [
|
13
|
+
'--exclude', 'spec',
|
14
|
+
'--exclude', '1\\.8\\/gems',
|
15
|
+
'--exclude', '1\\.9\\/gems',
|
16
|
+
]
|
17
|
+
end
|
18
|
+
|
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
|
23
|
+
end
|
24
|
+
|
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
|
33
|
+
|
34
|
+
desc "Generate HTML Specdocs for all specs"
|
35
|
+
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
36
|
+
specdoc_path = File.expand_path(
|
37
|
+
File.join(File.dirname(__FILE__), '../specdoc/'))
|
38
|
+
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
|
39
|
+
|
40
|
+
output_file = File.join(specdoc_path, 'index.html')
|
41
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
42
|
+
t.spec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
|
43
|
+
t.fail_on_error = false
|
44
|
+
end
|
45
|
+
|
46
|
+
namespace :rcov do
|
47
|
+
desc "Browse the code coverage report."
|
48
|
+
task :browse => "spec:rcov" do
|
49
|
+
require "launchy"
|
50
|
+
Launchy::Browser.run("coverage/index.html")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if RCOV_ENABLED
|
56
|
+
desc "Alias to spec:verify"
|
57
|
+
task "spec" => "spec:verify"
|
58
|
+
else
|
59
|
+
desc "Alias to spec:normal"
|
60
|
+
task "spec" => "spec:normal"
|
61
|
+
end
|
62
|
+
|
63
|
+
task "clobber" => ["spec:clobber_rcov"]
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: windmill
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bob Aman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-12 00:00:00 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.7.3
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.8
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: launchy
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.3.2
|
44
|
+
version:
|
45
|
+
description: |
|
46
|
+
Basic Ruby Windmill client so it's easy to integrate with
|
47
|
+
for example Cucumber features.
|
48
|
+
|
49
|
+
email: bob@sporkmonger.com
|
50
|
+
executables: []
|
51
|
+
|
52
|
+
extensions: []
|
53
|
+
|
54
|
+
extra_rdoc_files:
|
55
|
+
- README
|
56
|
+
files:
|
57
|
+
- lib/windmill/version.rb
|
58
|
+
- lib/windmill.rb
|
59
|
+
- spec/windmill_spec.rb
|
60
|
+
- tasks/clobber.rake
|
61
|
+
- tasks/gem.rake
|
62
|
+
- tasks/git.rake
|
63
|
+
- tasks/metrics.rake
|
64
|
+
- tasks/rdoc.rake
|
65
|
+
- tasks/rubyforge.rake
|
66
|
+
- tasks/spec.rake
|
67
|
+
- CHANGELOG
|
68
|
+
- LICENSE
|
69
|
+
- Rakefile
|
70
|
+
- README
|
71
|
+
has_rdoc: true
|
72
|
+
homepage: http://windmill.rubyforge.org/
|
73
|
+
licenses: []
|
74
|
+
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options:
|
77
|
+
- --main
|
78
|
+
- README
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
version:
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project: windmill
|
96
|
+
rubygems_version: 1.3.4
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: Windmill Ruby driver
|
100
|
+
test_files: []
|
101
|
+
|