glimmer-dsl-swt 4.17.1.0 → 4.17.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -0
- data/README.md +192 -54
- data/VERSION +1 -1
- data/bin/glimmer +0 -4
- data/glimmer-dsl-swt.gemspec +16 -16
- data/lib/ext/glimmer/config.rb +1 -0
- data/lib/glimmer-dsl-swt.rb +6 -0
- data/lib/glimmer/data_binding/table_items_binding.rb +1 -0
- data/lib/glimmer/launcher.rb +15 -6
- data/lib/glimmer/rake_task.rb +42 -18
- data/lib/glimmer/rake_task/list.rb +4 -1
- data/lib/glimmer/rake_task/package.rb +132 -0
- data/lib/glimmer/rake_task/scaffold.rb +661 -0
- data/lib/glimmer/swt/image_proxy.rb +20 -9
- data/lib/glimmer/swt/shell_proxy.rb +1 -0
- data/lib/glimmer/swt/widget_proxy.rb +53 -13
- data/lib/glimmer/ui/custom_widget.rb +7 -4
- data/lib/glimmer/util/proc_tracker.rb +2 -0
- data/samples/elaborate/contact_manager/contact_repository.rb +3 -99
- data/samples/hello/hello_combo.rb +10 -6
- data/samples/hello/hello_custom_shell.rb +155 -0
- data/samples/hello/hello_custom_widget.rb +86 -0
- data/samples/hello/hello_tab.rb +10 -5
- data/samples/hello/hello_world.rb +2 -2
- metadata +27 -45
- data/lib/glimmer/package.rb +0 -112
- data/lib/glimmer/scaffold.rb +0 -652
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.17.
|
1
|
+
4.17.2.3
|
data/bin/glimmer
CHANGED
@@ -21,10 +21,6 @@
|
|
21
21
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
23
|
|
24
|
-
if File.exist?(File.expand_path('./Gemfile'))
|
25
|
-
require 'bundler/setup' unless ENV['GLIMMER_BUNDLER_SETUP'].to_s.downcase == 'false'
|
26
|
-
end
|
27
|
-
|
28
24
|
require_relative '../lib/glimmer/launcher'
|
29
25
|
|
30
26
|
Glimmer::Launcher.new(ARGV).launch
|
data/glimmer-dsl-swt.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer-dsl-swt 4.17.
|
5
|
+
# stub: glimmer-dsl-swt 4.17.2.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-dsl-swt".freeze
|
9
|
-
s.version = "4.17.
|
9
|
+
s.version = "4.17.2.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["AndyMaleh".freeze]
|
14
|
-
s.date = "2020-
|
14
|
+
s.date = "2020-10-16"
|
15
15
|
s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Library)".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.executables = ["glimmer".freeze, "girb".freeze]
|
@@ -78,11 +78,11 @@ Gem::Specification.new do |s|
|
|
78
78
|
"lib/glimmer/dsl/swt/widget_expression.rb",
|
79
79
|
"lib/glimmer/dsl/swt/widget_listener_expression.rb",
|
80
80
|
"lib/glimmer/launcher.rb",
|
81
|
-
"lib/glimmer/package.rb",
|
82
81
|
"lib/glimmer/rake_task.rb",
|
83
82
|
"lib/glimmer/rake_task/list.rb",
|
83
|
+
"lib/glimmer/rake_task/package.rb",
|
84
84
|
"lib/glimmer/rake_task/sample.rb",
|
85
|
-
"lib/glimmer/scaffold.rb",
|
85
|
+
"lib/glimmer/rake_task/scaffold.rb",
|
86
86
|
"lib/glimmer/swt/color_proxy.rb",
|
87
87
|
"lib/glimmer/swt/cursor_proxy.rb",
|
88
88
|
"lib/glimmer/swt/display_proxy.rb",
|
@@ -120,6 +120,8 @@ Gem::Specification.new do |s|
|
|
120
120
|
"samples/hello/hello_combo.rb",
|
121
121
|
"samples/hello/hello_computed.rb",
|
122
122
|
"samples/hello/hello_computed/contact.rb",
|
123
|
+
"samples/hello/hello_custom_shell.rb",
|
124
|
+
"samples/hello/hello_custom_widget.rb",
|
123
125
|
"samples/hello/hello_drag_and_drop.rb",
|
124
126
|
"samples/hello/hello_list_multi_selection.rb",
|
125
127
|
"samples/hello/hello_list_single_selection.rb",
|
@@ -143,39 +145,37 @@ Gem::Specification.new do |s|
|
|
143
145
|
end
|
144
146
|
|
145
147
|
if s.respond_to? :add_runtime_dependency then
|
146
|
-
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.
|
148
|
+
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.1"])
|
147
149
|
s.add_runtime_dependency(%q<super_module>.freeze, ["~> 1.4.1"])
|
148
150
|
s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["~> 0.3.0"])
|
149
|
-
s.add_runtime_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.
|
150
|
-
s.add_runtime_dependency(%q<rake-tui>.freeze, [">= 0.2.
|
151
|
+
s.add_runtime_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.2"])
|
152
|
+
s.add_runtime_dependency(%q<rake-tui>.freeze, [">= 0.2.3", "< 2.0.0"])
|
151
153
|
s.add_runtime_dependency(%q<git-glimmer>.freeze, ["= 1.7.0"])
|
152
|
-
s.add_runtime_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0.0"])
|
153
154
|
s.add_runtime_dependency(%q<logging>.freeze, [">= 2.3.0", "< 3.0.0"])
|
154
155
|
s.add_runtime_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
|
155
156
|
s.add_runtime_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
156
|
-
s.add_runtime_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
|
157
157
|
s.add_runtime_dependency(%q<text-table>.freeze, [">= 1.2.4", "< 2.0.0"])
|
158
158
|
s.add_runtime_dependency(%q<tty-markdown>.freeze, [">= 0.6.0", "< 2.0.0"])
|
159
|
-
s.
|
159
|
+
s.add_development_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0.0"])
|
160
|
+
s.add_development_dependency(%q<warbler>.freeze, [">= 2.0.5", "< 3.0.0"])
|
160
161
|
s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
161
162
|
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
162
163
|
s.add_development_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
|
163
164
|
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
164
165
|
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
165
166
|
else
|
166
|
-
s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.
|
167
|
+
s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.1"])
|
167
168
|
s.add_dependency(%q<super_module>.freeze, ["~> 1.4.1"])
|
168
169
|
s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["~> 0.3.0"])
|
169
|
-
s.add_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.
|
170
|
-
s.add_dependency(%q<rake-tui>.freeze, [">= 0.2.
|
170
|
+
s.add_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.2"])
|
171
|
+
s.add_dependency(%q<rake-tui>.freeze, [">= 0.2.3", "< 2.0.0"])
|
171
172
|
s.add_dependency(%q<git-glimmer>.freeze, ["= 1.7.0"])
|
172
|
-
s.add_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0.0"])
|
173
173
|
s.add_dependency(%q<logging>.freeze, [">= 2.3.0", "< 3.0.0"])
|
174
174
|
s.add_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
|
175
175
|
s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
176
|
-
s.add_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
|
177
176
|
s.add_dependency(%q<text-table>.freeze, [">= 1.2.4", "< 2.0.0"])
|
178
177
|
s.add_dependency(%q<tty-markdown>.freeze, [">= 0.6.0", "< 2.0.0"])
|
178
|
+
s.add_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0.0"])
|
179
179
|
s.add_dependency(%q<warbler>.freeze, [">= 2.0.5", "< 3.0.0"])
|
180
180
|
s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
181
181
|
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
data/lib/ext/glimmer/config.rb
CHANGED
@@ -144,6 +144,7 @@ Glimmer::Config.excluded_keyword_checkers << lambda do |method_symbol, *args|
|
|
144
144
|
result ||= method == 'dispose' && is_a?(Glimmer::UI::CustomWidget) && respond_to?(method)
|
145
145
|
result ||= ['drag_source_proxy', 'drop_target_proxy'].include?(method) && is_a?(Glimmer::UI::CustomWidget)
|
146
146
|
result ||= method == 'post_initialize_child'
|
147
|
+
result ||= method == 'handle'
|
147
148
|
result ||= method.end_with?('=')
|
148
149
|
result ||= ['finish_edit!', 'search', 'all_tree_items', 'depth_first_search'].include?(method) && is_a?(Glimmer::UI::CustomWidget) && body_root.respond_to?(method)
|
149
150
|
end
|
data/lib/glimmer-dsl-swt.rb
CHANGED
@@ -22,6 +22,12 @@
|
|
22
22
|
$LOAD_PATH.unshift(File.expand_path('..', __FILE__))
|
23
23
|
|
24
24
|
# External requires
|
25
|
+
if !['', 'false'].include?(ENV['GLIMMER_BUNDLER_SETUP'].to_s.strip.downcase)
|
26
|
+
bundler_group = ENV['GLIMMER_BUNDLER_SETUP'].to_s.strip.downcase
|
27
|
+
bundler_group = 'default' if bundler_group == 'true'
|
28
|
+
require 'bundler'
|
29
|
+
Bundler.setup(bundler_group)
|
30
|
+
end
|
25
31
|
require 'java'
|
26
32
|
require 'puts_debuggerer' if ("#{ENV['pd']}#{ENV['PD']}").to_s.downcase.include?('true')
|
27
33
|
require 'glimmer'
|
@@ -80,6 +80,7 @@ module Glimmer
|
|
80
80
|
selected_table_items = [parent.swt_widget.getItems.first].to_java(TableItem) if selected_table_items.empty? && !parent.swt_widget.getItems.empty?
|
81
81
|
parent.swt_widget.setSelection(selected_table_items) unless selected_table_items.empty?
|
82
82
|
parent.sort
|
83
|
+
parent.swt_widget.redraw if parent&.swt_widget&.respond_to?(:redraw)
|
83
84
|
end
|
84
85
|
end
|
85
86
|
end
|
data/lib/glimmer/launcher.rb
CHANGED
@@ -19,6 +19,10 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
+
if ARGV.include?('--bundler') && File.exist?(File.expand_path('./Gemfile'))
|
23
|
+
require 'bundler'
|
24
|
+
Bundler.setup(:default)
|
25
|
+
end
|
22
26
|
require 'fileutils'
|
23
27
|
require 'os'
|
24
28
|
|
@@ -28,7 +32,7 @@ module Glimmer
|
|
28
32
|
|
29
33
|
TEXT_USAGE = <<~MULTI_LINE_STRING
|
30
34
|
Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v#{File.read(File.expand_path('../../../VERSION', __FILE__))}
|
31
|
-
Usage: glimmer [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
35
|
+
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
32
36
|
|
33
37
|
Runs Glimmer applications and tasks.
|
34
38
|
|
@@ -38,7 +42,9 @@ module Glimmer
|
|
38
42
|
Optionally, extra Glimmer options, JRuby options, and/or environment variables may be passed in.
|
39
43
|
|
40
44
|
Glimmer options:
|
41
|
-
- "--
|
45
|
+
- "--bundler=GROUP" : Activates gems in Bundler default group in Gemfile
|
46
|
+
- "--pd=BOOLEAN" : Requires puts_debuggerer to enable pd method
|
47
|
+
- "--quiet=BOOLEAN" : Does not announce file path of Glimmer application being launched
|
42
48
|
- "--debug" : Displays extra debugging information, passes "--debug" to JRuby, and enables debug logging
|
43
49
|
- "--log-level=VALUE" : Sets Glimmer's Ruby logger level ("ERROR" / "WARN" / "INFO" / "DEBUG"; default is none)
|
44
50
|
|
@@ -50,9 +56,11 @@ module Glimmer
|
|
50
56
|
|
51
57
|
GLIMMER_LIB_LOCAL = File.expand_path(File.join('lib', 'glimmer-dsl-swt.rb'))
|
52
58
|
GLIMMER_LIB_GEM = 'glimmer-dsl-swt'
|
53
|
-
GLIMMER_OPTIONS = %w[--log-level --quiet]
|
59
|
+
GLIMMER_OPTIONS = %w[--log-level --quiet --bundler --pd]
|
54
60
|
GLIMMER_OPTION_ENV_VAR_MAPPING = {
|
55
|
-
'--log-level' => 'GLIMMER_LOGGER_LEVEL'
|
61
|
+
'--log-level' => 'GLIMMER_LOGGER_LEVEL' ,
|
62
|
+
'--bundler' => 'GLIMMER_BUNDLER_SETUP' ,
|
63
|
+
'--pd' => 'PD' ,
|
56
64
|
}
|
57
65
|
REGEX_RAKE_TASK_WITH_ARGS = /^([^\[]+)\[?([^\]]*)\]?$/
|
58
66
|
|
@@ -195,6 +203,9 @@ module Glimmer
|
|
195
203
|
|
196
204
|
def display_tasks
|
197
205
|
if OS.windows?
|
206
|
+
require 'rake'
|
207
|
+
Rake::TaskManager.record_task_metadata = true
|
208
|
+
require_relative 'rake_task'
|
198
209
|
tasks = Rake.application.tasks
|
199
210
|
task_lines = tasks.reject do |task|
|
200
211
|
task.comment.nil?
|
@@ -202,8 +213,6 @@ module Glimmer
|
|
202
213
|
max_task_size = tasks.map(&:name_with_args).map(&:size).max + 1
|
203
214
|
task_name = task.name_with_args.sub('glimmer:', '')
|
204
215
|
line = "glimmer #{task_name.ljust(max_task_size)} # #{task.comment}"
|
205
|
-
bound = TTY::Screen.width - 6
|
206
|
-
line.size <= bound ? line : "#{line[0..(bound - 3)]}..."
|
207
216
|
end
|
208
217
|
puts task_lines.to_a
|
209
218
|
else
|
data/lib/glimmer/rake_task.rb
CHANGED
@@ -19,9 +19,28 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
-
|
22
|
+
module Glimmer
|
23
|
+
module RakeTask
|
24
|
+
RVM_FUNCTION = <<~MULTI_LINE_STRING
|
25
|
+
# Load RVM into a shell session *as a function*
|
26
|
+
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
27
|
+
|
28
|
+
# First try to load from a user install
|
29
|
+
source "$HOME/.rvm/scripts/rvm"
|
30
|
+
|
31
|
+
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
32
|
+
|
33
|
+
# Then try to load from a root install
|
34
|
+
source "/usr/local/rvm/scripts/rvm"
|
35
|
+
|
36
|
+
fi
|
37
|
+
MULTI_LINE_STRING
|
38
|
+
end
|
39
|
+
end
|
23
40
|
|
24
|
-
|
41
|
+
require 'rake'
|
42
|
+
|
43
|
+
require_relative 'rake_task/package'
|
25
44
|
|
26
45
|
ENV['GLIMMER_LOGGER_ENABLED'] = 'false'
|
27
46
|
require_relative '../ext/glimmer/config.rb'
|
@@ -54,34 +73,39 @@ namespace :glimmer do
|
|
54
73
|
namespace :package do
|
55
74
|
desc 'Clean by removing "dist" and "packages" directories'
|
56
75
|
task :clean do
|
57
|
-
Glimmer::Package.clean
|
76
|
+
Glimmer::RakeTask::Package.clean
|
77
|
+
end
|
78
|
+
|
79
|
+
desc 'Generate gemspec'
|
80
|
+
task :gemspec do
|
81
|
+
Glimmer::RakeTask::Package.gemspec
|
58
82
|
end
|
59
83
|
|
60
84
|
desc 'Generate JAR config file'
|
61
85
|
task :config do
|
62
|
-
Glimmer::Package.config
|
86
|
+
Glimmer::RakeTask::Package.config
|
63
87
|
end
|
64
88
|
|
65
89
|
desc 'Generate JAR file'
|
66
90
|
task :jar do
|
67
|
-
Glimmer::Package.jar
|
91
|
+
Glimmer::RakeTask::Package.jar
|
68
92
|
end
|
69
93
|
|
70
94
|
desc 'Lock JARs'
|
71
95
|
task :lock_jars do
|
72
|
-
Glimmer::Package.lock_jars
|
96
|
+
Glimmer::RakeTask::Package.lock_jars
|
73
97
|
end
|
74
98
|
|
75
99
|
desc 'Generate Native files. type can be dmg/pkg on the Mac, msi/exe on Windows, and rpm/deb on Linux (type is optional)'
|
76
100
|
task :native, [:type] do |t, args|
|
77
101
|
extra_args = ARGV.partition {|arg| arg.include?('package:native')}.last.to_a.join(' ')
|
78
|
-
Glimmer::Package.native(args[:type], extra_args)
|
102
|
+
Glimmer::RakeTask::Package.native(args[:type], extra_args)
|
79
103
|
end
|
80
104
|
end
|
81
105
|
|
82
106
|
desc 'Package app for distribution (generating config, jar, and native files) (type is optional)'
|
83
107
|
task :package, [:type] do |t, args|
|
84
|
-
Rake::Task['gemspec
|
108
|
+
Rake::Task['glimmer:package:gemspec'].execute
|
85
109
|
Rake::Task['glimmer:package:lock_jars'].execute
|
86
110
|
Rake::Task['glimmer:package:config'].execute
|
87
111
|
Rake::Task['glimmer:package:jar'].execute
|
@@ -90,15 +114,15 @@ namespace :glimmer do
|
|
90
114
|
|
91
115
|
desc 'Scaffold Glimmer application directory structure to build a new app'
|
92
116
|
task :scaffold, [:app_name] do |t, args|
|
93
|
-
require_relative 'scaffold'
|
94
|
-
Scaffold.app(args[:app_name])
|
117
|
+
require_relative 'rake_task/scaffold'
|
118
|
+
Glimmer::RakeTask::Scaffold.app(args[:app_name])
|
95
119
|
end
|
96
120
|
|
97
121
|
namespace :scaffold do
|
98
122
|
desc 'Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]'
|
99
123
|
task :customshell, [:name, :namespace] do |t, args|
|
100
|
-
require_relative 'scaffold'
|
101
|
-
Scaffold.custom_shell(args[:name], args[:namespace])
|
124
|
+
require_relative 'rake_task/scaffold'
|
125
|
+
Glimmer::RakeTask::Scaffold.custom_shell(args[:name], args[:namespace])
|
102
126
|
end
|
103
127
|
|
104
128
|
task :cs, [:name, :namespace] => :customshell
|
@@ -107,8 +131,8 @@ namespace :glimmer do
|
|
107
131
|
|
108
132
|
desc 'Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]'
|
109
133
|
task :customwidget, [:name, :namespace] do |t, args|
|
110
|
-
require_relative 'scaffold'
|
111
|
-
Scaffold.custom_widget(args[:name], args[:namespace])
|
134
|
+
require_relative 'rake_task/scaffold'
|
135
|
+
Glimmer::RakeTask::Scaffold.custom_widget(args[:name], args[:namespace])
|
112
136
|
end
|
113
137
|
|
114
138
|
task :cw, [:name, :namespace] => :customwidget
|
@@ -118,8 +142,8 @@ namespace :glimmer do
|
|
118
142
|
namespace :gem do
|
119
143
|
desc 'Scaffold Glimmer::UI::CustomShell subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:gem:cs]'
|
120
144
|
task :customshell, [:name, :namespace] do |t, args|
|
121
|
-
require_relative 'scaffold'
|
122
|
-
Scaffold.custom_shell_gem(args[:name], args[:namespace])
|
145
|
+
require_relative 'rake_task/scaffold'
|
146
|
+
Glimmer::RakeTask::Scaffold.custom_shell_gem(args[:name], args[:namespace])
|
123
147
|
end
|
124
148
|
|
125
149
|
task :cs, [:name, :namespace] => :customshell
|
@@ -128,8 +152,8 @@ namespace :glimmer do
|
|
128
152
|
|
129
153
|
desc 'Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cw]'
|
130
154
|
task :customwidget, [:name, :namespace] do |t, args|
|
131
|
-
require_relative 'scaffold'
|
132
|
-
Scaffold.custom_widget_gem(args[:name], args[:namespace])
|
155
|
+
require_relative 'rake_task/scaffold'
|
156
|
+
Glimmer::RakeTask::Scaffold.custom_widget_gem(args[:name], args[:namespace])
|
133
157
|
end
|
134
158
|
|
135
159
|
task :cw, [:name, :namespace] => :customwidget
|
@@ -71,8 +71,11 @@ module Glimmer
|
|
71
71
|
|
72
72
|
def tablify(gem_prefix, gems)
|
73
73
|
array_of_arrays = gems.map do |gem|
|
74
|
+
name, namespace = gem[:name].sub(gem_prefix, '').underscore.titlecase.split
|
75
|
+
human_name = name
|
76
|
+
human_name += " (#{namespace})" unless namespace.nil?
|
74
77
|
[
|
75
|
-
|
78
|
+
human_name,
|
76
79
|
gem[:name],
|
77
80
|
gem[:version],
|
78
81
|
gem[:author].sub('Author: ', ''),
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'os'
|
23
|
+
|
24
|
+
# TODO refactor to nest under RakeTask namespace
|
25
|
+
module Glimmer
|
26
|
+
module RakeTask
|
27
|
+
module Package
|
28
|
+
class << self
|
29
|
+
attr_accessor :javapackager_extra_args
|
30
|
+
alias jpackage_extra_args :javapackager_extra_args
|
31
|
+
|
32
|
+
def clean
|
33
|
+
require 'fileutils'
|
34
|
+
FileUtils.rm_rf('dist')
|
35
|
+
FileUtils.rm_rf('packages')
|
36
|
+
end
|
37
|
+
|
38
|
+
def gemspec
|
39
|
+
system 'rake gemspec:generate'
|
40
|
+
end
|
41
|
+
|
42
|
+
def lock_jars
|
43
|
+
puts 'Locking gem jar-dependencies by downloading & storing in vendor/jars...'
|
44
|
+
FileUtils.mkdir_p('vendor/jars')
|
45
|
+
command = "lock_jars --vendor-dir vendor/jars"
|
46
|
+
puts command
|
47
|
+
system command
|
48
|
+
end
|
49
|
+
|
50
|
+
def config
|
51
|
+
project_name = File.basename(File.expand_path('.'))
|
52
|
+
if !File.exists?('config/warble.rb')
|
53
|
+
puts 'Generating JAR configuration (config/warble.rb) to use with Warbler...'
|
54
|
+
FileUtils.mkdir_p('config')
|
55
|
+
if OS.windows?
|
56
|
+
system "jruby -S gem install warbler -v2.0.5 --no-document" unless warbler_exists?
|
57
|
+
else
|
58
|
+
system "bash -c '#{RVM_FUNCTION}\n cd .\n jruby -S gem install warbler -v2.0.5 --no-document\n'" unless warbler_exists?
|
59
|
+
end
|
60
|
+
if system('warble config')
|
61
|
+
new_config = File.read('config/warble.rb').split("\n").inject('') do |output, line|
|
62
|
+
if line.include?('config.dirs =')
|
63
|
+
line = line.sub('# ', '').sub(/=[^=\n]+$/, '= %w(app bin config db docs fonts icons images lib package script sounds vendor videos)')
|
64
|
+
end
|
65
|
+
if line.include?('config.includes =')
|
66
|
+
line = line.sub('# ', '').sub(/=[^=\n]+$/, "= FileList['LICENSE.txt', 'VERSION']")
|
67
|
+
end
|
68
|
+
if line.include?('config.autodeploy_dir =')
|
69
|
+
line = line.sub('# ', '')
|
70
|
+
end
|
71
|
+
output + "\n" + line
|
72
|
+
end
|
73
|
+
File.write('config/warble.rb', new_config)
|
74
|
+
else
|
75
|
+
puts 'Warbler executable "warble" is missing!'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def jar
|
81
|
+
FileUtils.mkdir_p('dist')
|
82
|
+
puts "Generating JAR with Warbler..."
|
83
|
+
system "jruby -S gem install warbler -v2.0.5 --no-document" unless warbler_exists?
|
84
|
+
system('warble')
|
85
|
+
end
|
86
|
+
|
87
|
+
def native(native_type=nil, native_extra_args)
|
88
|
+
puts "Generating native executable with javapackager/jpackage..."
|
89
|
+
require 'facets/string/titlecase'
|
90
|
+
require 'facets/string/underscore'
|
91
|
+
project_name = File.basename(File.expand_path('.'))
|
92
|
+
version_file = File.expand_path('./VERSION')
|
93
|
+
version = (File.read(version_file).strip if File.exists?(version_file) && File.file?(version_file)) rescue nil
|
94
|
+
license_file = File.expand_path('./LICENSE.txt')
|
95
|
+
license = (File.read(license_file).strip if File.exists?(license_file) && File.file?(license_file)) rescue nil
|
96
|
+
copyright = license.split("\n").first
|
97
|
+
human_name = project_name.underscore.titlecase
|
98
|
+
icon = "package/#{OS.mac? ? 'macosx' : 'windows'}/#{human_name}.#{OS.mac? ? 'icns' : 'ico'}"
|
99
|
+
if (`javapackager`.to_s.include?('Usage: javapackager') rescue nil)
|
100
|
+
command = "javapackager -deploy -native #{native_type} -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" -Bmac.category=\"public.app-category.business\" -BinstalldirChooser=true -Bvendor=\"#{human_name}\" -Bwin.menuGroup=\"#{human_name}\" "
|
101
|
+
command += " -BsystemWide=false " if OS.windows?
|
102
|
+
command += " -BjvmOptions=-XstartOnFirstThread " if OS.mac?
|
103
|
+
command += " -BappVersion=#{version} -Bmac.CFBundleVersion=#{version} " if version
|
104
|
+
command += " -srcfiles LICENSE.txt -BlicenseFile=LICENSE.txt " if license
|
105
|
+
command += " -Bcopyright=\"#{copyright}\" " if copyright
|
106
|
+
elsif (`jpackage`.to_s.include?('Usage: jpackage') rescue nil)
|
107
|
+
command = "jpackage --type #{native_type} --dest 'packages/bundles' --input 'dist' --main-class JarMain --main-jar '#{project_name}.jar' --name '#{human_name}' --vendor '#{human_name}' --icon '#{icon}' "
|
108
|
+
command += " --win-per-user-install --win-dir-chooser --win-menu --win-menu-group '#{human_name}' " if OS.windows?
|
109
|
+
command += " --java-options '-XstartOnFirstThread' --mac-package-name '#{human_name}' --mac-package-identifier 'org.#{project_name}.application.#{project_name}' " if OS.mac?
|
110
|
+
command += " --app-version \"#{version}\" " if version
|
111
|
+
command += " --license-file LICENSE.txt " if license
|
112
|
+
command += " --copyright \"#{copyright}\" " if copyright
|
113
|
+
else
|
114
|
+
puts "Neither javapackager nor jpackage exist in your Java installation. Please ensure javapackager or jpackage is available in PATH environment variable."
|
115
|
+
return
|
116
|
+
end
|
117
|
+
command += " #{javapackager_extra_args} " if javapackager_extra_args
|
118
|
+
command += " #{ENV['JAVAPACKAGER_EXTRA_ARGS']} " if ENV['JAVAPACKAGER_EXTRA_ARGS']
|
119
|
+
command += " #{native_extra_args} " if native_extra_args
|
120
|
+
puts command
|
121
|
+
system command
|
122
|
+
end
|
123
|
+
|
124
|
+
private
|
125
|
+
|
126
|
+
def warbler_exists?
|
127
|
+
OS.windows? ? system('where warble') : system('which warble')
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|