bones-extras 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/README.txt +46 -0
- data/Rakefile +27 -0
- data/lib/bones/plugins/rcov.rb +96 -0
- data/lib/bones/plugins/rubyforge.rb +88 -0
- data/lib/bones/plugins/spec.rb +60 -0
- data/lib/bones/plugins/zentest.rb +43 -0
- metadata +85 -0
data/History.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
bones-extras
|
2
|
+
by Tim Pease
|
3
|
+
http://gemcutter.org/gems/bones-extras
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
The extras package for Mr Bones provides some handy Rake tasks for running
|
8
|
+
Rcov code coverage on your tests, running Rspec tests, running the Zentest
|
9
|
+
autotest package, and uploading gems and generated rdoc to RubyForge.
|
10
|
+
|
11
|
+
== REQUIREMENTS:
|
12
|
+
|
13
|
+
The extras package for Mr Bones provides some handy Rake tasks for running
|
14
|
+
Rcov code coverage on your tests, running Rspec tests, running the Zentest
|
15
|
+
autotest package, and uploading gems and generated rdoc to RubyForge. In order
|
16
|
+
to use these Rake tasks, the corresponding gems will need to be installed on
|
17
|
+
your system: rcov, rspec, zentest, and rubyforge.
|
18
|
+
|
19
|
+
== INSTALL:
|
20
|
+
|
21
|
+
sudo gem install bones-extras
|
22
|
+
|
23
|
+
== LICENSE:
|
24
|
+
|
25
|
+
(The MIT License)
|
26
|
+
|
27
|
+
Copyright (c) 2009
|
28
|
+
|
29
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
30
|
+
a copy of this software and associated documentation files (the
|
31
|
+
'Software'), to deal in the Software without restriction, including
|
32
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
33
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
34
|
+
permit persons to whom the Software is furnished to do so, subject to
|
35
|
+
the following conditions:
|
36
|
+
|
37
|
+
The above copyright notice and this permission notice shall be
|
38
|
+
included in all copies or substantial portions of the Software.
|
39
|
+
|
40
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
41
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
42
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
43
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
44
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
45
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
46
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
begin
|
3
|
+
require 'bones'
|
4
|
+
rescue LoadError
|
5
|
+
abort '### Please install the "bones" gem ###'
|
6
|
+
end
|
7
|
+
|
8
|
+
ensure_in_path 'lib'
|
9
|
+
task :default => 'test:run'
|
10
|
+
|
11
|
+
Bones.plugin :ann, :gem, :git, :notes, :rdoc
|
12
|
+
|
13
|
+
Bones {
|
14
|
+
name 'bones-extras'
|
15
|
+
authors 'Tim Pease'
|
16
|
+
email 'tim.pease@gmail.com'
|
17
|
+
url 'http://github.com/TwP/bones-extras'
|
18
|
+
version '1.0.0'
|
19
|
+
ignore_file '.gitignore'
|
20
|
+
|
21
|
+
depend_on 'bones'
|
22
|
+
|
23
|
+
use_gmail
|
24
|
+
enable_sudo
|
25
|
+
}
|
26
|
+
|
27
|
+
# EOF
|
@@ -0,0 +1,96 @@
|
|
1
|
+
|
2
|
+
module Bones::Plugins::Rcov
|
3
|
+
include ::Bones::Helpers
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def initialize_rcov
|
7
|
+
::Bones.config {
|
8
|
+
desc 'Configuration settings for the Rcov code coverage tool.'
|
9
|
+
rcov {
|
10
|
+
dir 'coverage', :desc => <<-__
|
11
|
+
Code coverage metrics will be written to this directory.
|
12
|
+
__
|
13
|
+
|
14
|
+
opts %w[--sort coverage -T], :desc => <<-__
|
15
|
+
An array of command line options that will be passed to the rcov
|
16
|
+
command when running your tests. See the Rcov help documentation
|
17
|
+
either online or from the command line by running 'rcov --help'.
|
18
|
+
__
|
19
|
+
|
20
|
+
threshold 90.0, :desc => <<-__
|
21
|
+
The threshold value (in percent) for coverage. If the actual
|
22
|
+
coverage is not greater than or equal to this value, the verify task
|
23
|
+
will raise an exception.
|
24
|
+
__
|
25
|
+
|
26
|
+
threshold_exact false, :desc => <<-__
|
27
|
+
Require the threshold to be met exactly. By default this option is
|
28
|
+
set to false.
|
29
|
+
__
|
30
|
+
}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def post_load
|
35
|
+
require 'rcov'
|
36
|
+
config = ::Bones.config
|
37
|
+
config.exclude << "^#{Regexp.escape(config.rcov.dir)}/"
|
38
|
+
have?(:rcov) { true }
|
39
|
+
rescue LoadError
|
40
|
+
have?(:rcov) { false }
|
41
|
+
end
|
42
|
+
|
43
|
+
def define_tasks
|
44
|
+
return unless have? :rcov
|
45
|
+
config = ::Bones.config
|
46
|
+
|
47
|
+
if have? :test
|
48
|
+
namespace :test do
|
49
|
+
desc 'Run rcov on the unit tests'
|
50
|
+
Rcov::RcovTask.new do |t|
|
51
|
+
t.output_dir = config.rcov.dir
|
52
|
+
t.rcov_opts = config.rcov.opts
|
53
|
+
t.ruby_opts = config.ruby_opts.dup.concat(config.test.opts)
|
54
|
+
|
55
|
+
t.test_files =
|
56
|
+
if test(?f, config.test.file) then [config.test.file]
|
57
|
+
else config.test.files.to_a end
|
58
|
+
|
59
|
+
t.libs = config.libs unless config.libs.empty?
|
60
|
+
end
|
61
|
+
|
62
|
+
task :clobber_rcov do
|
63
|
+
rm_r config.rcov.dir rescue nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
task :clobber => 'test:clobber_rcov'
|
67
|
+
end
|
68
|
+
|
69
|
+
if have? :spec
|
70
|
+
require 'spec/rake/verify_rcov'
|
71
|
+
namespace :spec do
|
72
|
+
desc 'Run all specs with Rcov'
|
73
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
74
|
+
t.ruby_opts = config.ruby_opts
|
75
|
+
t.spec_opts = config.spec.opts
|
76
|
+
t.spec_files = config.spec.files
|
77
|
+
t.libs += config.libs
|
78
|
+
t.rcov = true
|
79
|
+
t.rcov_dir = config.rcov.dir
|
80
|
+
t.rcov_opts.concat(config.rcov.opts)
|
81
|
+
end
|
82
|
+
|
83
|
+
RCov::VerifyTask.new(:verify) do |t|
|
84
|
+
t.threshold = config.rcov.threshold
|
85
|
+
t.index_html = File.join(config.rcov.dir, 'index.html')
|
86
|
+
t.require_exact_threshold = config.rcov.threshold_exact
|
87
|
+
end
|
88
|
+
|
89
|
+
task :verify => :rcov
|
90
|
+
remove_desc_for_task %w(spec:clobber_rcov)
|
91
|
+
end
|
92
|
+
task :clobber => 'spec:clobber_rcov'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end # module Bones::Plugins::Rcov
|
@@ -0,0 +1,88 @@
|
|
1
|
+
|
2
|
+
module Bones::Plugins::Rubyforge
|
3
|
+
|
4
|
+
def initialize_rubyforge
|
5
|
+
::Bones.config {
|
6
|
+
desc 'Configuration settings for RubyForge publishing.'
|
7
|
+
rubyforge {
|
8
|
+
name nil, :desc => <<-__
|
9
|
+
The RubyForge project name where your code will be published. If not
|
10
|
+
supplied, the RubyForge name will default to the base 'name' of your
|
11
|
+
gem. The RubyForge name is used when your gem name differs from the
|
12
|
+
registered project name; for example if you release multiple gems
|
13
|
+
under the same project.
|
14
|
+
__
|
15
|
+
}
|
16
|
+
|
17
|
+
rdoc {
|
18
|
+
remote_dir nil, :desc => <<-__
|
19
|
+
This is the remote directory to use when publishing RDoc HTML
|
20
|
+
documentation to your RubyForge project page. If not specified, this
|
21
|
+
defaults to the root of the project page.
|
22
|
+
__
|
23
|
+
}
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def post_load
|
28
|
+
require 'rubyforge'
|
29
|
+
require 'rake/contrib/sshpublisher'
|
30
|
+
config = ::Bones.config
|
31
|
+
have?(:rubyforge) { true }
|
32
|
+
rescue LoadError
|
33
|
+
have?(:rubyforge) { false }
|
34
|
+
end
|
35
|
+
|
36
|
+
def define_tasks
|
37
|
+
return unless have? :rubyforge
|
38
|
+
config = ::Bones.config
|
39
|
+
|
40
|
+
if have? :gem
|
41
|
+
namespace :gem do
|
42
|
+
desc 'Package and upload to RubyForge'
|
43
|
+
task :release => [:clobber, 'gem'] do |t|
|
44
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
45
|
+
abort "Versions don't match #{v} vs #{config.version}" if v != config.version
|
46
|
+
pkg = "pkg/#{config.gem._spec.full_name}"
|
47
|
+
|
48
|
+
rf = RubyForge.new
|
49
|
+
rf.configure rescue nil
|
50
|
+
puts 'Logging in'
|
51
|
+
rf.login
|
52
|
+
|
53
|
+
c = rf.userconfig
|
54
|
+
c['release_notes'] = config.description if config.description
|
55
|
+
c['release_changes'] = config.changes if config.changes
|
56
|
+
c['preformatted'] = true
|
57
|
+
|
58
|
+
files = Dir.glob("#{pkg}*.*")
|
59
|
+
|
60
|
+
puts "Releasing #{config.name} v. #{config.version}"
|
61
|
+
rf.add_release config.rubyforge.name, config.name, config.version, *files
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end # have? :gem
|
65
|
+
|
66
|
+
if have? :rdoc
|
67
|
+
namespace :doc do
|
68
|
+
desc 'Publish RDoc to RubyForge'
|
69
|
+
task :release => %w(doc:clobber_rdoc doc:rdoc) do
|
70
|
+
config = YAML.load(
|
71
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
72
|
+
)
|
73
|
+
|
74
|
+
host = "#{config['username']}@rubyforge.org"
|
75
|
+
remote_dir = "/var/www/gforge-projects/#{config.rubyforge.name}/"
|
76
|
+
remote_dir << config.rdoc.remote_dir if config.rdoc.remote_dir
|
77
|
+
local_dir = config.rdoc.dir
|
78
|
+
|
79
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
80
|
+
end
|
81
|
+
end # namespace :doc
|
82
|
+
end # have? :rdoc
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end # module Bones::Plugins::Rubyforge
|
87
|
+
|
88
|
+
# EOF
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
module Bones::Plugins::Spec
|
3
|
+
include ::Bones::Helpers
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def initialize_spec
|
7
|
+
::Bones.config {
|
8
|
+
desc 'Configuration settings for the RSpec test framework.'
|
9
|
+
spec {
|
10
|
+
files FileList['spec/**/*_spec.rb'], :desc => <<-__
|
11
|
+
The list of spec files to run. This defaults to all the ruby fines
|
12
|
+
in the 'spec' directory that end with '_spec.rb' as their filename.
|
13
|
+
__
|
14
|
+
|
15
|
+
opts [], :desc => <<-__
|
16
|
+
An array of command line options that will be passed to the spec
|
17
|
+
command when running your tests. See the RSpec help documentation
|
18
|
+
either online or from the command line by running 'spec --help'.
|
19
|
+
__
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def post_load
|
25
|
+
require 'spec/rake/spectask'
|
26
|
+
config = ::Bones.config
|
27
|
+
have?(:spec) { !config.spec.files.to_a.empty? }
|
28
|
+
rescue LoadError
|
29
|
+
have?(:spec) { false }
|
30
|
+
end
|
31
|
+
|
32
|
+
def define_tasks
|
33
|
+
return unless have? :spec
|
34
|
+
config = ::Bones.config
|
35
|
+
|
36
|
+
namespace :spec do
|
37
|
+
desc 'Run all specs with basic output'
|
38
|
+
Spec::Rake::SpecTask.new(:run) do |t|
|
39
|
+
t.ruby_opts = config.ruby_opts
|
40
|
+
t.spec_opts = config.spec.opts
|
41
|
+
t.spec_files = config.spec.files
|
42
|
+
t.libs += config.libs
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'Run all specs with text output'
|
46
|
+
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
47
|
+
t.ruby_opts = config.ruby_opts
|
48
|
+
t.spec_opts = config.spec.opts + ['--format', 'specdoc']
|
49
|
+
t.spec_files = config.spec.files
|
50
|
+
t.libs += config.libs
|
51
|
+
end
|
52
|
+
end # namespace :spec
|
53
|
+
|
54
|
+
desc 'Alias to spec:run'
|
55
|
+
task :spec => 'spec:run'
|
56
|
+
end
|
57
|
+
|
58
|
+
end # module Bones::Plugins::Spec
|
59
|
+
|
60
|
+
# EOF
|
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
module Bones::Plugins::Zentest
|
3
|
+
include ::Bones::Helpers
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def post_load
|
7
|
+
require 'zentest'
|
8
|
+
have?(:zentest) { true }
|
9
|
+
rescue LoadError
|
10
|
+
have?(:zentest) { false }
|
11
|
+
end
|
12
|
+
|
13
|
+
def define_tasks
|
14
|
+
return unless have? :zentest
|
15
|
+
|
16
|
+
if have? :test
|
17
|
+
require 'autotest'
|
18
|
+
namespace :test do
|
19
|
+
task :autotest do
|
20
|
+
load '.autotest' if test(?f, '.autotest')
|
21
|
+
Autotest.run
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Run the autotest loop'
|
26
|
+
task :autotest => 'test:autotest'
|
27
|
+
end
|
28
|
+
|
29
|
+
if have? :spec
|
30
|
+
require 'autotest/rspec'
|
31
|
+
namespace :spec do
|
32
|
+
task :autotest do
|
33
|
+
load '.autotest' if test(?f, '.autotest')
|
34
|
+
Autotest::Rspec.run
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'Run the autotest loop'
|
39
|
+
task :autotest => 'spec:autotest'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end # module Bones::Plugins::Zentest
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bones-extras
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Pease
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-04 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bones
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 3.0.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bones
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0
|
34
|
+
version:
|
35
|
+
description: |-
|
36
|
+
The extras package for Mr Bones provides some handy Rake tasks for running
|
37
|
+
Rcov code coverage on your tests, running Rspec tests, running the Zentest
|
38
|
+
autotest package, and uploading gems and generated rdoc to RubyForge.
|
39
|
+
email: tim.pease@gmail.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
45
|
+
- History.txt
|
46
|
+
- README.txt
|
47
|
+
files:
|
48
|
+
- History.txt
|
49
|
+
- README.txt
|
50
|
+
- Rakefile
|
51
|
+
- lib/bones/plugins/rcov.rb
|
52
|
+
- lib/bones/plugins/rubyforge.rb
|
53
|
+
- lib/bones/plugins/spec.rb
|
54
|
+
- lib/bones/plugins/zentest.rb
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: http://github.com/TwP/bones-extras
|
57
|
+
licenses: []
|
58
|
+
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options:
|
61
|
+
- --main
|
62
|
+
- README.txt
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
version:
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
version:
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project: bones-extras
|
80
|
+
rubygems_version: 1.3.5
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: The extras package for Mr Bones provides some handy Rake tasks for running Rcov code coverage on your tests, running Rspec tests, running the Zentest autotest package, and uploading gems and generated rdoc to RubyForge
|
84
|
+
test_files: []
|
85
|
+
|