gestopft 0.0.3 → 0.0.4

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.
@@ -3,7 +3,7 @@
3
3
  require "gestopft/core_ext"
4
4
 
5
5
  module Gestopft
6
- VERSION = '0.0.3'
6
+ VERSION = '0.0.1'
7
7
 
8
8
  module Constants
9
9
  class Error < ::StandardError; end
@@ -17,8 +17,8 @@ class Gestopft::App
17
17
  end
18
18
 
19
19
  def self.run(argv=ARGV)
20
- new(argv).parse_arg.dispatch
21
- self
20
+ (app = new(argv)).parse_arg.dispatch
21
+ app
22
22
  end
23
23
 
24
24
  def self.commands
@@ -96,7 +96,7 @@ Commands:
96
96
  end
97
97
 
98
98
  def __default__
99
- STDIN.puts help_message
99
+ STDOUT.puts help_message
100
100
  end
101
101
  end
102
102
 
@@ -59,5 +59,11 @@ describe Gestopft::Option do
59
59
  subject.arity.should == 0
60
60
  end
61
61
  end
62
+
63
+ context "generated automatically" do
64
+ subject do
65
+ Gestopft::Option.new(:m, :alias_for => :my_option)
66
+ end
67
+ end
62
68
  end
63
69
 
@@ -79,5 +79,20 @@ describe Gestopft::App do
79
79
  subject.commands.should be_empty
80
80
  end
81
81
  end
82
+
83
+ context "when given some options" do
84
+ before do
85
+ subject.module_eval do
86
+ option :verbose
87
+ option :dry_run
88
+ end
89
+ end
90
+
91
+ it "automatically generate short options" do
92
+ subject.expectation.sort.map {|i|
93
+ i.option_name
94
+ }.should.include(%w(-v -d))
95
+ end
96
+ end
82
97
  end
83
98
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gestopft
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - aereal
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-19 00:00:00 +09:00
13
+ date: 2011-04-22 00:00:00 +09:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -26,12 +26,12 @@ files:
26
26
  - README.rdoc
27
27
  - .autotest
28
28
  - .rspec
29
+ - lib/gestopft/app.rb
29
30
  - lib/gestopft/core_ext/array.rb
30
- - lib/gestopft/core_ext/symbol.rb
31
31
  - lib/gestopft/core_ext/string.rb
32
- - lib/gestopft/app.rb
33
- - lib/gestopft/option.rb
32
+ - lib/gestopft/core_ext/symbol.rb
34
33
  - lib/gestopft/core_ext.rb
34
+ - lib/gestopft/option.rb
35
35
  - lib/gestopft.rb
36
36
  - spec/gestopft/option_spec.rb
37
37
  - spec/gestopft_spec.rb