methadone 1.9.5 → 2.0.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.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +2 -5
  5. data/README.rdoc +75 -47
  6. data/Rakefile +25 -29
  7. data/bin/methadone +13 -5
  8. data/lib/methadone.rb +1 -1
  9. data/lib/methadone/cli_logger.rb +0 -1
  10. data/lib/methadone/cli_logging.rb +1 -1
  11. data/lib/methadone/cucumber.rb +4 -0
  12. data/lib/methadone/main.rb +4 -1
  13. data/lib/methadone/test/base_integration_test.rb +29 -0
  14. data/lib/methadone/test/integration_test_assertions.rb +63 -0
  15. data/lib/methadone/version.rb +1 -1
  16. data/methadone.gemspec +3 -5
  17. data/templates/full/Rakefile.erb +9 -12
  18. data/templates/full/bin/executable.erb +2 -0
  19. data/templates/rspec/spec/something_spec.rb.erb +1 -1
  20. data/templates/test_unit/test/integration/test_cli.rb.erb +11 -0
  21. data/templates/test_unit/test/{tc_something.rb.erb → unit/test_something.rb.erb} +0 -0
  22. data/test/integration/base_integration_test.rb +60 -0
  23. data/test/integration/test_bootstrap.rb +150 -0
  24. data/test/integration/test_cli.rb +21 -0
  25. data/test/integration/test_license.rb +56 -0
  26. data/test/integration/test_readme.rb +53 -0
  27. data/test/integration/test_rspec.rb +28 -0
  28. data/test/integration/test_version.rb +21 -0
  29. data/test/{base_test.rb → unit/base_test.rb} +0 -0
  30. data/test/{command_for_tests.sh → unit/command_for_tests.sh} +0 -0
  31. data/test/{execution_strategy → unit/execution_strategy}/test_base.rb +0 -0
  32. data/test/{execution_strategy → unit/execution_strategy}/test_jvm.rb +4 -4
  33. data/test/{execution_strategy → unit/execution_strategy}/test_mri.rb +0 -0
  34. data/test/{execution_strategy → unit/execution_strategy}/test_open_3.rb +5 -5
  35. data/test/{execution_strategy → unit/execution_strategy}/test_open_4.rb +5 -5
  36. data/test/{execution_strategy → unit/execution_strategy}/test_rbx_open_4.rb +0 -0
  37. data/test/unit/test/test_integration_test_assertions.rb +211 -0
  38. data/test/{test_cli_logger.rb → unit/test_cli_logger.rb} +17 -17
  39. data/test/{test_cli_logging.rb → unit/test_cli_logging.rb} +12 -12
  40. data/test/{test_exit_now.rb → unit/test_exit_now.rb} +4 -4
  41. data/test/{test_main.rb → unit/test_main.rb} +48 -48
  42. data/test/{test_sh.rb → unit/test_sh.rb} +37 -37
  43. metadata +61 -93
  44. data/features/bootstrap.feature +0 -153
  45. data/features/license.feature +0 -43
  46. data/features/readme.feature +0 -26
  47. data/features/rspec_support.feature +0 -27
  48. data/features/step_definitions/bootstrap_steps.rb +0 -47
  49. data/features/step_definitions/license_steps.rb +0 -30
  50. data/features/step_definitions/readme_steps.rb +0 -26
  51. data/features/step_definitions/version_steps.rb +0 -4
  52. data/features/support/env.rb +0 -26
  53. data/features/version.feature +0 -17
  54. data/templates/full/features/executable.feature.erb +0 -13
  55. data/templates/full/features/step_definitions/executable_steps.rb.erb +0 -1
  56. 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
@@ -1,4 +0,0 @@
1
- When /^I successfully run `([^`]*)` with "([^"]*)" in the library path$/ do |command,dir|
2
- ENV["RUBYOPT"] = (ENV["RUBYOPT"] || '') + " -I" + File.join(Dir.pwd,ARUBA_DIR,'tmp',@app_name,dir)
3
- step %(I successfully run `#{command}`)
4
- end
@@ -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
@@ -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