wxruby3 0.9.5 → 0.9.7
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.
- checksums.yaml +4 -4
- data/INSTALL.md +315 -78
- data/README.md +31 -20
- data/lib/wx/core/ext.rb +22 -3
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/base.rb +6 -4
- data/lib/wx/wxruby/cmd/sampler.rb +39 -29
- data/lib/wx/wxruby/cmd/setup.rb +122 -0
- data/lib/wx/wxruby/cmd/test.rb +56 -6
- data/rakefile +14 -0
- data/rakelib/bin.rake +48 -0
- data/rakelib/bin.rb +62 -0
- data/rakelib/build.rb +11 -7
- data/rakelib/config.rake +3 -1
- data/rakelib/configure.rb +28 -8
- data/rakelib/doc.rake +3 -1
- data/rakelib/gem.rake +169 -0
- data/rakelib/gem.rb +82 -0
- data/rakelib/install.rb +2 -0
- data/rakelib/lib/config/linux.rb +24 -2
- data/rakelib/lib/config/macosx.rb +16 -0
- data/rakelib/lib/config/mingw.rb +133 -9
- data/rakelib/lib/config/pkgman/arch.rb +53 -0
- data/rakelib/lib/config/pkgman/base.rb +169 -0
- data/rakelib/lib/config/pkgman/debian.rb +66 -0
- data/rakelib/lib/config/pkgman/macosx.rb +183 -0
- data/rakelib/lib/config/pkgman/rhel.rb +54 -0
- data/rakelib/lib/config/pkgman/suse.rb +54 -0
- data/rakelib/lib/config/unixish.rb +36 -19
- data/rakelib/lib/config.rb +254 -61
- data/rakelib/lib/core/package.rb +47 -49
- data/rakelib/lib/director/gdicommon.rb +1 -2
- data/rakelib/lib/generate/doc.rb +29 -14
- data/rakelib/lib/generate/interface.rb +4 -2
- data/rakelib/lib/swig_runner.rb +11 -11
- data/rakelib/prepost.rake +9 -4
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +14 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +5 -5
- data/rakelib/yard/yard/relative_markdown_links.rb +7 -1
- metadata +21 -17
- data/ext/mkrf_conf_srcgem.rb +0 -67
- data/rakelib/run.rake +0 -52
data/rakelib/lib/config.rb
CHANGED
@@ -9,6 +9,8 @@
|
|
9
9
|
require 'rbconfig'
|
10
10
|
require 'fileutils'
|
11
11
|
require 'json'
|
12
|
+
require 'open3'
|
13
|
+
require 'monitor'
|
12
14
|
|
13
15
|
module FileUtils
|
14
16
|
# add convenience methods
|
@@ -73,14 +75,16 @@ module WXRuby3
|
|
73
75
|
'with-wxwin' => !!ENV['WITH_WXWIN'],
|
74
76
|
'with-debug' => ((ENV['WXRUBY_DEBUG'] || '') == '1'),
|
75
77
|
'swig' => ENV['WXRUBY_SWIG'] || 'swig',
|
76
|
-
'doxygen' => ENV['WXRUBY_DOXYGEN'] || 'doxygen'
|
78
|
+
'doxygen' => ENV['WXRUBY_DOXYGEN'] || 'doxygen',
|
79
|
+
'git' => ENV['WXRUBY_GIT'] || 'git'
|
77
80
|
})
|
81
|
+
CONFIG['autoinstall'] = (ENV['WXRUBY_AUTOINSTALL'] != '0') if ENV['WXRUBY_AUTOINSTALL']
|
78
82
|
BUILD_CFG = '.wxconfig'
|
79
83
|
|
80
84
|
# Ruby 2.5 is the minimum version for wxRuby3
|
81
85
|
__rb_ver = RUBY_VERSION.split('.').collect {|v| v.to_i}
|
82
86
|
if (__rb_major = __rb_ver.shift) < 2 || (__rb_major == 2 && __rb_ver.shift < 5)
|
83
|
-
|
87
|
+
$stderr.puts 'ERROR: wxRuby3 requires Ruby >= 2.5.0!'
|
84
88
|
exit(1)
|
85
89
|
end
|
86
90
|
|
@@ -111,38 +115,186 @@ module WXRuby3
|
|
111
115
|
|
112
116
|
module Config
|
113
117
|
|
114
|
-
def
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
118
|
+
def self.command_to_s(*cmd)
|
119
|
+
txt = if ::Hash === cmd.first
|
120
|
+
cmd = cmd.dup
|
121
|
+
env = cmd.shift
|
122
|
+
env.collect { |k, v| "#{k}=#{v}" }.join(' ') << ' '
|
123
|
+
else
|
124
|
+
''
|
125
|
+
end
|
126
|
+
txt << cmd.join(' ')
|
127
|
+
end
|
128
|
+
|
129
|
+
def run_silent?
|
130
|
+
!!ENV['WXRUBY_RUN_SILENT']
|
131
|
+
end
|
132
|
+
|
133
|
+
def silent_log_name
|
134
|
+
ENV['WXRUBY_RUN_SILENT'] || 'silent_run.log'
|
135
|
+
end
|
136
|
+
|
137
|
+
def log_progress(msg)
|
138
|
+
run_silent? ? silent_runner.log(msg) : $stdout.puts(msg)
|
139
|
+
end
|
140
|
+
|
141
|
+
class SilentRunner < Monitor
|
142
|
+
|
143
|
+
PROGRESS_CH = '.|/-\\|/-\\|'
|
144
|
+
|
145
|
+
def initialize
|
146
|
+
super
|
147
|
+
@cout = 0
|
148
|
+
@incremental = false
|
149
|
+
end
|
150
|
+
|
151
|
+
def incremental(f=true)
|
152
|
+
synchronize do
|
153
|
+
@cout = 0
|
154
|
+
@incremental = !!f
|
120
155
|
end
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
cmd << '2> ' << (windows? ? 'NULL' : '/dev/null')
|
127
|
-
when :err, :all
|
128
|
-
cmd << '2>&1'
|
156
|
+
end
|
157
|
+
|
158
|
+
def run(*cmd, **kwargs)
|
159
|
+
synchronize do
|
160
|
+
@cout = 0 unless @incremental
|
129
161
|
end
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
162
|
+
output = nil
|
163
|
+
verbose = kwargs.delete(:verbose)
|
164
|
+
capture = kwargs.delete(:capture)
|
165
|
+
if (Config.instance.verbose? && verbose != false) || !capture
|
166
|
+
txt = Config.command_to_s(*cmd)
|
167
|
+
if Config.instance.verbose? && verbose != false
|
168
|
+
$stdout.puts txt
|
169
|
+
end
|
170
|
+
if !capture
|
171
|
+
silent_log { |f| f.puts txt }
|
172
|
+
end
|
173
|
+
end
|
174
|
+
if capture
|
175
|
+
if capture == :out || capture == :no_err
|
176
|
+
kwargs[:err] = (Config.instance.windows? ? 'NULL' : '/dev/null') if capture == :no_err
|
177
|
+
Open3.popen2(*cmd, **kwargs) do |_ins, os, tw|
|
178
|
+
output = silent_runner(os)
|
179
|
+
tw.value
|
180
|
+
end
|
181
|
+
else
|
182
|
+
Open3.popen2e(*cmd, **kwargs) do |_ins, eos, tw|
|
183
|
+
output = silent_runner(eos)
|
184
|
+
tw.value
|
141
185
|
end
|
142
186
|
end
|
187
|
+
output.join
|
188
|
+
else
|
189
|
+
rc = silent_log do |fout|
|
190
|
+
Open3.popen2e(*cmd, **kwargs) do |_ins, eos, tw|
|
191
|
+
silent_runner(eos, fout)
|
192
|
+
v = tw.value.exitstatus
|
193
|
+
fout.puts "-> Exit code: #{v}"
|
194
|
+
v
|
195
|
+
end
|
196
|
+
end
|
197
|
+
rc
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def log(msg)
|
202
|
+
silent_log { |f| f.puts(msg) }
|
203
|
+
end
|
204
|
+
|
205
|
+
private
|
206
|
+
|
207
|
+
def silent_runner(os, output=[])
|
208
|
+
synchronize do
|
209
|
+
if @incremental
|
210
|
+
@cout += 1
|
211
|
+
$stdout.print "#{PROGRESS_CH[@cout%10]}\b"
|
212
|
+
$stdout.flush
|
213
|
+
end
|
214
|
+
end
|
215
|
+
os.each do |ln|
|
216
|
+
synchronize do
|
217
|
+
unless @incremental
|
218
|
+
@cout += 1
|
219
|
+
$stdout.print "#{PROGRESS_CH[@cout%10]}\b"
|
220
|
+
$stdout.flush
|
221
|
+
end
|
222
|
+
output << ln
|
223
|
+
end
|
224
|
+
end
|
225
|
+
output
|
226
|
+
end
|
227
|
+
|
228
|
+
def silent_log(&block)
|
229
|
+
File.open(Config.instance.silent_log_name, 'a') do |fout|
|
230
|
+
block.call(fout)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
|
236
|
+
def silent_runner
|
237
|
+
@silent_runner ||= SilentRunner.new
|
238
|
+
end
|
239
|
+
private :silent_runner
|
240
|
+
|
241
|
+
def do_silent_run(*cmd, **kwargs)
|
242
|
+
silent_runner.run(*cmd, **kwargs)
|
243
|
+
end
|
244
|
+
private :do_silent_run
|
245
|
+
|
246
|
+
def do_silent_run_step(*cmd, **kwargs)
|
247
|
+
silent_runner.run_one(*cmd, **kwargs)
|
248
|
+
end
|
249
|
+
private :do_silent_run_step
|
250
|
+
|
251
|
+
def set_silent_run_incremental
|
252
|
+
silent_runner.incremental
|
253
|
+
end
|
254
|
+
|
255
|
+
def set_silent_run_batched
|
256
|
+
silent_runner.incremental(false)
|
257
|
+
end
|
258
|
+
|
259
|
+
def do_run(*cmd, capture: nil)
|
260
|
+
output = nil
|
261
|
+
if run_silent?
|
262
|
+
output = do_silent_run(exec_env, *cmd, capture: capture)
|
263
|
+
unless capture
|
264
|
+
fail "Command failed with status (#{rc}): #{Config.command_to_s(*cmd)}" unless output == 0
|
143
265
|
end
|
144
266
|
else
|
145
|
-
|
267
|
+
if capture
|
268
|
+
env_bup = exec_env.keys.inject({}) do |h, ev|
|
269
|
+
h[ev] = ENV[ev] ? ENV[ev].dup : nil
|
270
|
+
h
|
271
|
+
end
|
272
|
+
case capture
|
273
|
+
when :out
|
274
|
+
# default
|
275
|
+
when :no_err
|
276
|
+
# redirect stderr to null sink
|
277
|
+
cmd << '2> ' << (windows? ? 'NULL' : '/dev/null')
|
278
|
+
when :err, :all
|
279
|
+
cmd << '2>&1'
|
280
|
+
end
|
281
|
+
begin
|
282
|
+
# setup ENV for child execution
|
283
|
+
ENV.merge!(Config.instance.exec_env)
|
284
|
+
output = `#{cmd.join(' ')}`
|
285
|
+
ensure
|
286
|
+
# restore ENV
|
287
|
+
env_bup.each_pair do |k,v|
|
288
|
+
if v
|
289
|
+
ENV[k] = v
|
290
|
+
else
|
291
|
+
ENV.delete(k)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
else
|
296
|
+
Rake.sh(exec_env, *cmd, verbose: verbose?)
|
297
|
+
end
|
146
298
|
end
|
147
299
|
output
|
148
300
|
end
|
@@ -182,24 +334,32 @@ module WXRuby3
|
|
182
334
|
def expand(cmd)
|
183
335
|
`#{cmd}`
|
184
336
|
end
|
185
|
-
private :expand
|
186
337
|
|
187
|
-
def sh(*cmd, **kwargs)
|
188
|
-
|
338
|
+
def sh(*cmd, fail_on_error: false, **kwargs)
|
339
|
+
if run_silent?
|
340
|
+
rc = do_silent_run(*cmd, **kwargs)
|
341
|
+
fail "Command failed with status (#{rc}): #{Config.command_to_s(*cmd)}" if fail_on_error && rc != 0
|
342
|
+
rc == 0
|
343
|
+
elsif fail_on_error
|
344
|
+
Rake.sh(*cmd, **kwargs)
|
345
|
+
else
|
346
|
+
Rake.sh(*cmd, **kwargs) { |ok,_| !!ok }
|
347
|
+
end
|
189
348
|
end
|
190
|
-
private :sh
|
191
349
|
alias :bash :sh
|
192
|
-
private :bash
|
193
350
|
|
194
351
|
def test(*tests, **options)
|
195
352
|
errors = 0
|
353
|
+
excludes = (ENV['WXRUBY_TEST_EXCLUDE'] || '').split(';')
|
196
354
|
tests = Dir.glob(File.join(Config.instance.test_dir, '*.rb')) if tests.empty?
|
197
355
|
tests.each do |test|
|
198
|
-
unless
|
199
|
-
|
200
|
-
|
356
|
+
unless excludes.include?(File.basename(test, '.*'))
|
357
|
+
unless File.exist?(test)
|
358
|
+
test = File.join(Config.instance.test_dir, test)
|
359
|
+
test = Dir.glob(test+'.rb').shift || test unless File.exist?(test)
|
360
|
+
end
|
361
|
+
Rake.sh(Config.instance.exec_env, *make_ruby_cmd(test)) { |ok,status| errors += 1 unless ok }
|
201
362
|
end
|
202
|
-
Rake.sh(Config.instance.exec_env, *make_ruby_cmd(test)) { |ok,status| errors += 1 unless ok }
|
203
363
|
end
|
204
364
|
fail "ERRORS: ##{errors} test scripts failed." if errors>0
|
205
365
|
end
|
@@ -209,26 +369,56 @@ module WXRuby3
|
|
209
369
|
Rake.sh(Config.instance.exec_env, *make_ruby_cmd('-x', irb_cmd), **options)
|
210
370
|
end
|
211
371
|
|
212
|
-
def
|
213
|
-
|
214
|
-
STDERR.puts 'ERROR: Need GIT installed to run wxRuby3 bootstrap!'
|
215
|
-
exit(1)
|
216
|
-
end
|
372
|
+
def check_wx_config
|
373
|
+
false
|
217
374
|
end
|
218
375
|
|
219
|
-
def
|
220
|
-
|
221
|
-
|
376
|
+
def wx_config(_option)
|
377
|
+
nil
|
378
|
+
end
|
379
|
+
|
380
|
+
def check_tool_pkgs
|
381
|
+
[]
|
382
|
+
end
|
383
|
+
|
384
|
+
def install_prerequisites
|
385
|
+
pkg_deps = check_tool_pkgs
|
386
|
+
if get_config('autoinstall') == false
|
387
|
+
$stderr.puts <<~__ERROR_TXT
|
388
|
+
ERROR: This system lacks installed versions of the following required software packages:
|
389
|
+
#{pkg_deps.join(', ')}
|
390
|
+
|
391
|
+
Install these packages and try again.
|
392
|
+
__ERROR_TXT
|
222
393
|
exit(1)
|
223
394
|
end
|
395
|
+
pkg_deps
|
224
396
|
end
|
225
397
|
|
226
|
-
|
227
|
-
|
398
|
+
# only called after src gem build
|
399
|
+
def cleanup_prerequisites
|
400
|
+
# noop
|
228
401
|
end
|
229
402
|
|
230
|
-
def
|
231
|
-
|
403
|
+
def wants_autoinstall?
|
404
|
+
flag = get_config('autoinstall')
|
405
|
+
if flag.nil?
|
406
|
+
$stdout.puts <<~__Q_TEXT
|
407
|
+
|
408
|
+
[ --- ATTENTION! --- ]
|
409
|
+
wxRuby3 requires some software packages to be installed before being able to continue building.
|
410
|
+
If you like these can be automatically installed next (if you are building the source gem the
|
411
|
+
software will be removed again after building finishes).
|
412
|
+
Do you want to have the required software installed now? [yN] :
|
413
|
+
__Q_TEXT
|
414
|
+
answer = $stdin.gets(chomp: true).strip
|
415
|
+
while !answer.empty? && !%w[Y y N n].include?(answer)
|
416
|
+
$stdout.puts 'Please answer Y/y or N/n [Yn] : '
|
417
|
+
answer = $stdin.gets(chomp: true).strip
|
418
|
+
end
|
419
|
+
flag = %w[Y y].include?(answer)
|
420
|
+
end
|
421
|
+
flag
|
232
422
|
end
|
233
423
|
|
234
424
|
def get_config(key)
|
@@ -341,10 +531,10 @@ module WXRuby3
|
|
341
531
|
def create
|
342
532
|
load # load the build config (if any)
|
343
533
|
klass = Class.new do
|
344
|
-
include Config
|
345
|
-
|
346
534
|
include FileUtils
|
347
535
|
|
536
|
+
include Config
|
537
|
+
|
348
538
|
def initialize
|
349
539
|
@ruby_exe = RB_CONFIG["ruby_install_name"]
|
350
540
|
|
@@ -431,8 +621,10 @@ module WXRuby3
|
|
431
621
|
@ruby_includes = [ RB_CONFIG["rubyhdrdir"],
|
432
622
|
RB_CONFIG["sitehdrdir"],
|
433
623
|
RB_CONFIG["vendorhdrdir"],
|
434
|
-
|
435
|
-
|
624
|
+
RB_CONFIG['rubyarchhdrdir'] ?
|
625
|
+
RB_CONFIG['rubyarchhdrdir'] :
|
626
|
+
File.join(RB_CONFIG["rubyhdrdir"], RB_CONFIG['arch'])
|
627
|
+
].compact
|
436
628
|
@ruby_includes << File.join(@wxruby_path, 'include')
|
437
629
|
|
438
630
|
@ruby_cppflags = [RB_CONFIG["CFLAGS"]].compact
|
@@ -482,10 +674,9 @@ module WXRuby3
|
|
482
674
|
|
483
675
|
def report
|
484
676
|
if @debug_build
|
485
|
-
|
486
|
-
puts "Enabled debugging output"
|
677
|
+
log_progress("Enabled DEBUG build")
|
487
678
|
else
|
488
|
-
|
679
|
+
log_progress("Enabled RELEASE build")
|
489
680
|
end
|
490
681
|
end
|
491
682
|
|
@@ -550,7 +741,7 @@ module WXRuby3
|
|
550
741
|
end
|
551
742
|
|
552
743
|
def do_bootstrap
|
553
|
-
|
744
|
+
install_prerequisites
|
554
745
|
# do we have a local wxWidgets tree already?
|
555
746
|
unless File.directory?(File.join(ext_path, 'wxWidgets', 'docs', 'doxygen'))
|
556
747
|
wx_checkout
|
@@ -567,6 +758,11 @@ module WXRuby3
|
|
567
758
|
respawn_rake
|
568
759
|
end
|
569
760
|
|
761
|
+
def cleanup_bootstrap
|
762
|
+
rm_rf(File.join(ext_path, 'wxWidgets'), verbose: !WXRuby3.config.run_silent?) if File.directory?(File.join(ext_path, 'wxWidgets'))
|
763
|
+
cleanup_prerequisites
|
764
|
+
end
|
765
|
+
|
570
766
|
# Testing the relevant wxWidgets setup.h file to see what
|
571
767
|
# features are supported.
|
572
768
|
|
@@ -638,10 +834,7 @@ module WXRuby3
|
|
638
834
|
private :create
|
639
835
|
|
640
836
|
def instance
|
641
|
-
|
642
|
-
@instance = create
|
643
|
-
end
|
644
|
-
@instance
|
837
|
+
@instance ||= create
|
645
838
|
end
|
646
839
|
|
647
840
|
def get_config(key)
|
data/rakelib/lib/core/package.rb
CHANGED
@@ -604,55 +604,53 @@ module WXRuby3
|
|
604
604
|
def generate_core_doc
|
605
605
|
script = <<~__SCRIPT
|
606
606
|
require 'wx'
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
__HEREDOC
|
655
|
-
end
|
607
|
+
STDOUT.puts \<<~__HEREDOC
|
608
|
+
# ----------------------------------------------------------------------------
|
609
|
+
# This file is automatically generated by the WXRuby3 documentation
|
610
|
+
# generator. Do not alter this file.
|
611
|
+
# ----------------------------------------------------------------------------
|
612
|
+
|
613
|
+
|
614
|
+
module Wx
|
615
|
+
|
616
|
+
# wxRuby version string
|
617
|
+
WXRUBY_VERSION = '\#{Wx::WXRUBY_VERSION}'
|
618
|
+
|
619
|
+
# wxRuby version release type (alpha, beta, rc)
|
620
|
+
WXRUBY_RELEASE_TYPE = '\#{Wx::WXRUBY_RELEASE_TYPE}'
|
621
|
+
# wxRuby major version number
|
622
|
+
WXRUBY_MAJOR = \#{Wx::WXRUBY_MAJOR}
|
623
|
+
# wxRuby minor version number
|
624
|
+
WXRUBY_MINOR = \#{Wx::WXRUBY_MINOR}
|
625
|
+
# wxRuby release number
|
626
|
+
WXRUBY_RELEASE = \#{Wx::WXRUBY_RELEASE}
|
627
|
+
|
628
|
+
# Convenience string for WxWidgets version info
|
629
|
+
WXWIDGETS_VERSION = '\#{Wx::WXWIDGETS_VERSION}'
|
630
|
+
|
631
|
+
# Integer constant reflecting the major version of the wxWidgets release used to build wxRuby
|
632
|
+
WXWIDGETS_MAJOR_VERSION = \#{Wx::WXWIDGETS_MAJOR_VERSION}
|
633
|
+
|
634
|
+
# Integer constant reflecting the minor version of the wxWidgets release used to build wxRuby
|
635
|
+
WXWIDGETS_MINOR_VERSION = \#{Wx::WXWIDGETS_MINOR_VERSION}
|
636
|
+
|
637
|
+
# Integer constant reflecting the release number of the wxWidgets release used to build wxRuby
|
638
|
+
WXWIDGETS_RELEASE_NUMBER = \#{Wx::WXWIDGETS_RELEASE_NUMBER}
|
639
|
+
|
640
|
+
# Integer constant reflecting the sub-release number of the wxWidgets release used to build wxRuby
|
641
|
+
WXWIDGETS_SUBRELEASE_NUMBER = \#{Wx::WXWIDGETS_SUBRELEASE_NUMBER}
|
642
|
+
|
643
|
+
# Integer constant reflecting the wxWidgets wxDEBUG_LEVEL
|
644
|
+
WXWIDGETS_DEBUG_LEVEL = \#{Wx::WXWIDGETS_DEBUG_LEVEL}
|
645
|
+
|
646
|
+
# Boolean constant indicating if wxRuby was build in debug (true) or release (false) mode
|
647
|
+
DEBUG = \#{Wx::DEBUG}
|
648
|
+
|
649
|
+
# Platform id of the wxWidgets port used to build wxRuby
|
650
|
+
PLATFORM = '\#{Wx::PLATFORM}'
|
651
|
+
|
652
|
+
end
|
653
|
+
__HEREDOC
|
656
654
|
__SCRIPT
|
657
655
|
begin
|
658
656
|
tmpfile = Tempfile.new('script')
|
@@ -52,8 +52,7 @@ module WXRuby3
|
|
52
52
|
if Config.instance.wx_version >= '3.3.0'
|
53
53
|
# ignore these as they are supposed to specify unary minus but confuse
|
54
54
|
# SWIG
|
55
|
-
spec.ignore 'wxPoint::operator-(const wxPoint&)'
|
56
|
-
'wxRealPoint::operator-(const wxRealPoint&)'
|
55
|
+
spec.ignore 'wxPoint::operator-(const wxPoint&)'
|
57
56
|
end
|
58
57
|
spec.regard 'wxRect::Offset', regard_doc: false
|
59
58
|
# overrule common wxPoint mapping for wxRect ctor to fix ctor ambiguities here wrt wxSize
|
data/rakelib/lib/generate/doc.rb
CHANGED
@@ -26,22 +26,30 @@ module WXRuby3
|
|
26
26
|
WX_GLOBAL_CONSTANTS=false
|
27
27
|
require 'wx'
|
28
28
|
def handle_module(mod, table)
|
29
|
+
Wx.delayed_constants_for(mod).each do |key, delayed_const|
|
30
|
+
table[key.sym.to_s] = { type: true, value: delayed_const.to_s }
|
31
|
+
end
|
29
32
|
mod.constants.each do |c|
|
30
33
|
a_const = mod.const_get(c)
|
31
34
|
if (::Module === a_const || ::Class === a_const) && a_const.name.start_with?('Wx::') # Wx:: Package submodule or Class (possibly Enum)
|
32
35
|
handle_module(a_const, table[c.to_s] = {})
|
33
36
|
elsif Wx::Enum === a_const
|
34
|
-
table[c.to_s] = { type:
|
35
|
-
elsif !(::Hash === a_const || ::Array === a_const)
|
36
|
-
|
37
|
+
table[c.to_s] = { type: true, value: "\#{a_const.class}.new(\#{a_const.to_i})" }
|
38
|
+
elsif !(::Hash === a_const || ::Array === a_const)
|
39
|
+
case a_const
|
40
|
+
when Wx::Size
|
41
|
+
table[c.to_s] = { type: true, value: "Wx::Size.new(\#{a_const.width}, \#{a_const.height})" }
|
42
|
+
when Wx::Point
|
43
|
+
table[c.to_s] = { type: true, value: "Wx::Point.new(\#{a_const.x}, \#{a_const.y})" }
|
44
|
+
else
|
45
|
+
table[c.to_s] = { type: true, value: a_const } unless c == :THE_APP
|
46
|
+
end
|
37
47
|
end
|
38
48
|
end
|
39
49
|
end
|
40
|
-
Wx
|
41
|
-
|
42
|
-
|
43
|
-
STDOUT.puts JSON.dump(table)
|
44
|
-
end
|
50
|
+
table = { 'Wx' => {}}
|
51
|
+
handle_module(Wx, table['Wx'])
|
52
|
+
STDOUT.puts JSON.dump(table)
|
45
53
|
__SCRIPT
|
46
54
|
STDERR.puts "* executing constants collection script:\n#{script}" if Director.trace?
|
47
55
|
begin
|
@@ -693,15 +701,22 @@ module WXRuby3
|
|
693
701
|
# at least 2 newlines to make Yard skip/forget the header comment
|
694
702
|
fdoc.puts
|
695
703
|
fdoc.puts
|
696
|
-
|
697
|
-
|
698
|
-
|
704
|
+
mod_indent = 0
|
705
|
+
package.all_modules.each do |modnm|
|
706
|
+
fdoc.iputs("module #{package.fullname}", mod_indent)
|
707
|
+
fdoc.puts
|
708
|
+
mod_indent += 1
|
709
|
+
end
|
710
|
+
fdoc.indent(mod_indent) do
|
699
711
|
gen_constants_doc(fdoc)
|
700
712
|
gen_functions_doc(fdoc) unless no_gen?(:functions)
|
701
713
|
gen_class_doc(fdoc) unless no_gen?(:classes)
|
702
714
|
end
|
703
|
-
|
704
|
-
|
715
|
+
package.all_modules.each do |_|
|
716
|
+
fdoc.puts
|
717
|
+
fdoc.iputs('end', mod_indent)
|
718
|
+
mod_indent -= 1
|
719
|
+
end
|
705
720
|
end
|
706
721
|
end
|
707
722
|
|
@@ -742,7 +757,7 @@ module WXRuby3
|
|
742
757
|
end
|
743
758
|
|
744
759
|
def gen_constant_value(val)
|
745
|
-
if ::String === val && /\A(#<(.*)>|[\w:]
|
760
|
+
if ::String === val && /\A(#<(.*)>|[\w:]+\.\w+\(.*\))\Z/ =~ val
|
746
761
|
if $2
|
747
762
|
valstr = $2
|
748
763
|
if /\Awx/ =~ valstr
|
@@ -603,7 +603,8 @@ module WXRuby3
|
|
603
603
|
elsif item.value =~ /wx(Colour|Font)(\(.*\))/
|
604
604
|
frbext = init_rb_ext_file unless frbext
|
605
605
|
frbext.indent do
|
606
|
-
|
606
|
+
code = "Wx::#{$1}.new#{$2}"
|
607
|
+
frbext.puts "Wx.add_delayed_constant(self, :#{rb_constant_name(item.name)}, '#{code}') { #{code} }"
|
607
608
|
end
|
608
609
|
frbext.puts
|
609
610
|
elsif item.value =~ /wxSystemSettings::(\w+)\((.*)\)/
|
@@ -611,7 +612,8 @@ module WXRuby3
|
|
611
612
|
setting_mtd = $1
|
612
613
|
args = $2.split(',').collect {|a| rb_constant_value(a) }.join(', ')
|
613
614
|
frbext.indent do
|
614
|
-
|
615
|
+
code = "Wx::SystemSettings.#{rb_method_name(setting_mtd)}(#{args})"
|
616
|
+
frbext.puts "Wx.add_delayed_constant(self, :#{rb_constant_name(item.name)}, '#{code}') { #{code} }"
|
615
617
|
end
|
616
618
|
frbext.puts
|
617
619
|
else
|