methadone 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use 1.9.2@methadone-dev --create
1
+ rvm use 1.9.3@methadone-dev --create
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.1.0 - April 21, 2012, 6:00 PM
4
+
5
+ * Can bootstrap apps using RSpec instead of Test::Unit (thanks @msgehard)
6
+
3
7
  ## v1.0.0 - April 1, 2012, 10:31
4
8
 
5
9
  * Initial official release
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source :rubygems
2
2
 
3
3
  gem 'open4', :platform => :ruby_18
4
4
  # Specify your gem's dependencies in methadone.gemspec
data/README.rdoc CHANGED
@@ -16,6 +16,12 @@ Toward that end, this gem provides:
16
16
  * Simplified zero-config logging that is a better-than-<tt>puts</tt> <tt>puts</tt>.
17
17
  * Cucumber Steps, built on Aruba, to allow you to test-drive your command-line app development.
18
18
 
19
+ == Tutorial
20
+
21
+ http://a1.mzstatic.com/us/r30/Publication/v4/2c/f7/90/2cf7902f-f709-9125-c73d-87311216527d/MethadoneTutorial.225x225-75.jpg
22
+
23
+ {Tutorial for your iPad}[http://itunes.apple.com/us/book/kick-bash-habit-ruby-methadone/id515825242?ls=1] - This is a *free* iBooks interactive ebook that contains a step-by-step tutorial on making an awesome app with Methadone, including screencasts.
24
+
19
25
  == Links
20
26
 
21
27
  * {Source on Github}[http://github.com/davetron5000/methadone]
data/bin/methadone CHANGED
@@ -28,10 +28,22 @@ main do |app_name|
28
28
 
29
29
  template_dirs_in(:full).each { |dir| mkdir_p dir }
30
30
 
31
- ["Rakefile", ".gitignore", "test/tc_something.rb", "features/support/env.rb"].each do |file|
31
+ rspec = options[:rspec]
32
+
33
+ ["Rakefile", ".gitignore", "features/support/env.rb"].each do |file|
32
34
  copy_file file, :binding => binding
33
35
  end
34
36
 
37
+ if rspec
38
+ template_dirs_in(:rspec).each { |dir| mkdir_p dir }
39
+ copy_file "spec/tc_something_spec.rb", :from => :rspec, :binding => binding
40
+
41
+ else
42
+ template_dirs_in(:test_unit).each { |dir| mkdir_p dir }
43
+ copy_file "test/tc_something.rb", :from => :test_unit, :binding => binding
44
+ end
45
+
46
+
35
47
  license = options[:license]
36
48
  warn "warning: your app has no license" unless license
37
49
  license = nil if license == 'NONE'
@@ -58,6 +70,7 @@ description "Kick the bash habit by bootstrapping your Ruby command-line apps"
58
70
 
59
71
  on("--force","Overwrite files if they exist")
60
72
  on("--[no-]readme","[Do not ]produce a README file")
73
+ on("--rspec", "Generate RSpec unit tests instead of Test::Unit")
61
74
 
62
75
  licenses = %w(mit apache custom NONE)
63
76
  on("-l LICENSE","--license",licenses,"Specify the license for your project",'(' + licenses.join('|') + ')')
@@ -17,6 +17,8 @@ Feature: Bootstrap a new command-line app
17
17
  |tmp/newgem/features |
18
18
  |tmp/newgem/features/support |
19
19
  |tmp/newgem/features/step_definitions |
20
+ Then the following directories should not exist:
21
+ |tmp/newgem/spec |
20
22
  And the following files should exist:
21
23
  |tmp/newgem/newgem.gemspec |
22
24
  |tmp/newgem/Rakefile |
@@ -0,0 +1,32 @@
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/tc_something_spec.rb |
17
+ Given I cd to "tmp/newgem"
18
+ When I successfully run `rake -T -I../../lib`
19
+ Then the output should contain:
20
+ """
21
+ rake spec # Run RSpec code examples
22
+ """
23
+ And the output should not contain:
24
+ """
25
+ rake test # Run tests
26
+ """
27
+ When I run `rake spec -I../../lib`
28
+ Then the exit status should be 0
29
+ And the output should contain:
30
+ """
31
+ 1 example, 0 failures
32
+ """
data/lib/methadone/cli.rb CHANGED
@@ -89,7 +89,7 @@ module Methadone
89
89
  end
90
90
 
91
91
  def template_dirs_in(profile)
92
- template_dir = template_dir(:full)
92
+ template_dir = template_dir(profile)
93
93
 
94
94
  Dir["#{template_dir}/**/*"].select { |x|
95
95
  File.directory? x
@@ -5,7 +5,7 @@ module Methadone
5
5
  # For RBX; it throws a different exception when a command isn't found, so we override that here.
6
6
  class RBXOpen_4 < Open_4
7
7
  def exception_meaning_command_not_found
8
- Errno::EINVAL
8
+ [Errno::EINVAL] + Array(super)
9
9
  end
10
10
  end
11
11
  end
data/lib/methadone/sh.rb CHANGED
@@ -111,7 +111,7 @@ module Methadone
111
111
  end
112
112
 
113
113
  process_status.exitstatus
114
- rescue exception_meaning_command_not_found => ex
114
+ rescue *exception_meaning_command_not_found => ex
115
115
  sh_logger.error("Error running '#{command}': #{ex.message}")
116
116
  127
117
117
  end
@@ -1,3 +1,3 @@
1
1
  module Methadone
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,6 +1,10 @@
1
1
  require 'bundler'
2
2
  require 'rake/clean'
3
+ <% if rspec %>
4
+ require 'rspec/core/rake_task'
5
+ <% else %>
3
6
  require 'rake/testtask'
7
+ <% end %>
4
8
  require 'cucumber'
5
9
  require 'cucumber/rake/task'
6
10
  gem 'rdoc' # we need the installed RDoc gem, not the system one
@@ -10,9 +14,15 @@ include Rake::DSL
10
14
 
11
15
  Bundler::GemHelper.install_tasks
12
16
 
17
+ <% if rspec %>
18
+ RSpec::Core::RakeTask.new do |t|
19
+ # Put spec opts in a file named .rspec in root
20
+ end
21
+ <% else %>
13
22
  Rake::TestTask.new do |t|
14
23
  t.pattern = 'test/tc_*.rb'
15
24
  end
25
+ <% end %>
16
26
 
17
27
  CUKE_RESULTS = 'results.html'
18
28
  CLEAN << CUKE_RESULTS
@@ -27,5 +37,8 @@ Rake::RDocTask.new do |rd|
27
37
  <% end %>
28
38
  rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
29
39
  end
30
-
40
+ <% if rspec %>
41
+ task :default => [:spec,:features]
42
+ <% else %>
31
43
  task :default => [:test,:features]
44
+ <% end %>
@@ -0,0 +1,5 @@
1
+ describe "TestSomething" do
2
+ it "should be true" do
3
+ true.should be_true
4
+ end
5
+ end
@@ -18,7 +18,7 @@ module ExecutionStrategy
18
18
  @klass = @strategy.exception_meaning_command_not_found
19
19
  }
20
20
  Then {
21
- @klass.should == Errno::EINVAL
21
+ @klass.should == [Errno::EINVAL,Errno::ENOENT]
22
22
  }
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,126 +1,165 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: methadone
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
5
  prerelease:
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 0
10
+ version: 1.1.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - davetron5000
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-04-01 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-04-21 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
15
22
  name: bundler
16
- requirement: &70200242436000 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
17
25
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
22
33
  type: :runtime
23
- prerelease: false
24
- version_requirements: *70200242436000
25
- - !ruby/object:Gem::Dependency
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
26
36
  name: rspec-expectations
27
- requirement: &70200242435020 !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
28
39
  none: false
29
- requirements:
40
+ requirements:
30
41
  - - ~>
31
- - !ruby/object:Gem::Version
32
- version: '2.6'
42
+ - !ruby/object:Gem::Version
43
+ hash: 15
44
+ segments:
45
+ - 2
46
+ - 6
47
+ version: "2.6"
33
48
  type: :development
34
- prerelease: false
35
- version_requirements: *70200242435020
36
- - !ruby/object:Gem::Dependency
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
37
51
  name: rake
38
- requirement: &70200242434120 !ruby/object:Gem::Requirement
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
39
54
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
44
62
  type: :development
45
- prerelease: false
46
- version_requirements: *70200242434120
47
- - !ruby/object:Gem::Dependency
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
48
65
  name: rdoc
49
- requirement: &70200242432880 !ruby/object:Gem::Requirement
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
50
68
  none: false
51
- requirements:
69
+ requirements:
52
70
  - - ~>
53
- - !ruby/object:Gem::Version
54
- version: '3.9'
71
+ - !ruby/object:Gem::Version
72
+ hash: 21
73
+ segments:
74
+ - 3
75
+ - 9
76
+ version: "3.9"
55
77
  type: :development
56
- prerelease: false
57
- version_requirements: *70200242432880
58
- - !ruby/object:Gem::Dependency
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
59
80
  name: cucumber
60
- requirement: &70200242431660 !ruby/object:Gem::Requirement
81
+ prerelease: false
82
+ requirement: &id005 !ruby/object:Gem::Requirement
61
83
  none: false
62
- requirements:
84
+ requirements:
63
85
  - - ~>
64
- - !ruby/object:Gem::Version
86
+ - !ruby/object:Gem::Version
87
+ hash: 17
88
+ segments:
89
+ - 1
90
+ - 1
91
+ - 1
65
92
  version: 1.1.1
66
93
  type: :development
67
- prerelease: false
68
- version_requirements: *70200242431660
69
- - !ruby/object:Gem::Dependency
94
+ version_requirements: *id005
95
+ - !ruby/object:Gem::Dependency
70
96
  name: aruba
71
- requirement: &70200242430780 !ruby/object:Gem::Requirement
97
+ prerelease: false
98
+ requirement: &id006 !ruby/object:Gem::Requirement
72
99
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
77
107
  type: :development
78
- prerelease: false
79
- version_requirements: *70200242430780
80
- - !ruby/object:Gem::Dependency
108
+ version_requirements: *id006
109
+ - !ruby/object:Gem::Dependency
81
110
  name: simplecov
82
- requirement: &70200242430120 !ruby/object:Gem::Requirement
111
+ prerelease: false
112
+ requirement: &id007 !ruby/object:Gem::Requirement
83
113
  none: false
84
- requirements:
114
+ requirements:
85
115
  - - ~>
86
- - !ruby/object:Gem::Version
87
- version: '0.5'
116
+ - !ruby/object:Gem::Version
117
+ hash: 1
118
+ segments:
119
+ - 0
120
+ - 5
121
+ version: "0.5"
88
122
  type: :development
89
- prerelease: false
90
- version_requirements: *70200242430120
91
- - !ruby/object:Gem::Dependency
123
+ version_requirements: *id007
124
+ - !ruby/object:Gem::Dependency
92
125
  name: clean_test
93
- requirement: &70200242428980 !ruby/object:Gem::Requirement
126
+ prerelease: false
127
+ requirement: &id008 !ruby/object:Gem::Requirement
94
128
  none: false
95
- requirements:
129
+ requirements:
96
130
  - - ~>
97
- - !ruby/object:Gem::Version
98
- version: '0.10'
131
+ - !ruby/object:Gem::Version
132
+ hash: 31
133
+ segments:
134
+ - 0
135
+ - 10
136
+ version: "0.10"
99
137
  type: :development
100
- prerelease: false
101
- version_requirements: *70200242428980
102
- - !ruby/object:Gem::Dependency
138
+ version_requirements: *id008
139
+ - !ruby/object:Gem::Dependency
103
140
  name: mocha
104
- requirement: &70200242428100 !ruby/object:Gem::Requirement
141
+ prerelease: false
142
+ requirement: &id009 !ruby/object:Gem::Requirement
105
143
  none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ hash: 3
148
+ segments:
149
+ - 0
150
+ version: "0"
110
151
  type: :development
111
- prerelease: false
112
- version_requirements: *70200242428100
113
- description: Methadone provides a lot of small but useful features for developing
114
- a command-line app, including an opinionated bootstrapping process, some helpful
115
- cucumber steps, and some classes to bridge logging and output into a simple, unified,
116
- interface
117
- email:
152
+ version_requirements: *id009
153
+ description: Methadone provides a lot of small but useful features for developing a command-line app, including an opinionated bootstrapping process, some helpful cucumber steps, and some classes to bridge logging and output into a simple, unified, interface
154
+ email:
118
155
  - davetron5000 at gmail.com
119
- executables:
156
+ executables:
120
157
  - methadone
121
158
  extensions: []
159
+
122
160
  extra_rdoc_files: []
123
- files:
161
+
162
+ files:
124
163
  - .gitignore
125
164
  - .rvmrc
126
165
  - .travis.yml
@@ -133,6 +172,7 @@ files:
133
172
  - features/bootstrap.feature
134
173
  - features/license.feature
135
174
  - features/readme.feature
175
+ - features/rspec_support.feature
136
176
  - features/step_definitions/bootstrap_steps.rb
137
177
  - features/step_definitions/license_steps.rb
138
178
  - features/step_definitions/readme_steps.rb
@@ -167,7 +207,8 @@ files:
167
207
  - templates/full/features/step_definitions/executable_steps.rb.erb
168
208
  - templates/full/features/support/env.rb.erb
169
209
  - templates/full/mit_LICENSE.txt.erb
170
- - templates/full/test/tc_something.rb.erb
210
+ - templates/rspec/spec/tc_something_spec.rb.erb
211
+ - templates/test_unit/test/tc_something.rb.erb
171
212
  - test/base_test.rb
172
213
  - test/command_for_tests.rb
173
214
  - test/execution_strategy/test_base.rb
@@ -181,35 +222,49 @@ files:
181
222
  - test/test_exit_now.rb
182
223
  - test/test_main.rb
183
224
  - test/test_sh.rb
225
+ has_rdoc: true
184
226
  homepage: http://github.com/davetron5000/methadone
185
227
  licenses: []
186
- post_install_message: ! "\n\n!!!!!!!!!!!!!!!!!!!!!!\n\nIf you are on Ruby 1.8 or REE,
187
- you MUST\n\ngem install open4\n\n!!!!!!!!!!!!!!!!!!!!!!\n "
228
+
229
+ post_install_message: "\n\n\
230
+ !!!!!!!!!!!!!!!!!!!!!!\n\n\
231
+ If you are on Ruby 1.8 or REE, you MUST\n\n\
232
+ gem install open4\n\n\
233
+ !!!!!!!!!!!!!!!!!!!!!!\n "
188
234
  rdoc_options: []
189
- require_paths:
235
+
236
+ require_paths:
190
237
  - lib
191
- required_ruby_version: !ruby/object:Gem::Requirement
238
+ required_ruby_version: !ruby/object:Gem::Requirement
192
239
  none: false
193
- requirements:
194
- - - ! '>='
195
- - !ruby/object:Gem::Version
196
- version: '0'
197
- required_rubygems_version: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ hash: 3
244
+ segments:
245
+ - 0
246
+ version: "0"
247
+ required_rubygems_version: !ruby/object:Gem::Requirement
198
248
  none: false
199
- requirements:
200
- - - ! '>='
201
- - !ruby/object:Gem::Version
202
- version: '0'
249
+ requirements:
250
+ - - ">="
251
+ - !ruby/object:Gem::Version
252
+ hash: 3
253
+ segments:
254
+ - 0
255
+ version: "0"
203
256
  requirements: []
257
+
204
258
  rubyforge_project: methadone
205
- rubygems_version: 1.8.10
259
+ rubygems_version: 1.5.2
206
260
  signing_key:
207
261
  specification_version: 3
208
262
  summary: Kick the bash habit and start your command-line apps off right
209
- test_files:
263
+ test_files:
210
264
  - features/bootstrap.feature
211
265
  - features/license.feature
212
266
  - features/readme.feature
267
+ - features/rspec_support.feature
213
268
  - features/step_definitions/bootstrap_steps.rb
214
269
  - features/step_definitions/license_steps.rb
215
270
  - features/step_definitions/readme_steps.rb