choosy 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 0.3.5 (March 26, 2011)
2
+
3
+ Features:
4
+
5
+ - Added additional rake tasks to make creating a release somewhat easier, including integration with git and gem. This makes my life easier in all my dependent projects.
6
+ - Skipped a couple of version numbers working out the rake integration :).
7
+
8
+ Fixes:
9
+
10
+ - Added or fixed the general documentation for printing functionality.
11
+
12
+ ## 0.3.1 (March 25, 2011)
13
+
14
+ Features:
15
+
16
+ - Refactored the version class to be easier to integrate with rake and dependent projects, if they want.
17
+ - Added some minor integration with rake for versioning assets.
18
+
1
19
  ## 0.3.0 (March 24, 2011)
2
20
 
3
21
  Features:
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- choosy ()
4
+ choosy (0.3.5)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
- ZenTest (4.4.2)
9
+ ZenTest (4.5.0)
10
10
  autotest (4.4.6)
11
11
  ZenTest (>= 4.4.1)
12
12
  autotest-notification (2.3.1)
@@ -25,6 +25,7 @@ PLATFORMS
25
25
  ruby
26
26
 
27
27
  DEPENDENCIES
28
+ ZenTest (>= 4.5.0)
28
29
  autotest
29
30
  autotest-notification
30
31
  choosy!
data/README.markdown CHANGED
@@ -1,4 +1,4 @@
1
- # Choosy: Picking your arguments carefully
1
+ # Choosy: Picking your Arguments Carefully
2
2
 
3
3
  This is a small DSL library for creating command line clients in Ruby. It is largely inspired by the <a href="https://github.com/defunkt/choice">choice</a>, <a href="https://github.com/visionmedia/commander">commander</a>, and <a href="http://furius.ca/optcomplete/">optcomplete.py</a> libraries, though it makes some different design decisions than they do. It is opinionated software.
4
4
 
@@ -8,7 +8,7 @@ This library should:
8
8
  - Make creating supercommands like git, subversion, and gem easier.
9
9
  - Allow you to add validation logic for your arguments within the parsing phase.
10
10
  - Allowing for dependencies between options, so that you can more easily validate related options (i.e. if the<code>--bold</code> flag requires the <code>--font Arial</code> flag, then you should be able to ask for the <code>--font</code> option to be validated first, and then the <code>--bold</code> option.
11
- - Allow you to customize its output using your own formatting system.
11
+ - Allow you to customize its output using your own formatting system, or provide several convenient defaults when you don't want to provide your own.
12
12
 
13
13
  This library should never:
14
14
 
@@ -406,12 +406,12 @@ Choosy allows you to customize the output printing of your documentation. It exp
406
406
  The <code>:standard</code> printer that is the default for any command can also be customized to meet some of your needs:
407
407
 
408
408
  Choosy::Command.new :foo do
409
- printer :standard,
410
- :max_width => 80,
411
- :color => true,
412
- :header_styles => [:bold, :green],
413
- :indent => ' ',
414
- :offset => ' '
409
+ printer :standard, # The default printer
410
+ :max_width => 80, # Defaults to the column witdh of the terminal
411
+ :color => true, # Default is true
412
+ :header_styles => [:bold, :green], # Defaults to [:bold, :blue]
413
+ :indent => ' ', # Defaults to this width
414
+ :offset => ' ' # Defaults to this width
415
415
 
416
416
  help "Show this help command."
417
417
  end
@@ -428,7 +428,7 @@ For those who want the nice, manpage experience, there's also the <code>:manpage
428
428
  :option_sytles => [:bold], # Same as :standard
429
429
  :indent => ' ', # Same as :standard
430
430
  :offset => ' ', # Same as :standard
431
- :version => FOO_VERSION, # Will use the version name you specify
431
+ :version => FOO_VERSION, # Will use the version name you specify, see below.
432
432
  :section => 1, # Default is always '1'
433
433
  :date => '03/24/2011', # Date you want displayed
434
434
  :manual => 'Foo Co.' # The manual page group
@@ -436,14 +436,28 @@ For those who want the nice, manpage experience, there's also the <code>:manpage
436
436
  version FOO_VERSION # If you don't supply a version above, this will be used
437
437
  end
438
438
 
439
- Because the library is super-awesome, the manpage will even be in color when piped to less (!). If you don't like the format of my manpage, feel free to implement your own using the <code>choosy/printing/manpage</code> class, a useful utility class for formatting manpage output correctly.
439
+ Because the library is super-awesome, the manpage will even be in color when piped to <code>less -R<code> (the default)! If you don't like the format of my manpage, feel free to implement your own using the <code>choosy/printing/manpage</code> class, a useful utility class for formatting manpage output correctly.
440
440
 
441
- There is also the <code>:erb</code> template that can be customized by writing a template of your choice:
441
+ If you already have some templates that you'd like to use, there is also the <code>:erb</code> template that can be customized by writing a template of your choice:
442
442
 
443
- Choosy::Command.new :foo od
444
- printer :erb, :color => true, :template => 'path/to/file.erb'
443
+ Choosy::Command.new :foo do
444
+ printer :erb,
445
+ :color => true, # Defaults to true
446
+ :template => 'path/to/file.erb' # Required
445
447
  end
446
448
 
447
449
  The ERB printer also accepts the <code>:color</code> option. The color is exposed via a <code>color</code> property in the template; the command is exposed by the <code>command</code> property.
448
450
 
449
- By the way, if you implement a custom printer, you can also include the <code>choosy/printing/terminal</code> module to get access to the line and column information of the console, if available.
451
+ Finally, because I don't want to tell you how to print your help, I also give you the option of supplying your own printer. Just create a class with a <code>print!(command)</code> method on that class, and it will be passed in the command that it should print the help for. I have supplied some code you may find useful in <code>choosy/printing/terminal</code> that will help with things like finding commands and determining the column width of the terminal.
452
+
453
+ class CustomPrinter
454
+ def print!(command)
455
+ puts "I got called on help for #{command.name}"
456
+ end
457
+ end
458
+
459
+ Choosy::Command.new :foo do
460
+ printer CustomPrinter.new
461
+ end
462
+
463
+
data/lib/VERSION.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
+ date: 26/03/2011
2
3
  version:
4
+ tiny: 5
3
5
  major: 0
4
6
  minor: 3
5
- tiny: 4
6
- date: 25/03/2011
data/lib/choosy/rake.rb CHANGED
@@ -72,7 +72,7 @@ end
72
72
  #########################################################################
73
73
  # Release
74
74
  desc "Tags the current release in git, builds the gemspec, and pushes the gem"
75
- task :release => ['git:diff', 'gem:push', 'git:tag', 'git:push']
75
+ task :release => ['gem:clean', 'git:diff', 'gem:push', 'git:tag', 'git:push']
76
76
 
77
77
  #########################################################################
78
78
  # Git
@@ -102,7 +102,7 @@ task :gem => ['gem:build']
102
102
 
103
103
  namespace :gem do
104
104
  desc "Builds the current gemspec."
105
- task :build do
105
+ task :build => ['version:load'] do
106
106
  SH.files('gemspec') do |gemspec|
107
107
  puts " Building gemspec: #{gemspec}"
108
108
  SH.attempt "gem build #{gemspec}"
@@ -111,7 +111,7 @@ namespace :gem do
111
111
 
112
112
  desc "Pushes the current gem."
113
113
  task :push => :build do
114
- SH.files ("#{$version}.gem") do |gem|
114
+ SH.files("#{$version}.gem") do |gem|
115
115
  puts " Pushing gems: #{gem}"
116
116
  SH.attempt "gem push #{gem}"
117
117
  end
@@ -119,7 +119,7 @@ namespace :gem do
119
119
 
120
120
  desc "Installs the current gem."
121
121
  task :install => :build do
122
- SH.files ("#{$version}.gem") do |gem|
122
+ SH.files("#{$version}.gem") do |gem|
123
123
  puts " Installing gem: #{gem}"
124
124
  SH.attempt "gem install --no-ri --no-rdoc #{gem}"
125
125
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: choosy
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 25
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 4
9
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - Gabe McArthur
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-03-25 00:00:00 -07:00
18
+ date: 2011-03-26 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,6 +26,7 @@ dependencies:
25
26
  requirements:
26
27
  - - ~>
27
28
  - !ruby/object:Gem::Version
29
+ hash: 9
28
30
  segments:
29
31
  - 2
30
32
  - 5
@@ -39,6 +41,7 @@ dependencies:
39
41
  requirements:
40
42
  - - ">="
41
43
  - !ruby/object:Gem::Version
44
+ hash: 3
42
45
  segments:
43
46
  - 0
44
47
  version: "0"
@@ -52,11 +55,28 @@ dependencies:
52
55
  requirements:
53
56
  - - ">="
54
57
  - !ruby/object:Gem::Version
58
+ hash: 3
55
59
  segments:
56
60
  - 0
57
61
  version: "0"
58
62
  type: :development
59
63
  version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: ZenTest
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 43
73
+ segments:
74
+ - 4
75
+ - 5
76
+ - 0
77
+ version: 4.5.0
78
+ type: :development
79
+ version_requirements: *id004
60
80
  description: This is a DSL for creating more complicated command line tools.
61
81
  email:
62
82
  - madeonamac@gmail.com
@@ -68,71 +88,71 @@ extra_rdoc_files: []
68
88
 
69
89
  files:
70
90
  - TODO.md
91
+ - LICENSE
92
+ - Rakefile
71
93
  - Gemfile
72
94
  - README.markdown
73
- - Gemfile.lock
74
95
  - CHANGELOG.md
75
- - LICENSE
76
- - Rakefile
77
- - lib/choosy.rb
78
- - lib/VERSION.yml
79
- - lib/choosy/errors.rb
96
+ - Gemfile.lock
97
+ - lib/choosy/super_parser.rb
98
+ - lib/choosy/option.rb
99
+ - lib/choosy/version.rb
80
100
  - lib/choosy/printing.rb
81
- - lib/choosy/rake.rb
101
+ - lib/choosy/command.rb
82
102
  - lib/choosy/converter.rb
83
103
  - lib/choosy/parse_result.rb
84
- - lib/choosy/verifier.rb
104
+ - lib/choosy/parser.rb
85
105
  - lib/choosy/argument.rb
86
- - lib/choosy/version.rb
87
- - lib/choosy/option.rb
88
- - lib/choosy/command.rb
89
106
  - lib/choosy/super_command.rb
90
- - lib/choosy/dsl/argument_builder.rb
107
+ - lib/choosy/dsl/base_command_builder.rb
91
108
  - lib/choosy/dsl/super_command_builder.rb
92
- - lib/choosy/dsl/base_builder.rb
93
109
  - lib/choosy/dsl/command_builder.rb
110
+ - lib/choosy/dsl/base_builder.rb
94
111
  - lib/choosy/dsl/option_builder.rb
95
- - lib/choosy/dsl/base_command_builder.rb
96
- - lib/choosy/parser.rb
112
+ - lib/choosy/dsl/argument_builder.rb
97
113
  - lib/choosy/base_command.rb
114
+ - lib/choosy/errors.rb
115
+ - lib/choosy/printing/terminal.rb
116
+ - lib/choosy/printing/manpage.rb
98
117
  - lib/choosy/printing/manpage_printer.rb
99
- - lib/choosy/printing/base_printer.rb
118
+ - lib/choosy/printing/help_printer.rb
100
119
  - lib/choosy/printing/formatting_element.rb
101
- - lib/choosy/printing/manpage.rb
102
- - lib/choosy/printing/terminal.rb
103
- - lib/choosy/printing/color.rb
104
120
  - lib/choosy/printing/erb_printer.rb
105
- - lib/choosy/printing/help_printer.rb
106
- - lib/choosy/super_parser.rb
107
- - spec/integration/command-A_spec.rb
108
- - spec/integration/supercommand-C_spec.rb
109
- - spec/integration/command-B_spec.rb
110
- - spec/integration/supercommand-B_spec.rb
111
- - spec/integration/supercommand-A_spec.rb
112
- - spec/integration/command-C_spec.rb
113
- - spec/choosy/converter_spec.rb
114
- - spec/choosy/option_spec.rb
121
+ - lib/choosy/printing/color.rb
122
+ - lib/choosy/printing/base_printer.rb
123
+ - lib/choosy/rake.rb
124
+ - lib/choosy/verifier.rb
125
+ - lib/choosy.rb
126
+ - lib/VERSION.yml
115
127
  - spec/choosy/version_spec.rb
116
- - spec/choosy/argument_spec.rb
117
- - spec/choosy/base_command_spec.rb
128
+ - spec/choosy/super_parser_spec.rb
129
+ - spec/choosy/super_command_spec.rb
118
130
  - spec/choosy/version.yml
119
131
  - spec/choosy/command_spec.rb
132
+ - spec/choosy/converter_spec.rb
133
+ - spec/choosy/dsl/argument_builder_spec.rb
134
+ - spec/choosy/dsl/commmand_builder_spec.rb
120
135
  - spec/choosy/dsl/super_command_builder_spec.rb
121
136
  - spec/choosy/dsl/option_builder_spec.rb
122
137
  - spec/choosy/dsl/base_builder_spec.rb
123
- - spec/choosy/dsl/argument_builder_spec.rb
124
- - spec/choosy/dsl/commmand_builder_spec.rb
125
138
  - spec/choosy/dsl/base_command_builder_spec.rb
126
- - spec/choosy/super_command_spec.rb
127
- - spec/choosy/super_parser_spec.rb
139
+ - spec/choosy/option_spec.rb
128
140
  - spec/choosy/verifier_spec.rb
129
- - spec/choosy/printing/help_printer_spec.rb
130
- - spec/choosy/printing/terminal_spec.rb
141
+ - spec/choosy/printing/manpage_spec.rb
131
142
  - spec/choosy/printing/base_printer_spec.rb
143
+ - spec/choosy/printing/terminal_spec.rb
132
144
  - spec/choosy/printing/manpage_printer_spec.rb
145
+ - spec/choosy/printing/help_printer_spec.rb
133
146
  - spec/choosy/printing/color_spec.rb
134
- - spec/choosy/printing/manpage_spec.rb
147
+ - spec/choosy/argument_spec.rb
148
+ - spec/choosy/base_command_spec.rb
135
149
  - spec/choosy/parser_spec.rb
150
+ - spec/integration/supercommand-A_spec.rb
151
+ - spec/integration/command-A_spec.rb
152
+ - spec/integration/supercommand-C_spec.rb
153
+ - spec/integration/command-B_spec.rb
154
+ - spec/integration/command-C_spec.rb
155
+ - spec/integration/supercommand-B_spec.rb
136
156
  - spec/spec_helpers.rb
137
157
  has_rdoc: true
138
158
  homepage: http://github.com/gabemc/choosy
@@ -148,6 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
168
  requirements:
149
169
  - - ">="
150
170
  - !ruby/object:Gem::Version
171
+ hash: 3
151
172
  segments:
152
173
  - 0
153
174
  version: "0"
@@ -156,6 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
177
  requirements:
157
178
  - - ">="
158
179
  - !ruby/object:Gem::Version
180
+ hash: 23
159
181
  segments:
160
182
  - 1
161
183
  - 3
@@ -164,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
186
  requirements: []
165
187
 
166
188
  rubyforge_project:
167
- rubygems_version: 1.3.7
189
+ rubygems_version: 1.6.2
168
190
  signing_key:
169
191
  specification_version: 3
170
192
  summary: Yet another option parsing library.