shoe 0.1.13 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,38 @@
1
+ = Notes on <tt>`bundle exec bash`</tt>
2
+
3
+ If your <tt>$SHELL</tt> happens to be +bash+, you may run into some of the same problems I did.
4
+
5
+ Here they are, with fixes:
6
+
7
+ == Functions and Aliases Aren't Available
8
+
9
+ I had all of my +bash+ configuration in <tt>~/.profile</tt>. But,
10
+ <tt>~/.profile</tt> isn't read when you execute +bash+ from the command-line
11
+ (i.e. as a non-login shell), and only environment variables are inherited from
12
+ the parent shell; not functions, aliases, or completion rules.
13
+
14
+ So, just move all your non-environment-variable configuration out of
15
+ <tt>~/.profile</tt> and into <tt>~/.bashrc</tt>, and then add something like
16
+ this to your <tt>~/.profile</tt>:
17
+
18
+ if [ -f ~/.bashrc ]; then
19
+ source ~/.bashrc
20
+ fi
21
+
22
+ == Prompts are SLOW!
23
+
24
+ Once I got that sorted, I still had the problem that my bash prompts were way
25
+ slow to generate. I was using the <tt>__git_ps1</tt> function and had the
26
+ standalone version of Chris Wanstrath's hub[http://github.com/defunkt/hub]
27
+ installed, with <tt>alias git=hub</tt> in my <tt>~/.bashrc</tt>.
28
+
29
+ The issue is that <tt>`bundle exec`</tt> adds <tt>-rbundler/setup</tt> to the
30
+ +RUBYOPT+ environment variable, so every +ruby+ invocation first requires all
31
+ of your bundled gems. Since +hub+ is a ruby script, and <tt>__git_ps1</tt>
32
+ invokes +git+ multiple times, generating a prompt gets expensive quickly. I was
33
+ seeing something like 3-second delays!
34
+
35
+ One way to work around this issue is to change the way you call +hub+, clearing
36
+ out +RUBYOPT+ first:
37
+
38
+ $ alias git='RUBYOPT= hub'
@@ -1,25 +1,28 @@
1
1
  = Shoe
2
2
 
3
- You probably don't want to use Shoe -- especially if you're like me!
3
+ You probably don't want to use shoe -- especially if you're like me!
4
4
 
5
- I like tinkering with my build scripts. That's why I don't use hoe[http://seattlerb.rubyforge.org/hoe] and jeweler[http://github.com/technicalpickles/jeweler] and those guys, even though they're awesome. I like to put my own thing together, so I made Shoe.
5
+ I like tinkering with my build scripts, so I made shoe, even though
6
+ hoe[http://seattlerb.rubyforge.org/hoe] and
7
+ jeweler[http://github.com/technicalpickles/jeweler] are awesome.
6
8
 
7
9
  == Behold
8
10
 
9
- Here's how your Rakefile looks:
11
+ Here's how your +Rakefile+ looks:
10
12
 
11
13
  require 'shoe'
14
+ require 'my_project/version'
12
15
 
13
- Shoe.tie('myproject', '0.1.0', "This is my project, and it's awesome!") do |spec|
16
+ Shoe.tie('my_project', MyProject::VERSION, "This is my project, and it's awesome!") do |spec|
14
17
  # do whatever you want with the Gem::Specification here, for example:
15
- # spec.add_development_dependency 'shoulda'
18
+ # spec.add_runtime_dependency 'dnssd'
16
19
  end
17
20
 
18
21
  And here's what you get, at most:
19
22
 
20
23
  rake clean # Remove ignored files
21
24
  rake compile # Compile C extensions
22
- rake cucumber # Run features
25
+ rake cucumber:ok # Run features
23
26
  rake cucumber:wip # Run work-in-progress features
24
27
  rake default # Run features
25
28
  rake gemspec # Show latest gemspec contents
@@ -28,16 +31,46 @@ And here's what you get, at most:
28
31
  rake shell # Run an irb console
29
32
  rake test # Run tests
30
33
 
31
- Most of the time, though, you won't see all of these: when possible, tasks are conditionally defined.
34
+ Most of the time, though, you won't see all of these: when possible, tasks are
35
+ conditionally defined.
32
36
 
33
- See what I mean by reading Shoe#define_tasks.
37
+ See what I mean by reading <tt>Shoe#define_tasks</tt>.
34
38
 
35
- == Install
39
+ == Getting Started
36
40
 
37
- gem install shoe
41
+ === With Bundler[http://github.com/carlhuda/bundler]
38
42
 
39
- == Getting Started
43
+ 1. Start with just shoe in your +Gemfile+:
44
+
45
+ source :gemcutter
46
+ gem 'shoe'
47
+
48
+ 2. Open a sub-shell configured for the bundler environment:
49
+
50
+ $ bundle exec $SHELL
51
+
52
+ (See BUNDLER.rdoc if you run into trouble with <tt>`bundle exec`</tt>.)
53
+
54
+ 3. Use +shoe+ to generate some skeleton project files:
55
+
56
+ $ shoe
40
57
 
41
- Shoe can create a Rakefile for you:
58
+ 4. And then you can poke around with
59
+
60
+ $ rake -T
61
+
62
+ === Without Bundler
63
+
64
+ If you're not using bundler, it's probably best not to use the +shoe+
65
+ generator. Instead, just install shoe normally:
66
+
67
+ $ gem install shoe
68
+
69
+ And then <tt>require 'shoe'</tt> and add a <tt>Shoe.tie</tt> clause to your +Rakefile+:
70
+
71
+ Shoe.tie('my_project', '0.0.0', 'My project is awesome.') do |spec|
72
+ # spec.add_runtime_dependency 'dnssd' # or whatever...
73
+ end
42
74
 
43
- cd myproject && shoe
75
+ Shoe also assumes you have a <tt>README.rdoc</tt>, so you'll need to create one if you
76
+ want to avoid warnings running <tt>`rake rdoc`</tt>.
data/Rakefile CHANGED
@@ -1,10 +1,7 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
1
  require 'shoe'
2
+ require 'shoe/version'
3
3
 
4
- Shoe.tie('shoe', '0.1.13', 'Another take on hoe, jeweler & friends.') do |spec|
5
- spec.remove_development_dependency_on_shoe
4
+ Shoe.tie('shoe', Shoe::VERSION, 'Another take on hoe, jeweler & friends.') do |spec|
6
5
  spec.requirements = ['git']
7
- spec.add_runtime_dependency 'cucumber'
8
- spec.add_runtime_dependency 'gemcutter'
9
6
  spec.add_runtime_dependency 'rake'
10
7
  end
data/bin/shoe CHANGED
@@ -1,31 +1,3 @@
1
- #!/usr/bin/env ruby
1
+ require 'shoe/cli'
2
2
 
3
- def create_file(name, contents)
4
- project_name = File.basename(File.expand_path(Dir.pwd))
5
-
6
- if File.exists?(name)
7
- STDERR.puts("#{name} exists. Not clobbering.")
8
- else
9
- File.open(name, 'w') { |file| file.write(contents.gsub('NAME', project_name)) }
10
- end
11
- end
12
-
13
- # TODO read about heredocs at http://tomayko.com to see if I can clean this up a little.
14
- create_file 'Rakefile', <<-END
15
- begin
16
- require 'shoe'
17
- rescue LoadError
18
- abort 'Please `gem install shoe` to get started.'
19
- end
20
-
21
- Shoe.tie('NAME', '0.0.0', 'TODO write a summary of NAME here.') do |spec|
22
- # do whatever you want with the Gem::Specification here, for example:
23
- # spec.add_development_dependency 'shoulda'
24
- end
25
- END
26
-
27
- create_file 'README.rdoc', <<-END
28
- = NAME
29
-
30
- NAME is one of my favorite things! Let me tell you about it:
31
- END
3
+ Shoe::CLI.run
@@ -4,33 +4,14 @@ 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 directory called "my_project"
8
- And I have run shoe inside "my_project"
9
- When I run rake --tasks inside "my_project"
7
+ Given I have created a project called "my_project"
8
+ When I run bundle exec rake --tasks inside "my_project"
10
9
  Then I should not see "rake cucumber" on standard out
11
10
 
12
11
  Scenario: Running rake --tasks in a shoe project with Cucumber features
13
- Given I have created a directory called "my_project"
12
+ Given I have created a project called "my_project"
14
13
  And I have created a directory called "my_project/features"
15
- And I have run shoe inside "my_project"
16
- When I run rake --tasks inside "my_project"
14
+ When I run bundle exec rake --tasks inside "my_project"
17
15
  Then I should see "rake cucumber" on standard out
18
- And I should not see "rake cucumber:wip" on standard out
16
+ And I should see "rake cucumber:wip" on standard out
19
17
 
20
- Scenario: Running rake --tasks in a shoe project with work-in-progress Cucumber features
21
- Given I have created a directory called "my_project"
22
- And I have created a directory called "my_project/features"
23
- And I have created a file called "my_project/features/some.feature" containing:
24
- """
25
- Feature: Cucumber
26
- In order to use cucumber conveniently
27
- As a developer
28
- I want shoe to give me a rake task
29
-
30
- @wip
31
- Scenario: Running rake --tasks in a shoe project with work-in-progress Cucumber features
32
- Given I have created a directory called "my_project"
33
- """
34
- And I have run shoe inside "my_project"
35
- When I run rake --tasks inside "my_project"
36
- Then I should see "rake cucumber:wip" on standard out
@@ -5,22 +5,25 @@ Feature: Getting started
5
5
 
6
6
  Scenario: Running shoe with no arguments in an empty directory
7
7
  Given I have created a directory called "my_project"
8
- When I run shoe inside "my_project"
8
+ And I have created a file called "my_project/Gemfile" containing:
9
+ """
10
+ source :gemcutter
11
+ gem 'shoe'
12
+ """
13
+ When I run bundle exec shoe inside "my_project"
9
14
  Then I should see a file "my_project/Rakefile"
10
15
  And I should see a file "my_project/README.rdoc"
16
+ And I should see a file "my_project/lib/my_project/version.rb"
17
+ And I should see a file "my_project/my_project.gemspec"
11
18
 
12
19
  Scenario: Running shoe with no arguments in a directory that already has a Rakefile
13
20
  Given I have created a directory called "my_project"
21
+ And I have created a file called "my_project/Gemfile" containing:
22
+ """
23
+ source :gemcutter
24
+ gem 'shoe'
25
+ """
14
26
  And I have created a file called "my_project/Rakefile" containing "# RAKEFILE CONTENTS"
15
- When I run shoe inside "my_project"
27
+ When I run bundle exec shoe inside "my_project"
16
28
  Then I should see "Rakefile exists. Not clobbering." on standard error
17
29
  And the contents of "my_project/Rakefile" should still be "# RAKEFILE CONTENTS"
18
- And I should see a file "my_project/README.rdoc"
19
-
20
- Scenario: Running shoe with no arguments in a directory that already has a README.rdoc
21
- Given I have created a directory called "my_project"
22
- And I have created a file called "my_project/README.rdoc" containing "= README CONTENTS"
23
- When I run shoe inside "my_project"
24
- Then I should see a file "my_project/Rakefile"
25
- Then I should see "README.rdoc exists. Not clobbering." on standard error
26
- And the contents of "my_project/README.rdoc" should still be "= README CONTENTS"
@@ -5,40 +5,29 @@ Feature: Release
5
5
 
6
6
  Background:
7
7
  Given I have created a directory called "origin"
8
- And I have run git init inside "origin"
9
- Given I have created a directory called "my_project"
10
- And I have run shoe inside "my_project"
8
+ And I have run git init --bare inside "origin"
9
+ Given I have created a project called "my_project"
11
10
  And I have run git init inside "my_project"
12
11
  And I have run git add . inside "my_project"
13
12
  And I have run git commit -m "Initial commit" inside "my_project"
14
- And I have run git remote add origin ../origin inside "my_project"
15
13
 
16
14
  Scenario: I can release
17
- When I run git push origin master inside "my_project"
18
- And I replace "0.0.0" with "0.1.0" in the file "my_project/Rakefile"
19
- And I run rake --tasks inside "my_project"
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"
20
17
  Then I should see "rake release" on standard out
21
18
 
22
19
  Scenario: I cannot release when the version is 0.0.0
23
- When I run git push origin master inside "my_project"
24
- And I run rake --tasks inside "my_project"
20
+ When I run bundle exec rake --tasks inside "my_project"
25
21
  Then I should not see "rake release" on standard out
26
22
 
27
23
  Scenario: I cannot release when I already have a tag for the current version
28
- When I run git push origin master inside "my_project"
29
- And I run git tag 0.1.0 inside "my_project"
30
- And I replace "0.0.0" with "0.1.0" in the file "my_project/Rakefile"
31
- And I run rake --tasks inside "my_project"
32
- Then I should not see "rake release" on standard out
33
-
34
- Scenario: I cannot release when I have not yet pushed master to origin
35
- When I replace "0.0.0" with "0.1.0" in the file "my_project/Rakefile"
36
- And I run rake --tasks inside "my_project"
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"
37
27
  Then I should not see "rake release" on standard out
38
28
 
39
29
  Scenario: I cannot release from a branch other than master
40
- When I run git push origin master inside "my_project"
41
- And I run git checkout -b topic inside "my_project"
42
- And I replace "0.0.0" with "0.1.0" in the file "my_project/Rakefile"
43
- And I run rake --tasks inside "my_project"
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"
44
33
  Then I should not see "rake release" on standard out
@@ -1,3 +1,12 @@
1
+ Given /^I have created a project called "([^\"]*)"$/ do |name|
2
+ create_directory(name)
3
+ create_file("#{name}/Gemfile", <<-END.gsub(/^\s*/, ''))
4
+ source :gemcutter
5
+ gem 'shoe'
6
+ END
7
+ run('bundle exec shoe', name)
8
+ end
9
+
1
10
  Given /^I have created a directory called "([^\"]*)"$/ do |name|
2
11
  create_directory(name)
3
12
  end
@@ -18,17 +27,18 @@ When /^I (?:have )?run (.*) inside "([^\"]*)"$/ do |command, path|
18
27
  run(command, path)
19
28
  end
20
29
 
21
- Then /^I (should.*) see "([^\"]*)" on (standard.*)$/ do |should_or_should_not, message, standard_out_or_error|
30
+ Then /^I should(.*) see "([^\"]*)" on (standard.*)$/ do |negate, message, standard_out_or_error|
22
31
  standard_out_or_error.tr!(' ', '_')
23
- should_or_should_not.tr!(' ', '_')
32
+ am_i_expecting_to_see_something = negate.strip.empty?
33
+ contents = send(standard_out_or_error)
24
34
 
25
- send(standard_out_or_error).send(should_or_should_not, include(message))
35
+ assert_equal am_i_expecting_to_see_something, contents.include?(message), contents
26
36
  end
27
37
 
28
38
  Then /^I should see a file "([^\"]*)"$/ do |path|
29
- file(path).exist?.should == true
39
+ assert file(path).exist?
30
40
  end
31
41
 
32
42
  Then /^the contents of "([^\"]*)" should still be "([^\"]*)"$/ do |path, expected|
33
- file(path).read.should == expected
43
+ assert_equal expected, file(path).read
34
44
  end
@@ -1,5 +1,6 @@
1
1
  require 'open3'
2
2
  require 'pathname'
3
+ require 'test/unit/assertions'
3
4
  require 'tmpdir'
4
5
 
5
6
  class WorkingDirectory
@@ -18,7 +19,11 @@ class WorkingDirectory
18
19
  end
19
20
 
20
21
  def create_file(path, contents)
21
- file(path).open('w') { |file| file.write(contents) }
22
+ file(path).open('w') { |file| file.write(be_sneaky_with_the_gemfile(contents)) }
23
+ end
24
+
25
+ def append_file(path, contents)
26
+ file(path).open('a') { |file| file.write(contents) }
22
27
  end
23
28
 
24
29
  def edit_file(path, search, replace)
@@ -33,7 +38,7 @@ class WorkingDirectory
33
38
 
34
39
  def run(command, path)
35
40
  Dir.chdir(working_directory.join(path)) do
36
- Open3.popen3(rejigger_the_path(command)) do |stdin, stdout, stderr|
41
+ Open3.popen3(isolate_environment(command)) do |stdin, stdout, stderr|
37
42
  @standard_out = stdout.read
38
43
  @standard_error = stderr.read
39
44
  end
@@ -42,11 +47,18 @@ class WorkingDirectory
42
47
 
43
48
  private
44
49
 
45
- def rejigger_the_path(command)
46
- "/usr/bin/env PATH='#{PROJECT_ROOT.join('bin')}:#{ENV['PATH']}' RUBYLIB='#{PROJECT_ROOT.join('lib')}' #{command}"
50
+ def be_sneaky_with_the_gemfile(contents)
51
+ contents.sub("gem 'shoe'", "gem 'shoe', :path => '#{Pathname.pwd.expand_path}'")
52
+ end
53
+
54
+ # bundle exec rake running from bundle exec cucumber otherwise gets confused
55
+ # about where the real Gemfile is.
56
+ def isolate_environment(command)
57
+ "/usr/bin/env -i HOME=#{ENV['HOME']} PATH=#{ENV['PATH']} #{command}"
47
58
  end
48
59
  end
49
60
 
61
+ World(Test::Unit::Assertions)
50
62
  World { WorkingDirectory.new }
51
63
  Before { working_directory.mkpath }
52
64
  After { working_directory.rmtree }
@@ -1,192 +1,25 @@
1
- require 'rubygems/doc_manager'
2
- require 'rubygems/ext'
3
-
4
- # Shoe defines some handy Rake tasks for your project, all built around your Gem::Specification.
1
+ # Shoe defines some handy Rake tasks for your project, all built around your
2
+ # Gem::Specification.
5
3
  #
6
4
  # Here's how you use it in your Rakefile:
7
5
  #
8
6
  # require 'shoe'
9
7
  # Shoe.tie('myproject', '0.1.0', "This is my project, and it's awesome!") do |spec|
10
8
  # # do whatever you want with the Gem::Specification here, for example:
11
- # # spec.add_development_dependency 'shoulda'
9
+ # # spec.add_runtime_dependency 'dnssd'
12
10
  # end
13
11
  #
14
- # Shoe comes with an executable named "shoe" that will generate a Rakefile like this (but slightly fancier) for you.
15
- class Shoe
12
+ # Shoe comes with an executable named "shoe" that will generate a Rakefile like
13
+ # this (but slightly fancier) for you.
14
+ module Shoe
15
+ autoload :Project, 'shoe/project'
16
+ autoload :Tasks, 'shoe/tasks'
17
+
16
18
  # Here's where you start. In your Rakefile, you'll probably just call
17
19
  # Shoe.tie, then add any dependencies in the block.
18
20
  def self.tie(name, version, summary)
19
- shoe = new(name, version, summary)
20
- yield shoe.spec if block_given?
21
- shoe.define_tasks
22
- end
23
-
24
- # The Gem::Specification for your project.
25
- attr_reader :spec
26
-
27
- # Initializes a Gem::Specification with some nice conventions.
28
- def initialize(name, version, summary)
29
- @spec = Gem::Specification.new do |spec|
30
- spec.name = name
31
- spec.version = version
32
- spec.summary = summary
33
- spec.files = FileList['Rakefile', '*.gemspec', '**/*.rdoc', 'bin/**/*', 'examples/**/*', 'ext/**/extconf.rb', 'ext/**/*.c', 'features/**/*', 'lib/**/*', 'resources/**/*', 'shoulda_macros/**/*', 'test/**/*'].to_a
34
- spec.executables = everything_in_the_bin_directory
35
- spec.extensions = FileList['ext/**/extconf.rb'].to_a
36
- spec.rdoc_options = %W(--main README.rdoc --title #{name}-#{version} --inline-source) # MAYBE include --all, so that we document private methods?
37
- spec.extra_rdoc_files = FileList['**/*.rdoc', 'shoulda_macros/**/*'].to_a
38
- spec.has_rdoc = true
39
- spec.author = `git config --get user.name`.chomp
40
- spec.email = `git config --get user.email`.chomp
41
- spec.add_development_dependency 'shoe'
42
- end
43
-
44
- def @spec.remove_development_dependency_on_shoe
45
- dependencies.delete_if { |d| d.name == 'shoe' }
46
- end
47
- end
48
-
49
- # This is where the magic happens.
50
- def define_tasks
51
- if File.directory?('.git')
52
- desc 'Remove ignored files'
53
- task :clean do
54
- sh 'git clean -fdX'
55
- end
56
- end
57
-
58
- if File.directory?('lib')
59
- desc 'Generate documentation'
60
- task :rdoc do
61
- LocalDocManager.new(spec).generate_rdoc
62
-
63
- case RUBY_PLATFORM
64
- when /darwin/
65
- sh 'open rdoc/index.html'
66
- when /mswin|mingw/
67
- sh 'start rdoc\index.html'
68
- else
69
- sh 'firefox rdoc/index.html'
70
- end
71
- end
72
- end
73
-
74
- if File.file?("lib/#{spec.name}.rb")
75
- desc 'Run an irb console'
76
- task :shell do
77
- exec 'irb', '-Ilib', "-r#{spec.name}"
78
- end
79
- end
80
-
81
- if File.directory?('test')
82
- require 'rake/testtask'
83
- # MAYBE be a little more forgiving in test selection, using test/**/*_test.rb. Or create suites based on subdirectory?
84
- Rake::TestTask.new do |task|
85
- task.libs = ['lib', 'test']
86
- task.pattern = 'test/*_test.rb'
87
- end
88
- default_depends_on(:test)
89
- end
90
-
91
- if File.directory?('features')
92
- require 'cucumber/rake/task'
93
- Cucumber::Rake::Task.new(:cucumber, 'Run features') { |task| task.cucumber_opts = '--tags ~@wip' }
94
- default_depends_on(:cucumber)
95
-
96
- if there_are_any_work_in_progress_features
97
- namespace :cucumber do
98
- Cucumber::Rake::Task.new(:wip, 'Run work-in-progress features') { |task| task.cucumber_opts = '--tags @wip --wip' }
99
- end
100
- end
101
- end
102
-
103
- desc 'Show latest gemspec contents'
104
- task :gemspec do
105
- puts spec.to_ruby
106
- end
107
-
108
- if the_current_version_is_greater_than_zero && there_is_no_tag_for_the_current_version && we_are_on_the_master_branch && we_have_already_pushed_the_master_branch_to_a_remote_called_origin
109
- desc "Release #{spec.name}-#{spec.version}"
110
- task :release do
111
- File.open("#{spec.name}.gemspec", 'w') { |f| f.write spec.to_ruby }
112
- sh "git add #{spec.name}.gemspec"
113
- sh "git commit -a -m 'Release #{spec.version}'"
114
- sh "git tag #{spec.version}"
115
- sh 'git push'
116
- sh 'git push --tags'
117
- sh "gem build #{spec.name}.gemspec"
118
- sh "gem push #{spec.file_name}"
119
- end
120
- end
121
-
122
- if File.directory?('ext')
123
- desc 'Compile C extensions'
124
- task :compile do
125
- top_level_path = File.expand_path('.')
126
- destination_path = File.join(top_level_path, spec.require_paths.first)
127
-
128
- spec.extensions.each do |extension|
129
- Dir.chdir(File.dirname(extension)) do
130
- Gem::Ext::ExtConfBuilder.build(extension, top_level_path, destination_path, results = [])
131
- end
132
- end
133
- end
134
-
135
- [:test, :cucumber, 'cucumber:wip', :release].each do |task_name|
136
- if Rake.application.lookup(task_name)
137
- task task_name => :compile
138
- end
139
- end
140
- end
141
- end
142
-
143
- private
144
-
145
- def default_depends_on(task_name)
146
- desc Rake.application.lookup(task_name).comment
147
- task :default => task_name
148
- end
149
-
150
- def everything_in_the_bin_directory
151
- File.directory?('bin') ? Dir.entries('bin') - ['.', '..'] : []
152
- end
153
-
154
- def the_current_version_is_greater_than_zero
155
- spec.version > Gem::Version.new('0.0.0')
156
- end
157
-
158
- def there_are_any_work_in_progress_features
159
- Dir.glob('features/**/*.feature').detect do |path|
160
- File.read(path).include?('@wip')
161
- end
162
- end
163
-
164
- def there_is_no_tag_for_the_current_version
165
- !File.file?(".git/refs/tags/#{spec.version}")
166
- end
167
-
168
- def we_are_on_the_master_branch
169
- File.file?('.git/HEAD') && File.read('.git/HEAD').strip == 'ref: refs/heads/master'
170
- end
171
-
172
- def we_have_already_pushed_the_master_branch_to_a_remote_called_origin
173
- File.file?('.git/refs/remotes/origin/master')
174
- end
175
-
176
- # Using Gem::DocManager instead of Rake::RDocTask means you get to see your
177
- # rdoc *exactly* as users who install your gem will.
178
- class LocalDocManager < Gem::DocManager #:nodoc:
179
- def initialize(spec)
180
- @spec = spec
181
- @doc_dir = Dir.pwd
182
- @rdoc_args = []
183
- adjust_spec_so_that_we_can_generate_rdoc_locally
184
- end
185
-
186
- def adjust_spec_so_that_we_can_generate_rdoc_locally
187
- def @spec.full_gem_path
188
- Dir.pwd
189
- end
190
- end
21
+ project = Project.new(name, version, summary)
22
+ yield project.spec if block_given?
23
+ project.define_tasks
191
24
  end
192
25
  end