shoe 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/{doc/bundler.rdoc → BUNDLER.rdoc} +0 -0
  2. data/CHANGELOG.rdoc +15 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +21 -3
  5. data/README.rdoc +22 -2
  6. data/TODO.rdoc +3 -3
  7. data/bin/shoe +16 -2
  8. data/data/shoe/templates/application.erb +23 -0
  9. data/data/shoe/templates/executable.erb +18 -0
  10. data/data/shoe/templates/extconf.erb +2 -0
  11. data/data/shoe/templates/extension.erb +9 -0
  12. data/data/shoe/templates/gemspec.erb +50 -0
  13. data/data/shoe/templates/gitignore.erb +4 -0
  14. data/data/shoe/templates/gitkeep.erb +0 -0
  15. data/data/shoe/templates/manpage.erb +30 -0
  16. data/data/shoe/templates/module.erb +31 -0
  17. data/data/shoe/templates/module_test.rb +7 -0
  18. data/data/shoe/templates/rakefile.erb +3 -0
  19. data/data/shoe/templates/readme.erb +3 -0
  20. data/data/shoe/templates/test_helper.erb +2 -0
  21. data/features/cucumber.feature +7 -8
  22. data/features/generator.feature +32 -0
  23. data/features/release.feature +8 -8
  24. data/features/step_definitions/shoe_steps.rb +0 -9
  25. data/features/support/env.rb +5 -9
  26. data/features/test.feature +4 -4
  27. data/lib/shoe.rb +20 -2
  28. data/lib/shoe/extensions.rb +10 -0
  29. data/lib/shoe/extensions/doc_manager.rb +11 -0
  30. data/lib/shoe/extensions/option_parser.rb +25 -0
  31. data/lib/shoe/extensions/pathname.rb +16 -0
  32. data/lib/shoe/extensions/source_index.rb +17 -0
  33. data/lib/shoe/extensions/specification.rb +19 -0
  34. data/lib/shoe/extensions/validator.rb +15 -0
  35. data/lib/shoe/generator.rb +122 -40
  36. data/lib/shoe/tasks.rb +2 -0
  37. data/lib/shoe/tasks/abstract.rb +3 -69
  38. data/lib/shoe/tasks/compile.rb +3 -1
  39. data/lib/shoe/tasks/cucumber.rb +13 -10
  40. data/lib/shoe/tasks/rdoc.rb +3 -22
  41. data/lib/shoe/tasks/release.rb +7 -12
  42. data/lib/shoe/tasks/ronn.rb +77 -0
  43. data/lib/shoe/tasks/test.rb +2 -26
  44. data/man/shoe.1 +64 -0
  45. data/man/shoe.1.ronn +63 -0
  46. data/shoe.gemspec +4 -1
  47. metadata +59 -15
  48. data/features/getting_started.feature +0 -29
  49. data/lib/shoe/templates/gemspec.erb +0 -41
  50. data/lib/shoe/templates/rakefile.erb +0 -3
  51. data/lib/shoe/templates/readme.erb +0 -3
  52. data/lib/shoe/templates/version.erb +0 -3
  53. data/lib/shoe/version.rb +0 -3
File without changes
@@ -1,3 +1,18 @@
1
+ == 0.6.0 -- 2010 April 20
2
+
3
+ * Add --webcvs to rdoc_options in generated gemspec.
4
+ * Move erb templates from lib to datadir.
5
+ * Generate a top-level project module.
6
+ * Move generated VERSION constant out of foo/version.rb, into foo.rb
7
+ * The shoe generator accepts an --application option to generate an executable stub.
8
+ * The shoe generator accepts a --data option to generate a data directory.
9
+ * The shoe generator accepts an --extension option to generate a C extension.
10
+ * The shoe generator accepts a --test-unit option to generate Test::Unit tests.
11
+ * Shoe::Tasks may no longer be built with a Gem::Specification object; pass the path to a gemspec file instead.
12
+ * Generate a .gitignore file.
13
+ * New `rake ronn` task to build man pages from ronn sources.
14
+ * Support running generated apps from a local checkout.
15
+
1
16
  == 0.5.1 -- 2010 April 7
2
17
 
3
18
  * Include summary in description.
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
1
  source :rubygems
2
2
 
3
3
  gem 'rake'
4
+ gem 'launchy'
4
5
 
5
6
  group :development do
6
7
  gem 'cucumber'
8
+ gem 'ronn'
7
9
  end
@@ -1,5 +1,9 @@
1
1
  ---
2
2
  dependencies:
3
+ ronn:
4
+ group:
5
+ - :development
6
+ version: ">= 0"
3
7
  rake:
4
8
  group:
5
9
  - :default
@@ -8,15 +12,21 @@ dependencies:
8
12
  group:
9
13
  - :development
10
14
  version: ">= 0"
15
+ launchy:
16
+ group:
17
+ - :default
18
+ version: ">= 0"
11
19
  specs:
12
20
  - rake:
13
21
  version: 0.8.7
14
22
  - builder:
15
23
  version: 2.1.2
24
+ - configuration:
25
+ version: 1.1.0
16
26
  - diff-lcs:
17
27
  version: 1.1.2
18
28
  - json_pure:
19
- version: 1.2.3
29
+ version: 1.2.4
20
30
  - polyglot:
21
31
  version: 0.3.1
22
32
  - term-ansicolor:
@@ -24,8 +34,16 @@ specs:
24
34
  - treetop:
25
35
  version: 1.4.5
26
36
  - cucumber:
27
- version: 0.6.3
28
- hash: bec7b29765230914672db7983d163d805c4afdb1
37
+ version: 0.6.4
38
+ - hpricot:
39
+ version: 0.8.2
40
+ - launchy:
41
+ version: 0.3.5
42
+ - rdiscount:
43
+ version: 1.6.3
44
+ - ronn:
45
+ version: "0.5"
46
+ hash: d47953731e3f472755d844fb72d2644ea08f56d9
29
47
  sources:
30
48
  - Rubygems:
31
49
  uri: http://gemcutter.org
@@ -16,6 +16,10 @@ Shoe is an ecosystem-friendly library of Rake tasks for your gem.
16
16
  {the}[http://rake.rubyforge.org/classes/Rake/RDocTask.html]
17
17
  {wheel}[http://rake.rubyforge.org/classes/Rake/TestTask.html].
18
18
 
19
+ * It <b>follows the
20
+ {Ruby Packaging Standard}[http://chneukirchen.github.com/rps/]</b>
21
+ when generating project files.
22
+
19
23
 
20
24
  == Install
21
25
 
@@ -56,6 +60,14 @@ Shoe::Tasks::Release::
56
60
  calls <tt>`git tag`</tt>, <tt>`git push`</tt>, <tt>`gem build`</tt> and
57
61
  <tt>`gem push`</tt>, of course.
58
62
 
63
+ Shoe::Tasks::Ronn::
64
+ builds man pages from your <tt>{ronn}[http://rtomayko.github.com/ronn/]</tt> sources,
65
+ honoring the
66
+ <tt>date[http://docs.rubygems.org/read/chapter/20#date]</tt>
67
+ and the first
68
+ <tt>author[http://docs.rubygems.org/read/chapter/20#authors]</tt>
69
+ in your gemspec.
70
+
59
71
  Shoe::Tasks::Test::
60
72
  runs the
61
73
  <tt>test_files[http://docs.rubygems.org/read/chapter/20#test_files]</tt> in
@@ -82,8 +94,16 @@ other skeleton files for your new project:
82
94
 
83
95
  $ shoe my_project
84
96
 
85
- If you're using {Bundler}[http://gembundler.com], see
86
- {bundler.rdoc}[link:files/doc/bundler_rdoc.html] for some helpful tips.
97
+ For more, run:
98
+
99
+ $ shoe --help
100
+
101
+ Or, if you have <tt>{gem-man}[http://github.com/defunkt/gem-man]</tt> installed:
102
+
103
+ $ gem man shoe
104
+
105
+ Also, if you're using {Bundler}[http://gembundler.com], see
106
+ <tt>BUNDLER.rdoc</tt> for some helpful tips.
87
107
 
88
108
 
89
109
  == Contribute
data/TODO.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = Next Up
2
2
 
3
- * Help generate man pages?
4
- * How would I incorporate Gem::Specification#add_bundler_dependencies?
5
- * Support any extension flavor that Rubygems supports, not just extconf.rb.
3
+ * Generator should do the right thing when the base directory has a dash in it.
6
4
  * Find a better way to clean; I don't want to whack .bundler and .rvmrc.
5
+ * 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`.
data/bin/shoe CHANGED
@@ -1,4 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'shoe'
4
- Shoe::Generator.new(*ARGV).run
3
+ begin
4
+ require 'shoe'
5
+ rescue LoadError
6
+ raise unless $!.message =~ /\bshoe$/
7
+
8
+ lib = File.expand_path('../../lib', __FILE__)
9
+ if !$:.include?(lib)
10
+ warn "#{$!}. Trying again with #{lib} on the $LOAD_PATH."
11
+ $:.unshift(lib)
12
+ retry
13
+ end
14
+
15
+ raise
16
+ end
17
+
18
+ Shoe::Generator.new.run(ARGV)
@@ -0,0 +1,23 @@
1
+ require 'optparse'
2
+
3
+ module <%= module_name %>
4
+ class Application
5
+ def initialize
6
+ @options = OptionParser.new do |opts|
7
+ # -h, --help, -v, --version are built into OptionParser
8
+ # Try `<%= name %> --version=all` as you require more libraries!
9
+ opts.version = <%= module_name %>::VERSION
10
+ end
11
+ end
12
+
13
+ def run(argv)
14
+ begin
15
+ @options.parse(argv)
16
+ rescue OptionParser::ParseError
17
+ @options.abort($!)
18
+ end
19
+
20
+ # Have at it!
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require '<%= name %>'
5
+ rescue LoadError
6
+ raise unless $!.message =~ /\b<%= name %>$/
7
+
8
+ lib = File.expand_path('../../lib', __FILE__)
9
+ if !$:.include?(lib)
10
+ warn "#{$!}. Trying again with #{lib} on the $LOAD_PATH."
11
+ $:.unshift(lib)
12
+ retry
13
+ end
14
+
15
+ raise
16
+ end
17
+
18
+ <%= module_name %>::Application.new.run(ARGV)
@@ -0,0 +1,2 @@
1
+ require 'mkmf'
2
+ create_makefile '<%= name %>/<%= extension_name %>'
@@ -0,0 +1,9 @@
1
+ #include "ruby.h"
2
+
3
+ static VALUE m<%= module_name %>;
4
+ static VALUE m<%= extension_module_name %>;
5
+
6
+ void Init_ext() {
7
+ m<%= module_name %> = rb_define_module("<%= module_name %>");
8
+ m<%= extension_module_name %> = rb_define_module_under("<%= module_name %>", "<%= extension_module_name %>");
9
+ }
@@ -0,0 +1,50 @@
1
+ $:.unshift File.expand_path('../lib', __FILE__)
2
+ require '<%= name %>'
3
+
4
+ # Feel free to change whatever you like! This file is yours now.
5
+ Gem::Specification.new do |spec|
6
+ spec.name = '<%= name %>'
7
+ spec.version = <%= module_name %>::VERSION
8
+
9
+ spec.summary = '<%= module_name %> is one of my favorite things!'
10
+ spec.description = <<-END.gsub(/^ */, '')
11
+ #{spec.summary}
12
+
13
+ Further description here.
14
+ END
15
+
16
+ spec.author = '<%= `git config --get user.name`.chomp %>'
17
+ spec.email = '<%= `git config --get user.email`.chomp %>'
18
+ spec.homepage = 'http://github.com/<%= `git config --get github.user`.chomp %>/<%= name %>'
19
+
20
+ # You may find these helpful:
21
+ # spec.requirements = ['git'] # If your library shells out to git
22
+ # spec.required_rubygems_version = ">= 1.3.6" # If you depend on prerelease gems
23
+ # spec.add_bundler_dependencies # I'm not sure how to use this yet...
24
+ # spec.add_runtime_dependency 'nokogiri' # Or what have you
25
+ spec.add_development_dependency 'shoe'
26
+
27
+ # This may not be the best way to select files for inclusion in your gem, but
28
+ # it does at least honor your .gitignore, keeping that bit of your
29
+ # configuration DRY. Alternatively, you could use more explicit Dir.glob
30
+ # patterns or even try reading a Manifest file, hoe-style.
31
+ def spec.git_files(glob=nil)
32
+ `git ls-files -z --cached --other --exclude-standard #{glob}`.split("\0")
33
+ end
34
+
35
+ # The kooky &File.method(:basename) trick keeps us from accidentally
36
+ # shadowing a variable named "file" in the context that evaluates this
37
+ # gemspec. I actually ran into this problem with Bundler!
38
+ spec.files = spec.git_files
39
+ spec.executables = spec.git_files('bin/*').map &File.method(:basename)
40
+ spec.extensions = spec.git_files('ext/**/extconf.rb')
41
+ spec.extra_rdoc_files = spec.git_files('{,**/}*.rdoc')
42
+ spec.test_files = spec.git_files('test/{,**/}*_test.rb')
43
+
44
+ spec.rdoc_options = %W(
45
+ --main README.rdoc
46
+ --title #{spec.full_name}
47
+ --inline-source
48
+ --webcvs http://github.com/<%= `git config --get github.user`.chomp %>/<%= name %>/blob/v#{spec.version}/
49
+ )
50
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ .rvmrc
3
+ *.gem
4
+ rdoc
File without changes
@@ -0,0 +1,30 @@
1
+ <%= name %>(1) --
2
+ =================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `<%= name %>` [_options_]
7
+
8
+ ## DESCRIPTION
9
+
10
+ Write your description here.
11
+
12
+ ## OPTIONS
13
+
14
+ `<%= name %>` also responds to the followng standard options:
15
+
16
+ * `-h`, `--help`:
17
+ Print a help message and exit.
18
+
19
+ * `-v`, `--version`[=all]:
20
+ Print `shoe`'s version number and exit. If `=all` is given, also print
21
+ version numbers of `shoe`'s dependencies. (This is standard `optparse` behavior
22
+ that deserves more attention!)
23
+
24
+ ## AUTHOR
25
+
26
+ <%= `git config --get user.name`.chomp %> <<%= `git config --get user.email`.chomp %>>
27
+
28
+ ## SEE ALSO
29
+
30
+ ruby(1)
@@ -0,0 +1,31 @@
1
+ <% if data? %>
2
+ require 'pathname'
3
+ require 'rbconfig'
4
+ require 'rbconfig/datadir'
5
+
6
+ <% end %>
7
+ module <%= module_name %>
8
+ VERSION = '<%= version %>'
9
+ <% if application? || extension? %>
10
+
11
+ <% end %>
12
+ <% if application? %>
13
+ autoload :Application, '<%= name %>/application'
14
+ <% end %>
15
+ <% if extension? %>
16
+ autoload :<%= extension_module_name %>, '<%= name %>/<%= extension_name %>'
17
+ <% end %>
18
+ <% if data? %>
19
+
20
+ def self.datadir
21
+ @@datadir ||= begin
22
+ datadir = RbConfig.datadir('<%= name %>')
23
+ if !File.exist?(datadir)
24
+ warn "#{datadir} does not exist. Trying again with data directory relative to __FILE__."
25
+ datadir = File.expand_path('../../data/<%= name %>', __FILE__)
26
+ end
27
+ Pathname.new(datadir)
28
+ end
29
+ end
30
+ <% end %>
31
+ end
@@ -0,0 +1,7 @@
1
+ require 'test/helper'
2
+
3
+ class <%= module_name %>Test < Test::Unit::TestCase
4
+ def test_dummy
5
+ assert_equal '<%= version %>', <%= module_name %>::VERSION
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ require 'shoe'
2
+
3
+ Shoe::Tasks.define('<%= name %>.gemspec')
@@ -0,0 +1,3 @@
1
+ = <%= module_name %>
2
+
3
+ <%= module_name %> is one of my favorite things! Let me tell you about it:
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require '<%= name %>'
@@ -4,25 +4,24 @@ Feature: Cucumber
4
4
  I want shoe to give me a rake task
5
5
 
6
6
  Scenario: Running rake --tasks in a shoe project without Cucumber features
7
- Given I have created a project called "my_project"
8
- When I run bundle exec rake --tasks inside "my_project"
7
+ Given I have run shoe my_project inside "."
8
+ When I run rake --tasks inside "my_project"
9
9
  Then I should not see "rake cucumber" on standard out
10
10
 
11
11
  Scenario: Running rake --tasks in a shoe project with Cucumber features
12
- Given I have created a project called "my_project"
13
- And I have appended "gem 'cucumber'" to "my_project/Gemfile"
12
+ Given I have run shoe my_project inside "."
13
+ And I have run git init inside "."
14
14
  And I have created a file called "my_project/cucumber.yml" containing:
15
15
  """
16
16
  default: --tags ~@wip
17
17
  wip: --tags @wip --wip
18
18
  """
19
- When I run bundle exec rake --tasks inside "my_project"
19
+ When I run rake --tasks inside "my_project"
20
20
  Then I should see "rake cucumber" on standard out
21
21
  And I should see "rake cucumber:wip" on standard out
22
22
 
23
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"
24
+ Given I have run shoe my_project inside "."
26
25
  And I have created a file called "my_project/cucumber.yml" containing ""
27
- When I run bundle exec rake --tasks inside "my_project"
26
+ When I run rake --tasks inside "my_project"
28
27
  Then I should not see "rake cucumber" on standard out
@@ -0,0 +1,32 @@
1
+ Feature: Getting started
2
+ In order to start using shoe
3
+ As a developer
4
+ I want a little help generating my Rakefile
5
+
6
+ Scenario: Running shoe to create a new project
7
+ When I run shoe my_project inside "."
8
+ Then I should see a file "my_project/.gitignore"
9
+ And I should see a file "my_project/Rakefile"
10
+ And I should see a file "my_project/README.rdoc"
11
+ And I should see a file "my_project/lib/my_project.rb"
12
+ And I should see a file "my_project/test/helper.rb"
13
+ And I should see a file "my_project/test/my_project_test.rb"
14
+ And I should see a file "my_project/my_project.gemspec"
15
+
16
+ Scenario: Running shoe --application to create a new project
17
+ When I run shoe --application my_project inside "."
18
+ Then I should see a file "my_project/bin/my_project"
19
+ And I should see a file "my_project/lib/my_project/application.rb"
20
+
21
+ Scenario: Running shoe --extension to create a new project
22
+ When I run shoe --extension my_project inside "."
23
+ Then I should see a file "my_project/ext/my_project/extconf.rb"
24
+ And I should see a file "my_project/ext/my_project/extension.c"
25
+
26
+ Scenario: Running shoe with no arguments in an existing project that already has a Rakefile
27
+ Given I have created a directory called "my_project"
28
+ And I have created a file called "my_project/Rakefile" containing "# RAKEFILE CONTENTS"
29
+ When I run shoe inside "my_project"
30
+ Then I should see "Rakefile exists. Not clobbering." on standard error
31
+ And the contents of "my_project/Rakefile" should still be "# RAKEFILE CONTENTS"
32
+
@@ -6,28 +6,28 @@ Feature: Release
6
6
  Background:
7
7
  Given I have created a directory called "origin"
8
8
  And I have run git init --bare inside "origin"
9
- Given I have created a project called "my_project"
9
+ Given I have run shoe my_project inside "."
10
10
  And I have run git init inside "my_project"
11
11
  And I have run git add . inside "my_project"
12
12
  And I have run git commit -m "Initial commit" inside "my_project"
13
13
 
14
14
  Scenario: I can release
15
- When I replace "0.0.0" with "0.1.0" in the file "my_project/lib/my_project/version.rb"
16
- And I run bundle exec rake --tasks inside "my_project"
15
+ When I replace "0.0.0" with "0.1.0" in the file "my_project/lib/my_project.rb"
16
+ And I run rake --tasks inside "my_project"
17
17
  Then I should see "rake release" on standard out
18
18
 
19
19
  Scenario: I cannot release when the version is 0.0.0
20
- When I run bundle exec rake --tasks inside "my_project"
20
+ When I run rake --tasks inside "my_project"
21
21
  Then I should not see "rake release" on standard out
22
22
 
23
23
  Scenario: I cannot release when I already have a tag for the current version
24
24
  When I run git tag v0.1.0 inside "my_project"
25
- And I replace "0.0.0" with "0.1.0" in the file "my_project/lib/my_project/version.rb"
26
- And I run bundle exec rake --tasks inside "my_project"
25
+ And I replace "0.0.0" with "0.1.0" in the file "my_project/lib/my_project.rb"
26
+ And I run rake --tasks inside "my_project"
27
27
  Then I should not see "rake release" on standard out
28
28
 
29
29
  Scenario: I cannot release from a branch other than master
30
30
  When I run git checkout -b topic inside "my_project"
31
- And I replace "0.0.0" with "0.1.0" in the file "my_project/lib/my_project/version.rb"
32
- And I run bundle exec rake --tasks inside "my_project"
31
+ And I replace "0.0.0" with "0.1.0" in the file "my_project/lib/my_project.rb"
32
+ And I run rake --tasks inside "my_project"
33
33
  Then I should not see "rake release" on standard out