shoe 0.4.0 → 0.5.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.rdoc +7 -0
- data/README.rdoc +71 -41
- data/TODO.rdoc +2 -4
- data/bin/shoe +1 -1
- data/cucumber.yml +2 -0
- data/{BUNDLER.rdoc → doc/bundler.rdoc} +2 -2
- data/features/cucumber.feature +11 -1
- data/features/getting_started.feature +2 -2
- data/features/step_definitions/shoe_steps.rb +1 -1
- data/features/test.feature +18 -0
- data/lib/shoe/generator.rb +2 -2
- data/lib/shoe/tasks.rb +5 -5
- data/lib/shoe/tasks/abstract.rb +5 -12
- data/lib/shoe/tasks/clean.rb +9 -0
- data/lib/shoe/tasks/compile.rb +11 -8
- data/lib/shoe/tasks/cucumber.rb +39 -10
- data/lib/shoe/tasks/rdoc.rb +23 -8
- data/lib/shoe/tasks/release.rb +24 -0
- data/lib/shoe/tasks/test.rb +97 -8
- data/lib/shoe/templates/gemspec.erb +1 -0
- data/lib/shoe/version.rb +1 -1
- data/shoe.gemspec +8 -2
- metadata +14 -8
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== Git
|
2
|
+
|
3
|
+
* Lean on cucumber.yml to define cucumber tasks.
|
4
|
+
* Lean on spec.test_files and Gem::Validator to run tests.
|
5
|
+
* Shoe::Tasks can now be used a la carte.
|
6
|
+
* The shoe generator script now requires a path argument.
|
7
|
+
|
1
8
|
== 0.4.0
|
2
9
|
|
3
10
|
* Don't generate the gemspec; *use* it instead.
|
data/README.rdoc
CHANGED
@@ -1,66 +1,96 @@
|
|
1
1
|
= Shoe
|
2
2
|
|
3
|
-
Shoe is
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
{
|
12
|
-
|
13
|
-
{
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
{Gem::Validator}[http://rubygems.rubyforge.org/rubygems-update/Gem/Validator.html].)
|
3
|
+
Shoe is an ecosystem-friendly library of Rake tasks for your gem.
|
4
|
+
|
5
|
+
* It <b>reads your gemspec</b> instead of writing it like
|
6
|
+
Hoe[http://seattlerb.rubyforge.org/hoe] and
|
7
|
+
Jeweler[http://github.com/technicalpickles/jeweler] do.
|
8
|
+
(Background[http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/].)
|
9
|
+
|
10
|
+
* It <b>uses Rubygems</b>
|
11
|
+
{for}[http://rubygems.rubyforge.org/rubygems-update/Gem/Ext/ExtConfBuilder.html]
|
12
|
+
{common}[http://rubygems.rubyforge.org/rubygems-update/Gem/DocManager.html]
|
13
|
+
{functionality}[http://rubygems.rubyforge.org/rubygems-update/Gem/Validator.html],
|
14
|
+
rather than
|
15
|
+
{reinventing}[http://github.com/luislavena/rake-compiler/]
|
16
|
+
{the}[http://rake.rubyforge.org/classes/Rake/RDocTask.html]
|
17
|
+
{wheel}[http://rake.rubyforge.org/classes/Rake/TestTask.html].
|
18
|
+
|
20
19
|
|
21
20
|
== Install
|
22
21
|
|
23
22
|
$ gem install shoe
|
24
23
|
|
25
|
-
== Use
|
26
24
|
|
27
|
-
|
25
|
+
== Use
|
28
26
|
|
29
27
|
require 'shoe'
|
30
28
|
|
31
29
|
Shoe::Tasks.define('my_project.gemspec')
|
32
30
|
|
33
|
-
Then you'll see (at most) the following rake tasks available:
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
32
|
+
== Configure
|
33
|
+
|
34
|
+
Shoe::Tasks accept no direct configuration. Instead, they rely on your project environment:
|
35
|
+
|
36
|
+
Shoe::Tasks::Clean::
|
37
|
+
calls <tt>`git clean -fdX`</tt>.
|
38
|
+
|
39
|
+
Shoe::Tasks::Compile::
|
40
|
+
builds the
|
41
|
+
<tt>extensions[http://docs.rubygems.org/read/chapter/20#extensions]</tt> in
|
42
|
+
your gemspec.
|
43
|
+
|
44
|
+
Shoe::Tasks::Cucumber::
|
45
|
+
runs individual profiles in your
|
46
|
+
<tt>{cucumber.yml}[http://wiki.github.com/aslakhellesoy/cucumber/cucumberyml]</tt>.
|
47
|
+
|
48
|
+
Shoe::Tasks::Rdoc::
|
49
|
+
uses the
|
50
|
+
<tt>rdoc_options[http://docs.rubygems.org/read/chapter/20#rdoc_options]</tt>
|
51
|
+
and
|
52
|
+
<tt>extra_rdoc_files[http://docs.rubygems.org/read/chapter/20#extra_rdoc_files]</tt>
|
53
|
+
in your gemspec.
|
54
|
+
|
55
|
+
Shoe::Tasks::Release::
|
56
|
+
calls <tt>`git tag`</tt>, <tt>`git push`</tt>, <tt>`gem build`</tt> and
|
57
|
+
<tt>`gem push`</tt>, of course.
|
58
|
+
|
59
|
+
Shoe::Tasks::Test::
|
60
|
+
runs the
|
61
|
+
<tt>test_files[http://docs.rubygems.org/read/chapter/20#test_files]</tt> in
|
62
|
+
your gemspec.
|
63
|
+
|
64
|
+
Each Task class definition has more specific configuration notes.
|
65
|
+
|
66
|
+
|
67
|
+
== Cherry Pick
|
68
|
+
|
69
|
+
If you don't want to use all the Shoe::Tasks, just instantiate the ones you
|
70
|
+
want:
|
71
|
+
|
72
|
+
require 'shoe'
|
73
|
+
|
74
|
+
Shoe::Tasks::Cucumber.new('my_project.gemspec')
|
75
|
+
Shoe::Tasks::Rdoc.new('my_project.gemspec')
|
43
76
|
|
44
|
-
I say "at most" because, when possible, tasks are conditionally defined: you
|
45
|
-
won't see "rake compile" if you don't specify any extensions in your gemspec,
|
46
|
-
for example.
|
47
77
|
|
48
78
|
== Bootstrap
|
49
79
|
|
50
|
-
|
51
|
-
|
80
|
+
The provided <tt>shoe</tt> executable will generate a helpful gemspec and some
|
81
|
+
other skeleton files for your new project:
|
52
82
|
|
53
|
-
$
|
54
|
-
$ cd foo
|
55
|
-
$ shoe
|
83
|
+
$ shoe my_project
|
56
84
|
|
57
|
-
|
58
|
-
|
85
|
+
If you're using {Bundler}[http://gembundler.com], see
|
86
|
+
{bundler.rdoc}[link:files/doc/bundler_rdoc.html] for some helpful tips.
|
59
87
|
|
60
|
-
If you're using Bundler, see {BUNDLER.rdoc}[link:files/BUNDLER_rdoc.html] for more.
|
61
88
|
|
62
|
-
==
|
89
|
+
== Contribute
|
63
90
|
|
64
|
-
A number of these tasks are maybe less useful for you than they could be,
|
91
|
+
A number of these tasks are maybe less useful for you than they could be,
|
92
|
+
probably because you and I use different conventions. If you have some ideas
|
93
|
+
for making Shoe better, I'd love to hear them! Feel free to send issues / pull
|
94
|
+
requests / messages through GitHub.
|
65
95
|
|
66
96
|
All the best, -- Matthew
|
data/TODO.rdoc
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
= Next Up
|
2
2
|
|
3
3
|
* Help generate man pages?
|
4
|
-
* Ditch cucumber tasks? (This moves us more into the pure-gemspec space.)
|
5
|
-
* Use Gem::Validator to run tests.
|
6
|
-
* Find a nicer way to express task dependencies; then maybe tasks could be used a la carte?
|
7
4
|
* How would I incorporate Gem::Specification#add_bundler_dependencies?
|
8
|
-
*
|
5
|
+
* Support any extension flavor that Rubygems supports, not just extconf.rb.
|
6
|
+
* Find a better way to clean; I don't want to whack .bundler and .rvmrc.
|
data/bin/shoe
CHANGED
data/cucumber.yml
ADDED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Using Shoe with Bundler
|
1
|
+
= Using Shoe with {Bundler}[http://gembundler.com]
|
2
2
|
|
3
3
|
Bootstrapping is a little chicken-and-egg-y, but with the following initial <tt>Gemfile</tt>:
|
4
4
|
|
@@ -8,7 +8,7 @@ Bootstrapping is a little chicken-and-egg-y, but with the following initial <tt>
|
|
8
8
|
You should be able to:
|
9
9
|
|
10
10
|
$ bundle install
|
11
|
-
$ bundle exec shoe
|
11
|
+
$ bundle exec shoe .
|
12
12
|
|
13
13
|
From there, I've been preferring <tt>`bundle exec bash`</tt> over <tt>`bundle
|
14
14
|
exec rake`</tt> or using <tt>require 'bundler/setup'</tt> in my
|
data/features/cucumber.feature
CHANGED
@@ -11,8 +11,18 @@ Feature: Cucumber
|
|
11
11
|
Scenario: Running rake --tasks in a shoe project with Cucumber features
|
12
12
|
Given I have created a project called "my_project"
|
13
13
|
And I have appended "gem 'cucumber'" to "my_project/Gemfile"
|
14
|
-
And I have created a
|
14
|
+
And I have created a file called "my_project/cucumber.yml" containing:
|
15
|
+
"""
|
16
|
+
default: --tags ~@wip
|
17
|
+
wip: --tags @wip --wip
|
18
|
+
"""
|
15
19
|
When I run bundle exec rake --tasks inside "my_project"
|
16
20
|
Then I should see "rake cucumber" on standard out
|
17
21
|
And I should see "rake cucumber:wip" on standard out
|
18
22
|
|
23
|
+
Scenario: Running rake --tasks in a shoe project with a bad cucumber.yml
|
24
|
+
Given I have created a project called "my_project"
|
25
|
+
And I have appended "gem 'cucumber'" to "my_project/Gemfile"
|
26
|
+
And I have created a file called "my_project/cucumber.yml" containing ""
|
27
|
+
When I run bundle exec rake --tasks inside "my_project"
|
28
|
+
Then I should not see "rake cucumber" on standard out
|
@@ -10,7 +10,7 @@ Feature: Getting started
|
|
10
10
|
source :rubygems
|
11
11
|
gem 'shoe', :group => :development
|
12
12
|
"""
|
13
|
-
When I run bundle exec shoe inside "my_project"
|
13
|
+
When I run bundle exec shoe . inside "my_project"
|
14
14
|
Then I should see a file "my_project/Rakefile"
|
15
15
|
And I should see a file "my_project/README.rdoc"
|
16
16
|
And I should see a file "my_project/lib/my_project/version.rb"
|
@@ -24,6 +24,6 @@ Feature: Getting started
|
|
24
24
|
gem 'shoe', :group => :development
|
25
25
|
"""
|
26
26
|
And I have created a file called "my_project/Rakefile" containing "# RAKEFILE CONTENTS"
|
27
|
-
When I run bundle exec shoe inside "my_project"
|
27
|
+
When I run bundle exec shoe . inside "my_project"
|
28
28
|
Then I should see "Rakefile exists. Not clobbering." on standard error
|
29
29
|
And the contents of "my_project/Rakefile" should still be "# RAKEFILE CONTENTS"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Test
|
2
|
+
In order to run tests
|
3
|
+
As a developer
|
4
|
+
I want shoe to give me a rake task
|
5
|
+
|
6
|
+
Scenario: Running rake --tasks in a shoe project without tests
|
7
|
+
Given I have created a project called "my_project"
|
8
|
+
And I have run git init inside "my_project"
|
9
|
+
When I run bundle exec rake --tasks inside "my_project"
|
10
|
+
Then I should not see "rake test" on standard out
|
11
|
+
|
12
|
+
Scenario: Running rake --tasks in a shoe project with tests
|
13
|
+
Given I have created a project called "my_project"
|
14
|
+
And I have run git init inside "my_project"
|
15
|
+
And I have created a directory called "my_project/test"
|
16
|
+
And I have created a file called "my_project/test/foo_test.rb" containing ""
|
17
|
+
When I run bundle exec rake --tasks inside "my_project"
|
18
|
+
Then I should see "rake test" on standard out
|
data/lib/shoe/generator.rb
CHANGED
data/lib/shoe/tasks.rb
CHANGED
@@ -9,18 +9,18 @@ module Shoe
|
|
9
9
|
autoload :Release, 'shoe/tasks/release'
|
10
10
|
autoload :Test, 'shoe/tasks/test'
|
11
11
|
|
12
|
-
|
12
|
+
NAMES = %w(
|
13
13
|
Clean
|
14
|
+
Compile
|
15
|
+
Cucumber
|
14
16
|
Rdoc
|
15
17
|
Release
|
16
18
|
Test
|
17
|
-
Cucumber
|
18
|
-
Compile
|
19
19
|
)
|
20
20
|
|
21
21
|
def self.define(spec)
|
22
|
-
|
23
|
-
|
22
|
+
NAMES.map { |name| const_get(name) }.
|
23
|
+
each { |task| task.new(spec) }
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
data/lib/shoe/tasks/abstract.rb
CHANGED
@@ -11,25 +11,18 @@ module Shoe
|
|
11
11
|
Gem::Specification.load(spec)
|
12
12
|
end
|
13
13
|
|
14
|
+
@spec.extend(LocalGemspecExtensions)
|
15
|
+
|
14
16
|
if active?
|
15
17
|
define
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
def active?
|
20
|
-
true
|
21
|
-
end
|
22
|
-
|
23
21
|
private
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def before_existing(name, dependency)
|
31
|
-
if Rake::Task.task_defined?(name)
|
32
|
-
task name => dependency
|
23
|
+
module LocalGemspecExtensions #:nodoc:
|
24
|
+
def full_gem_path
|
25
|
+
Dir.pwd
|
33
26
|
end
|
34
27
|
end
|
35
28
|
|
data/lib/shoe/tasks/clean.rb
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
module Shoe
|
2
2
|
module Tasks
|
3
3
|
|
4
|
+
# Defines <tt>`rake clean`</tt> to remove <tt>.gitignore</tt>d files and
|
5
|
+
# directories.
|
6
|
+
#
|
7
|
+
# Uses <tt>`{git clean}[http://www.kernel.org/pub/software/scm/git/docs/git-clean.html] -fdX`</tt>.
|
8
|
+
#
|
9
|
+
# To enable, version your project with git[http://git-scm.com].
|
10
|
+
#
|
11
|
+
# To configure, edit your
|
12
|
+
# <tt>{.gitignore}[http://www.kernel.org/pub/software/scm/git/docs/gitignore.html]</tt>.
|
4
13
|
class Clean < Abstract
|
5
14
|
def active?
|
6
15
|
File.directory?('.git')
|
data/lib/shoe/tasks/compile.rb
CHANGED
@@ -3,6 +3,16 @@ require 'rubygems/ext'
|
|
3
3
|
module Shoe
|
4
4
|
module Tasks
|
5
5
|
|
6
|
+
# Defines <tt>`rake compile`</tt> to build your C extensions.
|
7
|
+
#
|
8
|
+
# Uses
|
9
|
+
# <tt>{Gem::Ext::ExtConfBuilder}[http://rubygems.rubyforge.org/rubygems-update/Gem/Ext/ExtConfBuilder.html]</tt>,
|
10
|
+
# so extensions are compiled locally just as they will be with <tt>`gem
|
11
|
+
# install`</tt>. Your users will thank you.
|
12
|
+
#
|
13
|
+
# To enable and configure, add
|
14
|
+
# <tt>extensions[http://docs.rubygems.org/read/chapter/20#extensions]</tt>
|
15
|
+
# to your gemspec.
|
6
16
|
class Compile < Abstract
|
7
17
|
def active?
|
8
18
|
!spec.extensions.empty?
|
@@ -26,14 +36,7 @@ module Shoe
|
|
26
36
|
end
|
27
37
|
end
|
28
38
|
|
29
|
-
|
30
|
-
test
|
31
|
-
cucumber:ok
|
32
|
-
cucumber:wip
|
33
|
-
release
|
34
|
-
).each do |name|
|
35
|
-
before_existing(name, :compile)
|
36
|
-
end
|
39
|
+
task :prepare => :compile
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
data/lib/shoe/tasks/cucumber.rb
CHANGED
@@ -1,9 +1,18 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
1
3
|
module Shoe
|
2
4
|
module Tasks
|
3
5
|
|
6
|
+
# Defines <tt>`rake cucumber`</tt> and <tt>`rake cucumber:<PROFILE>`</tt> to
|
7
|
+
# run your Cucumber[http://cukes.info] features.
|
8
|
+
#
|
9
|
+
# <tt>`rake cucumber`</tt> will run features according to the <tt>default</tt> profile; <tt>`rake cucumber:foo`</tt> according to the <tt>foo</tt> profile.
|
10
|
+
#
|
11
|
+
# To enable and configure, create and edit your
|
12
|
+
# <tt>{cucumber.yml}[http://wiki.github.com/aslakhellesoy/cucumber/cucumberyml]</tt>.
|
4
13
|
class Cucumber < Abstract
|
5
14
|
def active?
|
6
|
-
|
15
|
+
!cucumber_profiles.empty?
|
7
16
|
end
|
8
17
|
|
9
18
|
def define
|
@@ -11,7 +20,7 @@ module Shoe
|
|
11
20
|
require 'cucumber/rake/task'
|
12
21
|
rescue LoadError
|
13
22
|
warn 'cucumber',
|
14
|
-
"Although you have a
|
23
|
+
"Although you have a cucumber.yml, it seems you don't have cucumber installed.",
|
15
24
|
"You probably want to add a \"gem 'cucumber'\" to your Gemfile."
|
16
25
|
else
|
17
26
|
define_tasks
|
@@ -21,18 +30,38 @@ module Shoe
|
|
21
30
|
private
|
22
31
|
|
23
32
|
def define_tasks
|
24
|
-
|
25
|
-
|
26
|
-
|
33
|
+
cucumber_profiles.each do |profile|
|
34
|
+
if profile == 'default'
|
35
|
+
define_default_task
|
36
|
+
else
|
37
|
+
define_profile_task(profile)
|
27
38
|
end
|
39
|
+
end
|
40
|
+
end
|
28
41
|
|
29
|
-
|
30
|
-
|
31
|
-
|
42
|
+
def cucumber_profiles
|
43
|
+
YAML.load_file('cucumber.yml').keys rescue []
|
44
|
+
end
|
45
|
+
|
46
|
+
def define_default_task
|
47
|
+
task :prepare
|
48
|
+
|
49
|
+
::Cucumber::Rake::Task.new({ :cucumber => :prepare }, 'Run features') do |task|
|
50
|
+
task.profile = 'default'
|
32
51
|
end
|
33
52
|
|
34
|
-
|
35
|
-
|
53
|
+
task :default
|
54
|
+
Rake.application[:default].prerequisites.push(Rake.application[:cucumber])
|
55
|
+
end
|
56
|
+
|
57
|
+
def define_profile_task(profile)
|
58
|
+
task :prepare
|
59
|
+
|
60
|
+
namespace :cucumber do
|
61
|
+
::Cucumber::Rake::Task.new({ profile => :prepare }, "Run #{profile} features") do |task|
|
62
|
+
task.profile = profile
|
63
|
+
end
|
64
|
+
end
|
36
65
|
end
|
37
66
|
end
|
38
67
|
|
data/lib/shoe/tasks/rdoc.rb
CHANGED
@@ -3,7 +3,30 @@ require 'rubygems/doc_manager'
|
|
3
3
|
module Shoe
|
4
4
|
module Tasks
|
5
5
|
|
6
|
+
# Defines <tt>`rake rdoc`</tt> to generate project documentation.
|
7
|
+
#
|
8
|
+
# Uses
|
9
|
+
# <tt>{Gem::DocManager}[http://rubygems.rubyforge.org/rubygems-update/Gem/DocManager.html]</tt>,
|
10
|
+
# so rdoc is generated locally just as it will be with <tt>`gem
|
11
|
+
# install`</tt> and <tt>`gem rdoc`</tt>. Your users will thank you for
|
12
|
+
# making sure their local documentation looks nice.
|
13
|
+
#
|
14
|
+
# (Incidentally, this is why Shoe prefers rdoc (the file format) over
|
15
|
+
# Markdown[http://daringfireball.net/projects/markdown/] and rdoc (the
|
16
|
+
# tool) over YARD[http://yardoc.org/], even though both have considerable
|
17
|
+
# advantages -- it's what your users are going to get!)
|
18
|
+
#
|
19
|
+
# This task is always enabled.
|
20
|
+
#
|
21
|
+
# To configure, add
|
22
|
+
# <tt>rdoc_options[http://docs.rubygems.org/read/chapter/20#rdoc_options]</tt> and
|
23
|
+
# <tt>extra_rdoc_files[http://docs.rubygems.org/read/chapter/20#extra_rdoc_files]</tt>
|
24
|
+
# to your gemspec.
|
6
25
|
class Rdoc < Abstract
|
26
|
+
def active?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
7
30
|
def define
|
8
31
|
desc 'Generate documentation'
|
9
32
|
task :rdoc do
|
@@ -29,16 +52,8 @@ module Shoe
|
|
29
52
|
@spec = spec
|
30
53
|
@doc_dir = Dir.pwd
|
31
54
|
@rdoc_args = []
|
32
|
-
adjust_spec_so_that_we_can_generate_rdoc_locally
|
33
|
-
end
|
34
|
-
|
35
|
-
def adjust_spec_so_that_we_can_generate_rdoc_locally
|
36
|
-
def @spec.full_gem_path
|
37
|
-
Dir.pwd
|
38
|
-
end
|
39
55
|
end
|
40
56
|
end
|
41
|
-
|
42
57
|
end
|
43
58
|
|
44
59
|
end
|
data/lib/shoe/tasks/release.rb
CHANGED
@@ -1,6 +1,30 @@
|
|
1
1
|
module Shoe
|
2
2
|
module Tasks
|
3
3
|
|
4
|
+
# Defines <tt>`rake release`</tt> to release your gem.
|
5
|
+
#
|
6
|
+
# To release is to: commit, tag, optionally push (with tags), and then
|
7
|
+
# build and push your gem.
|
8
|
+
#
|
9
|
+
# This task is enabled under very specific circumstances, to safeguard
|
10
|
+
# against accidental releases:
|
11
|
+
# 1. Your <tt>version[http://docs.rubygems.org/read/chapter/20#version]</tt> is greater than <tt>0.0.0</tt>.
|
12
|
+
# 2. There is no existing git tag <tt>"v#{version}"</tt>.
|
13
|
+
# 3. You are currently on the <tt>master</tt> branch.
|
14
|
+
#
|
15
|
+
# To configure, adjust the
|
16
|
+
# <tt>version[http://docs.rubygems.org/read/chapter/20#version]</tt> in
|
17
|
+
# your gemspec.
|
18
|
+
#
|
19
|
+
# = Semantic Versioning
|
20
|
+
#
|
21
|
+
# Shoe helps you follow the Tagging Specification of {Semantic
|
22
|
+
# Versioning}[http://semver.org] by tagging your releases as
|
23
|
+
# <tt>"v#{version}"</tt>, prefixing a <tt>"v"</tt> before the version
|
24
|
+
# number.
|
25
|
+
#
|
26
|
+
# Shoe additionally complains if you haven't yet created a <tt>semver</tt>
|
27
|
+
# tag to denote your compliance.
|
4
28
|
class Release < Abstract
|
5
29
|
def active?
|
6
30
|
spec.extend(VersionExtensions)
|
data/lib/shoe/tasks/test.rb
CHANGED
@@ -1,22 +1,111 @@
|
|
1
|
-
require '
|
1
|
+
require 'rubygems/validator'
|
2
|
+
require 'test/unit/ui/console/testrunner'
|
3
|
+
|
4
|
+
# Disable Test::Unit::AutoRunner.
|
5
|
+
#
|
6
|
+
# Though I tried to be really restrictive with the above testrunner require
|
7
|
+
# statement, test/unit itself still gets pulled in, activating the at_exit
|
8
|
+
# hook. Dang.
|
9
|
+
Test::Unit.run = true
|
2
10
|
|
3
11
|
module Shoe
|
4
12
|
module Tasks
|
5
13
|
|
6
|
-
#
|
7
|
-
#
|
14
|
+
# Defines <tt>`rake test`</tt> to run your tests.
|
15
|
+
#
|
16
|
+
# Uses
|
17
|
+
# <tt>{Gem::Validator}[http://rubygems.rubyforge.org/rubygems-update/Gem/Validator.html]</tt>,
|
18
|
+
# so tests are run locally just as they will be with <tt>`{gem
|
19
|
+
# check}[http://docs.rubygems.org/read/chapter/10#page30] --test
|
20
|
+
# your_project`</tt>.
|
21
|
+
#
|
22
|
+
# (Incidentally, this ensures your tests _are_ runnable via <tt>`gem
|
23
|
+
# check`</tt>, a forgotten command second only to <tt>`{gem
|
24
|
+
# cert}[http://docs.rubygems.org/read/chapter/10#page93]`</tt> in its
|
25
|
+
# underuse.)
|
26
|
+
#
|
27
|
+
# To enable and configure, edit the
|
28
|
+
# <tt>test_files[http://docs.rubygems.org/read/chapter/20#test_files]</tt>
|
29
|
+
# in your gemspec.
|
30
|
+
#
|
31
|
+
# = <tt>Test::Unit</tt>
|
32
|
+
#
|
33
|
+
# Using <tt>Gem::Validator</tt> in this way means that you *must* use
|
34
|
+
# <tt>Test::Unit</tt> in all of your
|
35
|
+
# <tt>test_files[http://docs</tt>.rubygems.org/read/chapter/20#test_files]
|
36
|
+
# -- if you prefer Rspec[http://rspec.info], just leave <tt>test_files</tt>
|
37
|
+
# blank and set up your own Rake task.
|
38
|
+
#
|
39
|
+
# = <tt>$LOAD_PATH</tt>
|
40
|
+
#
|
41
|
+
# At test time, the root of your gem, any
|
42
|
+
# <tt>{require_paths}[http://docs.rubygems.org/read/chapter/20#require_paths]</tt>,
|
43
|
+
# and any
|
44
|
+
# <tt>{dependencies}[http://docs.rubygems.org/read/chapter/20#dependencies]</tt>
|
45
|
+
# are on the <tt>$LOAD_PATH</tt>.
|
46
|
+
#
|
47
|
+
# <b>Bad:</b>
|
48
|
+
#
|
49
|
+
# # Don't do this; test_helper's not in the $LOAD_PATH
|
50
|
+
# require 'test_helper'
|
51
|
+
#
|
52
|
+
# <b>Good:</b>
|
53
|
+
#
|
54
|
+
# require 'test/test_helper'
|
55
|
+
#
|
8
56
|
class Test < Abstract
|
9
57
|
def active?
|
10
|
-
|
58
|
+
!spec.test_files.empty?
|
11
59
|
end
|
12
60
|
|
13
61
|
def define
|
14
|
-
|
15
|
-
|
16
|
-
|
62
|
+
desc 'Run tests'
|
63
|
+
task :test do
|
64
|
+
Gem.source_index.extend(LocalGemSourceIndex)
|
65
|
+
Gem.source_index.local_gemspec = spec
|
66
|
+
|
67
|
+
Gem::Validator.send(:remove_const, :TestRunner)
|
68
|
+
Gem::Validator.const_set(:TestRunner, LocalTestRunner)
|
69
|
+
Gem::Validator.new.extend(LocalGemValidator).unit_test(spec)
|
70
|
+
end
|
71
|
+
|
72
|
+
task :prepare
|
73
|
+
task :test => :prepare
|
74
|
+
|
75
|
+
task :default
|
76
|
+
Rake.application[:default].prerequisites.unshift(Rake.application[:test])
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
module LocalGemSourceIndex #:nodoc:
|
82
|
+
attr_accessor :local_gemspec
|
83
|
+
|
84
|
+
def find_name(*args)
|
85
|
+
if args.first == local_gemspec.name
|
86
|
+
[local_gemspec]
|
87
|
+
else
|
88
|
+
super
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
module LocalGemValidator #:nodoc:
|
94
|
+
def alert_error(*args)
|
95
|
+
# no-op
|
17
96
|
end
|
18
97
|
|
19
|
-
|
98
|
+
def unit_test(*args)
|
99
|
+
unless super.passed?
|
100
|
+
exit 1
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class LocalTestRunner < ::Test::Unit::UI::Console::TestRunner #:nodoc:
|
106
|
+
def self.run(*args)
|
107
|
+
new(args.first, ::Test::Unit::UI::NORMAL).start
|
108
|
+
end
|
20
109
|
end
|
21
110
|
end
|
22
111
|
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.files = spec.git_files
|
26
26
|
spec.executables = spec.git_files('bin/*').map &File.method(:basename)
|
27
27
|
spec.extensions = spec.git_files('ext/**/extconf.rb')
|
28
|
+
spec.test_files = spec.git_files('test/{,**/}*_test.rb')
|
28
29
|
|
29
30
|
spec.extra_rdoc_files = spec.git_files('{,**/}*.rdoc')
|
30
31
|
spec.rdoc_options = %W(
|
data/lib/shoe/version.rb
CHANGED
data/shoe.gemspec
CHANGED
@@ -5,8 +5,13 @@ Gem::Specification.new do |spec|
|
|
5
5
|
spec.name = 'shoe'
|
6
6
|
spec.version = Shoe::VERSION
|
7
7
|
|
8
|
-
spec.summary = '
|
9
|
-
spec.description =
|
8
|
+
spec.summary = 'An ecosystem-friendly library of Rake tasks for your gem.'
|
9
|
+
spec.description = <<-END.gsub(/^\s*/, '')
|
10
|
+
Shoe assumes you could be using any number of other tools -- bundler,
|
11
|
+
cucumber, git, rip, rubygems -- and so leans hard on them for the things
|
12
|
+
they do well, relegating command-line rake to mere syntactic sugar.
|
13
|
+
END
|
14
|
+
|
10
15
|
spec.author = 'Matthew Todd'
|
11
16
|
spec.email = 'matthew.todd@gmail.com'
|
12
17
|
spec.homepage = 'http://github.com/matthewtodd/shoe'
|
@@ -23,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
23
28
|
spec.files = spec.git_files
|
24
29
|
spec.executables = spec.git_files('bin/*').map &File.method(:basename)
|
25
30
|
spec.extensions = spec.git_files('ext/**/extconf.rb')
|
31
|
+
spec.test_files = spec.git_files('test/{,**/}*_test.rb')
|
26
32
|
|
27
33
|
spec.extra_rdoc_files = spec.git_files('{,**/}*.rdoc')
|
28
34
|
spec.rdoc_options = %W(
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 5
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.5.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matthew Todd
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-08 00:00:00 +03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -41,20 +41,23 @@ dependencies:
|
|
41
41
|
version: "0"
|
42
42
|
type: :development
|
43
43
|
version_requirements: *id002
|
44
|
-
description:
|
44
|
+
description: |
|
45
|
+
Shoe assumes you could be using any number of other tools -- bundler,
|
46
|
+
cucumber, git, rip, rubygems -- and so leans hard on them for the things
|
47
|
+
they do well, relegating command-line rake to mere syntactic sugar.
|
48
|
+
|
45
49
|
email: matthew.todd@gmail.com
|
46
50
|
executables:
|
47
51
|
- shoe
|
48
52
|
extensions: []
|
49
53
|
|
50
54
|
extra_rdoc_files:
|
51
|
-
- BUNDLER.rdoc
|
52
55
|
- CHANGELOG.rdoc
|
53
56
|
- README.rdoc
|
54
57
|
- TODO.rdoc
|
58
|
+
- doc/bundler.rdoc
|
55
59
|
files:
|
56
60
|
- .gitignore
|
57
|
-
- BUNDLER.rdoc
|
58
61
|
- CHANGELOG.rdoc
|
59
62
|
- Gemfile
|
60
63
|
- Gemfile.lock
|
@@ -62,11 +65,14 @@ files:
|
|
62
65
|
- Rakefile
|
63
66
|
- TODO.rdoc
|
64
67
|
- bin/shoe
|
68
|
+
- cucumber.yml
|
69
|
+
- doc/bundler.rdoc
|
65
70
|
- features/cucumber.feature
|
66
71
|
- features/getting_started.feature
|
67
72
|
- features/release.feature
|
68
73
|
- features/step_definitions/shoe_steps.rb
|
69
74
|
- features/support/env.rb
|
75
|
+
- features/test.feature
|
70
76
|
- lib/shoe.rb
|
71
77
|
- lib/shoe/generator.rb
|
72
78
|
- lib/shoe/tasks.rb
|
@@ -92,7 +98,7 @@ rdoc_options:
|
|
92
98
|
- --main
|
93
99
|
- README.rdoc
|
94
100
|
- --title
|
95
|
-
- shoe-0.
|
101
|
+
- shoe-0.5.0
|
96
102
|
- --inline-source
|
97
103
|
require_paths:
|
98
104
|
- lib
|
@@ -118,6 +124,6 @@ rubyforge_project:
|
|
118
124
|
rubygems_version: 1.3.6
|
119
125
|
signing_key:
|
120
126
|
specification_version: 3
|
121
|
-
summary:
|
127
|
+
summary: An ecosystem-friendly library of Rake tasks for your gem.
|
122
128
|
test_files: []
|
123
129
|
|