wx_sugar 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
data/bin/xrcise CHANGED
@@ -1,10 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
1
3
  # == Synopsis
2
4
  #
3
- # xrc-tool : Generates ruby code from wxWidgets XML
5
+ # xrcise : Generates ruby code from wxWidgets XML
4
6
  #
5
7
  # == Usage
6
8
  #
7
- # xrc-tool [OPTIONS] <FILE>
9
+ # xrcise [OPTIONS] <FILE>
8
10
  #
9
11
  # == Arguments
10
12
  #
@@ -33,45 +35,48 @@
33
35
 
34
36
  require 'wx_sugar/xrc'
35
37
  require 'getoptlong'
36
- require 'rdoc/ri/ri_paths' # avoid a bug in Ruby 1.8.5 with rdoc/usage
37
- require 'rdoc/usage'
38
-
39
- # Hacked version of RDoc::usage that allows it to accept an argument
40
- # specifying which file the usage comment source should be taken from;
41
- # the standard version defaults to the main program file, and when
42
- # installed via Rubygems, this points to the gem executable stub, which
43
- # has not-very-enlightening comments
44
- module RDoc
45
- class << self
46
- undef_method :usage
47
- def usage(main_program_file = nil, exit_status = 0)
48
- usage_no_exit(main_program_file)
49
- exit(exit_status)
50
- end
51
38
 
52
- undef_method :usage_no_exit
53
- def usage_no_exit(main_program_file = nil)
54
- main_program_file ||= caller[-1].sub(/:\d+$/, '')
55
- comment = File.open(main_program_file) do |file|
56
- find_comment(file)
57
- end
58
-
59
- comment = comment.gsub(/^\s*#/, '')
60
-
61
- markup = SM::SimpleMarkup.new
62
- flow_convertor = SM::ToFlow.new
63
- flow = markup.convert(comment, flow_convertor)
64
- format = "plain"
65
-
66
- options = RI::Options.instance
67
- if args = ENV["RI"]
68
- options.parse(args.split)
69
- end
70
- formatter = options.formatter.new(options, "")
71
- formatter.display_flow(flow)
72
- end
73
- end
74
- end
39
+ # RDoc before Ruby 1.9 was able to format the comment above into info
40
+ # suitable for a terminal, but rdoc/usage has been dropped. So do it
41
+ # manually below:
42
+ XRCISE_USAGE = <<USAGE
43
+ Synopsis
44
+ --------
45
+
46
+ xrcise : Generates ruby code from wxWidgets XML
47
+
48
+ Usage
49
+ -----
50
+
51
+ xrcise [OPTIONS] <FILE>
52
+
53
+ Arguments
54
+ ---------
55
+
56
+ <FILE> should be a valid XRC file from where class definitions are
57
+ extracted.
58
+
59
+ Options
60
+ -------
61
+
62
+ -a, --appname [NAME]
63
+ Create a basic Wx::App wrapper to run a frame. Not valid if more
64
+ than one frame is identified in this file
65
+
66
+ -h, --help:
67
+ Show this help
68
+
69
+ -n, --namespace:
70
+ Namespace module to wrap code in. If this is given, it will be
71
+ used both to prefix generated subclasses, and extend subclassed
72
+ controls contained in the windows.
73
+
74
+ -o, --output:
75
+ Location for generated code. If this is a file, write all the
76
+ generated classes to this one file. If this is a directory, writes
77
+ each class as a separate file in it.
78
+
79
+ USAGE
75
80
 
76
81
  # Back to the real program:
77
82
  opts = GetoptLong.new( [ '--appname', '-a', GetoptLong::OPTIONAL_ARGUMENT ],
@@ -85,7 +90,8 @@ output = nil
85
90
  opts.each do | opt, arg |
86
91
  case opt
87
92
  when '--help'
88
- RDoc::usage(__FILE__)
93
+ puts XRCISE_USAGE
94
+ exit
89
95
  when '--appname'
90
96
  options[:app_name] = ( arg.empty? ? 'MyApp' : arg )
91
97
  when '--namespace'
@@ -1,3 +1,3 @@
1
1
  module WxSugar
2
- VERSION = '0.1.21'
2
+ VERSION = '0.1.22'
3
3
  end
@@ -2,7 +2,7 @@
2
2
  # subclasses of Frames, Dialog and Panels to be loaded from XRC.
3
3
  class XRCClass
4
4
  # Only these classes may be subclassed in Ruby
5
- VALID_CLASSES = %|wxFrame wxDialog wxPanel|
5
+ VALID_CLASSES = %|wxFrame wxDialog wxPanel wxWizard|
6
6
 
7
7
  # Simple struct to hold details of a individual named control
8
8
  Control = Struct.new(:name, :sub_class)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wx_sugar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Fenton
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-14 00:00:00 +00:00
12
+ date: 2009-03-08 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15