shoe 0.6.0 → 0.6.1

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.
@@ -1,3 +1,11 @@
1
+ == 0.6.1 -- 2010 April 22
2
+
3
+ * Reformat warning messages.
4
+ * Sample-require redgreen in the generated test/helper.
5
+ * Include common dvelopment dependencies in the generated gemspec.
6
+ * Fix a couple of typos.
7
+ * Document extensions to OptionParser.
8
+
1
9
  == 0.6.0 -- 2010 April 20
2
10
 
3
11
  * Add --webcvs to rdoc_options in generated gemspec.
data/bin/shoe CHANGED
@@ -7,7 +7,7 @@ rescue LoadError
7
7
 
8
8
  lib = File.expand_path('../../lib', __FILE__)
9
9
  if !$:.include?(lib)
10
- warn "#{$!}. Trying again with #{lib} on the $LOAD_PATH."
10
+ warn "WARN: #{$!}.\n Trying again with #{lib} on the $LOAD_PATH..."
11
11
  $:.unshift(lib)
12
12
  retry
13
13
  end
@@ -20,8 +20,10 @@ Gem::Specification.new do |spec|
20
20
  # You may find these helpful:
21
21
  # spec.requirements = ['git'] # If your library shells out to git
22
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
23
  # spec.add_runtime_dependency 'nokogiri' # Or what have you
24
+ # spec.add_development_dependency 'cucumber'
25
+ # spec.add_development_dependency 'redgreen'
26
+ # spec.add_development_dependency 'ronn'
25
27
  spec.add_development_dependency 'shoe'
26
28
 
27
29
  # This may not be the best way to select files for inclusion in your gem, but
@@ -11,14 +11,14 @@ Write your description here.
11
11
 
12
12
  ## OPTIONS
13
13
 
14
- `<%= name %>` also responds to the followng standard options:
14
+ `<%= name %>` also responds to the following standard options:
15
15
 
16
16
  * `-h`, `--help`:
17
17
  Print a help message and exit.
18
18
 
19
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
20
+ Print `<%= name %>`'s version number and exit. If `=all` is given, also print
21
+ version numbers of `<%= name %>`'s dependencies. (This is standard `optparse` behavior
22
22
  that deserves more attention!)
23
23
 
24
24
  ## AUTHOR
@@ -1,2 +1,9 @@
1
1
  require 'test/unit'
2
2
  require '<%= name %>'
3
+
4
+ begin
5
+ require 'redgreen' if $stdout.tty?
6
+ rescue LoadError
7
+ # It's nice not to have hard dependencies on any gems for testing, so that
8
+ # it's super-easy for your users to run `gem check --test <%= name %>.`
9
+ end
@@ -27,6 +27,6 @@ Feature: Getting started
27
27
  Given I have created a directory called "my_project"
28
28
  And I have created a file called "my_project/Rakefile" containing "# RAKEFILE CONTENTS"
29
29
  When I run shoe inside "my_project"
30
- Then I should see "Rakefile exists. Not clobbering." on standard error
30
+ Then I should see "WARN: not clobbering existing Rakefile" on standard error
31
31
  And the contents of "my_project/Rakefile" should still be "# RAKEFILE CONTENTS"
32
32
 
@@ -3,7 +3,7 @@ require 'rbconfig'
3
3
  require 'rbconfig/datadir'
4
4
 
5
5
  module Shoe
6
- VERSION = '0.6.0'
6
+ VERSION = '0.6.1'
7
7
 
8
8
  autoload :Extensions, 'shoe/extensions'
9
9
  autoload :Generator, 'shoe/generator'
@@ -13,7 +13,7 @@ module Shoe
13
13
  @@datadir ||= begin
14
14
  datadir = RbConfig.datadir('shoe')
15
15
  if !File.exist?(datadir)
16
- warn "#{datadir} does not exist. Trying again with relative data directory."
16
+ warn "WARN: #{datadir} does not exist.\n Trying again with relative data directory..."
17
17
  datadir = File.expand_path('../../data/shoe', __FILE__)
18
18
  end
19
19
  Pathname.new(datadir)
@@ -1,23 +1,52 @@
1
1
  module Shoe
2
2
  module Extensions
3
3
 
4
+ # This extension allows for default options in OptionParser, processing
5
+ # them before any given options and appending them nicely to the help
6
+ # message. (It also does the conventional thing and errors with usage when
7
+ # there's trouble parsing options.)
8
+ #
9
+ # Note that it's important to use #order rather than #permute, to ensure
10
+ # that the given options have a chance to override the defaults. (These are
11
+ # <tt>POSIX</tt>-ly correct semantics.)
12
+ #
13
+ # To use:
14
+ # parser = OptionsParser.new do |opts|
15
+ # opts.extend(Shoe::Extensions::OptionParser)
16
+ # opts.defaults = %w(--foo --no-bar --baz=5)
17
+ # # ... and so on ...
18
+ # end
19
+ #
20
+ # parser.order(ARGV)
4
21
  module OptionParser
5
- attr_accessor :defaults
22
+ attr_reader :defaults
23
+
24
+ def defaults=(defaults)
25
+ @defaults = defaults.extend(Defaults)
26
+ end
6
27
 
7
28
  def order(*args, &block)
8
29
  begin
9
- super(defaults.dup.concat(*args), &block)
30
+ super(*defaults.followed_by(*args), &block)
10
31
  rescue ::OptionParser::ParseError
11
32
  abort($!)
12
33
  end
13
34
  end
14
35
 
15
- def summarize(*args, &block)
16
- return <<-END.gsub(/^ {10}/, '')
17
- #{super}
18
- Defaults:
19
- #{summary_indent}#{defaults.join(' ')}
20
- END
36
+ def help
37
+ defaults.help(super, summary_indent)
38
+ end
39
+
40
+ private
41
+
42
+ module Defaults #:nodoc:
43
+ def followed_by(*args)
44
+ dup.concat(*args)
45
+ end
46
+
47
+ def help(before, indent)
48
+ "#{before}\nDefaults:\n#{indent}#{join ' '}"
49
+ end
21
50
  end
22
51
  end
23
52
 
@@ -4,7 +4,7 @@ module Shoe
4
4
  module Pathname
5
5
  def install(contents, mode)
6
6
  if exist?
7
- warn "#{to_s} exists. Not clobbering."
7
+ warn "WARN: not clobbering existing #{to_s}"
8
8
  else
9
9
  open('w') { |file| file.write(contents) }
10
10
  chmod(mode)
@@ -21,7 +21,7 @@ module Shoe
21
21
  begin
22
22
  require 'cucumber/rake/task'
23
23
  rescue LoadError
24
- warn "It seems you don't have cucumber installed."
24
+ warn "WARN: Please `gem install cucumber`."
25
25
  else
26
26
  define_tasks
27
27
  end
@@ -39,7 +39,7 @@ module Shoe
39
39
  sh "git tag #{version_tag(spec.version)}"
40
40
 
41
41
  if there_is_no_tag_for('semver')
42
- warn "It seems you don't have a 'semver' tag. See http://semver.org/."
42
+ warn "WARN: Please `git tag semver`. <http://semver.org/>"
43
43
  end
44
44
 
45
45
  if there_is_a_remote_called('origin')
@@ -33,7 +33,7 @@ module Shoe
33
33
  begin
34
34
  require 'ronn'
35
35
  rescue LoadError
36
- warn "It seems you don't have 'ronn' installed."
36
+ warn "WARN: Please `gem install ronn`."
37
37
  else
38
38
  define_tasks
39
39
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 0
9
- version: 0.6.0
8
+ - 1
9
+ version: 0.6.1
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-20 00:00:00 +03:00
17
+ date: 2010-04-22 00:00:00 +03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -142,10 +142,10 @@ rdoc_options:
142
142
  - --main
143
143
  - README.rdoc
144
144
  - --title
145
- - shoe-0.6.0
145
+ - shoe-0.6.1
146
146
  - --inline-source
147
147
  - --webcvs
148
- - http://github.com/matthewtodd/shoe/blob/v0.6.0/
148
+ - http://github.com/matthewtodd/shoe/blob/v0.6.1/
149
149
  require_paths:
150
150
  - lib
151
151
  required_ruby_version: !ruby/object:Gem::Requirement