wxruby3 0.9.7 → 0.9.8

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +161 -42
  3. data/README.md +28 -22
  4. data/ext/mkrf_conf_ext.rb +68 -0
  5. data/lib/wx/core/secret_store.rb +38 -0
  6. data/lib/wx/doc/extra/02_lifecycles.md +4 -4
  7. data/lib/wx/doc/extra/14_config.md +1 -1
  8. data/lib/wx/doc/secret_store.rb +55 -0
  9. data/lib/wx/version.rb +1 -1
  10. data/lib/wx/wxruby/base.rb +3 -5
  11. data/lib/wx/wxruby/cmd/check.rb +182 -0
  12. data/lib/wx/wxruby/cmd/sampler.rb +1 -1
  13. data/lib/wx/wxruby/cmd/setup.rb +6 -3
  14. data/lib/wx/wxruby/cmd/test.rb +1 -1
  15. data/rakelib/configure.rb +60 -52
  16. data/rakelib/gem.rake +97 -67
  17. data/rakelib/gem.rb +293 -41
  18. data/rakelib/install.rb +3 -3
  19. data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
  20. data/rakelib/lib/config/linux.rb +3 -1
  21. data/rakelib/lib/config/macosx.rb +42 -11
  22. data/rakelib/lib/config/mingw.rb +2 -2
  23. data/rakelib/lib/config/pkgman/{base.rb → linux.rb} +36 -61
  24. data/rakelib/lib/config/pkgman/macosx.rb +17 -78
  25. data/rakelib/lib/config/unixish.rb +11 -1
  26. data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
  27. data/rakelib/lib/config.rb +49 -29
  28. data/rakelib/lib/director/aui_manager.rb +1 -1
  29. data/rakelib/lib/director/dialog.rb +8 -0
  30. data/rakelib/lib/director/grid_ctrl.rb +2 -2
  31. data/rakelib/lib/director/richtext_composite_object.rb +2 -4
  32. data/rakelib/lib/director/secret_store.rb +117 -0
  33. data/rakelib/lib/director/tree_event.rb +2 -2
  34. data/rakelib/lib/generate/doc/secret_store.yaml +55 -0
  35. data/rakelib/lib/generate/doc.rb +1 -1
  36. data/rakelib/lib/specs/interfaces.rb +1 -0
  37. data/rakelib/lib/typemap/common.rb +10 -0
  38. data/rakelib/prepost.rake +8 -1
  39. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +4 -0
  40. data/samples/sampler/sample.rb +2 -0
  41. data/tests/lib/wxapp_runner.rb +1 -1
  42. data/tests/test_config.rb +7 -4
  43. data/tests/test_secret_store.rb +83 -0
  44. metadata +41 -22
  45. data/rakefile +0 -14
  46. data/rakelib/lib/config/pkgman/arch.rb +0 -53
  47. data/rakelib/lib/config/pkgman/debian.rb +0 -66
  48. data/rakelib/lib/config/pkgman/rhel.rb +0 -54
  49. data/rakelib/lib/config/pkgman/suse.rb +0 -54
@@ -20,7 +20,7 @@ module WxRuby
20
20
  def commands
21
21
  @commands ||= ::Hash.new do |hash, key|
22
22
  STDERR.puts "Unknown command #{key} specified."
23
- exit(1)
23
+ exit(127)
24
24
  end
25
25
  end
26
26
  private :commands
@@ -73,7 +73,7 @@ module WxRuby
73
73
  describe_all
74
74
  exit(0)
75
75
  end
76
- opts.order!(args)
76
+ opts.order!(args) rescue ($stderr.puts $!.message; exit(127))
77
77
  end
78
78
  end
79
79
  end
@@ -81,9 +81,7 @@ module WxRuby
81
81
  def self.run(argv = ARGV)
82
82
  # parse global options (upto first command)
83
83
  argv = WxRuby::Commands.parse_args(argv)
84
- while !argv.empty?
85
- WxRuby::Commands.run(argv.shift, argv)
86
- end
84
+ WxRuby::Commands.run(argv.shift, argv) unless argv.empty?
87
85
  end
88
86
  end
89
87
 
@@ -0,0 +1,182 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ # wxruby check command handler
6
+ #--------------------------------------------------------------------
7
+
8
+ require 'fileutils'
9
+ require 'plat4m'
10
+
11
+ module WxRuby
12
+ module Commands
13
+
14
+ class Check
15
+
16
+ LOAD_ERRORS = {
17
+ linux: /cannot\s+open\s+shared\s+object/i,
18
+ darwin: /library\s+not\s+loaded/i,
19
+ windows: /specified\s+module\s+could\s+not\s+be\s+found/i
20
+ }
21
+
22
+ DESC = 'Run wxRuby3 runtime readiness check.'
23
+
24
+ def self.description
25
+ " check -h|[options]\t\t\t#{DESC}"
26
+ end
27
+
28
+ def self.options
29
+ Commands.options['check'] ||= { verbose: Commands.options[:verbose] }
30
+ end
31
+
32
+ def self.parse_args(args)
33
+ opts = OptionParser.new
34
+ opts.banner = "#{DESC}\n\nUsage: wxruby check -h|--help OR wxruby check [options]\n\n" +
35
+ "Returns:\n"+
36
+ " 0 if wxRuby3 is ready to run\n"+
37
+ " 1 if wxRuby3 does not seem to be built yet\n"+
38
+ " 2 if wxRuby3 has problems loading extension libraries\n"+
39
+ " 3 if an unexpected Ruby error occurred\n\n"+
40
+ "Unless '-q|--quiet' has been specified a description of the possible problem cause will\n"+
41
+ "be shown on failure.\n\n"
42
+ opts.separator ''
43
+ opts.on('-q', '--quiet',
44
+ "Do not show problem analysis messages on failures.") do |v|
45
+ Check.options[:quiet] = true
46
+ Check.options[:verbose] = false
47
+ end
48
+ opts.on('-v', '--verbose',
49
+ 'Show verbose output') do |v|
50
+ Check.options[:verbose] = true
51
+ Check.options[:quiet] = false
52
+ end
53
+ opts.on('-h', '--help',
54
+ 'Show this message.') do |v|
55
+ puts opts
56
+ puts
57
+ exit(0)
58
+ end
59
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
60
+ end
61
+
62
+ def self.show_error(msg)
63
+ $stderr.puts(msg) unless options[:quiet]
64
+ end
65
+
66
+ def self.show_log(msg)
67
+ $stdout.puts(msg) if options[:verbose]
68
+ end
69
+
70
+ def self.run(argv)
71
+ return description if argv == :describe
72
+
73
+ parse_args(argv)
74
+
75
+ show_log('Checking build (or binary package installation) completion...')
76
+ # check if the binary setup (packages or built) has been completed successfully
77
+ unless Commands.setup_done?
78
+ $stderr.puts <<~__INFO_TXT
79
+
80
+ wxRuby3 requires the post-install setup cmd to be run to build and finish installing
81
+ the required runtime binaries. Execute the command like:
82
+
83
+ $ wxruby setup
84
+
85
+ To see the available options for the command execute:
86
+
87
+ $ wxruby setup -h
88
+
89
+ __INFO_TXT
90
+ exit(1)
91
+ end
92
+
93
+ # check runtime
94
+ show_log('Attempting to load wxRuby3 libraries...')
95
+ sysinfo = Plat4m.current
96
+ begin
97
+ require 'wx'
98
+ rescue LoadError => ex
99
+ if ex.message =~ LOAD_ERRORS[sysinfo.os.id]
100
+ # error loading shared libraries
101
+ show_log("Captured LoadError: #{ex.message}")
102
+ # check if wxWidgets libs can be located
103
+ show_log('Checking wxWidgets availability...')
104
+ wx_found = if Dir[File.join(WxRuby::ROOT, 'ext', "*.#{RbConfig::CONFIG['SOEXT']}")].empty?
105
+ # no embedded wxWidgets -> if system installed than 'wx-config' should be in the path
106
+ if system("wx-config --version>#{sysinfo.dev_null} 2>&1")
107
+ true # system installed
108
+ else
109
+ # no system installed wxWidgets
110
+ # check the system dependent load paths if any wxWidgets libs can be found
111
+ case sysinfo.os.id
112
+ when :linux
113
+ (ENV['LD_LIBRARY_PATH']||'').split(':').any? { |p| !Dir[File.join(p, 'libwx_base*.so')].empty? }
114
+ when :darwin
115
+ (ENV['DYLD_LIBRARY_PATH']||'').split(':').any? { |p| !Dir[File.join(p, 'libwx_base*.dylib')].empty? }
116
+ when :windows
117
+ (ENV['PATH']||'').split(';').any? { |p| !Dir[File.join(p, 'wxbase*.dll')].empty? }
118
+ else
119
+ true # do not know how to search so assume wxWidgets found
120
+ end
121
+ end
122
+ else
123
+ true # embedded wxWidgets
124
+ end
125
+ if wx_found
126
+ show_log('wxWidgets found')
127
+ show_error <<~__INFO_TXT
128
+
129
+ The runtime environment of this system seems to be missing some required libraries for
130
+ executing wxRuby3 apps.
131
+ Please be aware wxRuby3 requires a properly configured GUI based system to function.
132
+ See the documentation for more information on the required runtime environment.
133
+
134
+ __INFO_TXT
135
+ else
136
+ show_log('NO wxWidgets found')
137
+ show_error <<~__INFO_TXT
138
+
139
+ It seems wxRuby3 is not able to load any of the required wxWidgets libraries it was built
140
+ for.
141
+ Please make sure these (shared) libraries are available in the appropriate search path
142
+ for this system.
143
+
144
+ __INFO_TXT
145
+ end
146
+ else
147
+ show_error <<~__INFO_TXT
148
+
149
+ There is an unexpected problem loading the wxRuby3 extension libraries.
150
+ Please check the problem report below for a probable cause analysis. If you have reason
151
+ to suspect a bug to be the cause of this problem please file an issue at Github and attach
152
+ the problem report.
153
+
154
+ #{ex.message}
155
+ #{ex.backtrace.join("\n")}
156
+
157
+ __INFO_TXT
158
+ end
159
+ exit(2)
160
+ rescue Exception => ex
161
+ show_log("Captured Exception: #{ex.message}")
162
+ show_error <<~__INFO_TXT
163
+
164
+ There is an unexpected problem loading the wxRuby3 libraries.
165
+ Please check the problem report below for a probable cause analysis. If you have reason
166
+ to suspect a bug to be the cause of this problem please file an issue at Github and attach
167
+ the problem report.
168
+
169
+ #{ex.message}
170
+ #{ex.backtrace.join("\n")}
171
+
172
+ __INFO_TXT
173
+ exit(3)
174
+ end
175
+ end
176
+
177
+ end
178
+
179
+ self.register('check', Check)
180
+
181
+ end
182
+ end
@@ -34,7 +34,7 @@ module WxRuby
34
34
  puts
35
35
  exit(0)
36
36
  end
37
- opts.parse!(args)
37
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
38
38
  end
39
39
 
40
40
  def self.run(argv)
@@ -14,7 +14,7 @@ module WxRuby
14
14
  DESC = 'Run wxRuby3 post-install setup.'
15
15
 
16
16
  def self.description
17
- " setup -h|[options]\t\t#{DESC}"
17
+ " setup -h|[options]\t\t\t#{DESC}"
18
18
  end
19
19
 
20
20
  def self.options
@@ -26,7 +26,10 @@ module WxRuby
26
26
  opts.banner = "#{DESC}\n\nUsage: wxruby setup -h|--help OR wxruby setup [options]\n\n"
27
27
  opts.separator ''
28
28
  opts.on('--wxwin=path',
29
- "the installation root for the wxWidgets libraries and headers if not using the system default") {|v| Setup.options['wxwin'] = File.expand_path(v)}
29
+ "the installation root for the wxWidgets libraries and headers if not using the system default",
30
+ "(use '@system' to force using system default only)") do |v|
31
+ Setup.options['wxwin'] = (v.downcase == '@system') ? v : File.expand_path(v)
32
+ end
30
33
  opts.on('--wxxml=path',
31
34
  "the path to the doxygen generated wxWidgets XML interface specs if not using bootstrap") {|v| Setup.options['wxxml'] = File.expand_path(v)}
32
35
  opts.on('--with-wxwin',
@@ -47,7 +50,7 @@ module WxRuby
47
50
  puts
48
51
  exit(0)
49
52
  end
50
- opts.parse!(args)
53
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
51
54
  end
52
55
 
53
56
  def self.run(argv)
@@ -45,7 +45,7 @@ module WxRuby
45
45
  puts
46
46
  exit(0)
47
47
  end
48
- opts.parse!(args)
48
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
49
49
  end
50
50
 
51
51
  def self.run(argv)
data/rakelib/configure.rb CHANGED
@@ -57,13 +57,26 @@ module WXRuby3
57
57
  opts.on('--sodir=path',
58
58
  "the directory for ruby extensions [#{get_config('sodir')}]") {|v| CONFIG['sodir'] = v}
59
59
  opts.on('--wxwin=path',
60
- "the installation root for the wxWidgets libraries and headers if not using the system default") {|v| CONFIG['wxwin'] = File.expand_path(v)}
60
+ "the installation root for the wxWidgets libraries and headers if not using the system default",
61
+ "(use '@system' to force using system default only)") { |v|
62
+ if v.downcase == '@system'
63
+ CONFIG[WXW_SYS_KEY] = true
64
+ CONFIG['wxwin'] = nil
65
+ CONFIG['with-wxwin'] = false
66
+ else
67
+ CONFIG['wxwin'] = File.expand_path(v)
68
+ CONFIG[WXW_SYS_KEY] = false
69
+ end
70
+ }
61
71
  opts.on('--wxxml=path',
62
72
  "the path to the doxygen generated wxWidgets XML interface specs if not using bootstrap") {|v| CONFIG['wxxml'] = File.expand_path(v)}
63
73
  opts.on('--wxwininstdir=path',
64
- "the directory where the wxWidgets dlls are to be installed for wxRuby [#{instance.get_config('wxwininstdir')}]") {|v| CONFIG['wxwininstdir'] = v}
74
+ "the directory where the wxWidgets dlls are installed (do not change if not absolutely needed) [#{instance.get_config('wxwininstdir')}]") {|v| CONFIG['wxwininstdir'] = v}
65
75
  opts.on('--with-wxwin',
66
- "build a local copy of wxWidgets for use with wxRuby [false]") {|v| CONFIG['with-wxwin'] = true}
76
+ "build a local copy of wxWidgets for use with wxRuby [false]") { |v|
77
+ CONFIG['with-wxwin'] = true
78
+ CONFIG[WXW_SYS_KEY] = false
79
+ }
67
80
  opts.on('--with-debug',
68
81
  "build with debugger support [#{instance.get_config('with-debug')}]") {|v| CONFIG['with-debug'] = true}
69
82
  opts.on('--swig=path',
@@ -84,69 +97,64 @@ module WXRuby3
84
97
  def self.check
85
98
  instance.init # re-initialize
86
99
 
87
- if Dir[File.join('ext', 'wxruby_*.so')].empty? # Don't check for wxWidgets installation when executed for binary gem install
100
+ # should we try to use a system or user defined wxWidgets installation?
101
+ if !get_config('with-wxwin')
88
102
 
89
- if !get_config('with-wxwin')
90
- # check if a user defined wxWidgets location is specified or we're using a system standard install
91
- if get_cfg_string('wxwin').empty?
92
- # assume system standard install; will be checked below
93
- set_config('wxwininstdir', get_cfg_string('libdir')) if get_cfg_string('wxwininstdir').empty?
94
- elsif get_cfg_string('wxwininstdir').empty?
95
- if instance.windows?
96
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin'))
97
- else
98
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib'))
99
- end
100
- end
101
- elsif !get_cfg_string('wxwin').empty?
102
- if get_cfg_string('wxwininstdir').empty?
103
- if instance.windows?
104
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin'))
105
- else
106
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib'))
107
- end
103
+ # check if a user defined wxWidgets location is specified or should be using a system standard install
104
+ if get_cfg_string('wxwin').empty?
105
+ # assume/force system standard install; will be checked below
106
+ set_config('wxwininstdir', get_cfg_string('libdir')) if get_cfg_string('wxwininstdir').empty?
107
+ elsif get_cfg_string('wxwininstdir').empty? # if not explicitly specified derive from 'wxwin'
108
+ if instance.windows?
109
+ set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin'))
110
+ else
111
+ set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib'))
108
112
  end
109
- else
110
- set_config('wxwininstdir', get_cfg_string('sodir')) if get_cfg_string('wxwininstdir').empty?
111
113
  end
112
114
 
113
- if !get_cfg_string('wxwin').empty? || !get_config('with-wxwin')
114
- # check wxWidgets availability through 'wx-config' command
115
- if instance.check_wx_config
116
- if instance.wx_config("--version") < '3.2.0'
117
- if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty?
118
- # no custom wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
119
- set_config('with-wxwin', true)
120
- else
121
- # if someone wants to customize they HAVE to do it right
122
- STDERR.puts "ERROR: Incompatible wxWidgets version. wxRuby requires a wxWidgets >= 3.2.0 release."
123
- exit(1)
124
- end
125
- end
126
- else
127
- if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty?
128
- # no custom wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
115
+ # or should we use an embedded (automatically built) wxWidgets installation
116
+ else
117
+
118
+ set_config('wxwininstdir', instance.ext_dir)
119
+
120
+ end
121
+
122
+ if !get_cfg_string('wxwin').empty? || !get_config('with-wxwin')
123
+ # check wxWidgets availability through 'wx-config' command
124
+ if instance.check_wx_config
125
+ if instance.wx_config("--version") < '3.2.0'
126
+ if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? && !get_config(WXW_SYS_KEY)
127
+ # no custom (or forced system) wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
129
128
  set_config('with-wxwin', true)
130
129
  else
131
130
  # if someone wants to customize they HAVE to do it right
132
- STDERR.puts "ERROR: Cannot find wxWidgets. wxRuby requires a wxWidgets >= 3.2.0 release."
131
+ STDERR.puts "ERROR: Incompatible wxWidgets version. wxRuby requires a wxWidgets >= 3.2.0 release."
133
132
  exit(1)
134
133
  end
135
134
  end
136
- # else we're are assumed to build wxWidgets ourselves so cannot test anything yet
137
- end
138
-
139
- if get_cfg_string('wxxml').empty? && !get_cfg_string('wxwin').empty?
140
- # in case of a custom wxWidgets build and no explicit xml path check if the custom build holds this
141
- xml_path = File.join(get_cfg_string('wxwin'), 'docs', 'doxygen', 'out', 'xml')
142
- # if not there see if the standard setup 'wxw_root/<install dir>' was used
143
- xml_path = File.join(get_cfg_string('wxwin'), '..', 'docs', 'doxygen', 'out', 'xml') unless File.directory?(xml_path)
144
- if File.directory?(xml_path) && !Dir.glob(File.join(xml_path, '*.xml')).empty?
145
- set_config('wxxml', xml_path)
135
+ else
136
+ if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? && !get_config(WXW_SYS_KEY)
137
+ # no custom (or forced system) wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
138
+ set_config('with-wxwin', true)
139
+ else
140
+ # if someone wants to customize they HAVE to do it right
141
+ STDERR.puts "ERROR: Cannot find wxWidgets. wxRuby requires a wxWidgets >= 3.2.0 release."
142
+ exit(1)
146
143
  end
147
144
  end
145
+ # else we're assumed to build wxWidgets ourselves so cannot test anything yet
146
+ end
148
147
 
148
+ if get_cfg_string('wxxml').empty? && !get_cfg_string('wxwin').empty?
149
+ # in case of a custom wxWidgets build and no explicit xml path check if the custom build holds this
150
+ xml_path = File.join(get_cfg_string('wxwin'), 'docs', 'doxygen', 'out', 'xml')
151
+ # if not there see if the standard setup 'wxw_root/<install dir>' was used
152
+ xml_path = File.join(get_cfg_string('wxwin'), '..', 'docs', 'doxygen', 'out', 'xml') unless File.directory?(xml_path)
153
+ if File.directory?(xml_path) && !Dir.glob(File.join(xml_path, '*.xml')).empty?
154
+ set_config('wxxml', xml_path)
155
+ end
149
156
  end
157
+
150
158
  end
151
159
 
152
160
  end
data/rakelib/gem.rake CHANGED
@@ -12,14 +12,10 @@ namespace :wxruby do
12
12
 
13
13
  namespace :gem do
14
14
 
15
- task :srcgem => ['bin:build', WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION)]
15
+ task :srcgem => ['bin:build', WXRuby3::Gem.gem_file]
16
16
 
17
- if WXRuby3.is_bootstrapped?
18
- task :bingem => ['bin:build', File.join(WXRuby3.config.rb_docgen_path, 'window.rb'), WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION, :bin)]
19
- end
20
-
21
- # this task only exists for installed source gems (where package tasks have been removed)
22
- unless File.file?(File.join(__dir__, 'package.rake'))
17
+ # this task only exists for installed (source) gems (where run tasks have been removed)
18
+ unless File.file?(File.join(__dir__, 'run.rake'))
23
19
 
24
20
  task :setup => 'config:bootstrap' do |_t, args|
25
21
  begin
@@ -51,7 +47,7 @@ namespace :wxruby do
51
47
 
52
48
  $ ./wxruby test
53
49
 
54
- The wxRuby3 sample selector can be run by executing:
50
+ The wxRuby3 sample explorer can be run by executing:
55
51
 
56
52
  $ ./wxruby sampler
57
53
 
@@ -65,13 +61,14 @@ namespace :wxruby do
65
61
  end
66
62
 
67
63
  # source gem file
68
- file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.manifest do
69
- gemspec = WXRuby3::Gem.define_spec('wxruby3', WXRuby3::WXRUBY_VERSION) do |gem|
64
+ file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do
65
+ gemspec = WXRuby3::Gem.define_spec do |gem|
70
66
  gem.summary = %Q{wxWidgets extension for Ruby}
71
67
  gem.description = %Q{wxRuby3 is a Ruby library providing an extension for the wxWidgets C++ UI framework}
72
68
  gem.email = 'mcorino@m2c-software.nl'
73
69
  gem.homepage = "https://github.com/mcorino/wxRuby3"
74
70
  gem.authors = ['Martin Corino']
71
+ gem.extensions = ['ext/mkrf_conf_ext.rb']
75
72
  gem.files = WXRuby3::Gem.manifest
76
73
  gem.require_paths = %w{lib}
77
74
  gem.bindir = 'bin'
@@ -82,6 +79,7 @@ file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.m
82
79
  gem.add_dependency 'rake'
83
80
  gem.add_dependency 'minitest', '~> 5.15'
84
81
  gem.add_dependency 'test-unit', '~> 3.5'
82
+ gem.add_dependency 'plat4m', '~> 1.0'
85
83
  gem.rdoc_options <<
86
84
  '--exclude=\\.dll' <<
87
85
  '--exclude=\\.so' <<
@@ -90,17 +88,39 @@ file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.m
90
88
  "'--exclude=lib/wx/(aui|core|grid|html|pg|prt|rbn|rtc|stc|wxruby)/.*'"
91
89
  gem.metadata = {
92
90
  "bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues",
93
- "source_code_uri" => "https://github.com/mcorino/wxRuby3",
94
- "documentation_uri" => "https://mcorino.github.io/wxRuby3",
95
91
  "homepage_uri" => "https://github.com/mcorino/wxRuby3",
92
+ "documentation_uri" => "https://mcorino.github.io/wxRuby3",
93
+ "github_repo" => "https://github.com/mcorino/wxRuby3"
96
94
  }
97
95
  gem.post_install_message = <<~__MSG
98
96
 
99
- The wxRuby3 Gem has been successfully installed.
100
- Before being able to use wxRuby3 you need to run the post-install setup process
101
- by executing the command 'wxruby setup'.
97
+ The wxRuby3 Gem has been successfully installed including the 'wxruby' utility.
98
+
99
+ In case no suitable binary release package was available for your platform you
100
+ will need to run the post-install setup process by executing:
101
+
102
+ $ wxruby setup
103
+
104
+ To check whether wxRuby3 is ready to run or not you can at any time execute the
105
+ following command:
106
+
107
+ $ wxruby check
108
+
109
+ Run 'wxruby check -h' for more information.
110
+
111
+ When the wxRuby3 setup has been fully completed you can start using wxRuby3.
112
+
113
+ You can run the regression tests to verify the installation by executing:
102
114
 
103
- Run 'wxruby setup -h' to see information on the available commandline options.
115
+ $ wxruby test
116
+
117
+ The wxRuby3 sample explorer can be run by executing:
118
+
119
+ $ wxruby sampler
120
+
121
+ Have fun using wxRuby3.
122
+
123
+ Run 'wxruby -h' to see information on the available commands.
104
124
 
105
125
  __MSG
106
126
  end
@@ -110,60 +130,70 @@ end
110
130
  desc 'Build wxRuby 3 gem'
111
131
  task :gem => 'wxruby:gem:srcgem'
112
132
 
113
- if WXRuby3.is_bootstrapped?
114
-
115
- # binary gem file
116
- file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION, :bin) => WXRuby3::Gem.manifest(:bin) + ['ext/mkrf_conf_bingem.rb'] do
117
- WXRuby3::Install.install_wxwin_shlibs
118
- begin
119
- # create gemspec
120
- gemspec = WXRuby3::Gem.define_spec('wxruby3', WXRuby3::WXRUBY_VERSION, :bin) do |gem|
121
- gem.summary = %Q{wxWidgets extension for Ruby}
122
- gem.description = %Q{wxRuby3 is a Ruby library providing an extension for the wxWidgets C++ UI framework}
123
- gem.email = 'mcorino@m2c-software.nl'
124
- gem.homepage = "https://github.com/mcorino/wxRuby3"
125
- gem.authors = ['Martin Corino']
126
- gem.files = WXRuby3::Gem.manifest(:bin)
127
- gem.require_paths = %w{lib}
128
- gem.require_paths << 'ext' if WXRuby3.config.get_config('with-wxwin')
129
- gem.bindir = 'bin'
130
- gem.executables = WXRuby3::Bin.binaries
131
- gem.extensions = ['ext/mkrf_conf_bingem.rb']
132
- gem.required_ruby_version = ">= #{WXRuby3::Config.rb_ver_major}.#{WXRuby3::Config.rb_ver_minor}",
133
- "< #{WXRuby3::Config.rb_ver_major}.#{WXRuby3::Config.rb_ver_minor+1}"
134
- gem.licenses = ['MIT']
135
- gem.add_dependency 'rake'
136
- gem.add_dependency 'minitest', '~> 5.15'
137
- gem.add_dependency 'test-unit', '~> 3.5'
138
- gem.rdoc_options << '--exclude=\\.dll' << '--exclude=\\.so'
139
- gem.metadata = {
140
- "bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues",
141
- "source_code_uri" => "https://github.com/mcorino/wxRuby3",
142
- "documentation_uri" => "https://mcorino.github.io/wxRuby3",
143
- "homepage_uri" => "https://github.com/mcorino/wxRuby3",
144
- }
145
- gem.post_install_message = <<~__MSG
146
-
147
- wxRuby3 has been successfully installed including the 'wxruby' utility.
148
-
149
- You can run the regression tests to verify the installation by executing:
150
-
151
- $ ./wxruby test
152
-
153
- The wxRuby3 sample selector can be run by executing:
154
-
155
- $ ./wxruby sampler
156
-
157
- Have fun using wxRuby3.
158
- __MSG
133
+ # these tasks do not exist for installed (source) gems (where run tasks have been removed)
134
+ if File.file?(File.join(__dir__, 'run.rake'))
135
+
136
+ if WXRuby3.is_bootstrapped?
137
+
138
+ namespace :wxruby do
139
+
140
+ namespace :gem do
141
+ task :binpkg => ['wxruby:build', 'wxruby:doc', 'bin:build', WXRuby3::Gem.bin_pkg_file]
142
+ end
143
+
144
+ end
145
+
146
+ # binary package file
147
+ file WXRuby3::Gem.bin_pkg_file => WXRuby3::Gem.bin_pkg_manifest do |t|
148
+ WXRuby3::Install.install_wxwin_shlibs
149
+ begin
150
+ # create bin package
151
+ WXRuby3::Gem.build_bin_pkg
152
+ ensure
153
+ # cleanup
154
+ WXRuby3::Install.remove_wxwin_shlibs
159
155
  end
160
- WXRuby3::Gem.build_gem(gemspec)
161
- ensure
162
- WXRuby3::Install.remove_wxwin_shlibs
163
156
  end
157
+
158
+ desc 'Build wxRuby 3 binary release package'
159
+ task :binpkg => 'wxruby:gem:binpkg'
160
+
164
161
  end
165
162
 
166
- desc 'Build wxRuby 3 binary gem'
167
- task :bingem => 'wxruby:gem:bingem'
163
+ else # in case of installed source gem the following tasks exist
164
+
165
+ namespace :wxruby do
166
+
167
+ namespace :gem do
168
+ kwargs = {}
169
+ no_prebuilt = false
170
+ task :install do |_, args|
171
+ argv = args.extras
172
+ until argv.empty?
173
+ switch = argv.shift
174
+ case switch
175
+ when '--prebuilt'
176
+ kwargs[:prebuilt_only] = true
177
+ when '--no-prebuilt'
178
+ no_prebuilt = true unless kwargs[:package]
179
+ when '--package'
180
+ fail "Missing value for '--package' argument for wxruby:gem:install." if argv.empty?
181
+ kwargs[:package] = argv.shift
182
+ no_prebuilt = false
183
+ else
184
+ fail "Invalid argument #{switch} for wxruby:gem:install."
185
+ end
186
+ end
187
+ unless no_prebuilt # do not even try to find&install a binary package
188
+ if WXRuby3::Gem.install_gem(**kwargs)
189
+ # binaries have been installed -> finish install
190
+ Rake::Task['wxruby:post:binpkg'].invoke
191
+ end
192
+ end
193
+ end
194
+
195
+ end
196
+
197
+ end
168
198
 
169
199
  end