shoe 0.6.2 → 0.7.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.
- data/{data/shoe/templates/gitignore.erb → .gitignore} +1 -1
- data/.rvmrc +1 -0
- data/CHANGELOG.rdoc +9 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +39 -0
- data/README.rdoc +20 -72
- data/Rakefile +6 -0
- data/TODO.rdoc +10 -5
- data/lib/shoe.rb +29 -13
- data/lib/shoe/extensions.rb +0 -4
- data/lib/shoe/extensions/specification.rb +0 -4
- data/lib/shoe/extensions/validator.rb +40 -11
- data/lib/shoe/tasks.rb +13 -22
- data/lib/shoe/tasks/clean.rb +4 -4
- data/lib/shoe/tasks/compile.rb +2 -4
- data/lib/shoe/tasks/cucumber.rb +5 -9
- data/lib/shoe/tasks/rdoc.rb +2 -3
- data/lib/shoe/tasks/ronn.rb +5 -5
- data/lib/shoe/tasks/{abstract.rb → task.rb} +1 -1
- data/lib/shoe/tasks/test.rb +17 -57
- data/lib/shoe/util/minitest_colors.rb +60 -0
- data/lib/shoe/version.rb +3 -0
- data/man/shoe.3 +5 -11
- data/man/shoe.3.ronn +4 -13
- data/shoe.gemspec +35 -0
- data/test/helper.rb +6 -12
- data/test/support/assertions.rb +45 -0
- data/test/support/command_runner.rb +11 -0
- data/test/support/declarative_tests.rb +24 -0
- data/test/support/example_project.rb +37 -0
- data/test/support/file_manipulation.rb +43 -0
- data/test/support/gemspec_manipulation.rb +24 -0
- data/test/support/project_files.rb +60 -0
- data/test/support/redgreen.rb +6 -0
- data/test/system/rake_test.rb +124 -0
- metadata +75 -96
- data/bin/shoe +0 -18
- data/data/shoe/templates/application.erb +0 -23
- data/data/shoe/templates/executable.erb +0 -18
- data/data/shoe/templates/extconf.erb +0 -2
- data/data/shoe/templates/extension.erb +0 -25
- data/data/shoe/templates/gemspec.erb +0 -44
- data/data/shoe/templates/gitkeep.erb +0 -0
- data/data/shoe/templates/manpage_1.erb +0 -29
- data/data/shoe/templates/manpage_3.erb +0 -19
- data/data/shoe/templates/module.erb +0 -31
- data/data/shoe/templates/module_test.rb +0 -7
- data/data/shoe/templates/rakefile.erb +0 -3
- data/data/shoe/templates/readme.erb +0 -3
- data/data/shoe/templates/test_helper.erb +0 -9
- data/lib/shoe/extensions/option_parser.rb +0 -52
- data/lib/shoe/extensions/pathname.rb +0 -16
- data/lib/shoe/extensions/source_index.rb +0 -17
- data/lib/shoe/extensions/test_runner.rb +0 -28
- data/lib/shoe/generator.rb +0 -147
- data/lib/shoe/tasks/release.rb +0 -81
- data/man/shoe.1 +0 -63
- data/man/shoe.1.ronn +0 -60
- data/test/extensions/fake_rubygems_server.rb +0 -62
- data/test/extensions/helper_methods.rb +0 -73
- data/test/extensions/isolated_environment.rb +0 -50
- data/test/extensions/test_case.rb +0 -40
- data/test/system/rake_clean_test.rb +0 -36
- data/test/system/rake_compile_test.rb +0 -25
- data/test/system/rake_cucumber_test.rb +0 -51
- data/test/system/rake_rdoc_test.rb +0 -26
- data/test/system/rake_release_test.rb +0 -94
- data/test/system/rake_ronn_test.rb +0 -25
- data/test/system/rake_test_test.rb +0 -45
- data/test/system/shoe_test.rb +0 -79
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class RakeCompileTest < Test::Unit::TestCase
|
4
|
-
isolate_environment
|
5
|
-
include_helper_methods
|
6
|
-
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
in_project 'foo'
|
10
|
-
system 'shoe'
|
11
|
-
end
|
12
|
-
|
13
|
-
test 'rake compile is active only if there are extensions' do
|
14
|
-
assert_no_task 'compile'
|
15
|
-
add_files_for_c_extension
|
16
|
-
assert_task 'compile'
|
17
|
-
end
|
18
|
-
|
19
|
-
test 'rake compile builds extensions' do
|
20
|
-
add_files_for_c_extension
|
21
|
-
system 'rake compile'
|
22
|
-
system 'ruby -Ilib -rfoo/extension -e "puts Foo::Extension.name"'
|
23
|
-
assert_equal 'Foo::Extension', stdout.chomp
|
24
|
-
end
|
25
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
class RakeCucumberTest < Test::Unit::TestCase
|
5
|
-
isolate_environment
|
6
|
-
include_helper_methods
|
7
|
-
|
8
|
-
def setup
|
9
|
-
super
|
10
|
-
in_project 'foo'
|
11
|
-
system 'shoe'
|
12
|
-
end
|
13
|
-
|
14
|
-
test 'rake cucumber is active only if there are profiles in cucumber.yml', :require => 'cucumber' do
|
15
|
-
assert_no_task 'cucumber'
|
16
|
-
add_files_for_cucumber
|
17
|
-
assert_task 'cucumber'
|
18
|
-
assert_task 'cucumber:wip'
|
19
|
-
end
|
20
|
-
|
21
|
-
test 'rake cucumber runs cucumber features', :require => 'cucumber' do
|
22
|
-
add_files_for_cucumber
|
23
|
-
system 'rake cucumber'
|
24
|
-
assert_match '1 scenario (1 passed)', stdout
|
25
|
-
end
|
26
|
-
|
27
|
-
test 'rake cucumber depends on rake compile', :require => 'cucumber' do
|
28
|
-
add_files_for_c_extension
|
29
|
-
add_files_for_cucumber 'require "foo/extension"'
|
30
|
-
system 'rake cucumber'
|
31
|
-
assert_match '1 scenario (1 passed)', stdout
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def add_files_for_cucumber(assertion='')
|
37
|
-
write_file 'cucumber.yml', { 'default' => 'features', 'wip' => 'features' }.to_yaml
|
38
|
-
|
39
|
-
write_file 'features/api.feature', <<-END.gsub(/^ /, '')
|
40
|
-
Feature: The API
|
41
|
-
Scenario: Exercising something
|
42
|
-
Then I should pass
|
43
|
-
END
|
44
|
-
|
45
|
-
write_file 'features/step_definitions/steps.rb', <<-END
|
46
|
-
Then /^I should pass$/ do
|
47
|
-
#{assertion}
|
48
|
-
end
|
49
|
-
END
|
50
|
-
end
|
51
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class RakeRdocTest < Test::Unit::TestCase
|
4
|
-
isolate_environment
|
5
|
-
include_helper_methods
|
6
|
-
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
in_project 'foo'
|
10
|
-
system 'shoe'
|
11
|
-
end
|
12
|
-
|
13
|
-
test 'rake rdoc is unconditionally active' do
|
14
|
-
assert_task 'rdoc'
|
15
|
-
end
|
16
|
-
|
17
|
-
test 'rake rdoc generates rdoc' do
|
18
|
-
# Launchy runs BROWSER in a subshell, sending output to /dev/null, so if I
|
19
|
-
# want to test it, I'm going to have to be more clever than this. For the
|
20
|
-
# meantime, though, using /bin/echo at least keeps from opening a real
|
21
|
-
# browser at test time.
|
22
|
-
ENV['BROWSER'] = '/bin/echo'
|
23
|
-
system 'rake rdoc'
|
24
|
-
assert_file 'rdoc/index.html'
|
25
|
-
end
|
26
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class RakeReleaseTest < Test::Unit::TestCase
|
4
|
-
isolate_environment
|
5
|
-
include_helper_methods
|
6
|
-
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
in_project 'foo'
|
10
|
-
system 'shoe --no-test-unit'
|
11
|
-
end
|
12
|
-
|
13
|
-
test 'rake release is enabled once the version is greater than 0' do
|
14
|
-
perform_initial_commit
|
15
|
-
assert_no_task 'release'
|
16
|
-
bump_version_to '0.1.0'
|
17
|
-
assert_task 'release'
|
18
|
-
end
|
19
|
-
|
20
|
-
test 'rake release is disabled if the version has already been tagged' do
|
21
|
-
perform_initial_commit
|
22
|
-
bump_version_to '0.1.0'
|
23
|
-
system 'git tag v0.1.0'
|
24
|
-
assert_no_task 'release'
|
25
|
-
end
|
26
|
-
|
27
|
-
test 'rake release is disabled if current branch is not master' do
|
28
|
-
perform_initial_commit
|
29
|
-
bump_version_to '0.1.0'
|
30
|
-
system 'git checkout -b other'
|
31
|
-
assert_no_task 'release'
|
32
|
-
end
|
33
|
-
|
34
|
-
test 'rake release tags, builds, and pushes' do
|
35
|
-
perform_initial_commit
|
36
|
-
add_git_remote 'origin'
|
37
|
-
bump_version_to '0.1.0'
|
38
|
-
|
39
|
-
uploaded_gem = with_fake_rubygems_server do
|
40
|
-
system 'rake release'
|
41
|
-
end
|
42
|
-
|
43
|
-
# local should have tag
|
44
|
-
system 'git tag'
|
45
|
-
assert_match 'v0.1.0', stdout
|
46
|
-
|
47
|
-
# origin should have refs and tags
|
48
|
-
system "git ls-remote --heads --tags . master"
|
49
|
-
local = stdout
|
50
|
-
system "git ls-remote --heads --tags origin master"
|
51
|
-
assert_match local, stdout
|
52
|
-
|
53
|
-
# gem should be pushed
|
54
|
-
assert_equal File.read('foo-0.1.0.gem'), uploaded_gem
|
55
|
-
end
|
56
|
-
|
57
|
-
test 'rake release depends on rake ronn', :require => 'ronn' do
|
58
|
-
perform_initial_commit
|
59
|
-
bump_version_to '0.1.0'
|
60
|
-
|
61
|
-
uploaded_gem = with_fake_rubygems_server do
|
62
|
-
system 'rake release'
|
63
|
-
end
|
64
|
-
|
65
|
-
assert uploaded_gem.contents.include?('man/foo.3'),
|
66
|
-
uploaded_gem.contents.inspect
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
def add_git_remote(name)
|
72
|
-
path = File.expand_path("../#{name}.git")
|
73
|
-
system "git init --bare #{path}"
|
74
|
-
system "git remote add #{name} #{path}"
|
75
|
-
end
|
76
|
-
|
77
|
-
def bump_version_to(version)
|
78
|
-
write_file 'lib/foo.rb', <<-END
|
79
|
-
module Foo
|
80
|
-
VERSION = '#{version}'
|
81
|
-
end
|
82
|
-
END
|
83
|
-
end
|
84
|
-
|
85
|
-
def perform_initial_commit
|
86
|
-
system 'git init'
|
87
|
-
system 'git add .'
|
88
|
-
system 'git commit -a -m "Initial commit."'
|
89
|
-
end
|
90
|
-
|
91
|
-
def with_fake_rubygems_server(&block)
|
92
|
-
Shoe::TestExtensions::FakeRubygemsServer.start(&block)
|
93
|
-
end
|
94
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class RakeRonnTest < Test::Unit::TestCase
|
4
|
-
isolate_environment
|
5
|
-
include_helper_methods
|
6
|
-
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
in_project 'foo'
|
10
|
-
system 'shoe'
|
11
|
-
end
|
12
|
-
|
13
|
-
test 'rake ronn is enabled if there are ronn files', :require => 'ronn' do
|
14
|
-
assert_task 'ronn'
|
15
|
-
system 'rm **/*.ronn'
|
16
|
-
assert_no_task 'ronn'
|
17
|
-
end
|
18
|
-
|
19
|
-
test 'rake ronn generates man pages', :require => 'ronn' do
|
20
|
-
ENV['MANPAGER'] = '/bin/cat'
|
21
|
-
system 'rake ronn'
|
22
|
-
assert_file 'man/foo.3'
|
23
|
-
assert_match 'FOO(3)', stdout.chomp
|
24
|
-
end
|
25
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class RakeTestTest < Test::Unit::TestCase
|
4
|
-
isolate_environment
|
5
|
-
include_helper_methods
|
6
|
-
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
in_project 'foo'
|
10
|
-
system 'shoe --no-test-unit'
|
11
|
-
end
|
12
|
-
|
13
|
-
test 'rake test is active only if there are test files present' do
|
14
|
-
assert_no_task 'test'
|
15
|
-
add_files_for_test
|
16
|
-
assert_task 'test'
|
17
|
-
end
|
18
|
-
|
19
|
-
test 'rake test runs tests' do
|
20
|
-
add_files_for_test
|
21
|
-
system 'rake test'
|
22
|
-
assert_match '1 tests, 1 assertions, 0 failures, 0 errors', stdout
|
23
|
-
end
|
24
|
-
|
25
|
-
test 'rake test depends (perhaps indirectly) on rake compile' do
|
26
|
-
add_files_for_c_extension
|
27
|
-
add_files_for_test 'require "foo/extension"'
|
28
|
-
system 'rake test'
|
29
|
-
assert_match '1 tests, 0 assertions, 0 failures, 0 errors', stdout
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def add_files_for_test(assertion='assert true')
|
35
|
-
write_file 'test/foo_test.rb', <<-END
|
36
|
-
require 'test/unit'
|
37
|
-
class FooTest < Test::Unit::TestCase
|
38
|
-
def test_something
|
39
|
-
#{assertion}
|
40
|
-
end
|
41
|
-
end
|
42
|
-
END
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/test/system/shoe_test.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'test/helper'
|
2
|
-
|
3
|
-
class ShoeTest < Test::Unit::TestCase
|
4
|
-
isolate_environment
|
5
|
-
include_helper_methods
|
6
|
-
|
7
|
-
test 'running without arguments generates files named after the current directory' do
|
8
|
-
Dir.mkdir 'existing_project'
|
9
|
-
Dir.chdir 'existing_project'
|
10
|
-
system 'shoe'
|
11
|
-
assert_find '.', %w(
|
12
|
-
.gitignore
|
13
|
-
README.rdoc
|
14
|
-
Rakefile
|
15
|
-
existing_project.gemspec
|
16
|
-
lib/existing_project.rb
|
17
|
-
man/existing_project.3.ronn
|
18
|
-
test/helper.rb
|
19
|
-
test/existing_project_test.rb
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
test 'running with a path generates files named after the path' do
|
24
|
-
system 'shoe new_project'
|
25
|
-
assert_file 'new_project/new_project.gemspec'
|
26
|
-
end
|
27
|
-
|
28
|
-
test 'running in an existing project does not clobber existing files' do
|
29
|
-
in_project 'existing_project'
|
30
|
-
write_file 'Rakefile', '# original'
|
31
|
-
system 'shoe'
|
32
|
-
assert_match 'WARN: not clobbering existing Rakefile', stderr
|
33
|
-
assert_equal '# original', File.read('Rakefile')
|
34
|
-
end
|
35
|
-
|
36
|
-
test 'running produces a buildable gemspec' do
|
37
|
-
in_project 'foo'
|
38
|
-
system 'shoe'
|
39
|
-
system 'gem build foo.gemspec'
|
40
|
-
assert_file 'foo-0.0.0.gem'
|
41
|
-
end
|
42
|
-
|
43
|
-
test 'running generates a module with a VERSION constant' do
|
44
|
-
in_project 'foo'
|
45
|
-
system 'shoe'
|
46
|
-
system 'ruby -Ilib -rfoo -e "puts Foo::VERSION"'
|
47
|
-
assert_equal '0.0.0', stdout.chomp
|
48
|
-
end
|
49
|
-
|
50
|
-
test 'running --application generates an executable script' do
|
51
|
-
in_project 'foo'
|
52
|
-
system 'shoe --application'
|
53
|
-
system './bin/foo --version'
|
54
|
-
assert_equal 'foo 0.0.0', stdout.chomp
|
55
|
-
end
|
56
|
-
|
57
|
-
test 'running --data generates a datadir helper method' do
|
58
|
-
in_project 'foo'
|
59
|
-
system 'shoe --data'
|
60
|
-
write_file 'data/foo/file', 'DATA!'
|
61
|
-
system 'ruby -Ilib -rfoo -e "puts Foo.datadir.join(\"file\").read"'
|
62
|
-
assert_equal 'DATA!', stdout.chomp
|
63
|
-
end
|
64
|
-
|
65
|
-
test 'running --extension generates an Extension' do
|
66
|
-
in_project 'foo'
|
67
|
-
system 'shoe --extension'
|
68
|
-
Dir.chdir('ext/foo') { system 'ruby extconf.rb && make' }
|
69
|
-
system 'ruby -Ilib -Iext -rfoo -e "puts Foo::Extension.name"'
|
70
|
-
assert_equal 'Foo::Extension', stdout.chomp
|
71
|
-
end
|
72
|
-
|
73
|
-
test 'running --test generates passing tests' do
|
74
|
-
in_project 'foo'
|
75
|
-
system 'shoe --test'
|
76
|
-
system 'testrb -I. -Ilib test/*_test.rb'
|
77
|
-
assert_match '1 tests, 1 assertions, 0 failures, 0 errors', stdout
|
78
|
-
end
|
79
|
-
end
|