bones-rspec 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/History.txt +5 -0
- data/{README.txt → README.md} +23 -8
- data/Rakefile +1 -2
- data/lib/bones/plugins/rspec.rb +41 -0
- data/lib/bones/rspec/rspec_version1.rb +87 -0
- data/lib/bones/rspec/rspec_version2.rb +85 -0
- data/version.txt +1 -1
- metadata +28 -26
- data/lib/bones/plugins/spec.rb +0 -84
data/.gitignore
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# The list of files that should be ignored by Mr Bones.
|
2
|
+
# Lines that start with '#' are comments.
|
3
|
+
#
|
4
|
+
# A .gitignore file can be used instead by setting it as the ignore
|
5
|
+
# file in your Rakefile:
|
6
|
+
#
|
7
|
+
# Bones {
|
8
|
+
# ignore_file '.gitignore'
|
9
|
+
# }
|
10
|
+
#
|
11
|
+
# For a project with a C extension, the following would be a good set of
|
12
|
+
# exclude patterns (uncomment them if you want to use them):
|
13
|
+
# *.[oa]
|
14
|
+
# *~
|
15
|
+
announcement.txt
|
16
|
+
coverage
|
17
|
+
doc
|
18
|
+
pkg
|
data/History.txt
CHANGED
data/{README.txt → README.md}
RENAMED
@@ -1,20 +1,35 @@
|
|
1
|
-
bones-rspec
|
2
|
-
by Tim Pease
|
3
|
-
http://rubygems.org/gems/bones-rspec
|
1
|
+
# bones-rspec
|
4
2
|
|
5
|
-
|
3
|
+
A plugin for [Mr Bones](http://rugyems.org/gems/bones) that incorporates rake
|
4
|
+
tasks for running RSpec style tests.
|
5
|
+
|
6
|
+
## DESCRIPTION
|
6
7
|
|
7
8
|
The rspec package for Mr Bones provides tasks to incorporate rspec tests into
|
8
9
|
bones based projects. It also works in tandem with the bones-rcov plugin to
|
9
10
|
run code coverage over your specs.
|
10
11
|
|
11
|
-
|
12
|
+
This plugin is compatible with both RSpec version 1 and RSpec version 2. If
|
13
|
+
you have both RSpec versions installed this plugin will favor the newer
|
14
|
+
version of RSpec. To force use of the older RSpec version, use the **gem**
|
15
|
+
command in your Rakefile to load the appropriate version.
|
16
|
+
|
17
|
+
gem 'rspec', '~> 1.3.0'
|
18
|
+
|
19
|
+
Bones {
|
20
|
+
name 'my-awesome-gem'
|
21
|
+
...
|
22
|
+
}
|
23
|
+
|
24
|
+
The gem command must appear before the Bones configuration block.
|
25
|
+
|
26
|
+
## INSTALL
|
12
27
|
|
13
|
-
|
28
|
+
gem install bones-rspec
|
14
29
|
|
15
|
-
|
30
|
+
#### LICENSE
|
16
31
|
|
17
|
-
|
32
|
+
*The MIT License*
|
18
33
|
|
19
34
|
Copyright (c) 2010
|
20
35
|
|
data/Rakefile
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
module Bones::Plugins::Rspec
|
3
|
+
include ::Bones::Helpers
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def initialize_rspec
|
7
|
+
gemspec = Gem.loaded_specs['rspec']
|
8
|
+
|
9
|
+
if gemspec
|
10
|
+
version = gemspec.version.segments.first
|
11
|
+
path = File.expand_path("../../rspec/rspec_version#{version}", __FILE__)
|
12
|
+
require path
|
13
|
+
|
14
|
+
@delegate = Bones::Rspec.const_get "RspecVersion#{version}"
|
15
|
+
have?(:rspec) { @delegate.initialize_rspec }
|
16
|
+
else
|
17
|
+
version = 2
|
18
|
+
while (version > 0)
|
19
|
+
path = File.expand_path("../../rspec/rspec_version#{version}", __FILE__)
|
20
|
+
require path
|
21
|
+
|
22
|
+
@delegate = Bones::Rspec.const_get "RspecVersion#{version}"
|
23
|
+
have?(:rspec) { @delegate.initialize_rspec }
|
24
|
+
break if have? :rspec
|
25
|
+
version -= 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def post_load
|
31
|
+
return unless have? :rspec
|
32
|
+
@delegate.post_load
|
33
|
+
end
|
34
|
+
|
35
|
+
def define_tasks
|
36
|
+
return unless have? :rspec
|
37
|
+
@delegate.define_tasks
|
38
|
+
end
|
39
|
+
|
40
|
+
end # Bones::Plugins::Rspec
|
41
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
|
2
|
+
module Bones::Rspec
|
3
|
+
|
4
|
+
module RspecVersion1
|
5
|
+
include ::Bones::Helpers
|
6
|
+
extend self
|
7
|
+
|
8
|
+
def initialize_rspec
|
9
|
+
require 'spec/rake/spectask'
|
10
|
+
|
11
|
+
::Bones.config {
|
12
|
+
desc 'Configuration settings for the RSpec test framework.'
|
13
|
+
spec {
|
14
|
+
files FileList['spec/**/*_spec.rb'], :desc => <<-__
|
15
|
+
The list of spec files to run. This defaults to all the ruby fines
|
16
|
+
in the 'spec' directory that end with '_spec.rb' as their filename.
|
17
|
+
__
|
18
|
+
|
19
|
+
opts [], :desc => <<-__
|
20
|
+
An array of command line options that will be passed to the rspec
|
21
|
+
command when running your tests. See the RSpec help documentation
|
22
|
+
either online or from the command line by running 'spec --help'.
|
23
|
+
|
24
|
+
Options can also be defined in the "spec/spec.opts" file. Please
|
25
|
+
leave this opts array empty if you prefer to use the spec.opts file
|
26
|
+
instead. However, both can be used in conjunction; watch out for
|
27
|
+
options colliions.
|
28
|
+
__
|
29
|
+
}
|
30
|
+
}
|
31
|
+
return true
|
32
|
+
|
33
|
+
rescue LoadError
|
34
|
+
return false
|
35
|
+
end
|
36
|
+
|
37
|
+
def post_load
|
38
|
+
config = ::Bones.config
|
39
|
+
have?(:rspec) { !config.spec.files.to_a.empty? }
|
40
|
+
end
|
41
|
+
|
42
|
+
def define_tasks
|
43
|
+
config = ::Bones.config
|
44
|
+
|
45
|
+
namespace :spec do
|
46
|
+
desc 'Run all specs with basic output'
|
47
|
+
Spec::Rake::SpecTask.new(:run) do |t|
|
48
|
+
t.ruby_opts = config.ruby_opts
|
49
|
+
t.spec_opts = config.spec.opts unless config.spec.opts.empty?
|
50
|
+
t.spec_files = config.spec.files
|
51
|
+
t.libs += config.libs
|
52
|
+
end
|
53
|
+
|
54
|
+
if have? :rcov
|
55
|
+
require 'spec/rake/verify_rcov'
|
56
|
+
|
57
|
+
desc 'Run all specs with Rcov'
|
58
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
59
|
+
t.ruby_opts = config.ruby_opts
|
60
|
+
t.spec_opts = config.spec.opts unless config.spec.opts.empty?
|
61
|
+
t.spec_files = config.spec.files
|
62
|
+
t.libs += config.libs
|
63
|
+
t.rcov = true
|
64
|
+
t.rcov_dir = config.rcov.dir
|
65
|
+
t.rcov_opts.concat(config.rcov.opts)
|
66
|
+
end
|
67
|
+
|
68
|
+
RCov::VerifyTask.new(:verify) do |t|
|
69
|
+
t.threshold = config.rcov.threshold
|
70
|
+
t.index_html = File.join(config.rcov.dir, 'index.html')
|
71
|
+
t.require_exact_threshold = config.rcov.threshold_exact
|
72
|
+
end
|
73
|
+
|
74
|
+
task :verify => :rcov
|
75
|
+
remove_desc_for_task %w(spec:clobber_rcov)
|
76
|
+
end
|
77
|
+
end # namespace :spec
|
78
|
+
|
79
|
+
desc 'Alias to spec:run'
|
80
|
+
task :spec => 'spec:run'
|
81
|
+
|
82
|
+
task :clobber => 'spec:clobber_rcov' if have? :rcov
|
83
|
+
end
|
84
|
+
|
85
|
+
end # RspecVersion1
|
86
|
+
end # Bones::Rspec
|
87
|
+
|
@@ -0,0 +1,85 @@
|
|
1
|
+
|
2
|
+
module Bones::Rspec
|
3
|
+
|
4
|
+
module RspecVersion2
|
5
|
+
include ::Bones::Helpers
|
6
|
+
extend self
|
7
|
+
|
8
|
+
def initialize_rspec
|
9
|
+
require 'rspec/core/rake_task'
|
10
|
+
|
11
|
+
::Bones.config {
|
12
|
+
desc 'Configuration settings for the RSpec test framework.'
|
13
|
+
spec {
|
14
|
+
files 'spec/**/*_spec.rb', :desc => <<-__
|
15
|
+
Glob pattern used to match spec files to run. This defaults to all
|
16
|
+
the ruby fines in the 'spec' directory that end with '_spec.rb' as
|
17
|
+
their filename.
|
18
|
+
__
|
19
|
+
|
20
|
+
opts [], :desc => <<-__
|
21
|
+
An array of command line options that will be passed to the rspec
|
22
|
+
command when running your tests. See the RSpec help documentation
|
23
|
+
either online or from the command line by running 'spec --help'.
|
24
|
+
|
25
|
+
Options can also be defined in the "spec/spec.opts" file. Please
|
26
|
+
leave this opts array empty if you prefer to use the spec.opts file
|
27
|
+
instead. However, both can be used in conjunction; watch out for
|
28
|
+
options colliions.
|
29
|
+
__
|
30
|
+
}
|
31
|
+
}
|
32
|
+
return true
|
33
|
+
|
34
|
+
rescue LoadError
|
35
|
+
return false
|
36
|
+
end
|
37
|
+
|
38
|
+
def post_load
|
39
|
+
config = ::Bones.config
|
40
|
+
have?(:rspec) { !FileList[config.spec.files].to_a.empty? }
|
41
|
+
end
|
42
|
+
|
43
|
+
def define_tasks
|
44
|
+
config = ::Bones.config
|
45
|
+
|
46
|
+
namespace :spec do
|
47
|
+
desc 'Run all specs with basic output'
|
48
|
+
::RSpec::Core::RakeTask.new(:run) do |t|
|
49
|
+
t.ruby_opts = config.ruby_opts
|
50
|
+
t.rspec_opts = config.spec.opts unless config.spec.opts.empty?
|
51
|
+
t.pattern = config.spec.files
|
52
|
+
end
|
53
|
+
|
54
|
+
if have? :rcov
|
55
|
+
desc 'Run all specs with Rcov'
|
56
|
+
::RSpec::Core::RakeTask.new(:rcov) do |t|
|
57
|
+
t.ruby_opts = config.ruby_opts
|
58
|
+
t.rspec_opts = config.spec.opts unless config.spec.opts.empty?
|
59
|
+
t.pattern = config.spec.files
|
60
|
+
|
61
|
+
t.rcov = true
|
62
|
+
t.rcov_path = config.rcov.path
|
63
|
+
|
64
|
+
rcov_opts = []
|
65
|
+
rcov_opts.concat config.rcov.opts
|
66
|
+
rcov_opts << '--output' << config.rcov.dir if config.rcov.dir
|
67
|
+
|
68
|
+
t.rcov_opts = rcov_opts
|
69
|
+
end
|
70
|
+
|
71
|
+
task :clobber_rcov do
|
72
|
+
rm_r config.rcov.dir rescue nil
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end # namespace :spec
|
76
|
+
|
77
|
+
desc 'Alias to spec:run'
|
78
|
+
task :spec => 'spec:run'
|
79
|
+
|
80
|
+
task :clobber => 'spec:clobber_rcov' if have? :rcov
|
81
|
+
end
|
82
|
+
|
83
|
+
end # RspecVersion2
|
84
|
+
end # Bones::Rspec
|
85
|
+
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bones-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
|
-
-
|
8
|
-
- 1
|
7
|
+
- 2
|
9
8
|
- 0
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 2.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tim Pease
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-05 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -24,14 +24,14 @@ dependencies:
|
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - "="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 25
|
30
30
|
segments:
|
31
31
|
- 3
|
32
|
-
-
|
33
|
-
-
|
34
|
-
version: 3.
|
32
|
+
- 6
|
33
|
+
- 3
|
34
|
+
version: 3.6.3
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -40,12 +40,14 @@ dependencies:
|
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - "="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 25
|
46
46
|
segments:
|
47
47
|
- 1
|
48
|
-
|
48
|
+
- 3
|
49
|
+
- 1
|
50
|
+
version: 1.3.1
|
49
51
|
type: :runtime
|
50
52
|
version_requirements: *id002
|
51
53
|
- !ruby/object:Gem::Dependency
|
@@ -56,18 +58,17 @@ dependencies:
|
|
56
58
|
requirements:
|
57
59
|
- - ">="
|
58
60
|
- !ruby/object:Gem::Version
|
59
|
-
hash:
|
61
|
+
hash: 25
|
60
62
|
segments:
|
61
63
|
- 3
|
62
|
-
-
|
63
|
-
-
|
64
|
-
version: 3.
|
64
|
+
- 6
|
65
|
+
- 3
|
66
|
+
version: 3.6.3
|
65
67
|
type: :development
|
66
68
|
version_requirements: *id003
|
67
69
|
description: |-
|
68
|
-
|
69
|
-
|
70
|
-
run code coverage over your specs.
|
70
|
+
A plugin for [Mr Bones](http://rugyems.org/gems/bones) that incorporates rake
|
71
|
+
tasks for running RSpec style tests.
|
71
72
|
email: tim.pease@gmail.com
|
72
73
|
executables: []
|
73
74
|
|
@@ -75,13 +76,14 @@ extensions: []
|
|
75
76
|
|
76
77
|
extra_rdoc_files:
|
77
78
|
- History.txt
|
78
|
-
- README.txt
|
79
|
-
- version.txt
|
80
79
|
files:
|
80
|
+
- .gitignore
|
81
81
|
- History.txt
|
82
|
-
- README.
|
82
|
+
- README.md
|
83
83
|
- Rakefile
|
84
|
-
- lib/bones/plugins/
|
84
|
+
- lib/bones/plugins/rspec.rb
|
85
|
+
- lib/bones/rspec/rspec_version1.rb
|
86
|
+
- lib/bones/rspec/rspec_version2.rb
|
85
87
|
- version.txt
|
86
88
|
has_rdoc: true
|
87
89
|
homepage: http://github.com/TwP/bones-rspec
|
@@ -90,7 +92,7 @@ licenses: []
|
|
90
92
|
post_install_message:
|
91
93
|
rdoc_options:
|
92
94
|
- --main
|
93
|
-
- README.
|
95
|
+
- README.md
|
94
96
|
require_paths:
|
95
97
|
- lib
|
96
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -117,6 +119,6 @@ rubyforge_project: bones-rspec
|
|
117
119
|
rubygems_version: 1.3.7
|
118
120
|
signing_key:
|
119
121
|
specification_version: 3
|
120
|
-
summary:
|
122
|
+
summary: A plugin for [Mr Bones](http://rugyems.
|
121
123
|
test_files: []
|
122
124
|
|
data/lib/bones/plugins/spec.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
|
2
|
-
module Bones::Plugins::Spec
|
3
|
-
include ::Bones::Helpers
|
4
|
-
extend self
|
5
|
-
|
6
|
-
def initialize_spec
|
7
|
-
require 'spec/rake/spectask'
|
8
|
-
have?(:spec) { true }
|
9
|
-
|
10
|
-
::Bones.config {
|
11
|
-
desc 'Configuration settings for the RSpec test framework.'
|
12
|
-
spec {
|
13
|
-
files FileList['spec/**/*_spec.rb'], :desc => <<-__
|
14
|
-
The list of spec files to run. This defaults to all the ruby fines
|
15
|
-
in the 'spec' directory that end with '_spec.rb' as their filename.
|
16
|
-
__
|
17
|
-
|
18
|
-
opts [], :desc => <<-__
|
19
|
-
An array of command line options that will be passed to the spec
|
20
|
-
command when running your tests. See the RSpec help documentation
|
21
|
-
either online or from the command line by running 'spec --help'.
|
22
|
-
|
23
|
-
Options can also be defined in the "spec/spec.opts" file. Please
|
24
|
-
leave this opts array empty if you prefer to use the spec.opts file
|
25
|
-
instead.
|
26
|
-
__
|
27
|
-
}
|
28
|
-
}
|
29
|
-
rescue LoadError
|
30
|
-
have?(:spec) { false }
|
31
|
-
end
|
32
|
-
|
33
|
-
def post_load
|
34
|
-
return unless have? :spec
|
35
|
-
config = ::Bones.config
|
36
|
-
have?(:spec) { !config.spec.files.to_a.empty? }
|
37
|
-
end
|
38
|
-
|
39
|
-
def define_tasks
|
40
|
-
return unless have? :spec
|
41
|
-
config = ::Bones.config
|
42
|
-
|
43
|
-
namespace :spec do
|
44
|
-
desc 'Run all specs with basic output'
|
45
|
-
Spec::Rake::SpecTask.new(:run) do |t|
|
46
|
-
t.ruby_opts = config.ruby_opts
|
47
|
-
t.spec_opts = config.spec.opts unless config.spec.opts.empty?
|
48
|
-
t.spec_files = config.spec.files
|
49
|
-
t.libs += config.libs
|
50
|
-
end
|
51
|
-
|
52
|
-
if have? :rcov
|
53
|
-
require 'spec/rake/verify_rcov'
|
54
|
-
|
55
|
-
desc 'Run all specs with Rcov'
|
56
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
57
|
-
t.ruby_opts = config.ruby_opts
|
58
|
-
t.spec_opts = config.spec.opts unless config.spec.opts.empty?
|
59
|
-
t.spec_files = config.spec.files
|
60
|
-
t.libs += config.libs
|
61
|
-
t.rcov = true
|
62
|
-
t.rcov_dir = config.rcov.dir
|
63
|
-
t.rcov_opts.concat(config.rcov.opts)
|
64
|
-
end
|
65
|
-
|
66
|
-
RCov::VerifyTask.new(:verify) do |t|
|
67
|
-
t.threshold = config.rcov.threshold
|
68
|
-
t.index_html = File.join(config.rcov.dir, 'index.html')
|
69
|
-
t.require_exact_threshold = config.rcov.threshold_exact
|
70
|
-
end
|
71
|
-
|
72
|
-
task :verify => :rcov
|
73
|
-
remove_desc_for_task %w(spec:clobber_rcov)
|
74
|
-
end
|
75
|
-
end # namespace :spec
|
76
|
-
|
77
|
-
desc 'Alias to spec:run'
|
78
|
-
task :spec => 'spec:run'
|
79
|
-
|
80
|
-
task :clobber => 'spec:clobber_rcov' if have? :rcov
|
81
|
-
end
|
82
|
-
|
83
|
-
end # module Bones::Plugins::Spec
|
84
|
-
|