choosy 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/Gemfile.lock +13 -1
  2. data/README.md +259 -0
  3. data/Rakefile +28 -17
  4. data/lib/VERSION.yml +4 -4
  5. data/lib/choosy.rb +38 -10
  6. data/lib/choosy/argument.rb +0 -2
  7. data/lib/choosy/base_command.rb +9 -8
  8. data/lib/choosy/command.rb +0 -6
  9. data/lib/choosy/converter.rb +0 -5
  10. data/lib/choosy/dsl/argument_builder.rb +0 -5
  11. data/lib/choosy/dsl/base_builder.rb +0 -2
  12. data/lib/choosy/dsl/base_command_builder.rb +54 -42
  13. data/lib/choosy/dsl/command_builder.rb +0 -6
  14. data/lib/choosy/dsl/option_builder.rb +4 -6
  15. data/lib/choosy/dsl/super_command_builder.rb +0 -4
  16. data/lib/choosy/errors.rb +10 -2
  17. data/lib/choosy/option.rb +0 -3
  18. data/lib/choosy/parse_result.rb +0 -2
  19. data/lib/choosy/parser.rb +0 -4
  20. data/lib/choosy/printing/base_printer.rb +0 -3
  21. data/lib/choosy/printing/color.rb +21 -33
  22. data/lib/choosy/printing/erb_printer.rb +0 -2
  23. data/lib/choosy/printing/formatting_element.rb +0 -2
  24. data/lib/choosy/printing/help_printer.rb +0 -3
  25. data/lib/choosy/printing/manpage.rb +5 -2
  26. data/lib/choosy/printing/manpage_printer.rb +1 -6
  27. data/lib/choosy/rake.rb +33 -31
  28. data/lib/choosy/super_command.rb +1 -7
  29. data/lib/choosy/super_parser.rb +0 -6
  30. data/lib/choosy/terminal.rb +0 -3
  31. data/lib/choosy/verifier.rb +0 -3
  32. data/lib/choosy/version.rb +0 -2
  33. data/spec/choosy/argument_spec.rb +0 -3
  34. data/spec/choosy/base_command_spec.rb +0 -3
  35. data/spec/choosy/command_spec.rb +0 -4
  36. data/spec/choosy/converter_spec.rb +0 -4
  37. data/spec/choosy/dsl/argument_builder_spec.rb +0 -3
  38. data/spec/choosy/dsl/base_builder_spec.rb +0 -3
  39. data/spec/choosy/dsl/base_command_builder_spec.rb +18 -5
  40. data/spec/choosy/dsl/commmand_builder_spec.rb +0 -6
  41. data/spec/choosy/dsl/option_builder_spec.rb +0 -3
  42. data/spec/choosy/dsl/super_command_builder_spec.rb +0 -4
  43. data/spec/choosy/option_spec.rb +0 -3
  44. data/spec/choosy/parser_spec.rb +0 -5
  45. data/spec/choosy/printing/base_printer_spec.rb +0 -5
  46. data/spec/choosy/printing/color_spec.rb +1 -4
  47. data/spec/choosy/printing/help_printer_spec.rb +0 -5
  48. data/spec/choosy/printing/manpage_printer_spec.rb +0 -4
  49. data/spec/choosy/printing/manpage_spec.rb +2 -3
  50. data/spec/choosy/super_command_spec.rb +0 -3
  51. data/spec/choosy/super_parser_spec.rb +0 -5
  52. data/spec/choosy/terminal_spec.rb +0 -3
  53. data/spec/choosy/verifier_spec.rb +0 -7
  54. data/spec/choosy/version_spec.rb +0 -2
  55. metadata +127 -121
  56. data/README.markdown +0 -463
  57. data/lib/choosy/printing.rb +0 -1
  58. data/spec/integration/command-A_spec.rb +0 -37
@@ -1,9 +1,3 @@
1
- require 'choosy/errors'
2
- require 'choosy/parser'
3
- require 'choosy/base_command'
4
- require 'choosy/super_parser'
5
- require 'choosy/dsl/super_command_builder'
6
-
7
1
  module Choosy
8
2
  class SuperCommand < BaseCommand
9
3
  attr_accessor :metaname, :default_command
@@ -66,7 +60,7 @@ module Choosy
66
60
  def handle_help(hc)
67
61
  command_name = hc.message
68
62
 
69
- if command_name == :help_option || command_name == Choosy::DSL::SuperCommandBuilder::SUPER
63
+ if command_name == :help || command_name == Choosy::DSL::SuperCommandBuilder::SUPER
70
64
  printer.print!(self)
71
65
  else
72
66
  builder = command_builders[command_name]
@@ -1,9 +1,3 @@
1
- require 'choosy/errors'
2
- require 'choosy/parser'
3
- require 'choosy/parse_result'
4
- require 'choosy/verifier'
5
- require 'choosy/dsl/super_command_builder'
6
-
7
1
  module Choosy
8
2
  class SuperParser
9
3
  attr_reader :terminals, :verifier
@@ -1,6 +1,3 @@
1
- require 'choosy/errors'
2
- require 'choosy/printing/color'
3
-
4
1
  module Choosy
5
2
  module Terminal
6
3
  DEFAULT_LINE_COUNT = 25
@@ -1,6 +1,3 @@
1
- require 'choosy/errors'
2
- require 'choosy/dsl/option_builder'
3
-
4
1
  module Choosy
5
2
  class Verifier
6
3
  def verify!(result)
@@ -1,6 +1,4 @@
1
1
  require 'yaml'
2
- require 'time'
3
- require 'choosy/errors'
4
2
 
5
3
  module Choosy
6
4
  class Version
@@ -1,6 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/argument'
3
-
4
1
  module Choosy
5
2
  describe Argument do
6
3
  before :each do
@@ -1,6 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/command'
3
-
4
1
  module Choosy
5
2
  describe BaseCommand do
6
3
  before :each do
@@ -1,7 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/command'
3
- require 'choosy/printing/help_printer'
4
-
5
1
  module Choosy
6
2
  describe Command do
7
3
  before :each do
@@ -1,7 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/version'
3
- require 'choosy/converter'
4
-
5
1
  module Choosy
6
2
  describe Converter do
7
3
 
@@ -1,6 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/dsl/argument_builder'
3
-
4
1
  module Choosy::DSL
5
2
  describe ArgumentBuilder do
6
3
  before :each do
@@ -1,6 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/dsl/base_builder'
3
-
4
1
  module Choosy::DSL
5
2
  class FakeBuilder
6
3
  include BaseBuilder
@@ -1,8 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/dsl/base_command_builder'
3
- require 'choosy/command'
4
- require 'choosy/super_command'
5
-
6
1
  module Choosy::DSL
7
2
  describe BaseCommandBuilder do
8
3
  before :each do
@@ -404,6 +399,24 @@ module Choosy::DSL
404
399
  v = @builder.version "1.0"
405
400
  v.cast_to.should eql(:boolean)
406
401
  end
402
+
403
+ it "should create a singleton method for the actual version" do
404
+ v = @builder.version "1.0"
405
+ v.version.should eql("1.0")
406
+ end
407
407
  end#version
408
+
409
+ describe :no_color do
410
+ it "should allow for a custom message" do
411
+ n = @builder.no_color "msg"
412
+ n.description.should eql("msg")
413
+ end
414
+
415
+ it "should turn off the printing" do
416
+ n = @builder.no_color "msg"
417
+ n.validation_step.call
418
+ @builder.entity.printer.color.should be_disabled
419
+ end
420
+ end
408
421
  end
409
422
  end
@@ -1,9 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/dsl/command_builder'
3
- require 'choosy/command'
4
- require 'choosy/converter'
5
- require 'choosy/errors'
6
-
7
1
  module Choosy::DSL
8
2
  class FakeExecutor
9
3
  attr_reader :options, :args
@@ -1,6 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy'
3
-
4
1
  module Choosy::DSL
5
2
  describe OptionBuilder do
6
3
  before :each do
@@ -1,7 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/super_command'
3
- require 'choosy/dsl/super_command_builder'
4
-
5
1
  module Choosy::DSL
6
2
  describe SuperCommandBuilder do
7
3
  before :each do
@@ -1,6 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/option'
3
-
4
1
  module Choosy
5
2
  describe Option do
6
3
  before :each do
@@ -1,8 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/parser'
3
- require 'choosy/command'
4
- require 'choosy/dsl/command_builder'
5
-
6
1
  module Choosy
7
2
  class ParserBuilder
8
3
  attr_reader :command, :lazy
@@ -1,8 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/printing/base_printer'
3
- require 'choosy/command'
4
- require 'choosy/super_command'
5
-
6
1
  module Choosy::Printing
7
2
  describe BasePrinter do
8
3
  before :each do
@@ -1,6 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/printing/color'
3
-
4
1
  module Choosy::Printing
5
2
  describe Color do
6
3
  before :each do
@@ -42,7 +39,7 @@ module Choosy::Printing
42
39
  it "should fail on too many arguments" do
43
40
  attempting {
44
41
  @c.red("string", :foreground, "extra")
45
- }.should raise_error(ArgumentError, /Color#red/)
42
+ }.should raise_error(ArgumentError, /max 2/)
46
43
  end
47
44
 
48
45
  it "should fail when setting a style not foreground or background" do
@@ -1,8 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/command'
3
- require 'choosy/super_command'
4
- require 'choosy/printing/help_printer'
5
-
6
1
  module Choosy::Printing
7
2
  describe HelpPrinter do
8
3
  before :each do
@@ -1,7 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/command'
3
- require 'choosy/printing/manpage_printer'
4
-
5
1
  module Choosy::Printing
6
2
  describe ManpagePrinter do
7
3
  before :each do
@@ -1,6 +1,3 @@
1
- require 'choosy/printing/manpage'
2
- require 'spec_helpers'
3
-
4
1
  module Choosy::Printing
5
2
  describe ManpageFormatter do
6
3
  before :each do
@@ -184,6 +181,7 @@ module Choosy::Printing
184
181
  @man.name = "blah"
185
182
  @man.date = 'today'
186
183
 
184
+ @man.column_width = 100
187
185
  @man.section_heading('description')
188
186
  @man.paragraph('this is a line of text')
189
187
 
@@ -196,6 +194,7 @@ module Choosy::Printing
196
194
  .nh
197
195
  .\\" disable justification (adjust text to left margin only)
198
196
  .ad l
197
+ .ll 100
199
198
  .SH "DESCRIPTION"
200
199
  .P
201
200
  this is a line of text
@@ -1,6 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/super_command'
3
-
4
1
  module Choosy
5
2
  describe SuperCommand do
6
3
  before :each do
@@ -1,8 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/super_parser'
3
- require 'choosy/super_command'
4
- require 'choosy/dsl/super_command_builder'
5
-
6
1
  module Choosy
7
2
  class SuperParserBuilder
8
3
  attr_reader :super
@@ -1,6 +1,3 @@
1
- require 'spec_helpers'
2
- require 'choosy/terminal'
3
-
4
1
  module Choosy
5
2
  class TerminalTest
6
3
  include Terminal
@@ -1,11 +1,4 @@
1
- require 'spec_helpers'
2
- require 'choosy/verifier'
3
- require 'choosy/errors'
4
- require 'choosy/parser'
5
- require 'choosy/command'
6
-
7
1
  module Choosy
8
-
9
2
  module VerifierHelper
10
3
  def reset!
11
4
  @c = Command.new(:verifier)
@@ -1,6 +1,4 @@
1
- require 'spec_helpers'
2
1
  require 'tempfile'
3
- require 'choosy/version'
4
2
 
5
3
  module Choosy
6
4
  describe Version do
metadata CHANGED
@@ -1,184 +1,190 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: choosy
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 4
8
- - 9
9
- version: 0.4.9
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.10
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Gabe McArthur
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-04-07 00:00:00 -07:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-04-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
31
22
  type: :development
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: autotest
35
23
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
37
25
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- version: "0"
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: autotest
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
44
38
  type: :development
45
- version_requirements: *id002
46
- - !ruby/object:Gem::Dependency
47
- name: autotest-notification
48
39
  prerelease: false
49
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
50
41
  none: false
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: autotest-notification
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
57
54
  type: :development
58
- version_requirements: *id003
59
- - !ruby/object:Gem::Dependency
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
60
63
  name: ZenTest
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
61
71
  prerelease: false
62
- requirement: &id004 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
63
73
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
- version: "0"
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: cucumber
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
70
86
  type: :development
71
- version_requirements: *id004
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
72
94
  description: This is a DSL for creating more complicated command line tools.
73
- email:
95
+ email:
74
96
  - madeonamac@gmail.com
75
97
  executables: []
76
-
77
98
  extensions: []
78
-
79
99
  extra_rdoc_files: []
80
-
81
- files:
82
- - TODO.md
100
+ files:
101
+ - CHANGELOG.md
83
102
  - Gemfile
84
- - README.markdown
85
103
  - Gemfile.lock
86
- - CHANGELOG.md
87
104
  - LICENSE
88
105
  - Rakefile
89
- - lib/choosy.rb
90
- - lib/VERSION.yml
91
- - lib/choosy/errors.rb
92
- - lib/choosy/printing.rb
93
- - lib/choosy/rake.rb
94
- - lib/choosy/converter.rb
95
- - lib/choosy/parse_result.rb
96
- - lib/choosy/verifier.rb
106
+ - README.md
107
+ - TODO.md
97
108
  - lib/choosy/argument.rb
98
- - lib/choosy/version.rb
99
- - lib/choosy/option.rb
109
+ - lib/choosy/base_command.rb
100
110
  - lib/choosy/command.rb
101
- - lib/choosy/terminal.rb
102
- - lib/choosy/super_command.rb
111
+ - lib/choosy/converter.rb
103
112
  - lib/choosy/dsl/argument_builder.rb
104
- - lib/choosy/dsl/super_command_builder.rb
105
113
  - lib/choosy/dsl/base_builder.rb
114
+ - lib/choosy/dsl/base_command_builder.rb
106
115
  - lib/choosy/dsl/command_builder.rb
107
116
  - lib/choosy/dsl/option_builder.rb
108
- - lib/choosy/dsl/base_command_builder.rb
117
+ - lib/choosy/dsl/super_command_builder.rb
118
+ - lib/choosy/errors.rb
119
+ - lib/choosy/option.rb
109
120
  - lib/choosy/parser.rb
110
- - lib/choosy/base_command.rb
111
- - lib/choosy/printing/manpage_printer.rb
121
+ - lib/choosy/parse_result.rb
112
122
  - lib/choosy/printing/base_printer.rb
113
- - lib/choosy/printing/formatting_element.rb
114
- - lib/choosy/printing/manpage.rb
115
123
  - lib/choosy/printing/color.rb
116
124
  - lib/choosy/printing/erb_printer.rb
125
+ - lib/choosy/printing/formatting_element.rb
117
126
  - lib/choosy/printing/help_printer.rb
127
+ - lib/choosy/printing/manpage.rb
128
+ - lib/choosy/printing/manpage_printer.rb
129
+ - lib/choosy/rake.rb
130
+ - lib/choosy/super_command.rb
118
131
  - lib/choosy/super_parser.rb
119
- - spec/integration/command-A_spec.rb
120
- - spec/integration/supercommand-C_spec.rb
121
- - spec/integration/command-B_spec.rb
122
- - spec/integration/supercommand-B_spec.rb
123
- - spec/integration/supercommand-A_spec.rb
124
- - spec/integration/command-C_spec.rb
125
- - spec/choosy/converter_spec.rb
126
- - spec/choosy/option_spec.rb
127
- - spec/choosy/version_spec.rb
132
+ - lib/choosy/terminal.rb
133
+ - lib/choosy/verifier.rb
134
+ - lib/choosy/version.rb
135
+ - lib/choosy.rb
136
+ - lib/VERSION.yml
128
137
  - spec/choosy/argument_spec.rb
129
138
  - spec/choosy/base_command_spec.rb
130
- - spec/choosy/version.yml
131
- - spec/choosy/terminal_spec.rb
132
139
  - spec/choosy/command_spec.rb
133
- - spec/choosy/dsl/super_command_builder_spec.rb
134
- - spec/choosy/dsl/option_builder_spec.rb
135
- - spec/choosy/dsl/base_builder_spec.rb
140
+ - spec/choosy/converter_spec.rb
136
141
  - spec/choosy/dsl/argument_builder_spec.rb
137
- - spec/choosy/dsl/commmand_builder_spec.rb
142
+ - spec/choosy/dsl/base_builder_spec.rb
138
143
  - spec/choosy/dsl/base_command_builder_spec.rb
139
- - spec/choosy/super_command_spec.rb
140
- - spec/choosy/super_parser_spec.rb
141
- - spec/choosy/verifier_spec.rb
142
- - spec/choosy/printing/help_printer_spec.rb
144
+ - spec/choosy/dsl/commmand_builder_spec.rb
145
+ - spec/choosy/dsl/option_builder_spec.rb
146
+ - spec/choosy/dsl/super_command_builder_spec.rb
147
+ - spec/choosy/option_spec.rb
148
+ - spec/choosy/parser_spec.rb
143
149
  - spec/choosy/printing/base_printer_spec.rb
144
- - spec/choosy/printing/manpage_printer_spec.rb
145
150
  - spec/choosy/printing/color_spec.rb
151
+ - spec/choosy/printing/help_printer_spec.rb
152
+ - spec/choosy/printing/manpage_printer_spec.rb
146
153
  - spec/choosy/printing/manpage_spec.rb
147
- - spec/choosy/parser_spec.rb
154
+ - spec/choosy/super_command_spec.rb
155
+ - spec/choosy/super_parser_spec.rb
156
+ - spec/choosy/terminal_spec.rb
157
+ - spec/choosy/verifier_spec.rb
158
+ - spec/choosy/version.yml
159
+ - spec/choosy/version_spec.rb
160
+ - spec/integration/command-B_spec.rb
161
+ - spec/integration/command-C_spec.rb
162
+ - spec/integration/supercommand-A_spec.rb
163
+ - spec/integration/supercommand-B_spec.rb
164
+ - spec/integration/supercommand-C_spec.rb
148
165
  - spec/spec_helpers.rb
149
- has_rdoc: true
150
166
  homepage: http://github.com/gabemc/choosy
151
167
  licenses: []
152
-
153
168
  post_install_message:
154
169
  rdoc_options: []
155
-
156
- require_paths:
170
+ require_paths:
157
171
  - lib
158
- required_ruby_version: !ruby/object:Gem::Requirement
172
+ required_ruby_version: !ruby/object:Gem::Requirement
159
173
  none: false
160
- requirements:
161
- - - ">="
162
- - !ruby/object:Gem::Version
163
- segments:
164
- - 0
165
- version: "0"
166
- required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
179
  none: false
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- segments:
172
- - 1
173
- - 3
174
- - 6
180
+ requirements:
181
+ - - ! '>='
182
+ - !ruby/object:Gem::Version
175
183
  version: 1.3.6
176
184
  requirements: []
177
-
178
185
  rubyforge_project:
179
- rubygems_version: 1.3.7
186
+ rubygems_version: 1.8.22
180
187
  signing_key:
181
188
  specification_version: 3
182
189
  summary: Yet another option parsing library.
183
190
  test_files: []
184
-