methadone 1.9.5 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +2 -5
- data/README.rdoc +75 -47
- data/Rakefile +25 -29
- data/bin/methadone +13 -5
- data/lib/methadone.rb +1 -1
- data/lib/methadone/cli_logger.rb +0 -1
- data/lib/methadone/cli_logging.rb +1 -1
- data/lib/methadone/cucumber.rb +4 -0
- data/lib/methadone/main.rb +4 -1
- data/lib/methadone/test/base_integration_test.rb +29 -0
- data/lib/methadone/test/integration_test_assertions.rb +63 -0
- data/lib/methadone/version.rb +1 -1
- data/methadone.gemspec +3 -5
- data/templates/full/Rakefile.erb +9 -12
- data/templates/full/bin/executable.erb +2 -0
- data/templates/rspec/spec/something_spec.rb.erb +1 -1
- data/templates/test_unit/test/integration/test_cli.rb.erb +11 -0
- data/templates/test_unit/test/{tc_something.rb.erb → unit/test_something.rb.erb} +0 -0
- data/test/integration/base_integration_test.rb +60 -0
- data/test/integration/test_bootstrap.rb +150 -0
- data/test/integration/test_cli.rb +21 -0
- data/test/integration/test_license.rb +56 -0
- data/test/integration/test_readme.rb +53 -0
- data/test/integration/test_rspec.rb +28 -0
- data/test/integration/test_version.rb +21 -0
- data/test/{base_test.rb → unit/base_test.rb} +0 -0
- data/test/{command_for_tests.sh → unit/command_for_tests.sh} +0 -0
- data/test/{execution_strategy → unit/execution_strategy}/test_base.rb +0 -0
- data/test/{execution_strategy → unit/execution_strategy}/test_jvm.rb +4 -4
- data/test/{execution_strategy → unit/execution_strategy}/test_mri.rb +0 -0
- data/test/{execution_strategy → unit/execution_strategy}/test_open_3.rb +5 -5
- data/test/{execution_strategy → unit/execution_strategy}/test_open_4.rb +5 -5
- data/test/{execution_strategy → unit/execution_strategy}/test_rbx_open_4.rb +0 -0
- data/test/unit/test/test_integration_test_assertions.rb +211 -0
- data/test/{test_cli_logger.rb → unit/test_cli_logger.rb} +17 -17
- data/test/{test_cli_logging.rb → unit/test_cli_logging.rb} +12 -12
- data/test/{test_exit_now.rb → unit/test_exit_now.rb} +4 -4
- data/test/{test_main.rb → unit/test_main.rb} +48 -48
- data/test/{test_sh.rb → unit/test_sh.rb} +37 -37
- metadata +61 -93
- data/features/bootstrap.feature +0 -153
- data/features/license.feature +0 -43
- data/features/readme.feature +0 -26
- data/features/rspec_support.feature +0 -27
- data/features/step_definitions/bootstrap_steps.rb +0 -47
- data/features/step_definitions/license_steps.rb +0 -30
- data/features/step_definitions/readme_steps.rb +0 -26
- data/features/step_definitions/version_steps.rb +0 -4
- data/features/support/env.rb +0 -26
- data/features/version.feature +0 -17
- data/templates/full/features/executable.feature.erb +0 -13
- data/templates/full/features/step_definitions/executable_steps.rb.erb +0 -1
- data/templates/full/features/support/env.rb.erb +0 -16
@@ -1,27 +0,0 @@
|
|
1
|
-
Feature: Bootstrap a new command-line app using RSpec instead of Test::Unit
|
2
|
-
As an awesome developer who wants to make a command-line app
|
3
|
-
I should be able to use methadone to bootstrap it
|
4
|
-
And get support for RSpec instead of Test::Unit
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given the directory "tmp/newgem" does not exist
|
8
|
-
|
9
|
-
Scenario: Bootstrap a new app from scratch
|
10
|
-
When I successfully run `methadone --rspec tmp/newgem`
|
11
|
-
Then the following directories should exist:
|
12
|
-
|tmp/newgem/spec |
|
13
|
-
And the following directories should not exist:
|
14
|
-
|tmp/newgem/test |
|
15
|
-
And the following files should exist:
|
16
|
-
|tmp/newgem/spec/something_spec.rb |
|
17
|
-
And the file "tmp/newgem/newgem.gemspec" should match /add_development_dependency\('rspec'/
|
18
|
-
When I cd to "tmp/newgem"
|
19
|
-
And I successfully run `rake -T -I../../lib`
|
20
|
-
Then the output should match /rake spec/
|
21
|
-
And the output should not match /rake test/
|
22
|
-
When I run `rake spec -I../../lib`
|
23
|
-
Then the exit status should be 0
|
24
|
-
And the output should contain:
|
25
|
-
"""
|
26
|
-
1 example, 0 failures
|
27
|
-
"""
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
Given /^the directory "([^"]*)" does not exist$/ do |dir|
|
5
|
-
dir = File.join(ARUBA_DIR,dir)
|
6
|
-
rm_rf dir,:verbose => false, :secure => true
|
7
|
-
end
|
8
|
-
|
9
|
-
Given /^my app's name is "([^"]*)"$/ do |app_name|
|
10
|
-
@app_name = app_name
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^the file "([^"]*)" should use the same block variable throughout$/ do |file|
|
14
|
-
prep_for_fs_check do
|
15
|
-
content = IO.read(file)
|
16
|
-
from_bundler = content.match(/(\w+)\.authors/)[1]
|
17
|
-
added_by_methadone = content.match(/(\w+).add_development_dependency\('rdoc'/)[1]
|
18
|
-
from_bundler.should == added_by_methadone
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
Then /^the stderr should match \/([^\/]*)\/$/ do |expected|
|
23
|
-
assert_matching_output(expected, all_stderr)
|
24
|
-
end
|
25
|
-
|
26
|
-
Given /^"(.*?)" has configured version to show only the version (.*)and not help$/ do |gemname,extras|
|
27
|
-
lines = File.read("tmp/aruba/tmp/new-gem/#{gemname}").split(/\n/)
|
28
|
-
File.open("tmp/aruba/tmp/new-gem/#{gemname}","w") do |file|
|
29
|
-
lines.each do |line|
|
30
|
-
if line =~ /^\s*version New::Gem::VERSION/
|
31
|
-
if extras =~ /with a custom format/
|
32
|
-
file.puts line + ", :compact => true, :format => '%s V%s'"
|
33
|
-
else
|
34
|
-
file.puts line + ", :compact => true"
|
35
|
-
end
|
36
|
-
else
|
37
|
-
file.puts line
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
Then /^the file "(.*?)" should include "(.*?)" if needed$/ do |file, gemname|
|
44
|
-
if RUBY_VERSION =~ /^2\./ && RUBY_VERSION !~ /^2.0/ && RUBY_VERSION !~ /^2.1/
|
45
|
-
step %{the file "#{file}" should match /add_development_dependency\\('#{gemname}/}
|
46
|
-
end
|
47
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
Then /^the README should not reference a license$/ do
|
2
|
-
step %(the file "tmp/newgem/README.rdoc" should not match /[Ll]icense/)
|
3
|
-
end
|
4
|
-
|
5
|
-
Then /^newgem's license should be the (\w+) license/ do |license|
|
6
|
-
@license = license
|
7
|
-
step %(a file named "tmp/newgem/LICENSE.txt" should exist)
|
8
|
-
step %(the file "tmp/newgem/newgem.gemspec" should match /#{@license.upcase}/)
|
9
|
-
end
|
10
|
-
|
11
|
-
Then /^the README should reference this license$/ do
|
12
|
-
step %(the file "tmp/newgem/README.rdoc" should match /License::/)
|
13
|
-
step %(the file "tmp/newgem/README.rdoc" should match /#{@license}/)
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
Then /^newgem's license should be an empty file$/ do
|
18
|
-
step %(a file named "tmp/newgem/LICENSE.txt" should exist)
|
19
|
-
File.read("tmp/aruba/tmp/newgem/LICENSE.txt").should == "\n"
|
20
|
-
end
|
21
|
-
|
22
|
-
Then /^the README should reference the need for a license$/ do
|
23
|
-
step %(the file "tmp/newgem/README.rdoc" should match /License:: INSERT LICENSE HERE/)
|
24
|
-
end
|
25
|
-
|
26
|
-
Then(/^LICENSE\.txt should contain user information and program name$/) do
|
27
|
-
step %(the file "tmp/newgem/LICENSE.txt" should match /#{`git config user.name`}/)
|
28
|
-
step %(the file "tmp/newgem/LICENSE.txt" should match /newgem/)
|
29
|
-
step %(the file "tmp/newgem/LICENSE.txt" should match /#{Time.now.year}/)
|
30
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
Then /^a README should not be generated$/ do
|
2
|
-
step %(the file "tmp/newgem/README.rdoc" should not exist)
|
3
|
-
end
|
4
|
-
|
5
|
-
Then /^a README should be generated in RDoc$/ do
|
6
|
-
step %(a file named "tmp/newgem/README.rdoc" should exist)
|
7
|
-
end
|
8
|
-
|
9
|
-
Then /^the README should contain the project name$/ do
|
10
|
-
step %(the file "tmp/newgem/README.rdoc" should match /newgem/)
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^the README should contain my name$/ do
|
14
|
-
step %(the file "tmp/newgem/README.rdoc" should match /Author:: YOUR NAME \\\(YOUR EMAIL\\\)/)
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^the README should contain links to Github and RDoc.info$/ do
|
18
|
-
step %(the file "tmp/newgem/README.rdoc" should match /\\\* \\\{Source on Github\\\}\\\[LINK TO GITHUB\\\]/)
|
19
|
-
step %(the file "tmp/newgem/README.rdoc" should match /RDoc\\\[LINK TO RDOC.INFO\\\]/)
|
20
|
-
end
|
21
|
-
|
22
|
-
Then /^the README should contain empty sections for common elements of a README$/ do
|
23
|
-
step %(the file "tmp/newgem/README.rdoc" should match /^== Install/)
|
24
|
-
step %(the file "tmp/newgem/README.rdoc" should match /^== Examples/)
|
25
|
-
step %(the file "tmp/newgem/README.rdoc" should match /^== Contributing/)
|
26
|
-
end
|
data/features/support/env.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'aruba/cucumber'
|
2
|
-
require 'methadone/cucumber'
|
3
|
-
|
4
|
-
PROJECT_ROOT = File.join(File.dirname(__FILE__),'..','..')
|
5
|
-
ENV['PATH'] = "#{File.join(PROJECT_ROOT,'bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
6
|
-
ARUBA_DIR = File.join(%w(tmp aruba))
|
7
|
-
Before do
|
8
|
-
@dirs = [ARUBA_DIR]
|
9
|
-
@puts = true
|
10
|
-
@aruba_timeout_seconds = 60
|
11
|
-
@original_rubylib = ENV['RUBYLIB']
|
12
|
-
@original_rubyopt = ENV['RUBYOPT']
|
13
|
-
|
14
|
-
# We want to use, hopefully, the methadone from this codebase and not
|
15
|
-
# the gem, so we put it in the RUBYLIB
|
16
|
-
ENV['RUBYLIB'] = File.join(PROJECT_ROOT,'lib') + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
17
|
-
|
18
|
-
# We need -rubygems here so that 1.8-style rubies work AND travis-ci doesn't barf with it in the shebang line
|
19
|
-
ENV['RUBYOPT'] = (ENV['RUBYOPT'] || '') + ' -rubygems'
|
20
|
-
end
|
21
|
-
|
22
|
-
After do
|
23
|
-
# Put back how it was
|
24
|
-
ENV['RUBYLIB'] = @original_rubylib
|
25
|
-
ENV['RUBYOPT'] = @original_rubyopt
|
26
|
-
end
|
data/features/version.feature
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
Feature: The version should show up in the banner by default
|
2
|
-
As a developer
|
3
|
-
I should be able to have the current gem version in the banner
|
4
|
-
So I don't have to maintain it in two places
|
5
|
-
And so users can easily see the version from the app itself
|
6
|
-
|
7
|
-
Scenario Outline: Show the gem version
|
8
|
-
Given my app's name is "newgem"
|
9
|
-
And I successfully run `methadone tmp/newgem`
|
10
|
-
When I cd to "tmp/newgem"
|
11
|
-
And I successfully run `bin/newgem <flag>` with "lib" in the library path
|
12
|
-
Then the banner should include the version
|
13
|
-
|
14
|
-
Examples:
|
15
|
-
|flag |
|
16
|
-
|--help |
|
17
|
-
|--version |
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: My bootstrapped app kinda works
|
2
|
-
In order to get going on coding my awesome app
|
3
|
-
I want to have aruba and cucumber setup
|
4
|
-
So I don't have to do it myself
|
5
|
-
|
6
|
-
Scenario: App just runs
|
7
|
-
When I get help for "<%= gemname %>"
|
8
|
-
Then the exit status should be 0
|
9
|
-
And the banner should be present
|
10
|
-
And the banner should document that this app takes options
|
11
|
-
And the following options should be documented:
|
12
|
-
|--version|
|
13
|
-
And the banner should document that this app takes no arguments
|
@@ -1 +0,0 @@
|
|
1
|
-
# Put your step definitions here
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'aruba/cucumber'
|
2
|
-
require 'methadone/cucumber'
|
3
|
-
|
4
|
-
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
5
|
-
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
6
|
-
|
7
|
-
Before do
|
8
|
-
# Using "announce" causes massive warnings on 1.9.2
|
9
|
-
@puts = true
|
10
|
-
@original_rubylib = ENV['RUBYLIB']
|
11
|
-
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
12
|
-
end
|
13
|
-
|
14
|
-
After do
|
15
|
-
ENV['RUBYLIB'] = @original_rubylib
|
16
|
-
end
|