doodle 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,14 @@
1
+ == 0.2.2 / 2009-03-02
2
+
3
+ - Features:
4
+ - added obj.doodle.keys method
5
+ - added more examples to website
6
+
7
+ == 0.2.1 / 2009-03-02
8
+
9
+ - Bug fixes:
10
+ - Doodle::App not displaying help text
11
+
1
12
  == 0.2.0 / 2009-02-08
2
13
  - Features:
3
14
  - object.doodle.values for easy access to array of attribute values
@@ -404,6 +404,13 @@ class Doodle
404
404
  attributes(tf).map{ |k, a| @this.send(k)}
405
405
  end
406
406
 
407
+ # returns array of attribute names
408
+ # - if tf == true, returns all inherited attribute names (default)
409
+ # - if tf == false, returns only those attribute names defined in current object
410
+ def keys(tf = true)
411
+ attributes(tf).keys
412
+ end
413
+
407
414
  # return class level attributes
408
415
  def class_attributes
409
416
  attrs = Doodle::OrderedHash.new
@@ -27,6 +27,8 @@ require 'pp'
27
27
  class Doodle
28
28
  # command line option handling DSL implemented using Doodle
29
29
  class App < Doodle
30
+ class HelpExit < ::Exception
31
+ end
30
32
  # specialised classes for handling attributes
31
33
 
32
34
  # replace the full directory path with ./ where appropriate
@@ -251,6 +253,8 @@ class Doodle
251
253
 
252
254
  # use this to include 'standard' flags: help (-h, --help), verbose (-v, --verbose) and debug (-d, --debug)
253
255
  def std_flags
256
+ # FIXME: this is bogus
257
+ m = method(:help_text)
254
258
  boolean :help, :flag => "h", :doc => "display this help"
255
259
  boolean :verbose, :flag => "v", :doc => "verbose output"
256
260
  boolean :debug, :flag => "D", :doc => "turn on debugging"
@@ -261,13 +265,14 @@ class Doodle
261
265
  # call App.run to start your application (calls instance.run)
262
266
  def run(argv = ARGV)
263
267
  begin
264
- app = from_argv(argv)
265
- if app.help
268
+ # cheating
269
+ if argv.include?('-h') or argv.include?('--help')
266
270
  puts help_text
267
271
  else
272
+ app = from_argv(argv)
268
273
  app.run
269
274
  end
270
- rescue Object => e
275
+ rescue Exception => e
271
276
  if exit_status == 0
272
277
  exit_status 1
273
278
  end
@@ -2,7 +2,7 @@ class Doodle #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doodle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean O'Halpin