shoe 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/{data/shoe/templates/gitignore.erb → .gitignore} +1 -1
  2. data/.rvmrc +1 -0
  3. data/CHANGELOG.rdoc +9 -1
  4. data/Gemfile +2 -0
  5. data/Gemfile.lock +39 -0
  6. data/README.rdoc +20 -72
  7. data/Rakefile +6 -0
  8. data/TODO.rdoc +10 -5
  9. data/lib/shoe.rb +29 -13
  10. data/lib/shoe/extensions.rb +0 -4
  11. data/lib/shoe/extensions/specification.rb +0 -4
  12. data/lib/shoe/extensions/validator.rb +40 -11
  13. data/lib/shoe/tasks.rb +13 -22
  14. data/lib/shoe/tasks/clean.rb +4 -4
  15. data/lib/shoe/tasks/compile.rb +2 -4
  16. data/lib/shoe/tasks/cucumber.rb +5 -9
  17. data/lib/shoe/tasks/rdoc.rb +2 -3
  18. data/lib/shoe/tasks/ronn.rb +5 -5
  19. data/lib/shoe/tasks/{abstract.rb → task.rb} +1 -1
  20. data/lib/shoe/tasks/test.rb +17 -57
  21. data/lib/shoe/util/minitest_colors.rb +60 -0
  22. data/lib/shoe/version.rb +3 -0
  23. data/man/shoe.3 +5 -11
  24. data/man/shoe.3.ronn +4 -13
  25. data/shoe.gemspec +35 -0
  26. data/test/helper.rb +6 -12
  27. data/test/support/assertions.rb +45 -0
  28. data/test/support/command_runner.rb +11 -0
  29. data/test/support/declarative_tests.rb +24 -0
  30. data/test/support/example_project.rb +37 -0
  31. data/test/support/file_manipulation.rb +43 -0
  32. data/test/support/gemspec_manipulation.rb +24 -0
  33. data/test/support/project_files.rb +60 -0
  34. data/test/support/redgreen.rb +6 -0
  35. data/test/system/rake_test.rb +124 -0
  36. metadata +75 -96
  37. data/bin/shoe +0 -18
  38. data/data/shoe/templates/application.erb +0 -23
  39. data/data/shoe/templates/executable.erb +0 -18
  40. data/data/shoe/templates/extconf.erb +0 -2
  41. data/data/shoe/templates/extension.erb +0 -25
  42. data/data/shoe/templates/gemspec.erb +0 -44
  43. data/data/shoe/templates/gitkeep.erb +0 -0
  44. data/data/shoe/templates/manpage_1.erb +0 -29
  45. data/data/shoe/templates/manpage_3.erb +0 -19
  46. data/data/shoe/templates/module.erb +0 -31
  47. data/data/shoe/templates/module_test.rb +0 -7
  48. data/data/shoe/templates/rakefile.erb +0 -3
  49. data/data/shoe/templates/readme.erb +0 -3
  50. data/data/shoe/templates/test_helper.erb +0 -9
  51. data/lib/shoe/extensions/option_parser.rb +0 -52
  52. data/lib/shoe/extensions/pathname.rb +0 -16
  53. data/lib/shoe/extensions/source_index.rb +0 -17
  54. data/lib/shoe/extensions/test_runner.rb +0 -28
  55. data/lib/shoe/generator.rb +0 -147
  56. data/lib/shoe/tasks/release.rb +0 -81
  57. data/man/shoe.1 +0 -63
  58. data/man/shoe.1.ronn +0 -60
  59. data/test/extensions/fake_rubygems_server.rb +0 -62
  60. data/test/extensions/helper_methods.rb +0 -73
  61. data/test/extensions/isolated_environment.rb +0 -50
  62. data/test/extensions/test_case.rb +0 -40
  63. data/test/system/rake_clean_test.rb +0 -36
  64. data/test/system/rake_compile_test.rb +0 -25
  65. data/test/system/rake_cucumber_test.rb +0 -51
  66. data/test/system/rake_rdoc_test.rb +0 -26
  67. data/test/system/rake_release_test.rb +0 -94
  68. data/test/system/rake_ronn_test.rb +0 -25
  69. data/test/system/rake_test_test.rb +0 -45
  70. data/test/system/shoe_test.rb +0 -79
@@ -1,4 +1,4 @@
1
1
  .bundle
2
- .rvmrc
3
2
  *.gem
3
+ pkg
4
4
  rdoc
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use @shoe
@@ -1,4 +1,12 @@
1
- == Git
1
+ == 0.7.0 -- 2010 October 11
2
+
3
+ * 1.9 compatibility!
4
+ * Remove shoe generator; use `bundle gem foo` instead.
5
+ * Remove release tasks; suggest Bundler's instead.
6
+ * Use Shoe.install_tasks to auto-detect gemspec.
7
+ * Remove dependency on launchy.
8
+
9
+ == 0.6.2 -- 2010 April 29
2
10
 
3
11
  * Generated C extension actually works now.
4
12
  * `rake test` now properly depends on `rake compile`.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ shoe (0.7.0)
5
+ rake (~> 0.8.7)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ builder (2.1.2)
11
+ cucumber (0.6.4)
12
+ builder (>= 2.1.2)
13
+ diff-lcs (>= 1.1.2)
14
+ json_pure (>= 1.2.0)
15
+ polyglot (>= 0.2.9)
16
+ term-ansicolor (>= 1.0.4)
17
+ treetop (>= 1.4.2)
18
+ diff-lcs (1.1.2)
19
+ hpricot (0.8.2)
20
+ json_pure (1.4.3)
21
+ polyglot (0.3.1)
22
+ rake (0.8.7)
23
+ rdiscount (1.6.3.1)
24
+ ronn (0.5)
25
+ hpricot (>= 0.8.2)
26
+ rdiscount (>= 1.5.8)
27
+ term-ansicolor (1.0.5)
28
+ treetop (1.4.8)
29
+ polyglot (>= 0.3.1)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ bundler (~> 1.0.0)
36
+ cucumber (~> 0.6.4)
37
+ rake (~> 0.8.7)
38
+ ronn (~> 0.5)
39
+ shoe!
@@ -1,24 +1,13 @@
1
1
  = Shoe
2
2
 
3
- Shoe is an ecosystem-friendly library of Rake tasks for your gem.
3
+ Configuration-free Rake tasks that {read your
4
+ gemspec}[http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/] and
5
+ re-use
6
+ {built-in}[http://rubygems.rubyforge.org/rubygems-update/Gem/Ext/ExtConfBuilder.html]
7
+ {Rubygems}[http://rubygems.rubyforge.org/rubygems-update/Gem/DocManager.html]
8
+ {functionality}[http://rubygems.rubyforge.org/rubygems-update/Gem/Validator.html].
4
9
 
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
-
19
- * It <b>follows the
20
- {Ruby Packaging Standard}[http://chneukirchen.github.com/rps/]</b>
21
- when generating project files.
10
+ Shoe works great on both Ruby 1.8 and 1.9.
22
11
 
23
12
 
24
13
  == Install
@@ -29,58 +18,37 @@ Shoe is an ecosystem-friendly library of Rake tasks for your gem.
29
18
  == Use
30
19
 
31
20
  require 'shoe'
32
-
33
- Shoe::Tasks.define('my_project.gemspec')
21
+ Shoe.install_tasks
34
22
 
35
23
 
36
24
  == Configure
37
25
 
38
- Shoe::Tasks accept no direct configuration. Instead, they rely on your project environment:
26
+ Keep your configuration DRY: use your gemspec! (And friends.)
39
27
 
40
28
  Shoe::Tasks::Clean::
41
- calls something like <tt>`git clean -fdX`</tt>, but preserves
42
- <tt>.bundle/</tt> and <tt>.rvmrc</tt>.
29
+ {.gitignore}[http://www.kernel.org/pub/software/scm/git/docs/gitignore.html]
43
30
 
44
31
  Shoe::Tasks::Compile::
45
- builds the
46
- <tt>extensions[http://docs.rubygems.org/read/chapter/20#extensions]</tt> in
47
- your gemspec.
32
+ {#extensions}[http://docs.rubygems.org/read/chapter/20#extensions]
48
33
 
49
34
  Shoe::Tasks::Cucumber::
50
- runs individual profiles in your
51
- <tt>{cucumber.yml}[http://wiki.github.com/aslakhellesoy/cucumber/cucumberyml]</tt>.
35
+ cucumber.yml[http://wiki.github.com/aslakhellesoy/cucumber/cucumberyml]
52
36
 
53
37
  Shoe::Tasks::Rdoc::
54
- uses the
55
- <tt>rdoc_options[http://docs.rubygems.org/read/chapter/20#rdoc_options]</tt>
56
- and
57
- <tt>extra_rdoc_files[http://docs.rubygems.org/read/chapter/20#extra_rdoc_files]</tt>
58
- in your gemspec.
59
-
60
- Shoe::Tasks::Release::
61
- calls <tt>`git tag`</tt>, <tt>`git push`</tt>, <tt>`gem build`</tt> and
62
- <tt>`gem push`</tt>, of course.
38
+ {#rdoc_options}[http://docs.rubygems.org/read/chapter/20#rdoc_options],
39
+ {#extra_rdoc_files}[http://docs.rubygems.org/read/chapter/20#extra_rdoc_files]
63
40
 
64
41
  Shoe::Tasks::Ronn::
65
- builds man pages from your <tt>{ronn}[http://rtomayko.github.com/ronn/]</tt> sources,
66
- honoring the
67
- <tt>date[http://docs.rubygems.org/read/chapter/20#date]</tt>
68
- and the first
69
- <tt>author[http://docs.rubygems.org/read/chapter/20#authors]</tt>
70
- in your gemspec.
42
+ {#date}[http://docs.rubygems.org/read/chapter/20#date],
43
+ {#author}[http://docs.rubygems.org/read/chapter/20#authors]
71
44
 
72
45
  Shoe::Tasks::Test::
73
- runs the
74
- <tt>test_files[http://docs.rubygems.org/read/chapter/20#test_files]</tt> in
75
- your gemspec.
76
-
77
- Each Task class definition has more specific configuration notes.
46
+ {#test_files}[http://docs.rubygems.org/read/chapter/20#test_files]
78
47
 
79
48
 
80
49
  == Cherry Pick
81
50
 
82
- If you don't want to use all the Shoe::Tasks, just instantiate the ones you
83
- want:
51
+ If you don't want to use all the tasks, just instantiate the ones you want:
84
52
 
85
53
  require 'shoe'
86
54
 
@@ -88,27 +56,7 @@ want:
88
56
  Shoe::Tasks::Rdoc.new('my_project.gemspec')
89
57
 
90
58
 
91
- == Bootstrap
92
-
93
- The provided <tt>shoe</tt> executable will generate a helpful gemspec and some
94
- other skeleton files for your new project:
95
-
96
- $ shoe my_project
97
-
98
- For more, run:
99
-
100
- $ shoe --help
101
-
102
- Or, if you have <tt>{gem-man}[http://github.com/defunkt/gem-man]</tt> installed:
103
-
104
- $ gem man shoe
105
-
106
-
107
59
  == Contribute
108
60
 
109
- A number of these tasks are maybe less useful for you than they could be,
110
- probably because you and I use different conventions. If you have some ideas
111
- for making Shoe better, I'd love to hear them! Feel free to send issues / pull
112
- requests / messages through GitHub.
113
-
114
- All the best, -- Matthew
61
+ Feel free to send issues / pull requests / messages through
62
+ GitHub[http://github.com/matthewtodd/shoe].
@@ -0,0 +1,6 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+ Bundler.setup(:default, :development)
4
+
5
+ require 'shoe'
6
+ Shoe.install_tasks
data/TODO.rdoc CHANGED
@@ -1,12 +1,17 @@
1
1
  = Next Up
2
2
 
3
- * Remove Launchy? (Follow hub's lead.)
4
3
  * Start running on 1.9: Gem::Validator uses MiniTest::Unit.
5
4
 
6
5
  = Someday Maybe
7
6
 
8
7
  * 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?
11
- * Generator should do the right thing when the base directory has a dash in it.
12
- * Add :only/:except options to Shoe::Tasks.define.
8
+ * Document rake task hook prepare.
9
+ * Reintroduce a command-line tool to fill in the gaps left by bundler:
10
+ * Modify the gemspec:
11
+ * Help setting rdoc_options and extra_rdoc_files.
12
+ * Help setting author and email?
13
+ * Help setting extensions?
14
+ * Generate a C extension.
15
+ * Generate a data directory and provide access to it.
16
+ * Generate man pages.
17
+ * Generate an .rvmrc.
@@ -1,22 +1,38 @@
1
- require 'pathname'
2
- require 'rbconfig'
3
- require 'rbconfig/datadir'
1
+ require 'shoe/version'
4
2
 
5
3
  module Shoe
6
- VERSION = '0.6.2'
7
-
8
4
  autoload :Extensions, 'shoe/extensions'
9
- autoload :Generator, 'shoe/generator'
10
5
  autoload :Tasks, 'shoe/tasks'
11
6
 
12
- def self.datadir
13
- @@datadir ||= begin
14
- datadir = RbConfig.datadir('shoe')
15
- if !File.exist?(datadir)
16
- warn "WARN: #{datadir} does not exist.\n Trying again with relative data directory..."
17
- datadir = File.expand_path('../../data/shoe', __FILE__)
7
+ class << self
8
+ def browse(url)
9
+ system(browser, url)
10
+ end
11
+
12
+ def install_tasks(name='*')
13
+ Tasks.define Dir["#{name}.gemspec"].first
14
+ end
15
+
16
+ private
17
+
18
+ # stolen from hub
19
+ def browser
20
+ if ENV['BROWSER']
21
+ ENV['BROWSER']
22
+ elsif RUBY_PLATFORM.include?('darwin')
23
+ 'open'
24
+ elsif command?("xdg-open")
25
+ 'xdg-open'
26
+ elsif command?("cygstart")
27
+ 'cygstart'
28
+ else
29
+ abort 'Please set $BROWSER to a web launcher to use this command.'
18
30
  end
19
- Pathname.new(datadir)
31
+ end
32
+
33
+ def command?(name)
34
+ `which #{name} 2>/dev/null`
35
+ $?.success?
20
36
  end
21
37
  end
22
38
  end
@@ -1,11 +1,7 @@
1
1
  module Shoe
2
2
  module Extensions
3
3
  autoload :DocManager, 'shoe/extensions/doc_manager'
4
- autoload :OptionParser, 'shoe/extensions/option_parser'
5
- autoload :Pathname, 'shoe/extensions/pathname'
6
- autoload :SourceIndex, 'shoe/extensions/source_index'
7
4
  autoload :Specification, 'shoe/extensions/specification'
8
- autoload :TestRunner, 'shoe/extensions/test_runner'
9
5
  autoload :Validator, 'shoe/extensions/validator'
10
6
  end
11
7
  end
@@ -9,10 +9,6 @@ module Shoe
9
9
  def full_gem_path
10
10
  Dir.pwd
11
11
  end
12
-
13
- def has_version_greater_than?(string)
14
- version > Gem::Version.new(string)
15
- end
16
12
  end
17
13
 
18
14
  end
@@ -1,24 +1,53 @@
1
+
1
2
  module Shoe
2
3
  module Extensions
3
4
 
4
5
  module Validator
5
6
  def self.extended(base)
6
- base.send :include, InstanceMethods
7
- base.test_runner = TestRunner
7
+ if RUBY_VERSION < '1.9'
8
+ require 'test/unit'
9
+ Test::Unit.run = true
10
+ base.send :include, Ruby18::InstanceMethods
11
+ base.send :remove_const, :TestRunner
12
+ base.send :const_set, :TestRunner, Ruby18::TestRunner
13
+ else
14
+ require 'minitest/unit'
15
+ MiniTest::Unit.class_eval('@@installed_at_exit = true')
16
+ end
8
17
  end
9
18
 
10
- def test_runner=(klass)
11
- remove_const :TestRunner
12
- const_set :TestRunner, klass
13
- end
19
+ module Ruby18 #:nodoc:
20
+ module InstanceMethods #:nodoc:
21
+ def alert_error(*args)
22
+ # no-op
23
+ end
14
24
 
15
- module InstanceMethods #:nodoc:
16
- def alert_error(*args)
17
- # no-op
25
+ def unit_test(*args)
26
+ exit(1) unless super.passed?
27
+ end
18
28
  end
19
29
 
20
- def unit_test(*args)
21
- exit(1) unless super.passed?
30
+ module TestRunner #:nodoc:
31
+ # Conforms the normal TestRunner interface to the slightly different form
32
+ # called by Gem::Validator.
33
+ #
34
+ # Note that we use Test::Unit::AutoRunner (rather than going directly for
35
+ # Test::Unit::UI::Console::TestRunner) in order to give redgreen a chance
36
+ # to register itself, should it have been required in one of the
37
+ # test_files.
38
+ def self.run(suite, ui)
39
+ runner = Test::Unit::AutoRunner.new(false)
40
+ runner.collector = lambda { suite }
41
+ runner.run.extend(BooleanPassed)
42
+ end
43
+
44
+ private
45
+
46
+ module BooleanPassed #:nodoc:
47
+ def passed?
48
+ self
49
+ end
50
+ end
22
51
  end
23
52
  end
24
53
  end
@@ -1,29 +1,20 @@
1
1
  module Shoe
2
2
  module Tasks
3
-
4
- autoload :Abstract, 'shoe/tasks/abstract'
5
- autoload :Clean, 'shoe/tasks/clean'
6
- autoload :Compile, 'shoe/tasks/compile'
7
- autoload :Cucumber, 'shoe/tasks/cucumber'
8
- autoload :Rdoc, 'shoe/tasks/rdoc'
9
- autoload :Ronn, 'shoe/tasks/ronn'
10
- autoload :Release, 'shoe/tasks/release'
11
- autoload :Test, 'shoe/tasks/test'
12
-
13
- NAMES = %w(
14
- Clean
15
- Compile
16
- Cucumber
17
- Rdoc
18
- Ronn
19
- Release
20
- Test
21
- )
3
+ autoload :Clean, 'shoe/tasks/clean'
4
+ autoload :Compile, 'shoe/tasks/compile'
5
+ autoload :Cucumber, 'shoe/tasks/cucumber'
6
+ autoload :Rdoc, 'shoe/tasks/rdoc'
7
+ autoload :Ronn, 'shoe/tasks/ronn'
8
+ autoload :Task, 'shoe/tasks/task'
9
+ autoload :Test, 'shoe/tasks/test'
22
10
 
23
11
  def self.define(spec)
24
- NAMES.map { |name| const_get(name) }.
25
- each { |task| task.new(spec) }
12
+ Clean.new(spec)
13
+ Compile.new(spec)
14
+ Cucumber.new(spec)
15
+ Rdoc.new(spec)
16
+ Ronn.new(spec)
17
+ Test.new(spec)
26
18
  end
27
-
28
19
  end
29
20
  end
@@ -6,13 +6,13 @@ module Shoe
6
6
  #
7
7
  # Uses something like <tt>`{git
8
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>.
9
+ # -fdX`</tt>, except preserves <tt>.bundle/</tt>.
10
10
  #
11
11
  # To enable, version your project with git[http://git-scm.com].
12
12
  #
13
13
  # To configure, edit your
14
14
  # <tt>{.gitignore}[http://www.kernel.org/pub/software/scm/git/docs/gitignore.html]</tt>.
15
- class Clean < Abstract
15
+ class Clean < Task
16
16
  def active?
17
17
  File.directory?('.git')
18
18
  end
@@ -21,7 +21,7 @@ module Shoe
21
21
  desc <<-END.gsub(/^ */, '')
22
22
  Remove ignored files.
23
23
  Configure via your .gitignore file. Uses something like `git clean -fdX`,
24
- except preserves .bundle/ and .rvmrc.
24
+ except preserves .bundle/.
25
25
  END
26
26
 
27
27
  task :clean do
@@ -36,7 +36,7 @@ module Shoe
36
36
  end
37
37
 
38
38
  def preserved_files
39
- %w( .bundle/ .rvmrc )
39
+ %w( .bundle/ )
40
40
  end
41
41
  end
42
42