shoe 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +10 -0
- data/README.rdoc +2 -4
- data/TODO.rdoc +8 -2
- data/data/shoe/templates/extension.erb +18 -2
- data/data/shoe/templates/gemspec.erb +5 -13
- data/data/shoe/templates/{manpage.erb → manpage_1.erb} +3 -4
- data/data/shoe/templates/manpage_3.erb +19 -0
- data/lib/shoe.rb +1 -1
- data/lib/shoe/extensions.rb +1 -0
- data/lib/shoe/extensions/option_parser.rb +5 -7
- data/lib/shoe/extensions/test_runner.rb +28 -0
- data/lib/shoe/extensions/validator.rb +16 -4
- data/lib/shoe/generator.rb +2 -1
- data/lib/shoe/tasks/clean.rb +20 -3
- data/lib/shoe/tasks/compile.rb +5 -1
- data/lib/shoe/tasks/cucumber.rb +2 -2
- data/lib/shoe/tasks/rdoc.rb +6 -1
- data/lib/shoe/tasks/release.rb +1 -1
- data/lib/shoe/tasks/ronn.rb +8 -4
- data/lib/shoe/tasks/test.rb +33 -16
- data/man/shoe.1 +9 -10
- data/man/shoe.1.ronn +13 -16
- data/man/shoe.3 +68 -0
- data/man/shoe.3.ronn +64 -0
- data/test/extensions/fake_rubygems_server.rb +62 -0
- data/test/extensions/helper_methods.rb +73 -0
- data/test/extensions/isolated_environment.rb +50 -0
- data/test/extensions/test_case.rb +40 -0
- data/test/helper.rb +20 -0
- data/test/system/rake_clean_test.rb +36 -0
- data/test/system/rake_compile_test.rb +25 -0
- data/test/system/rake_cucumber_test.rb +51 -0
- data/test/system/rake_rdoc_test.rb +26 -0
- data/test/system/rake_release_test.rb +94 -0
- data/test/system/rake_ronn_test.rb +25 -0
- data/test/system/rake_test_test.rb +45 -0
- data/test/system/shoe_test.rb +79 -0
- metadata +48 -26
- data/.gitignore +0 -4
- data/BUNDLER.rdoc +0 -16
- data/Gemfile +0 -9
- data/Gemfile.lock +0 -49
- data/Rakefile +0 -4
- data/cucumber.yml +0 -2
- data/features/cucumber.feature +0 -27
- data/features/generator.feature +0 -32
- data/features/release.feature +0 -33
- data/features/step_definitions/shoe_steps.rb +0 -39
- data/features/support/env.rb +0 -69
- data/features/test.feature +0 -18
- data/shoe.gemspec +0 -44
data/.gitignore
DELETED
data/BUNDLER.rdoc
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
= Using Shoe with {Bundler}[http://gembundler.com]
|
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!
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
---
|
2
|
-
dependencies:
|
3
|
-
ronn:
|
4
|
-
group:
|
5
|
-
- :development
|
6
|
-
version: ">= 0"
|
7
|
-
rake:
|
8
|
-
group:
|
9
|
-
- :default
|
10
|
-
version: ">= 0"
|
11
|
-
cucumber:
|
12
|
-
group:
|
13
|
-
- :development
|
14
|
-
version: ">= 0"
|
15
|
-
launchy:
|
16
|
-
group:
|
17
|
-
- :default
|
18
|
-
version: ">= 0"
|
19
|
-
specs:
|
20
|
-
- rake:
|
21
|
-
version: 0.8.7
|
22
|
-
- builder:
|
23
|
-
version: 2.1.2
|
24
|
-
- configuration:
|
25
|
-
version: 1.1.0
|
26
|
-
- diff-lcs:
|
27
|
-
version: 1.1.2
|
28
|
-
- json_pure:
|
29
|
-
version: 1.2.4
|
30
|
-
- polyglot:
|
31
|
-
version: 0.3.1
|
32
|
-
- term-ansicolor:
|
33
|
-
version: 1.0.5
|
34
|
-
- treetop:
|
35
|
-
version: 1.4.5
|
36
|
-
- cucumber:
|
37
|
-
version: 0.6.4
|
38
|
-
- hpricot:
|
39
|
-
version: 0.8.2
|
40
|
-
- launchy:
|
41
|
-
version: 0.3.5
|
42
|
-
- rdiscount:
|
43
|
-
version: 1.6.3
|
44
|
-
- ronn:
|
45
|
-
version: "0.5"
|
46
|
-
hash: d47953731e3f472755d844fb72d2644ea08f56d9
|
47
|
-
sources:
|
48
|
-
- Rubygems:
|
49
|
-
uri: http://gemcutter.org
|
data/Rakefile
DELETED
data/cucumber.yml
DELETED
data/features/cucumber.feature
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
Feature: Cucumber
|
2
|
-
In order to use cucumber conveniently
|
3
|
-
As a developer
|
4
|
-
I want shoe to give me a rake task
|
5
|
-
|
6
|
-
Scenario: Running rake --tasks in a shoe project without Cucumber features
|
7
|
-
Given I have run shoe my_project inside "."
|
8
|
-
When I run rake --tasks inside "my_project"
|
9
|
-
Then I should not see "rake cucumber" on standard out
|
10
|
-
|
11
|
-
Scenario: Running rake --tasks in a shoe project with Cucumber features
|
12
|
-
Given I have run shoe my_project inside "."
|
13
|
-
And I have run git init inside "."
|
14
|
-
And I have created a file called "my_project/cucumber.yml" containing:
|
15
|
-
"""
|
16
|
-
default: --tags ~@wip
|
17
|
-
wip: --tags @wip --wip
|
18
|
-
"""
|
19
|
-
When I run rake --tasks inside "my_project"
|
20
|
-
Then I should see "rake cucumber" on standard out
|
21
|
-
And I should see "rake cucumber:wip" on standard out
|
22
|
-
|
23
|
-
Scenario: Running rake --tasks in a shoe project with a bad cucumber.yml
|
24
|
-
Given I have run shoe my_project inside "."
|
25
|
-
And I have created a file called "my_project/cucumber.yml" containing ""
|
26
|
-
When I run rake --tasks inside "my_project"
|
27
|
-
Then I should not see "rake cucumber" on standard out
|
data/features/generator.feature
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
Feature: Getting started
|
2
|
-
In order to start using shoe
|
3
|
-
As a developer
|
4
|
-
I want a little help generating my Rakefile
|
5
|
-
|
6
|
-
Scenario: Running shoe to create a new project
|
7
|
-
When I run shoe my_project inside "."
|
8
|
-
Then I should see a file "my_project/.gitignore"
|
9
|
-
And I should see a file "my_project/Rakefile"
|
10
|
-
And I should see a file "my_project/README.rdoc"
|
11
|
-
And I should see a file "my_project/lib/my_project.rb"
|
12
|
-
And I should see a file "my_project/test/helper.rb"
|
13
|
-
And I should see a file "my_project/test/my_project_test.rb"
|
14
|
-
And I should see a file "my_project/my_project.gemspec"
|
15
|
-
|
16
|
-
Scenario: Running shoe --application to create a new project
|
17
|
-
When I run shoe --application my_project inside "."
|
18
|
-
Then I should see a file "my_project/bin/my_project"
|
19
|
-
And I should see a file "my_project/lib/my_project/application.rb"
|
20
|
-
|
21
|
-
Scenario: Running shoe --extension to create a new project
|
22
|
-
When I run shoe --extension my_project inside "."
|
23
|
-
Then I should see a file "my_project/ext/my_project/extconf.rb"
|
24
|
-
And I should see a file "my_project/ext/my_project/extension.c"
|
25
|
-
|
26
|
-
Scenario: Running shoe with no arguments in an existing project that already has a Rakefile
|
27
|
-
Given I have created a directory called "my_project"
|
28
|
-
And I have created a file called "my_project/Rakefile" containing "# RAKEFILE CONTENTS"
|
29
|
-
When I run shoe inside "my_project"
|
30
|
-
Then I should see "WARN: not clobbering existing Rakefile" on standard error
|
31
|
-
And the contents of "my_project/Rakefile" should still be "# RAKEFILE CONTENTS"
|
32
|
-
|
data/features/release.feature
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
Feature: Release
|
2
|
-
In order to conveniently make a release of my project
|
3
|
-
As a developer
|
4
|
-
I want shoe to give me a rake task
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given I have created a directory called "origin"
|
8
|
-
And I have run git init --bare inside "origin"
|
9
|
-
Given I have run shoe my_project inside "."
|
10
|
-
And I have run git init inside "my_project"
|
11
|
-
And I have run git add . inside "my_project"
|
12
|
-
And I have run git commit -m "Initial commit" inside "my_project"
|
13
|
-
|
14
|
-
Scenario: I can release
|
15
|
-
When I replace "0.0.0" with "0.1.0" in the file "my_project/lib/my_project.rb"
|
16
|
-
And I run rake --tasks inside "my_project"
|
17
|
-
Then I should see "rake release" on standard out
|
18
|
-
|
19
|
-
Scenario: I cannot release when the version is 0.0.0
|
20
|
-
When I run rake --tasks inside "my_project"
|
21
|
-
Then I should not see "rake release" on standard out
|
22
|
-
|
23
|
-
Scenario: I cannot release when I already have a tag for the current version
|
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.rb"
|
26
|
-
And I run rake --tasks inside "my_project"
|
27
|
-
Then I should not see "rake release" on standard out
|
28
|
-
|
29
|
-
Scenario: I cannot release from a branch other than master
|
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.rb"
|
32
|
-
And I run rake --tasks inside "my_project"
|
33
|
-
Then I should not see "rake release" on standard out
|
@@ -1,39 +0,0 @@
|
|
1
|
-
Given /^I have created a directory called "([^\"]*)"$/ do |name|
|
2
|
-
create_directory(name)
|
3
|
-
end
|
4
|
-
|
5
|
-
Given /^I have created a file called "([^\"]*)" containing "([^\"]*)"$/ do |path, contents|
|
6
|
-
create_file(path, contents)
|
7
|
-
end
|
8
|
-
|
9
|
-
Given /^I have created a file called "([^\"]*)" containing:$/ do |path, contents|
|
10
|
-
create_file(path, contents)
|
11
|
-
end
|
12
|
-
|
13
|
-
Given /^I have appended "([^\"]*)" to "([^\"]*)"$/ do |contents, path|
|
14
|
-
append_file(path, contents)
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I replace "([^\"]*)" with "([^\"]*)" in the file "([^\"]*)"$/ do |search, replace, path|
|
18
|
-
edit_file(path, search, replace)
|
19
|
-
end
|
20
|
-
|
21
|
-
When /^I (?:have )?run (.*) inside "([^\"]*)"$/ do |command, path|
|
22
|
-
run(command, path)
|
23
|
-
end
|
24
|
-
|
25
|
-
Then /^I should(.*) see "([^\"]*)" on (standard.*)$/ do |negate, message, standard_out_or_error|
|
26
|
-
standard_out_or_error.tr!(' ', '_')
|
27
|
-
am_i_expecting_to_see_something = negate.strip.empty?
|
28
|
-
contents = send(standard_out_or_error)
|
29
|
-
|
30
|
-
assert_equal am_i_expecting_to_see_something, contents.include?(message), contents
|
31
|
-
end
|
32
|
-
|
33
|
-
Then /^I should see a file "([^\"]*)"$/ do |path|
|
34
|
-
assert file(path).exist?
|
35
|
-
end
|
36
|
-
|
37
|
-
Then /^the contents of "([^\"]*)" should still be "([^\"]*)"$/ do |path, expected|
|
38
|
-
assert_equal expected, file(path).read
|
39
|
-
end
|
data/features/support/env.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'open3'
|
2
|
-
require 'pathname'
|
3
|
-
require 'test/unit/assertions'
|
4
|
-
require 'tmpdir'
|
5
|
-
|
6
|
-
class WorkingDirectory
|
7
|
-
PROJECT_ROOT = Pathname.new(File.expand_path('../../..', __FILE__))
|
8
|
-
|
9
|
-
attr_reader :working_directory
|
10
|
-
attr_reader :standard_out
|
11
|
-
attr_reader :standard_error
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
@working_directory = Pathname.new(Dir.mktmpdir)
|
15
|
-
end
|
16
|
-
|
17
|
-
def create_directory(path)
|
18
|
-
file(path).mkpath
|
19
|
-
end
|
20
|
-
|
21
|
-
def create_file(path, contents)
|
22
|
-
file(path).open('w') { |file| file.write(contents) }
|
23
|
-
end
|
24
|
-
|
25
|
-
def append_file(path, contents)
|
26
|
-
file(path).open('a') { |file| file.write(contents) }
|
27
|
-
end
|
28
|
-
|
29
|
-
def edit_file(path, search, replace)
|
30
|
-
old_contents = file(path).read
|
31
|
-
new_contents = old_contents.gsub(search, replace)
|
32
|
-
create_file(path, new_contents)
|
33
|
-
end
|
34
|
-
|
35
|
-
def file(path)
|
36
|
-
working_directory.join(path)
|
37
|
-
end
|
38
|
-
|
39
|
-
def run(command, path)
|
40
|
-
Dir.chdir(working_directory.join(path)) do
|
41
|
-
Open3.popen3(isolate_environment(command)) do |stdin, stdout, stderr|
|
42
|
-
@standard_out = stdout.read
|
43
|
-
@standard_error = stderr.read
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def isolate_environment(command)
|
51
|
-
# set the PATH so tests can just run shoe
|
52
|
-
ENV['PATH'] = ENV['PATH'].split(File::PATH_SEPARATOR).
|
53
|
-
unshift(PROJECT_ROOT.join('bin')).uniq.
|
54
|
-
join(File::PATH_SEPARATOR)
|
55
|
-
ENV['RUBYLIB'] = PROJECT_ROOT.join('lib')
|
56
|
-
|
57
|
-
# whack most environment variables for good hygiene
|
58
|
-
"/usr/bin/env -i #{preserve_environment 'HOME', 'PATH', 'GEM_HOME', 'GEM_PATH', 'RUBYLIB'} #{command}"
|
59
|
-
end
|
60
|
-
|
61
|
-
def preserve_environment(*variables)
|
62
|
-
variables.map { |name| "#{name}='#{ENV[name]}'" }.join(' ')
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
World(Test::Unit::Assertions)
|
67
|
-
World { WorkingDirectory.new }
|
68
|
-
Before { working_directory.mkpath }
|
69
|
-
After { working_directory.rmtree }
|
data/features/test.feature
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Feature: Test
|
2
|
-
In order to run tests
|
3
|
-
As a developer
|
4
|
-
I want shoe to give me a rake task
|
5
|
-
|
6
|
-
Scenario: Running rake --tasks in a shoe project without tests
|
7
|
-
Given I have run shoe --no-test-unit my_project inside "."
|
8
|
-
And I have run git init inside "my_project"
|
9
|
-
When I run rake --tasks inside "my_project"
|
10
|
-
Then I should not see "rake test" on standard out
|
11
|
-
|
12
|
-
Scenario: Running rake --tasks in a shoe project with tests
|
13
|
-
Given I have run shoe --no-test-unit my_project inside "."
|
14
|
-
And I have run git init inside "my_project"
|
15
|
-
And I have created a directory called "my_project/test"
|
16
|
-
And I have created a file called "my_project/test/foo_test.rb" containing ""
|
17
|
-
When I run rake --tasks inside "my_project"
|
18
|
-
Then I should see "rake test" on standard out
|
data/shoe.gemspec
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
$:.unshift File.expand_path('../lib', __FILE__)
|
2
|
-
require 'shoe'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = 'shoe'
|
6
|
-
spec.version = Shoe::VERSION
|
7
|
-
|
8
|
-
spec.summary = 'An ecosystem-friendly library of Rake tasks for your gem.'
|
9
|
-
spec.description = <<-END.gsub(/^ */, '')
|
10
|
-
#{spec.summary}
|
11
|
-
|
12
|
-
Shoe assumes you could be using any number of other tools -- bundler,
|
13
|
-
cucumber, git, rip, rubygems -- and so leans hard on them for the things
|
14
|
-
they do well, relegating command-line rake to mere syntactic sugar.
|
15
|
-
END
|
16
|
-
|
17
|
-
spec.author = 'Matthew Todd'
|
18
|
-
spec.email = 'matthew.todd@gmail.com'
|
19
|
-
spec.homepage = 'http://github.com/matthewtodd/shoe'
|
20
|
-
|
21
|
-
spec.requirements = ['git']
|
22
|
-
spec.required_rubygems_version = '>= 1.3.6'
|
23
|
-
spec.add_runtime_dependency 'rake'
|
24
|
-
spec.add_runtime_dependency 'launchy'
|
25
|
-
spec.add_development_dependency 'cucumber'
|
26
|
-
spec.add_development_dependency 'ronn'
|
27
|
-
|
28
|
-
def spec.git_files(glob=nil)
|
29
|
-
`git ls-files -z --cached --other --exclude-standard #{glob}`.split("\0")
|
30
|
-
end
|
31
|
-
|
32
|
-
spec.files = spec.git_files
|
33
|
-
spec.executables = spec.git_files('bin/*').map &File.method(:basename)
|
34
|
-
spec.extensions = spec.git_files('ext/**/extconf.rb')
|
35
|
-
spec.test_files = spec.git_files('test/{,**/}*_test.rb')
|
36
|
-
|
37
|
-
spec.extra_rdoc_files = spec.git_files('{,**/}*.rdoc')
|
38
|
-
spec.rdoc_options = %W(
|
39
|
-
--main README.rdoc
|
40
|
-
--title #{spec.full_name}
|
41
|
-
--inline-source
|
42
|
-
--webcvs http://github.com/matthewtodd/shoe/blob/v#{spec.version}/
|
43
|
-
)
|
44
|
-
end
|