shoe 0.6.1 → 0.6.2
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 +10 -0
- data/README.rdoc +2 -4
- data/TODO.rdoc +8 -2
- data/data/shoe/templates/extension.erb +18 -2
- data/data/shoe/templates/gemspec.erb +5 -13
- data/data/shoe/templates/{manpage.erb → manpage_1.erb} +3 -4
- data/data/shoe/templates/manpage_3.erb +19 -0
- data/lib/shoe.rb +1 -1
- data/lib/shoe/extensions.rb +1 -0
- data/lib/shoe/extensions/option_parser.rb +5 -7
- data/lib/shoe/extensions/test_runner.rb +28 -0
- data/lib/shoe/extensions/validator.rb +16 -4
- data/lib/shoe/generator.rb +2 -1
- data/lib/shoe/tasks/clean.rb +20 -3
- data/lib/shoe/tasks/compile.rb +5 -1
- data/lib/shoe/tasks/cucumber.rb +2 -2
- data/lib/shoe/tasks/rdoc.rb +6 -1
- data/lib/shoe/tasks/release.rb +1 -1
- data/lib/shoe/tasks/ronn.rb +8 -4
- data/lib/shoe/tasks/test.rb +33 -16
- data/man/shoe.1 +9 -10
- data/man/shoe.1.ronn +13 -16
- data/man/shoe.3 +68 -0
- data/man/shoe.3.ronn +64 -0
- data/test/extensions/fake_rubygems_server.rb +62 -0
- data/test/extensions/helper_methods.rb +73 -0
- data/test/extensions/isolated_environment.rb +50 -0
- data/test/extensions/test_case.rb +40 -0
- data/test/helper.rb +20 -0
- data/test/system/rake_clean_test.rb +36 -0
- data/test/system/rake_compile_test.rb +25 -0
- data/test/system/rake_cucumber_test.rb +51 -0
- data/test/system/rake_rdoc_test.rb +26 -0
- data/test/system/rake_release_test.rb +94 -0
- data/test/system/rake_ronn_test.rb +25 -0
- data/test/system/rake_test_test.rb +45 -0
- data/test/system/shoe_test.rb +79 -0
- metadata +48 -26
- data/.gitignore +0 -4
- data/BUNDLER.rdoc +0 -16
- data/Gemfile +0 -9
- data/Gemfile.lock +0 -49
- data/Rakefile +0 -4
- data/cucumber.yml +0 -2
- data/features/cucumber.feature +0 -27
- data/features/generator.feature +0 -32
- data/features/release.feature +0 -33
- data/features/step_definitions/shoe_steps.rb +0 -39
- data/features/support/env.rb +0 -69
- data/features/test.feature +0 -18
- data/shoe.gemspec +0 -44
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== Git
|
2
|
+
|
3
|
+
* Generated C extension actually works now.
|
4
|
+
* `rake test` now properly depends on `rake compile`.
|
5
|
+
* Run Gem::Validator tests via Test::Unit::AutoRunner, so that redgreen has a chance to color the dots as well as the result line.
|
6
|
+
* Generated gemspec now selects files with Dir.glob instead of `git ls-files`.
|
7
|
+
* Always generate a section 3 manpage.
|
8
|
+
* `rake clean` now preserves <tt>.bundle/</tt> and <tt>.rvmrc</tt>.
|
9
|
+
* Include C extensions in RDoc.
|
10
|
+
|
1
11
|
== 0.6.1 -- 2010 April 22
|
2
12
|
|
3
13
|
* Reformat warning messages.
|
data/README.rdoc
CHANGED
@@ -38,7 +38,8 @@ Shoe is an ecosystem-friendly library of Rake tasks for your gem.
|
|
38
38
|
Shoe::Tasks accept no direct configuration. Instead, they rely on your project environment:
|
39
39
|
|
40
40
|
Shoe::Tasks::Clean::
|
41
|
-
calls <tt>`git clean -fdX`</tt
|
41
|
+
calls something like <tt>`git clean -fdX`</tt>, but preserves
|
42
|
+
<tt>.bundle/</tt> and <tt>.rvmrc</tt>.
|
42
43
|
|
43
44
|
Shoe::Tasks::Compile::
|
44
45
|
builds the
|
@@ -102,9 +103,6 @@ Or, if you have <tt>{gem-man}[http://github.com/defunkt/gem-man]</tt> installed:
|
|
102
103
|
|
103
104
|
$ gem man shoe
|
104
105
|
|
105
|
-
Also, if you're using {Bundler}[http://gembundler.com], see
|
106
|
-
<tt>BUNDLER.rdoc</tt> for some helpful tips.
|
107
|
-
|
108
106
|
|
109
107
|
== Contribute
|
110
108
|
|
data/TODO.rdoc
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
= Next Up
|
2
2
|
|
3
|
+
* Remove Launchy? (Follow hub's lead.)
|
4
|
+
* Start running on 1.9: Gem::Validator uses MiniTest::Unit.
|
5
|
+
|
6
|
+
= Someday Maybe
|
7
|
+
|
8
|
+
* Re-think focus: probably want to ditch cucumber, since I'm not using it for shoe?
|
9
|
+
* Document rake task hooks prepare:execute and prepare:release.
|
10
|
+
* Use a generator framework?
|
3
11
|
* Generator should do the right thing when the base directory has a dash in it.
|
4
|
-
* Find a better way to clean; I don't want to whack .bundler and .rvmrc.
|
5
12
|
* Add :only/:except options to Shoe::Tasks.define.
|
6
|
-
* Port cucumber features to Test::Unit so they'll be run under `gem check --test shoe`.
|
@@ -3,7 +3,23 @@
|
|
3
3
|
static VALUE m<%= module_name %>;
|
4
4
|
static VALUE m<%= extension_module_name %>;
|
5
5
|
|
6
|
-
|
6
|
+
/*
|
7
|
+
* Document-class: <%= extension_module_name %>
|
8
|
+
* Document-method: run
|
9
|
+
*
|
10
|
+
* call-seq:
|
11
|
+
* run -> nil
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
static VALUE run(VALUE self) {
|
15
|
+
return Qnil;
|
16
|
+
}
|
17
|
+
|
18
|
+
/*
|
19
|
+
* Documentation for <%= extension_module_name %>.
|
20
|
+
*/
|
21
|
+
void Init_extension() {
|
7
22
|
m<%= module_name %> = rb_define_module("<%= module_name %>");
|
8
|
-
m<%= extension_module_name %> = rb_define_module_under(
|
23
|
+
m<%= extension_module_name %> = rb_define_module_under(m<%= module_name %>, "<%= extension_module_name %>");
|
24
|
+
rb_define_method(m<%= extension_module_name %>, "run", run, 0);
|
9
25
|
}
|
@@ -26,22 +26,14 @@ Gem::Specification.new do |spec|
|
|
26
26
|
# spec.add_development_dependency 'ronn'
|
27
27
|
spec.add_development_dependency 'shoe'
|
28
28
|
|
29
|
-
# This may not be the best way to select files for inclusion in your gem, but
|
30
|
-
# it does at least honor your .gitignore, keeping that bit of your
|
31
|
-
# configuration DRY. Alternatively, you could use more explicit Dir.glob
|
32
|
-
# patterns or even try reading a Manifest file, hoe-style.
|
33
|
-
def spec.git_files(glob=nil)
|
34
|
-
`git ls-files -z --cached --other --exclude-standard #{glob}`.split("\0")
|
35
|
-
end
|
36
|
-
|
37
29
|
# The kooky &File.method(:basename) trick keeps us from accidentally
|
38
30
|
# shadowing a variable named "file" in the context that evaluates this
|
39
31
|
# gemspec. I actually ran into this problem with Bundler!
|
40
|
-
spec.files =
|
41
|
-
spec.executables =
|
42
|
-
spec.extensions =
|
43
|
-
spec.extra_rdoc_files =
|
44
|
-
spec.test_files =
|
32
|
+
spec.files = Dir['**/*.rdoc', 'bin/*', 'data/**/*', 'ext/**/*.{rb,c}', 'lib/**/*.rb', 'man/**/*', 'test/**/*.rb']
|
33
|
+
spec.executables = Dir['bin/*'].map &File.method(:basename)
|
34
|
+
spec.extensions = Dir['ext/**/extconf.rb']
|
35
|
+
spec.extra_rdoc_files = Dir['**/*.rdoc', 'ext/**/*.c']
|
36
|
+
spec.test_files = Dir['test/**/*_test.rb']
|
45
37
|
|
46
38
|
spec.rdoc_options = %W(
|
47
39
|
--main README.rdoc
|
@@ -18,13 +18,12 @@ Write your description here.
|
|
18
18
|
|
19
19
|
* `-v`, `--version`[=all]:
|
20
20
|
Print `<%= name %>`'s version number and exit. If `=all` is given, also print
|
21
|
-
version numbers of `<%= name %>`'s dependencies.
|
22
|
-
that deserves more attention!)
|
21
|
+
version numbers of `<%= name %>`'s dependencies.
|
23
22
|
|
24
23
|
## AUTHOR
|
25
24
|
|
26
|
-
<%= `git config --get user.name`.chomp
|
25
|
+
<%= `git config --get user.name`.chomp %>, [<%= `git config --get github.user`.chomp %>](http://github.com/<%= `git config --get github.user`.chomp %>) on GitHub.
|
27
26
|
|
28
27
|
## SEE ALSO
|
29
28
|
|
30
|
-
|
29
|
+
<%= name %>(3)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= name %>(3) --
|
2
|
+
=================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`require '<%= name %>'`
|
7
|
+
<%= module_name %>.somthing(_parameter_)
|
8
|
+
|
9
|
+
## DESCRIPTION
|
10
|
+
|
11
|
+
Write your description here.
|
12
|
+
|
13
|
+
## AUTHOR
|
14
|
+
|
15
|
+
<%= `git config --get user.name`.chomp %>, [<%= `git config --get github.user`.chomp %>](http://github.com/<%= `git config --get github.user`.chomp %>) on GitHub.
|
16
|
+
|
17
|
+
## SEE ALSO
|
18
|
+
|
19
|
+
ruby(1)
|
data/lib/shoe.rb
CHANGED
data/lib/shoe/extensions.rb
CHANGED
@@ -5,6 +5,7 @@ module Shoe
|
|
5
5
|
autoload :Pathname, 'shoe/extensions/pathname'
|
6
6
|
autoload :SourceIndex, 'shoe/extensions/source_index'
|
7
7
|
autoload :Specification, 'shoe/extensions/specification'
|
8
|
+
autoload :TestRunner, 'shoe/extensions/test_runner'
|
8
9
|
autoload :Validator, 'shoe/extensions/validator'
|
9
10
|
end
|
10
11
|
end
|
@@ -13,7 +13,7 @@ module Shoe
|
|
13
13
|
# To use:
|
14
14
|
# parser = OptionsParser.new do |opts|
|
15
15
|
# opts.extend(Shoe::Extensions::OptionParser)
|
16
|
-
# opts.defaults = %w(--foo --no-bar --baz=
|
16
|
+
# opts.defaults = %w(--foo --no-bar --baz=42)
|
17
17
|
# # ... and so on ...
|
18
18
|
# end
|
19
19
|
#
|
@@ -26,11 +26,9 @@ module Shoe
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def order(*args, &block)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
abort($!)
|
33
|
-
end
|
29
|
+
super(*defaults.followed_by(*args), &block)
|
30
|
+
rescue ::OptionParser::ParseError
|
31
|
+
abort($!)
|
34
32
|
end
|
35
33
|
|
36
34
|
def help
|
@@ -41,7 +39,7 @@ module Shoe
|
|
41
39
|
|
42
40
|
module Defaults #:nodoc:
|
43
41
|
def followed_by(*args)
|
44
|
-
dup.concat(
|
42
|
+
dup.concat(args.flatten)
|
45
43
|
end
|
46
44
|
|
47
45
|
def help(before, indent)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Shoe
|
2
|
+
module Extensions
|
3
|
+
|
4
|
+
module TestRunner
|
5
|
+
# Conforms the normal TestRunner interface to the slightly different form
|
6
|
+
# called by Gem::Validator.
|
7
|
+
#
|
8
|
+
# Note that we use Test::Unit::AutoRunner (rather than going directly for
|
9
|
+
# Test::Unit::UI::Console::TestRunner) in order to give redgreen a chance
|
10
|
+
# to register itself, should it have been required in one of the
|
11
|
+
# test_files.
|
12
|
+
def self.run(suite, ui)
|
13
|
+
runner = Test::Unit::AutoRunner.new(false)
|
14
|
+
runner.collector = lambda { suite }
|
15
|
+
runner.run.extend(BooleanPassed)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
module BooleanPassed #:nodoc:
|
21
|
+
def passed?
|
22
|
+
self
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -2,12 +2,24 @@ module Shoe
|
|
2
2
|
module Extensions
|
3
3
|
|
4
4
|
module Validator
|
5
|
-
def
|
6
|
-
|
5
|
+
def self.extended(base)
|
6
|
+
base.send :include, InstanceMethods
|
7
|
+
base.test_runner = TestRunner
|
7
8
|
end
|
8
9
|
|
9
|
-
def
|
10
|
-
|
10
|
+
def test_runner=(klass)
|
11
|
+
remove_const :TestRunner
|
12
|
+
const_set :TestRunner, klass
|
13
|
+
end
|
14
|
+
|
15
|
+
module InstanceMethods #:nodoc:
|
16
|
+
def alert_error(*args)
|
17
|
+
# no-op
|
18
|
+
end
|
19
|
+
|
20
|
+
def unit_test(*args)
|
21
|
+
exit(1) unless super.passed?
|
22
|
+
end
|
11
23
|
end
|
12
24
|
end
|
13
25
|
|
data/lib/shoe/generator.rb
CHANGED
@@ -52,11 +52,12 @@ module Shoe
|
|
52
52
|
install('rakefile.erb', 'Rakefile')
|
53
53
|
install('gemspec.erb', "#{name}.gemspec")
|
54
54
|
install('module.erb', "lib/#{name}.rb")
|
55
|
+
install('manpage_3.erb', "man/#{name}.3.ronn")
|
55
56
|
|
56
57
|
if application?
|
57
58
|
install('executable.erb', "bin/#{name}", 0755)
|
58
59
|
install('application.erb', "lib/#{name}/application.rb")
|
59
|
-
install('
|
60
|
+
install('manpage_1.erb', "man/#{name}.1.ronn")
|
60
61
|
end
|
61
62
|
|
62
63
|
if data?
|
data/lib/shoe/tasks/clean.rb
CHANGED
@@ -4,7 +4,9 @@ module Shoe
|
|
4
4
|
# Defines <tt>`rake clean`</tt> to remove <tt>.gitignore</tt>d files and
|
5
5
|
# directories.
|
6
6
|
#
|
7
|
-
# Uses <tt>`{git
|
7
|
+
# Uses something like <tt>`{git
|
8
|
+
# clean}[http://www.kernel.org/pub/software/scm/git/docs/git-clean.html]
|
9
|
+
# -fdX`</tt>, except preserves <tt>.bundle/</tt> and <tt>.rvmrc</tt>.
|
8
10
|
#
|
9
11
|
# To enable, version your project with git[http://git-scm.com].
|
10
12
|
#
|
@@ -16,11 +18,26 @@ module Shoe
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def define
|
19
|
-
desc
|
21
|
+
desc <<-END.gsub(/^ */, '')
|
22
|
+
Remove ignored files.
|
23
|
+
Configure via your .gitignore file. Uses something like `git clean -fdX`,
|
24
|
+
except preserves .bundle/ and .rvmrc.
|
25
|
+
END
|
26
|
+
|
20
27
|
task :clean do
|
21
|
-
|
28
|
+
rm_r ignored_files - preserved_files
|
22
29
|
end
|
23
30
|
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def ignored_files
|
35
|
+
`git ls-files -z --exclude-standard --ignored --others --directory`.split("\0")
|
36
|
+
end
|
37
|
+
|
38
|
+
def preserved_files
|
39
|
+
%w( .bundle/ .rvmrc )
|
40
|
+
end
|
24
41
|
end
|
25
42
|
|
26
43
|
end
|
data/lib/shoe/tasks/compile.rb
CHANGED
@@ -19,7 +19,11 @@ module Shoe
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def define
|
22
|
-
desc
|
22
|
+
desc <<-END.gsub(/^ */, '')
|
23
|
+
Compile C extensions.
|
24
|
+
Configure via the `extensions` field in #{spec.name}.gemspec.
|
25
|
+
END
|
26
|
+
|
23
27
|
task :compile do
|
24
28
|
top_level_path = File.expand_path('.')
|
25
29
|
destination_path = File.join(top_level_path, spec.require_paths.first)
|
data/lib/shoe/tasks/cucumber.rb
CHANGED
@@ -48,7 +48,7 @@ module Shoe
|
|
48
48
|
task :execute
|
49
49
|
end
|
50
50
|
|
51
|
-
::Cucumber::Rake::Task.new({ :cucumber => 'prepare:execute' },
|
51
|
+
::Cucumber::Rake::Task.new({ :cucumber => 'prepare:execute' }, "Run features.\nConfigure via the default profile in cucumber.yml.") do |task|
|
52
52
|
task.profile = 'default'
|
53
53
|
end
|
54
54
|
|
@@ -61,7 +61,7 @@ module Shoe
|
|
61
61
|
end
|
62
62
|
|
63
63
|
namespace :cucumber do
|
64
|
-
::Cucumber::Rake::Task.new({ profile => 'prepare:execute' }, "Run #{profile} features") do |task|
|
64
|
+
::Cucumber::Rake::Task.new({ profile => 'prepare:execute' }, "Run #{profile} features.\nConfigure via the #{profile} profile in cucumber.yml.") do |task|
|
65
65
|
task.profile = profile
|
66
66
|
end
|
67
67
|
end
|
data/lib/shoe/tasks/rdoc.rb
CHANGED
@@ -29,7 +29,12 @@ module Shoe
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def define
|
32
|
-
desc
|
32
|
+
desc <<-END.gsub(/^ */, '')
|
33
|
+
Generate documentation.
|
34
|
+
Configure via the `rdoc_options` and `extra_rdoc_files` fields in
|
35
|
+
#{spec.name}.gemspec. Open in a different browser by setting the
|
36
|
+
BROWSER environment variable.
|
37
|
+
END
|
33
38
|
task :rdoc do
|
34
39
|
Gem::DocManager.new(spec).extend(Extensions::DocManager).generate_rdoc
|
35
40
|
Launchy::Browser.run('rdoc/index.html')
|
data/lib/shoe/tasks/release.rb
CHANGED
data/lib/shoe/tasks/ronn.rb
CHANGED
@@ -14,9 +14,8 @@ module Shoe
|
|
14
14
|
#
|
15
15
|
# == Notes
|
16
16
|
#
|
17
|
-
# * It's best to
|
18
|
-
#
|
19
|
-
# {gem-man}[http://github.com/defunkt/gem-man].
|
17
|
+
# * It's best to include the generated man pages in your gem, so that
|
18
|
+
# {gem-man}[http://github.com/defunkt/gem-man] can get to them.
|
20
19
|
#
|
21
20
|
# * Ronn becomes a prerequisite for Release, so your man pages are sure to
|
22
21
|
# be up-to-date.
|
@@ -42,7 +41,12 @@ module Shoe
|
|
42
41
|
private
|
43
42
|
|
44
43
|
def define_tasks
|
45
|
-
desc
|
44
|
+
desc <<-END.gsub(/^ */, '')
|
45
|
+
Generate man pages.
|
46
|
+
Configure via the `date` and `authors` fields in #{spec.name}.gemspec.
|
47
|
+
Uses ronn sources in man/*.ronn.
|
48
|
+
END
|
49
|
+
|
46
50
|
task :ronn => 'ronn:build' do
|
47
51
|
sh 'man', *man_files
|
48
52
|
end
|
data/lib/shoe/tasks/test.rb
CHANGED
@@ -44,45 +44,62 @@ module Shoe
|
|
44
44
|
# <tt>{dependencies}[http://docs.rubygems.org/read/chapter/20#dependencies]</tt>
|
45
45
|
# are on the <tt>$LOAD_PATH</tt>.
|
46
46
|
#
|
47
|
-
# <b>
|
47
|
+
# <b>Wrong:</b>
|
48
48
|
#
|
49
49
|
# # Don't do this; test_helper's not in the $LOAD_PATH
|
50
50
|
# require 'test_helper'
|
51
51
|
#
|
52
|
-
# <b>
|
52
|
+
# <b>Right:</b>
|
53
53
|
#
|
54
54
|
# require 'test/test_helper'
|
55
55
|
#
|
56
|
+
# = Pretty Colors
|
57
|
+
#
|
58
|
+
# If you like pretty colors (I do!), just <tt>require
|
59
|
+
# '{redgreen}[http://rubygems.org/gems/redgreen]'</tt> in your tests. The
|
60
|
+
# <tt>Gem::Validator</tt> has been configured to play nicely with it.
|
61
|
+
#
|
62
|
+
# <b>Wrong:</b>
|
63
|
+
#
|
64
|
+
# # Don't do this; it breaks `gem check --test` if redgreen's not installed.
|
65
|
+
# require 'redgreen' if $stdout.tty?
|
66
|
+
#
|
67
|
+
# <b>Right:</b>
|
68
|
+
#
|
69
|
+
# begin
|
70
|
+
# require 'redgreen' if $stdout.tty?
|
71
|
+
# rescue LoadError
|
72
|
+
# # No colors, but `gem check --test` is golden!
|
73
|
+
# end
|
74
|
+
#
|
56
75
|
class Test < Abstract
|
57
76
|
def active?
|
58
77
|
!spec.test_files.empty?
|
59
78
|
end
|
60
79
|
|
61
80
|
def define
|
62
|
-
desc
|
81
|
+
desc <<-END.gsub(/^ */, '')
|
82
|
+
Run tests.
|
83
|
+
Configure via the `test_files` field in #{spec.name}.gemspec.
|
84
|
+
END
|
85
|
+
|
63
86
|
task :test do
|
64
87
|
Gem.source_index.extend(Extensions::SourceIndex)
|
65
88
|
Gem.source_index.local_gemspec = spec
|
66
89
|
|
67
|
-
Gem::Validator.
|
68
|
-
Gem::Validator.
|
69
|
-
Gem::Validator.new.extend(Extensions::Validator).unit_test(spec)
|
90
|
+
Gem::Validator.extend(Extensions::Validator)
|
91
|
+
Gem::Validator.new.unit_test(spec)
|
70
92
|
end
|
71
93
|
|
72
|
-
|
73
|
-
|
94
|
+
namespace :prepare do
|
95
|
+
task :execute
|
96
|
+
end
|
97
|
+
|
98
|
+
task :test => 'prepare:execute'
|
74
99
|
|
75
100
|
task :default
|
76
101
|
Rake.application[:default].prerequisites.unshift(Rake.application[:test])
|
77
102
|
end
|
78
|
-
|
79
|
-
private
|
80
|
-
|
81
|
-
class LocalTestRunner < ::Test::Unit::UI::Console::TestRunner #:nodoc:
|
82
|
-
def self.run(*args)
|
83
|
-
new(args.first, ::Test::Unit::UI::NORMAL).start
|
84
|
-
end
|
85
|
-
end
|
86
103
|
end
|
87
104
|
|
88
105
|
end
|