methadone 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cf2e467dfef11e61fd7f58da69b83a58b14ed95
4
- data.tar.gz: c4b5ccba71b1d321c7903ed4aa7a174b1ebba65c
3
+ metadata.gz: ea5a066a8f38016a6a0a185bae7a5f57e4d686cf
4
+ data.tar.gz: 690d8cfdc514e92027804e18cb5836e46e820b3c
5
5
  SHA512:
6
- metadata.gz: e1d2154ca7452e62ab16fe0fd2deb43e61a385ce7f46724cb07c4ee7176897f7f235aa9f212eb99740847e68415a0e15fd6a47d508482ff2d4fd3cb6aaf9c990
7
- data.tar.gz: cd2ea0edd3b87534072160a47c371817cec145cd08fb4a18998d1fa23c2a4710f14dd6931623944d290a148e18ad7892fdc011b684f55dffbdd6c18a9228e2e4
6
+ metadata.gz: c75f27bba82d19ea8990d0293d4a2cc40c9e39e1447b97f4f4d3a3329c6ef2df897e2179b2ac94937f2ecf07f19daa874ac09601efe9c0044ee2f1b388e589f8
7
+ data.tar.gz: f85d5d1f8c0ae99125a4a1175ef65ae1931be39e66ee4b1f5e06e1b38e9b3c9543c061b7573e7d70c0c096ce0ac635b78b6aa8ad1cca189b5e26a9c4a1d5ae4b
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.2.0
@@ -7,5 +7,6 @@ rvm:
7
7
  - 1.9.3
8
8
  - 2.0.0
9
9
  - 2.1.0
10
+ - 2.2.0
10
11
  - jruby-18mode
11
12
  - jruby-19mode
data/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
1
  source 'http://www.rubygems.org'
2
2
 
3
3
  gem 'open4', :platform => :ruby_18
4
+ gem 'test-unit'
4
5
  # Specify your gem's dependencies in methadone.gemspec
5
6
  gemspec
@@ -133,14 +133,18 @@ module Methadone
133
133
  @env_var = env_var
134
134
  end
135
135
 
136
- # Set the name of the file, in the user's home directory, where defaults can be configured.
136
+ # Set the path to the file where defaults can be configured.
137
+ #
137
138
  # The format of this file can be either a simple string of options, like what goes
138
139
  # in the environment variable (see #defaults_from_env_var), or YAML, in which case
139
140
  # it should be a hash where keys are the option names, and values their defaults.
140
141
  #
141
- # filename:: name of the file, relative to the user's home directory
142
+ # Relative paths will be expanded relative to the user's home directory.
143
+ #
144
+ # filename:: path to the file. If relative, will look in user's HOME directory.
145
+ # If absolute, this is the absolute path to where the file should be.
142
146
  def defaults_from_config_file(filename,options={})
143
- @rc_file = File.join(ENV['HOME'],filename)
147
+ @rc_file = File.expand_path(filename, ENV['HOME'])
144
148
  end
145
149
 
146
150
  # Start your command-line app, exiting appropriately when
@@ -1,3 +1,3 @@
1
1
  module Methadone #:nodoc:
2
- VERSION = "1.8.0" #:nodoc:
2
+ VERSION = "1.9.0" #:nodoc:
3
3
  end
@@ -27,4 +27,5 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency("mocha", "0.13.2")
28
28
  s.add_development_dependency("sdoc")
29
29
  s.add_development_dependency("rspec", "~> 3.0.0")
30
+ s.add_development_dependency("i18n", "= 0.6.1")
30
31
  end
@@ -652,6 +652,31 @@ class TestMain < BaseTest
652
652
 
653
653
  end
654
654
 
655
+ test_that "we can get defaults from an absolute config filename" do
656
+ tempfile = Tempfile.new('methadone_test.rc')
657
+ Given app_to_use_rc_file(tempfile.path)
658
+ And {
659
+ @flag_value = any_string
660
+ rc_file = File.join(tempfile.path)
661
+ File.open(rc_file,'w') do |file|
662
+ file.puts({
663
+ 'switch' => true,
664
+ 'flag' => @flag_value,
665
+ }.to_yaml)
666
+ end
667
+ }
668
+ When {
669
+ @code = lambda { go! }
670
+ }
671
+ Then {
672
+ assert_exits(0,&@code)
673
+ @switch.should == true
674
+ @flag.should == @flag_value
675
+ }
676
+
677
+ end
678
+
679
+
655
680
  test_that "we can specify an rc file even if it doesn't exist" do
656
681
  Given app_to_use_rc_file
657
682
  And {
@@ -740,7 +765,7 @@ class TestMain < BaseTest
740
765
 
741
766
  private
742
767
 
743
- def app_to_use_rc_file
768
+ def app_to_use_rc_file(rc_file = '.my_app.rc')
744
769
  lambda {
745
770
  reset!
746
771
  @switch = nil
@@ -752,7 +777,7 @@ private
752
777
  @args = args
753
778
  end
754
779
 
755
- defaults_from_config_file '.my_app.rc'
780
+ defaults_from_config_file rc_file
756
781
 
757
782
  on('--switch','Some Switch')
758
783
  on('--flag FOO','Some Flag')
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: methadone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - davetron5000
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-22 00:00:00.000000000 Z
11
+ date: 2015-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.9'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.9'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: cucumber
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aruba
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0.5'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.5'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: clean_test
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
@@ -126,30 +126,44 @@ dependencies:
126
126
  name: sdoc
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: 3.0.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 3.0.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: i18n
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '='
158
+ - !ruby/object:Gem::Version
159
+ version: 0.6.1
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '='
165
+ - !ruby/object:Gem::Version
166
+ version: 0.6.1
153
167
  description: Methadone provides a lot of small but useful features for developing
154
168
  a command-line app, including an opinionated bootstrapping process, some helpful
155
169
  cucumber steps, and some classes to bridge logging and output into a simple, unified,
@@ -161,10 +175,10 @@ executables:
161
175
  extensions: []
162
176
  extra_rdoc_files: []
163
177
  files:
164
- - .gitignore
165
- - .ruby-gemset
166
- - .ruby-version
167
- - .travis.yml
178
+ - ".gitignore"
179
+ - ".ruby-gemset"
180
+ - ".ruby-version"
181
+ - ".travis.yml"
168
182
  - CHANGES.md
169
183
  - Gemfile
170
184
  - LICENSE.txt
@@ -237,17 +251,17 @@ require_paths:
237
251
  - lib
238
252
  required_ruby_version: !ruby/object:Gem::Requirement
239
253
  requirements:
240
- - - '>='
254
+ - - ">="
241
255
  - !ruby/object:Gem::Version
242
256
  version: '0'
243
257
  required_rubygems_version: !ruby/object:Gem::Requirement
244
258
  requirements:
245
- - - '>='
259
+ - - ">="
246
260
  - !ruby/object:Gem::Version
247
261
  version: '0'
248
262
  requirements: []
249
263
  rubyforge_project: methadone
250
- rubygems_version: 2.0.14
264
+ rubygems_version: 2.4.5
251
265
  signing_key:
252
266
  specification_version: 4
253
267
  summary: Kick the bash habit and start your command-line apps off right