commandline2 0.7.2 → 0.7.3

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.
Files changed (2) hide show
  1. data/lib/commandline/application.rb +9 -4
  2. metadata +20 -39
@@ -50,8 +50,8 @@ class Application
50
50
  __initialize_text_formatting
51
51
 
52
52
  # Call the child usurped initialize
53
- __child_initialize if
54
- self.class.private_instance_methods(false).include?("__child_initialize")
53
+ initAvailable = self.class.private_instance_methods(false).include?(:__child_initialize) || self.class.private_instance_methods(false).include?("__child_initialize")
54
+ __child_initialize if initAvailable
55
55
 
56
56
  @option_parser ||= CommandLine::OptionParser.new(@options)
57
57
  end
@@ -238,7 +238,11 @@ class Application
238
238
  def self.run(argv=ARGV)
239
239
  # Usurp an existing initialize so ours can be called first.
240
240
  # We rename it __child_initialize and call it from initialize.
241
- if self.private_instance_methods(false).include?("initialize")
241
+
242
+ # Used to work with 1.9.x and 1.8.x
243
+ initAvailable = self.private_instance_methods(false).include?(:initialize) || self.private_instance_methods(false).include?("initialize")
244
+
245
+ if initAvailable
242
246
  $VERBOSE, verbose = nil, $VERBOSE
243
247
  self.class_eval {
244
248
  alias :__child_initialize :initialize
@@ -259,7 +263,8 @@ class Application
259
263
  end
260
264
 
261
265
  def self.inherited(child_class)
262
- @@appname = caller[0][/.*:/][0..-2]
266
+ appname = caller[0]
267
+ @@appname = appname[0..(appname.index(':')-1)]
263
268
  @@child_class = child_class
264
269
  if @@appname == $0
265
270
  __set_auto_run
metadata CHANGED
@@ -1,32 +1,22 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: commandline2
3
- version: !ruby/object:Gem::Version
4
- hash: 7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 7
9
- - 2
10
- version: 0.7.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Alexander Brausch
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-10-21 00:00:00 Z
12
+ date: 2011-10-27 00:00:00.000000000Z
19
13
  dependencies: []
20
-
21
14
  description:
22
15
  email: abrausch@web.de
23
16
  executables: []
24
-
25
17
  extensions: []
26
-
27
18
  extra_rdoc_files: []
28
-
29
- files:
19
+ files:
30
20
  - lib/commandline/application.rb
31
21
  - lib/commandline/kernel.rb
32
22
  - lib/commandline/optionparser/option.rb
@@ -39,36 +29,27 @@ files:
39
29
  - lib/test/unit/systemtest.rb
40
30
  homepage: http://rubyforge.org/projects/optionparser/
41
31
  licenses: []
42
-
43
32
  post_install_message:
44
33
  rdoc_options: []
45
-
46
- require_paths:
34
+ require_paths:
47
35
  - lib
48
- required_ruby_version: !ruby/object:Gem::Requirement
36
+ required_ruby_version: !ruby/object:Gem::Requirement
49
37
  none: false
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- hash: 3
54
- segments:
55
- - 0
56
- version: "0"
57
- required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
43
  none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- hash: 3
63
- segments:
64
- - 0
65
- version: "0"
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
66
48
  requirements: []
67
-
68
49
  rubyforge_project:
69
- rubygems_version: 1.8.7
50
+ rubygems_version: 1.8.10
70
51
  signing_key:
71
52
  specification_version: 3
72
- summary: Tools to facilitate creation of command line applications and flexible parsing of command line options.
53
+ summary: Tools to facilitate creation of command line applications and flexible parsing
54
+ of command line options.
73
55
  test_files: []
74
-