shoe 0.2.0 → 0.3.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.
@@ -1,17 +1,19 @@
1
1
  = Shoe
2
2
 
3
- You probably don't want to use shoe -- especially if you're like me!
3
+ Shoe defines some handy Rake tasks for your project, all built around your
4
+ Gem::Specification.
4
5
 
5
- I like tinkering with my build scripts, so I made shoe, even though
6
+ Shoe is a small blip in the grand tradition of more popular projects like
6
7
  hoe[http://seattlerb.rubyforge.org/hoe] and
7
- jeweler[http://github.com/technicalpickles/jeweler] are awesome.
8
+ jeweler[http://github.com/technicalpickles/jeweler]. I had an itch to scratch,
9
+ you understand.
8
10
 
9
11
  == Behold
10
12
 
11
13
  Here's how your +Rakefile+ looks:
12
14
 
13
- require 'shoe'
14
15
  require 'my_project/version'
16
+ require 'shoe'
15
17
 
16
18
  Shoe.tie('my_project', MyProject::VERSION, "This is my project, and it's awesome!") do |spec|
17
19
  # do whatever you want with the Gem::Specification here, for example:
@@ -34,7 +36,7 @@ And here's what you get, at most:
34
36
  Most of the time, though, you won't see all of these: when possible, tasks are
35
37
  conditionally defined.
36
38
 
37
- See what I mean by reading <tt>Shoe#define_tasks</tt>.
39
+ See what I mean by clicking through the various <tt>Shoe::Tasks</tt>.
38
40
 
39
41
  == Getting Started
40
42
 
@@ -42,14 +44,15 @@ See what I mean by reading <tt>Shoe#define_tasks</tt>.
42
44
 
43
45
  1. Start with just shoe in your +Gemfile+:
44
46
 
45
- source :gemcutter
47
+ source :rubygems
46
48
  gem 'shoe'
47
49
 
48
50
  2. Open a sub-shell configured for the bundler environment:
49
51
 
50
52
  $ bundle exec $SHELL
51
53
 
52
- (See BUNDLER.rdoc if you run into trouble with <tt>`bundle exec`</tt>.)
54
+ (If you run into trouble, {this blog
55
+ post}[http://matthewtodd.org/2010/02/19/bundle-exec-bash.html] may help.)
53
56
 
54
57
  3. Use +shoe+ to generate some skeleton project files:
55
58
 
data/Rakefile CHANGED
@@ -3,5 +3,6 @@ require 'shoe/version'
3
3
 
4
4
  Shoe.tie('shoe', Shoe::VERSION, 'Another take on hoe, jeweler & friends.') do |spec|
5
5
  spec.requirements = ['git']
6
+ spec.required_rubygems_version = '>= 1.3.6'
6
7
  spec.add_runtime_dependency 'rake'
7
8
  end
data/bin/shoe CHANGED
@@ -1,3 +1,4 @@
1
- require 'shoe/cli'
1
+ #!/usr/bin/env ruby
2
2
 
3
+ require 'shoe/cli'
3
4
  Shoe::CLI.run
@@ -10,6 +10,7 @@ Feature: Cucumber
10
10
 
11
11
  Scenario: Running rake --tasks in a shoe project with Cucumber features
12
12
  Given I have created a project called "my_project"
13
+ And I have appended "gem 'cucumber'" to "my_project/Gemfile"
13
14
  And I have created a directory called "my_project/features"
14
15
  When I run bundle exec rake --tasks inside "my_project"
15
16
  Then I should see "rake cucumber" on standard out
@@ -7,7 +7,7 @@ Feature: Getting started
7
7
  Given I have created a directory called "my_project"
8
8
  And I have created a file called "my_project/Gemfile" containing:
9
9
  """
10
- source :gemcutter
10
+ source :rubygems
11
11
  gem 'shoe'
12
12
  """
13
13
  When I run bundle exec shoe inside "my_project"
@@ -20,7 +20,7 @@ Feature: Getting started
20
20
  Given I have created a directory called "my_project"
21
21
  And I have created a file called "my_project/Gemfile" containing:
22
22
  """
23
- source :gemcutter
23
+ source :rubygems
24
24
  gem 'shoe'
25
25
  """
26
26
  And I have created a file called "my_project/Rakefile" containing "# RAKEFILE CONTENTS"
@@ -1,7 +1,7 @@
1
1
  Given /^I have created a project called "([^\"]*)"$/ do |name|
2
2
  create_directory(name)
3
3
  create_file("#{name}/Gemfile", <<-END.gsub(/^\s*/, ''))
4
- source :gemcutter
4
+ source :rubygems
5
5
  gem 'shoe'
6
6
  END
7
7
  run('bundle exec shoe', name)
@@ -19,6 +19,10 @@ Given /^I have created a file called "([^\"]*)" containing:$/ do |path, contents
19
19
  create_file(path, contents)
20
20
  end
21
21
 
22
+ Given /^I have appended "([^\"]*)" to "([^\"]*)"$/ do |contents, path|
23
+ append_file(path, contents)
24
+ end
25
+
22
26
  When /^I replace "([^\"]*)" with "([^\"]*)" in the file "([^\"]*)"$/ do |search, replace, path|
23
27
  edit_file(path, search, replace)
24
28
  end
@@ -4,7 +4,7 @@ require 'test/unit/assertions'
4
4
  require 'tmpdir'
5
5
 
6
6
  class WorkingDirectory
7
- PROJECT_ROOT = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), '..', '..')))
7
+ PROJECT_ROOT = Pathname.new(File.expand_path('../../..', __FILE__))
8
8
 
9
9
  attr_reader :working_directory
10
10
  attr_reader :standard_out
@@ -48,13 +48,22 @@ class WorkingDirectory
48
48
  private
49
49
 
50
50
  def be_sneaky_with_the_gemfile(contents)
51
- contents.sub("gem 'shoe'", "gem 'shoe', :path => '#{Pathname.pwd.expand_path}'")
51
+ contents.sub("gem 'shoe'", "gem 'shoe', :path => '#{PROJECT_ROOT.expand_path}'")
52
52
  end
53
53
 
54
- # bundle exec rake running from bundle exec cucumber otherwise gets confused
55
- # about where the real Gemfile is.
56
54
  def isolate_environment(command)
57
- "/usr/bin/env -i HOME=#{ENV['HOME']} PATH=#{ENV['PATH']} #{command}"
55
+ # set the PATH so bundle exec can find shoe
56
+ ENV['PATH'] = ENV['PATH'].split(File::PATH_SEPARATOR).
57
+ unshift(PROJECT_ROOT.join('bin')).uniq.
58
+ join(File::PATH_SEPARATOR)
59
+
60
+ # whack most environment variables so nested bundle exec won't get confused
61
+ # about where the Gemfile is
62
+ "/usr/bin/env -i #{preserve_environment 'HOME', 'PATH', 'GEM_HOME', 'GEM_PATH'} #{command}"
63
+ end
64
+
65
+ def preserve_environment(*variables)
66
+ variables.map { |name| "#{name}='#{ENV[name]}'" }.join(' ')
58
67
  end
59
68
  end
60
69
 
@@ -1,22 +1,7 @@
1
- # Shoe defines some handy Rake tasks for your project, all built around your
2
- # Gem::Specification.
3
- #
4
- # Here's how you use it in your Rakefile:
5
- #
6
- # require 'shoe'
7
- # Shoe.tie('myproject', '0.1.0', "This is my project, and it's awesome!") do |spec|
8
- # # do whatever you want with the Gem::Specification here, for example:
9
- # # spec.add_runtime_dependency 'dnssd'
10
- # end
11
- #
12
- # Shoe comes with an executable named "shoe" that will generate a Rakefile like
13
- # this (but slightly fancier) for you.
14
1
  module Shoe
15
2
  autoload :Project, 'shoe/project'
16
3
  autoload :Tasks, 'shoe/tasks'
17
4
 
18
- # Here's where you start. In your Rakefile, you'll probably just call
19
- # Shoe.tie, then add any dependencies in the block.
20
5
  def self.tie(name, version, summary)
21
6
  project = Project.new(name, version, summary)
22
7
  yield project.spec if block_given?
@@ -3,7 +3,7 @@
3
3
  require 'erb'
4
4
  require 'pathname'
5
5
 
6
- class Shoe
6
+ module Shoe
7
7
  class CLI
8
8
  class << self
9
9
  def run
@@ -74,6 +74,35 @@ module Shoe
74
74
  task name => dependency
75
75
  end
76
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
77
106
  end
78
107
 
79
108
  end
@@ -10,7 +10,9 @@ module Shoe
10
10
  begin
11
11
  require 'cucumber/rake/task'
12
12
  rescue LoadError
13
- # no cuke for you
13
+ warn 'cucumber',
14
+ "Although you have a features directory, it seems you don't have cucumber installed.",
15
+ "You probably want to add a \"gem 'cucumber'\" to your Gemfile."
14
16
  else
15
17
  define_tasks
16
18
  end
@@ -22,18 +22,10 @@ module Shoe
22
22
  sh "git tag #{version_tag(spec.version)}"
23
23
 
24
24
  if there_is_no_tag_for('semver')
25
- $stderr.puts <<-END.gsub(/^ +/, '')
26
- ---------------------------------------------
27
- SEMANTIC VERSIONING WARNING
28
-
29
- It seems you don't yet have a 'semver' tag.
30
-
31
- Please read more about the emerging consensus
32
- around semantic versioning:
33
-
34
- http://semver.org/
35
- ---------------------------------------------
36
- END
25
+ warn 'semantic versioning',
26
+ "It seems you don't yet have a 'semver' tag.",
27
+ 'Please read more about the emerging consensus around semantic versioning:',
28
+ 'http://semver.org'
37
29
  end
38
30
 
39
31
  if there_is_a_remote_called('origin')
@@ -42,22 +34,7 @@ module Shoe
42
34
  end
43
35
 
44
36
  sh "gem build #{spec.name}.gemspec"
45
-
46
- if Gem::CommandManager.instance.command_names.include?('push')
47
- sh "gem push #{spec.file_name}"
48
- else
49
- $stderr.puts <<-END.gsub(/^ +/, '')
50
- ---------------------------------------------
51
- GEMCUTTER WARNING
52
-
53
- It seems you don't have gemcutter installed.
54
-
55
- Please `gem install gemcutter` and
56
- `gem push #{spec.file_name}`
57
- if you would like to make a public release.
58
- ---------------------------------------------
59
- END
60
- end
37
+ sh "gem push #{spec.file_name}"
61
38
  end
62
39
  end
63
40
 
@@ -1,5 +1,5 @@
1
- require 'shoe'
2
1
  require '<%= project %>/version'
2
+ require 'shoe'
3
3
 
4
4
  Shoe.tie('<%= project %>', <%= project_class %>::VERSION, 'TODO write a summary of <%= project_class %> here.') do |spec|
5
5
  # do whatever you want with the Gem::Specification here, for example:
@@ -1,3 +1,3 @@
1
1
  module Shoe
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -2,20 +2,20 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{shoe}
5
- s.version = "0.2.0"
5
+ s.version = "0.3.0"
6
6
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Matthew Todd"]
9
- s.date = %q{2010-02-16}
9
+ s.date = %q{2010-03-30}
10
10
  s.default_executable = %q{shoe}
11
11
  s.email = %q{matthew.todd@gmail.com}
12
12
  s.executables = ["shoe"]
13
- s.extra_rdoc_files = ["BUNDLER.rdoc", "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", "BUNDLER.rdoc", "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.2.0", "--inline-source"]
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
16
  s.require_paths = ["lib"]
17
17
  s.requirements = ["git"]
18
- s.rubygems_version = %q{1.3.5}
18
+ s.rubygems_version = %q{1.3.6}
19
19
  s.summary = %q{Another take on hoe, jeweler & friends.}
20
20
 
21
21
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Matthew Todd
@@ -9,19 +14,21 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-16 00:00:00 +03:00
17
+ date: 2010-03-30 00:00:00 +03:00
13
18
  default_executable: shoe
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rake
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :runtime
31
+ version_requirements: *id001
25
32
  description:
26
33
  email: matthew.todd@gmail.com
27
34
  executables:
@@ -29,7 +36,6 @@ executables:
29
36
  extensions: []
30
37
 
31
38
  extra_rdoc_files:
32
- - BUNDLER.rdoc
33
39
  - README.rdoc
34
40
  files:
35
41
  - Rakefile
@@ -54,7 +60,6 @@ files:
54
60
  - lib/shoe/version.rb
55
61
  - lib/shoe.rb
56
62
  - bin/shoe
57
- - BUNDLER.rdoc
58
63
  - README.rdoc
59
64
  - shoe.gemspec
60
65
  - features/cucumber.feature
@@ -71,7 +76,7 @@ rdoc_options:
71
76
  - --main
72
77
  - README.rdoc
73
78
  - --title
74
- - shoe-0.2.0
79
+ - shoe-0.3.0
75
80
  - --inline-source
76
81
  require_paths:
77
82
  - lib
@@ -79,18 +84,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
84
  requirements:
80
85
  - - ">="
81
86
  - !ruby/object:Gem::Version
87
+ segments:
88
+ - 0
82
89
  version: "0"
83
- version:
84
90
  required_rubygems_version: !ruby/object:Gem::Requirement
85
91
  requirements:
86
92
  - - ">="
87
93
  - !ruby/object:Gem::Version
88
- version: "0"
89
- version:
94
+ segments:
95
+ - 1
96
+ - 3
97
+ - 6
98
+ version: 1.3.6
90
99
  requirements:
91
100
  - git
92
101
  rubyforge_project:
93
- rubygems_version: 1.3.5
102
+ rubygems_version: 1.3.6
94
103
  signing_key:
95
104
  specification_version: 3
96
105
  summary: Another take on hoe, jeweler & friends.
@@ -1,38 +0,0 @@
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'