visionmedia-commander 3.2.5 → 3.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ === 3.2.6 / 2009-04-08
3
+
4
+ * Added Commander::UI::AskForClass
5
+ * Added support to #remove_global_options for options with arguments
6
+ * Removed .re directory used for visionmedia-release
7
+ * Fixed bug preventing --trace from working
8
+
2
9
  === 3.2.5 / 2009-04-02
3
10
 
4
11
  * Added #ask_editor
data/commander.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{commander}
5
- s.version = "3.2.5"
5
+ s.version = "3.2.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["TJ Holowaychuk"]
9
- s.date = %q{2009-04-02}
9
+ s.date = %q{2009-04-08}
10
10
  s.default_executable = %q{commander}
11
11
  s.description = %q{The complete solution for Ruby command-line executables}
12
12
  s.email = %q{tj@vision-media.ca}
@@ -6,7 +6,7 @@ class Array
6
6
  # conjunection with Highline's ask, or ask_for_array
7
7
  # methods, which must respond to #parse.
8
8
  #
9
- # === Highline example:
9
+ # === Highline example
10
10
  #
11
11
  # # ask invokes Array#parse
12
12
  # list = ask 'Favorite cookies:', Array
@@ -15,10 +15,21 @@ class Object
15
15
 
16
16
  extend Forwardable
17
17
  include Commander::UI
18
+ include Commander::UI::AskForClass
19
+
20
+ #--
21
+ # UI related delegation.
22
+ #++
18
23
 
19
24
  def_delegators Commander::UI::ProgressBar, :progress
20
- def_delegators :$command_runner, :add_command, :command, :program, :run!,
21
- :commands, :alias_command, :default_command, :global_option
25
+
26
+ #--
27
+ # Command runner delegation.
28
+ #++
29
+
30
+ def_delegators :$command_runner,
31
+ :add_command, :command, :program, :run!, :global_option,
32
+ :commands, :alias_command, :default_command
22
33
 
23
34
  ##
24
35
  # Return the current binding.
@@ -33,17 +44,5 @@ class Object
33
44
  def command_runner
34
45
  $command_runner
35
46
  end
36
-
37
- ##
38
- # Implement #ask_for_CLASS.
39
-
40
- include Module.new {
41
- def method_missing meth, *args, &block
42
- case meth.to_s
43
- when /^ask_for_([\w]+)/ ; $terminal.ask(args.first, eval($1.capitalize))
44
- else super
45
- end
46
- end
47
- }
48
47
 
49
48
  end
@@ -1,8 +1,7 @@
1
1
 
2
- require 'commander/help_formatters/base'
3
-
4
2
  module Commander
5
3
  module HelpFormatter
4
+ autoload :Base, 'commander/help_formatters/base'
6
5
  autoload :Terminal, 'commander/help_formatters/terminal'
7
6
  autoload :TerminalCompact, 'commander/help_formatters/terminal_compact'
8
7
  end
@@ -278,10 +278,10 @@ module Commander
278
278
  def remove_global_options
279
279
  # TODO: refactor with flipflop
280
280
  options.each do |option|
281
- switch, has_arg = option[:args].first.split
281
+ switches = option[:switches]
282
282
  past_switch, arg_removed = false, false
283
283
  @args.delete_if do |arg|
284
- if arg == switch
284
+ if switches.any? { |switch| switch =~ /^#{arg}/ }
285
285
  past_switch, arg_removed = true, false
286
286
  true
287
287
  elsif past_switch && !arg_removed && arg !~ /^-/
@@ -79,6 +79,18 @@ module Commander
79
79
  end
80
80
  end
81
81
 
82
+ ##
83
+ # Implements ask_for_CLASS methods.
84
+
85
+ module AskForClass
86
+ def method_missing meth, *args, &block
87
+ case meth.to_s
88
+ when /^ask_for_([\w]+)/ ; $terminal.ask(args.first, eval($1.capitalize))
89
+ else super
90
+ end
91
+ end
92
+ end
93
+
82
94
  ##
83
95
  # = Progress Bar
84
96
  #
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Commander
3
- VERSION = '3.2.5'
3
+ VERSION = '3.2.6'
4
4
  end
data/tasks/docs.rake CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ desc 'Build docs with sdoc gem'
3
+ task :docs do
4
+ sh 'sdoc -N lib/commander'
5
+ end
6
+
2
7
  namespace :docs do
3
8
 
4
9
  desc 'Remove rdoc products'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visionmedia-commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.5
4
+ version: 3.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-02 00:00:00 -07:00
12
+ date: 2009-04-08 00:00:00 -07:00
13
13
  default_executable: commander
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency