shoe 0.3.0 → 0.4.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.
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ .rvmrc
3
+ *.gem
4
+ rdoc
@@ -0,0 +1,16 @@
1
+ = Using Shoe with Bundler
2
+
3
+ Bootstrapping is a little chicken-and-egg-y, but with the following initial <tt>Gemfile</tt>:
4
+
5
+ source :rubygems
6
+ gem 'shoe', :group => :development
7
+
8
+ You should be able to:
9
+
10
+ $ bundle install
11
+ $ bundle exec shoe
12
+
13
+ From there, I've been preferring <tt>`bundle exec bash`</tt> over <tt>`bundle
14
+ exec rake`</tt> or using <tt>require 'bundler/setup'</tt> in my
15
+ <tt>Rakefile</tt>. But, if you're using Bundler, you're probably already used
16
+ to puzzling over such things!
@@ -0,0 +1,7 @@
1
+ == 0.4.0
2
+
3
+ * Don't generate the gemspec; *use* it instead.
4
+
5
+ == 0.3.0 and before
6
+
7
+ (I need to spelunk through `git log` to be coherent here.)
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gem 'rake'
4
+
5
+ group :development do
6
+ gem 'cucumber'
7
+ end
@@ -0,0 +1,31 @@
1
+ ---
2
+ dependencies:
3
+ rake:
4
+ group:
5
+ - :default
6
+ version: ">= 0"
7
+ cucumber:
8
+ group:
9
+ - :development
10
+ version: ">= 0"
11
+ specs:
12
+ - rake:
13
+ version: 0.8.7
14
+ - builder:
15
+ version: 2.1.2
16
+ - diff-lcs:
17
+ version: 1.1.2
18
+ - json_pure:
19
+ version: 1.2.3
20
+ - polyglot:
21
+ version: 0.3.1
22
+ - term-ansicolor:
23
+ version: 1.0.5
24
+ - treetop:
25
+ version: 1.4.5
26
+ - cucumber:
27
+ version: 0.6.3
28
+ hash: bec7b29765230914672db7983d163d805c4afdb1
29
+ sources:
30
+ - Rubygems:
31
+ uri: http://gemcutter.org
@@ -1,79 +1,66 @@
1
1
  = Shoe
2
2
 
3
- Shoe defines some handy Rake tasks for your project, all built around your
4
- Gem::Specification.
3
+ Shoe is a library of Rake tasks that (unlike
4
+ Hoe[http://seattlerb.rubyforge.org/hoe] and
5
+ Jeweler[http://github.com/technicalpickles/jeweler]) honors your gemspec.
6
+ (Background[http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/].)
7
+
8
+ Shoe's Rake tasks accept *zero* configuration parameters. All configuration
9
+ should be performed in your (checked into version control) gemspec. This way,
10
+ Shoe can lean on Rubygems for the things it's already good at, using
11
+ {Gem::Ext::ExtConfBuilder}[http://rubygems.rubyforge.org/rubygems-update/Gem/Ext/ExtConfBuilder.html]
12
+ and
13
+ {Gem::DocManager}[http://rubygems.rubyforge.org/rubygems-update/Gem/DocManager.html]
14
+ instead of {ad-hoc}[http://github.com/luislavena/rake-compiler/] {Rake
15
+ tasks}[http://rake.rubyforge.org/classes/Rake/RDocTask.html] -- indeed, this is
16
+ what your users will be doing when they install your gem!
17
+
18
+ (I have a pipe dream of one day running tests strictly with
19
+ {Gem::Validator}[http://rubygems.rubyforge.org/rubygems-update/Gem/Validator.html].)
20
+
21
+ == Install
5
22
 
6
- Shoe is a small blip in the grand tradition of more popular projects like
7
- hoe[http://seattlerb.rubyforge.org/hoe] and
8
- jeweler[http://github.com/technicalpickles/jeweler]. I had an itch to scratch,
9
- you understand.
23
+ $ gem install shoe
10
24
 
11
- == Behold
25
+ == Use
12
26
 
13
- Here's how your +Rakefile+ looks:
27
+ In your <tt>Rakefile</tt>:
14
28
 
15
- require 'my_project/version'
16
29
  require 'shoe'
17
30
 
18
- Shoe.tie('my_project', MyProject::VERSION, "This is my project, and it's awesome!") do |spec|
19
- # do whatever you want with the Gem::Specification here, for example:
20
- # spec.add_runtime_dependency 'dnssd'
21
- end
31
+ Shoe::Tasks.define('my_project.gemspec')
22
32
 
23
- And here's what you get, at most:
33
+ Then you'll see (at most) the following rake tasks available:
24
34
 
25
35
  rake clean # Remove ignored files
26
36
  rake compile # Compile C extensions
27
37
  rake cucumber:ok # Run features
28
38
  rake cucumber:wip # Run work-in-progress features
29
- rake default # Run features
30
- rake gemspec # Show latest gemspec contents
39
+ rake default # Run tests / Run features
31
40
  rake rdoc # Generate documentation
32
41
  rake release # Release myproject-0.1.0
33
- rake shell # Run an irb console
34
42
  rake test # Run tests
35
43
 
36
- Most of the time, though, you won't see all of these: when possible, tasks are
37
- conditionally defined.
38
-
39
- See what I mean by clicking through the various <tt>Shoe::Tasks</tt>.
40
-
41
- == Getting Started
42
-
43
- === With Bundler[http://github.com/carlhuda/bundler]
44
-
45
- 1. Start with just shoe in your +Gemfile+:
46
-
47
- source :rubygems
48
- gem 'shoe'
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.
49
47
 
50
- 2. Open a sub-shell configured for the bundler environment:
48
+ == Bootstrap
51
49
 
52
- $ bundle exec $SHELL
50
+ If you like, you can also use the provided <tt>shoe</tt> executable to generate
51
+ some starter files for your new project:
53
52
 
54
- (If you run into trouble, {this blog
55
- post}[http://matthewtodd.org/2010/02/19/bundle-exec-bash.html] may help.)
53
+ $ mkdir foo
54
+ $ cd foo
55
+ $ shoe
56
56
 
57
- 3. Use +shoe+ to generate some skeleton project files:
57
+ This will generate <tt>README.rdoc</tt>, <tt>Rakefile</tt>,
58
+ <tt>foo.gemspec</tt>, and <tt>lib/foo/version.rb</tt>.
58
59
 
59
- $ shoe
60
-
61
- 4. And then you can poke around with
62
-
63
- $ rake -T
64
-
65
- === Without Bundler
66
-
67
- If you're not using bundler, it's probably best not to use the +shoe+
68
- generator. Instead, just install shoe normally:
69
-
70
- $ gem install shoe
60
+ If you're using Bundler, see {BUNDLER.rdoc}[link:files/BUNDLER_rdoc.html] for more.
71
61
 
72
- And then <tt>require 'shoe'</tt> and add a <tt>Shoe.tie</tt> clause to your +Rakefile+:
62
+ == Send Me Feedback
73
63
 
74
- Shoe.tie('my_project', '0.0.0', 'My project is awesome.') do |spec|
75
- # spec.add_runtime_dependency 'dnssd' # or whatever...
76
- end
64
+ A number of these tasks are maybe less useful for you than they could be, probably because you and I use different conventions. If you have some ideas for making Shoe better, I'd love to hear them! Feel free to send issues / pull requests / messages through GitHub.
77
65
 
78
- Shoe also assumes you have a <tt>README.rdoc</tt>, so you'll need to create one if you
79
- want to avoid warnings running <tt>`rake rdoc`</tt>.
66
+ All the best, -- Matthew
data/Rakefile CHANGED
@@ -1,8 +1,4 @@
1
+ $:.unshift 'lib'
1
2
  require 'shoe'
2
- require 'shoe/version'
3
3
 
4
- Shoe.tie('shoe', Shoe::VERSION, 'Another take on hoe, jeweler & friends.') do |spec|
5
- spec.requirements = ['git']
6
- spec.required_rubygems_version = '>= 1.3.6'
7
- spec.add_runtime_dependency 'rake'
8
- end
4
+ Shoe::Tasks.define('shoe.gemspec')
@@ -0,0 +1,8 @@
1
+ = Next Up
2
+
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
+ * How would I incorporate Gem::Specification#add_bundler_dependencies?
8
+ * Require a path argument for the shoe executable.
data/bin/shoe CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'shoe/cli'
4
- Shoe::CLI.run
3
+ require 'shoe'
4
+ Shoe::Generator.new.run
@@ -8,7 +8,7 @@ Feature: Getting started
8
8
  And I have created a file called "my_project/Gemfile" containing:
9
9
  """
10
10
  source :rubygems
11
- gem 'shoe'
11
+ gem 'shoe', :group => :development
12
12
  """
13
13
  When I run bundle exec shoe inside "my_project"
14
14
  Then I should see a file "my_project/Rakefile"
@@ -21,7 +21,7 @@ Feature: Getting started
21
21
  And I have created a file called "my_project/Gemfile" containing:
22
22
  """
23
23
  source :rubygems
24
- gem 'shoe'
24
+ gem 'shoe', :group => :development
25
25
  """
26
26
  And I have created a file called "my_project/Rakefile" containing "# RAKEFILE CONTENTS"
27
27
  When I run bundle exec shoe inside "my_project"
@@ -2,7 +2,7 @@ Given /^I have created a project called "([^\"]*)"$/ do |name|
2
2
  create_directory(name)
3
3
  create_file("#{name}/Gemfile", <<-END.gsub(/^\s*/, ''))
4
4
  source :rubygems
5
- gem 'shoe'
5
+ gem 'shoe', :group => :development
6
6
  END
7
7
  run('bundle exec shoe', name)
8
8
  end
@@ -1,10 +1,4 @@
1
1
  module Shoe
2
- autoload :Project, 'shoe/project'
3
- autoload :Tasks, 'shoe/tasks'
4
-
5
- def self.tie(name, version, summary)
6
- project = Project.new(name, version, summary)
7
- yield project.spec if block_given?
8
- project.define_tasks
9
- end
2
+ autoload :Generator, 'shoe/generator'
3
+ autoload :Tasks, 'shoe/tasks'
10
4
  end
@@ -0,0 +1,64 @@
1
+ require 'erb'
2
+ require 'pathname'
3
+
4
+ module Shoe
5
+ class Generator
6
+ def initialize
7
+ @root = Pathname.pwd.expand_path
8
+ @template_path = Pathname.new(__FILE__).dirname.join('templates')
9
+ end
10
+
11
+ def run
12
+ path('README.rdoc').install template('readme.erb')
13
+ path('Rakefile').install template('rakefile.erb')
14
+ path(version_path).install template('version.erb')
15
+ path(gemspec_path).install template('gemspec.erb')
16
+ end
17
+
18
+ private
19
+
20
+ def project_name
21
+ @root.basename.to_s
22
+ end
23
+
24
+ def project_module
25
+ project_name.capitalize.gsub(/_(\w)/) { $1.upcase }
26
+ end
27
+
28
+ def project_version
29
+ '0.0.0'
30
+ end
31
+
32
+ def version_path
33
+ "lib/#{project_name}/version.rb"
34
+ end
35
+
36
+ def gemspec_path
37
+ "#{project_name}.gemspec"
38
+ end
39
+
40
+ def template(name)
41
+ ERB.new(template_contents(name)).result(binding)
42
+ end
43
+
44
+ def template_contents(name)
45
+ @template_path.join(name).read
46
+ end
47
+
48
+ def path(name)
49
+ path = @root.join(name)
50
+ path.dirname.mkpath
51
+ path.extend(PathExtensions)
52
+ end
53
+
54
+ module PathExtensions #:nodoc:
55
+ def install(contents)
56
+ if exist?
57
+ $stderr.puts "#{to_s} exists. Not clobbering."
58
+ else
59
+ open('w') { |file| file.write(contents) }
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,108 +1,26 @@
1
1
  module Shoe
2
2
  module Tasks
3
3
 
4
- autoload :Bin, 'shoe/tasks/bin'
4
+ autoload :Abstract, 'shoe/tasks/abstract'
5
5
  autoload :Clean, 'shoe/tasks/clean'
6
6
  autoload :Compile, 'shoe/tasks/compile'
7
7
  autoload :Cucumber, 'shoe/tasks/cucumber'
8
- autoload :Gemspec, 'shoe/tasks/gemspec'
9
8
  autoload :Rdoc, 'shoe/tasks/rdoc'
10
9
  autoload :Release, 'shoe/tasks/release'
11
- autoload :Resources, 'shoe/tasks/resources'
12
- autoload :Shell, 'shoe/tasks/shell'
13
- autoload :Shoulda, 'shoe/tasks/shoulda'
14
10
  autoload :Test, 'shoe/tasks/test'
15
11
 
16
12
  LOAD_ORDER = %w(
17
- Bin
18
13
  Clean
19
- Gemspec
20
14
  Rdoc
21
15
  Release
22
- Resources
23
- Shell
24
- Shoulda
25
16
  Test
26
17
  Cucumber
27
18
  Compile
28
19
  )
29
20
 
30
- def self.each
31
- LOAD_ORDER.map { |name| const_get name }.
32
- each { |task| yield task }
33
- end
34
-
35
- class AbstractTask
36
- def self.define(spec)
37
- task = new(spec)
38
-
39
- if task.active?
40
- task.update_spec
41
- task.define
42
- end
43
-
44
- task
45
- end
46
-
47
- attr_reader :spec
48
-
49
- def initialize(spec)
50
- @spec = spec
51
- end
52
-
53
- def active?
54
- true
55
- end
56
-
57
- def define
58
- # no-op
59
- end
60
-
61
- def update_spec
62
- # no-op
63
- end
64
-
65
- private
66
-
67
- def before(name, dependency)
68
- desc Rake::Task[dependency].comment
69
- task name => dependency
70
- end
71
-
72
- def before_existing(name, dependency)
73
- if Rake::Task.task_defined?(name)
74
- task name => dependency
75
- end
76
- end
77
-
78
- def warn(subject, *paragraphs)
79
- message = StringIO.new
80
- width = 72
81
-
82
- message.puts '-' * width
83
- message.puts "#{subject} warning from shoe".upcase
84
- paragraphs.each do |paragraph|
85
- message.puts
86
- message.puts wrap(paragraph, width)
87
- end
88
- message.puts '-' * width
89
-
90
- $stderr.write yellow(message.string)
91
- $stderr.flush
92
- end
93
-
94
- # blatantly stolen from Gem::Command
95
- def wrap(text, width)
96
- text.gsub(/(.{1,#{width}})( +|$\n?)|(.{1,#{width}})/, "\\1\\3\n")
97
- end
98
-
99
- def yellow(string)
100
- if $stderr.tty?
101
- "\e[33m#{string}\e[0m"
102
- else
103
- string
104
- end
105
- end
21
+ def self.define(spec)
22
+ LOAD_ORDER.map { |name| const_get(name) }.
23
+ each { |task| task.new(spec) }
106
24
  end
107
25
 
108
26
  end
@@ -0,0 +1,88 @@
1
+ module Shoe
2
+ module Tasks
3
+
4
+ class Abstract
5
+ attr_reader :spec
6
+
7
+ def initialize(spec)
8
+ @spec = if spec.respond_to?(:rubygems_version)
9
+ spec
10
+ else
11
+ Gem::Specification.load(spec)
12
+ end
13
+
14
+ if active?
15
+ define
16
+ end
17
+ end
18
+
19
+ def active?
20
+ true
21
+ end
22
+
23
+ private
24
+
25
+ def before(name, dependency)
26
+ desc Rake::Task[dependency].comment
27
+ task name => dependency
28
+ end
29
+
30
+ def before_existing(name, dependency)
31
+ if Rake::Task.task_defined?(name)
32
+ task name => dependency
33
+ end
34
+ end
35
+
36
+ def warn(subject, *paragraphs)
37
+ $stderr.extend(Colored).
38
+ extend(Formatted).
39
+ message(subject, paragraphs)
40
+ end
41
+
42
+ module Colored #:nodoc:
43
+ YELLOW = "\e[33m"
44
+ CLEAR = "\e[0m"
45
+
46
+ def write(string)
47
+ super(YELLOW) if tty?
48
+ super
49
+ super(CLEAR) if tty?
50
+ end
51
+ end
52
+
53
+ module Formatted #:nodoc:
54
+ WIDTH = 72
55
+ WRAP = /(.{1,#{WIDTH}})( +|$\n?)|(.{1,#{WIDTH}})/
56
+
57
+ def message(subject, paragraphs)
58
+ border
59
+ heading(subject)
60
+ body(paragraphs)
61
+ border
62
+ end
63
+
64
+ private
65
+
66
+ def border
67
+ puts '-' * WIDTH
68
+ end
69
+
70
+ def heading(string)
71
+ puts "#{string} warning from shoe".upcase
72
+ end
73
+
74
+ def body(paragraphs)
75
+ paragraphs.each do |paragraph|
76
+ puts
77
+ puts wrap(paragraph)
78
+ end
79
+ end
80
+
81
+ def wrap(string)
82
+ string.gsub(WRAP, "\\1\\3\n")
83
+ end
84
+ end
85
+ end
86
+
87
+ end
88
+ end
@@ -1,7 +1,7 @@
1
1
  module Shoe
2
2
  module Tasks
3
3
 
4
- class Clean < AbstractTask
4
+ class Clean < Abstract
5
5
  def active?
6
6
  File.directory?('.git')
7
7
  end
@@ -3,9 +3,9 @@ require 'rubygems/ext'
3
3
  module Shoe
4
4
  module Tasks
5
5
 
6
- class Compile < AbstractTask
6
+ class Compile < Abstract
7
7
  def active?
8
- File.directory?('ext')
8
+ !spec.extensions.empty?
9
9
  end
10
10
 
11
11
  def define
@@ -35,11 +35,6 @@ module Shoe
35
35
  before_existing(name, :compile)
36
36
  end
37
37
  end
38
-
39
- def update_spec
40
- spec.files += Rake::FileList['ext/**/extconf.rb', 'ext/**/*.c']
41
- spec.extensions += Rake::FileList['ext/**/extconf.rb']
42
- end
43
38
  end
44
39
 
45
40
  end
@@ -1,7 +1,7 @@
1
1
  module Shoe
2
2
  module Tasks
3
3
 
4
- class Cucumber < AbstractTask
4
+ class Cucumber < Abstract
5
5
  def active?
6
6
  File.directory?('features')
7
7
  end
@@ -18,10 +18,6 @@ module Shoe
18
18
  end
19
19
  end
20
20
 
21
- def update_spec
22
- spec.files += Rake::FileList['features/**/*']
23
- end
24
-
25
21
  private
26
22
 
27
23
  def define_tasks
@@ -3,11 +3,7 @@ require 'rubygems/doc_manager'
3
3
  module Shoe
4
4
  module Tasks
5
5
 
6
- class Rdoc < AbstractTask
7
- def active?
8
- File.directory?('lib')
9
- end
10
-
6
+ class Rdoc < Abstract
11
7
  def define
12
8
  desc 'Generate documentation'
13
9
  task :rdoc do
@@ -24,20 +20,6 @@ module Shoe
24
20
  end
25
21
  end
26
22
 
27
- def update_spec
28
- spec.files += Rake::FileList['**/*.rdoc', 'examples/**/*']
29
-
30
- spec.rdoc_options = %W(
31
- --main README.rdoc
32
- --title #{spec.full_name}
33
- --inline-source
34
- )
35
-
36
- spec.extra_rdoc_files += Rake::FileList['**/*.rdoc']
37
-
38
- spec.has_rdoc = true
39
- end
40
-
41
23
  private
42
24
 
43
25
  # Using Gem::DocManager instead of Rake::RDocTask means you get to see your
@@ -1,7 +1,7 @@
1
1
  module Shoe
2
2
  module Tasks
3
3
 
4
- class Release < AbstractTask
4
+ class Release < Abstract
5
5
  def active?
6
6
  spec.extend(VersionExtensions)
7
7
 
@@ -13,11 +13,6 @@ module Shoe
13
13
  def define
14
14
  desc "Release #{spec.full_name}"
15
15
  task :release do
16
- File.open("#{spec.name}.gemspec", 'w') do |stream|
17
- stream.write(spec.to_ruby)
18
- end
19
-
20
- sh "git add #{spec.name}.gemspec"
21
16
  sh "git commit -a -m 'Release #{spec.version}'"
22
17
  sh "git tag #{version_tag(spec.version)}"
23
18
 
@@ -38,13 +33,9 @@ module Shoe
38
33
  end
39
34
  end
40
35
 
41
- def update_spec
42
- spec.files += Rake::FileList['*.gemspec']
43
- end
44
-
45
36
  private
46
37
 
47
- module VersionExtensions
38
+ module VersionExtensions #:nodoc:
48
39
  def has_version_greater_than?(string)
49
40
  version > Gem::Version.new(string)
50
41
  end
@@ -5,7 +5,7 @@ module Shoe
5
5
 
6
6
  # MAYBE be a little more forgiving in test selection, using
7
7
  # test/**/*_test.rb. Or create suites based on subdirectory?
8
- class Test < AbstractTask
8
+ class Test < Abstract
9
9
  def active?
10
10
  File.directory?('test')
11
11
  end
@@ -18,10 +18,6 @@ module Shoe
18
18
 
19
19
  before(:default, :test)
20
20
  end
21
-
22
- def update_spec
23
- spec.files += Rake::FileList['test/**/*']
24
- end
25
21
  end
26
22
 
27
23
  end
@@ -0,0 +1,35 @@
1
+ $:.unshift File.expand_path('../lib', __FILE__)
2
+ require '<%= project_name %>/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = '<%= project_name %>'
6
+ spec.version = <%= project_module %>::VERSION
7
+
8
+ spec.summary = ''
9
+ spec.description = spec.summary
10
+ spec.author = '<%= `git config --get user.name`.chomp %>'
11
+ spec.email = '<%= `git config --get user.email`.chomp %>'
12
+ spec.homepage = 'http://github.com/<%= `git config --get github.user`.chomp %>/<%= project_name %>'
13
+
14
+ # You may find these helpful:
15
+ # spec.requirements = ['git']
16
+ # spec.required_rubygems_version = ">= 1.3.6"
17
+ # spec.add_runtime_dependency 'nokogiri'
18
+ # spec.add_development_dependency 'cucumber'
19
+ # spec.add_bundler_dependencies # though I'm not sure how to use this yet...
20
+
21
+ def spec.git_files(glob=nil)
22
+ `git ls-files -z --cached --other --exclude-standard #{glob}`.split("\0")
23
+ end
24
+
25
+ spec.files = spec.git_files
26
+ spec.executables = spec.git_files('bin/*').map &File.method(:basename)
27
+ spec.extensions = spec.git_files('ext/**/extconf.rb')
28
+
29
+ spec.extra_rdoc_files = spec.git_files('{,**/}*.rdoc')
30
+ spec.rdoc_options = %W(
31
+ --main README.rdoc
32
+ --title #{spec.full_name}
33
+ --inline-source
34
+ )
35
+ end
@@ -1,7 +1,3 @@
1
- require '<%= project %>/version'
2
1
  require 'shoe'
3
2
 
4
- Shoe.tie('<%= project %>', <%= project_class %>::VERSION, 'TODO write a summary of <%= project_class %> here.') do |spec|
5
- # do whatever you want with the Gem::Specification here, for example:
6
- # spec.add_runtime_dependency 'dnssd'
7
- end
3
+ Shoe::Tasks.define('<%= gemspec_path %>')
@@ -1,3 +1,3 @@
1
- = <%= project_class %>
1
+ = <%= project_module %>
2
2
 
3
- <%= project_class %> is one of my favorite things! Let me tell you about it:
3
+ <%= project_module %> is one of my favorite things! Let me tell you about it:
@@ -1,3 +1,3 @@
1
- class <%= project_class %>
1
+ module <%= project_module %>
2
2
  VERSION = '<%= project_version %>'
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Shoe
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -1,33 +1,33 @@
1
- # -*- encoding: utf-8 -*-
1
+ $:.unshift File.expand_path('../lib', __FILE__)
2
+ require 'shoe/version'
2
3
 
3
- Gem::Specification.new do |s|
4
- s.name = %q{shoe}
5
- s.version = "0.3.0"
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'shoe'
6
+ spec.version = Shoe::VERSION
6
7
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Matthew Todd"]
9
- s.date = %q{2010-03-30}
10
- s.default_executable = %q{shoe}
11
- s.email = %q{matthew.todd@gmail.com}
12
- s.executables = ["shoe"]
13
- s.extra_rdoc_files = ["README.rdoc"]
14
- s.files = ["Rakefile", "lib/shoe", "lib/shoe/cli.rb", "lib/shoe/project.rb", "lib/shoe/tasks", "lib/shoe/tasks/bin.rb", "lib/shoe/tasks/clean.rb", "lib/shoe/tasks/compile.rb", "lib/shoe/tasks/cucumber.rb", "lib/shoe/tasks/gemspec.rb", "lib/shoe/tasks/rdoc.rb", "lib/shoe/tasks/release.rb", "lib/shoe/tasks/resources.rb", "lib/shoe/tasks/shell.rb", "lib/shoe/tasks/shoulda.rb", "lib/shoe/tasks/test.rb", "lib/shoe/tasks.rb", "lib/shoe/templates", "lib/shoe/templates/gemfile.erb", "lib/shoe/templates/rakefile.erb", "lib/shoe/templates/readme.erb", "lib/shoe/templates/version.erb", "lib/shoe/version.rb", "lib/shoe.rb", "bin/shoe", "README.rdoc", "shoe.gemspec", "features/cucumber.feature", "features/getting_started.feature", "features/release.feature", "features/step_definitions", "features/step_definitions/shoe_steps.rb", "features/support", "features/support/env.rb"]
15
- s.rdoc_options = ["--main", "README.rdoc", "--title", "shoe-0.3.0", "--inline-source"]
16
- s.require_paths = ["lib"]
17
- s.requirements = ["git"]
18
- s.rubygems_version = %q{1.3.6}
19
- s.summary = %q{Another take on hoe, jeweler & friends.}
8
+ spec.summary = 'Another take on hoe, jeweler & friends.'
9
+ spec.description = spec.summary
10
+ spec.author = 'Matthew Todd'
11
+ spec.email = 'matthew.todd@gmail.com'
12
+ spec.homepage = 'http://github.com/matthewtodd/shoe'
20
13
 
21
- if s.respond_to? :specification_version then
22
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
- s.specification_version = 3
14
+ spec.requirements = ['git']
15
+ spec.required_rubygems_version = '>= 1.3.6'
16
+ spec.add_runtime_dependency 'rake'
17
+ spec.add_development_dependency 'cucumber'
24
18
 
25
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<rake>, [">= 0"])
27
- else
28
- s.add_dependency(%q<rake>, [">= 0"])
29
- end
30
- else
31
- s.add_dependency(%q<rake>, [">= 0"])
19
+ def spec.git_files(glob=nil)
20
+ `git ls-files -z --cached --other --exclude-standard #{glob}`.split("\0")
32
21
  end
22
+
23
+ spec.files = spec.git_files
24
+ spec.executables = spec.git_files('bin/*').map &File.method(:basename)
25
+ spec.extensions = spec.git_files('ext/**/extconf.rb')
26
+
27
+ spec.extra_rdoc_files = spec.git_files('{,**/}*.rdoc')
28
+ spec.rdoc_options = %W(
29
+ --main README.rdoc
30
+ --title #{spec.full_name}
31
+ --inline-source
32
+ )
33
33
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
7
+ - 4
8
8
  - 0
9
- version: 0.3.0
9
+ version: 0.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matthew Todd
@@ -14,8 +14,8 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-30 00:00:00 +03:00
18
- default_executable: shoe
17
+ date: 2010-04-07 00:00:00 +03:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake
@@ -29,46 +29,62 @@ dependencies:
29
29
  version: "0"
30
30
  type: :runtime
31
31
  version_requirements: *id001
32
- description:
32
+ - !ruby/object:Gem::Dependency
33
+ name: cucumber
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :development
43
+ version_requirements: *id002
44
+ description: Another take on hoe, jeweler & friends.
33
45
  email: matthew.todd@gmail.com
34
46
  executables:
35
47
  - shoe
36
48
  extensions: []
37
49
 
38
50
  extra_rdoc_files:
51
+ - BUNDLER.rdoc
52
+ - CHANGELOG.rdoc
39
53
  - README.rdoc
54
+ - TODO.rdoc
40
55
  files:
56
+ - .gitignore
57
+ - BUNDLER.rdoc
58
+ - CHANGELOG.rdoc
59
+ - Gemfile
60
+ - Gemfile.lock
61
+ - README.rdoc
41
62
  - Rakefile
42
- - lib/shoe/cli.rb
43
- - lib/shoe/project.rb
44
- - lib/shoe/tasks/bin.rb
63
+ - TODO.rdoc
64
+ - bin/shoe
65
+ - features/cucumber.feature
66
+ - features/getting_started.feature
67
+ - features/release.feature
68
+ - features/step_definitions/shoe_steps.rb
69
+ - features/support/env.rb
70
+ - lib/shoe.rb
71
+ - lib/shoe/generator.rb
72
+ - lib/shoe/tasks.rb
73
+ - lib/shoe/tasks/abstract.rb
45
74
  - lib/shoe/tasks/clean.rb
46
75
  - lib/shoe/tasks/compile.rb
47
76
  - lib/shoe/tasks/cucumber.rb
48
- - lib/shoe/tasks/gemspec.rb
49
77
  - lib/shoe/tasks/rdoc.rb
50
78
  - lib/shoe/tasks/release.rb
51
- - lib/shoe/tasks/resources.rb
52
- - lib/shoe/tasks/shell.rb
53
- - lib/shoe/tasks/shoulda.rb
54
79
  - lib/shoe/tasks/test.rb
55
- - lib/shoe/tasks.rb
56
- - lib/shoe/templates/gemfile.erb
80
+ - lib/shoe/templates/gemspec.erb
57
81
  - lib/shoe/templates/rakefile.erb
58
82
  - lib/shoe/templates/readme.erb
59
83
  - lib/shoe/templates/version.erb
60
84
  - lib/shoe/version.rb
61
- - lib/shoe.rb
62
- - bin/shoe
63
- - README.rdoc
64
85
  - shoe.gemspec
65
- - features/cucumber.feature
66
- - features/getting_started.feature
67
- - features/release.feature
68
- - features/step_definitions/shoe_steps.rb
69
- - features/support/env.rb
70
86
  has_rdoc: true
71
- homepage:
87
+ homepage: http://github.com/matthewtodd/shoe
72
88
  licenses: []
73
89
 
74
90
  post_install_message:
@@ -76,7 +92,7 @@ rdoc_options:
76
92
  - --main
77
93
  - README.rdoc
78
94
  - --title
79
- - shoe-0.3.0
95
+ - shoe-0.4.0
80
96
  - --inline-source
81
97
  require_paths:
82
98
  - lib
@@ -1,94 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'erb'
4
- require 'pathname'
5
-
6
- module Shoe
7
- class CLI
8
- class << self
9
- def run
10
- new.run
11
- end
12
- end
13
-
14
- attr_reader :root
15
- attr_reader :spec
16
- attr_reader :template_path
17
-
18
- def initialize
19
- @root = Pathname.pwd.expand_path
20
-
21
- @spec = Gem::Specification.new do |spec|
22
- spec.name = root.basename.to_s
23
- spec.version = '0.0.0'
24
- end
25
-
26
- @template_path = Pathname.new(__FILE__).dirname.join('templates')
27
- end
28
-
29
- def run
30
- path('Gemfile').update template('gemfile.erb')
31
-
32
- path('README.rdoc').install template('readme.erb')
33
- path('Rakefile').install template('rakefile.erb')
34
- path(version_path).install template('version.erb')
35
- path(gemspec_path).install spec.to_ruby
36
- end
37
-
38
- private
39
-
40
- def project
41
- spec.name
42
- end
43
-
44
- def project_class
45
- project.capitalize.gsub(/_(\w)/) { $1.upcase }
46
- end
47
-
48
- def project_version
49
- spec.version
50
- end
51
-
52
- def version_path
53
- "lib/#{project}/version.rb"
54
- end
55
-
56
- def gemspec_path
57
- "#{project}.gemspec"
58
- end
59
-
60
- def template(name)
61
- ERB.new(template_contents(name)).result(binding)
62
- end
63
-
64
- def template_contents(name)
65
- template_path.join(name).read
66
- end
67
-
68
- def path(name)
69
- path = root.join(name)
70
- path.dirname.mkpath
71
- path.extend(PathExtensions)
72
- end
73
-
74
- module PathExtensions
75
- def install(contents)
76
- if exist?
77
- $stderr.puts "#{to_s} exists. Not clobbering."
78
- else
79
- write(contents, 'w')
80
- end
81
- end
82
-
83
- def update(contents)
84
- write(contents, 'a')
85
- end
86
-
87
- private
88
-
89
- def write(contents, mode)
90
- open(mode) { |file| file.write(contents) }
91
- end
92
- end
93
- end
94
- end
@@ -1,26 +0,0 @@
1
- module Shoe
2
- class Project
3
-
4
- # The Gem::Specification for your project.
5
- attr_reader :spec
6
-
7
- # Initializes a Gem::Specification with some nice conventions.
8
- def initialize(name, version, summary)
9
- @spec = Gem::Specification.new do |spec|
10
- spec.name = name
11
- spec.version = version
12
- spec.summary = summary
13
- spec.files = FileList['Rakefile', 'lib/**/*']
14
- spec.author = `git config --get user.name`.chomp
15
- spec.email = `git config --get user.email`.chomp
16
- end
17
- end
18
-
19
- # This is where the magic happens.
20
- def define_tasks
21
- Shoe::Tasks.each do |task|
22
- task.define(spec)
23
- end
24
- end
25
- end
26
- end
@@ -1,14 +0,0 @@
1
- module Shoe
2
- module Tasks
3
-
4
- class Bin < AbstractTask
5
- def update_spec
6
- spec.files += Rake::FileList['bin/*']
7
- spec.executables += Rake::FileList['bin/*'].map do |path|
8
- File.basename(path)
9
- end
10
- end
11
- end
12
-
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module Shoe
2
- module Tasks
3
-
4
- class Gemspec < AbstractTask
5
- def define
6
- desc 'Show latest gemspec contents'
7
- task :gemspec do
8
- puts spec.to_ruby
9
- end
10
- end
11
- end
12
-
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- module Shoe
2
- module Tasks
3
-
4
- class Resources < AbstractTask
5
- def update_spec
6
- spec.files += Rake::FileList['resources/**/*']
7
- end
8
- end
9
-
10
- end
11
- end
@@ -1,20 +0,0 @@
1
- module Shoe
2
- module Tasks
3
-
4
- # TODO can remove irb args -- and thus this task altogether! -- if we
5
- # assume bundler
6
- class Shell < AbstractTask
7
- def active?
8
- File.file?("lib/#{spec.name}.rb")
9
- end
10
-
11
- def define
12
- desc 'Run an irb console'
13
- task :shell do
14
- exec 'irb', '-Ilib', "-r#{spec.name}"
15
- end
16
- end
17
- end
18
-
19
- end
20
- end
@@ -1,12 +0,0 @@
1
- module Shoe
2
- module Tasks
3
-
4
- class Shoulda < AbstractTask
5
- def update_spec
6
- spec.files += Rake::FileList['shoulda_macros/**/*']
7
- spec.extra_rdoc_files += Rake::FileList['shoulda_macros/**/*']
8
- end
9
- end
10
-
11
- end
12
- end
@@ -1 +0,0 @@
1
- gem '<%= project %>', :path => File.expand_path('..', __FILE__)