glimmer-dsl-swt 4.17.0.0 → 4.17.2.2
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 +167 -45
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +187 -0
- data/lib/ext/glimmer/config.rb +0 -5
- data/lib/glimmer-dsl-swt.rb +6 -0
- data/lib/glimmer/launcher.rb +16 -11
- data/lib/glimmer/rake_task.rb +45 -85
- data/lib/glimmer/rake_task/list.rb +4 -1
- data/lib/glimmer/rake_task/package.rb +128 -0
- data/lib/glimmer/rake_task/sample.rb +115 -0
- data/lib/glimmer/rake_task/scaffold.rb +661 -0
- data/lib/glimmer/swt/shell_proxy.rb +1 -0
- data/lib/glimmer/swt/widget_proxy.rb +3 -0
- data/lib/glimmer/ui/custom_widget.rb +8 -4
- data/lib/glimmer/util/proc_tracker.rb +2 -0
- data/samples/elaborate/contact_manager/contact_repository.rb +3 -99
- data/samples/hello/hello_browser.rb +1 -1
- 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 +52 -62
- 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.2
|
@@ -0,0 +1,187 @@
|
|
1
|
+
# Generated by juwelier
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: glimmer-dsl-swt 4.17.2.2 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "glimmer-dsl-swt".freeze
|
9
|
+
s.version = "4.17.2.2"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["AndyMaleh".freeze]
|
14
|
+
s.date = "2020-10-14"
|
15
|
+
s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Library)".freeze
|
16
|
+
s.email = "andy.am@gmail.com".freeze
|
17
|
+
s.executables = ["glimmer".freeze, "girb".freeze]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE.txt",
|
20
|
+
"README.md"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
"CHANGELOG.md",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"RUBY_VERSION",
|
27
|
+
"VERSION",
|
28
|
+
"bin/girb",
|
29
|
+
"bin/girb_runner.rb",
|
30
|
+
"bin/glimmer",
|
31
|
+
"glimmer-dsl-swt.gemspec",
|
32
|
+
"icons/scaffold_app.icns",
|
33
|
+
"icons/scaffold_app.ico",
|
34
|
+
"icons/scaffold_app.png",
|
35
|
+
"lib/ext/glimmer.rb",
|
36
|
+
"lib/ext/glimmer/config.rb",
|
37
|
+
"lib/glimmer-dsl-swt.rb",
|
38
|
+
"lib/glimmer/Rakefile",
|
39
|
+
"lib/glimmer/data_binding/list_selection_binding.rb",
|
40
|
+
"lib/glimmer/data_binding/observable_widget.rb",
|
41
|
+
"lib/glimmer/data_binding/shine.rb",
|
42
|
+
"lib/glimmer/data_binding/table_items_binding.rb",
|
43
|
+
"lib/glimmer/data_binding/tree_items_binding.rb",
|
44
|
+
"lib/glimmer/data_binding/widget_binding.rb",
|
45
|
+
"lib/glimmer/dsl/swt/async_exec_expression.rb",
|
46
|
+
"lib/glimmer/dsl/swt/bind_expression.rb",
|
47
|
+
"lib/glimmer/dsl/swt/block_property_expression.rb",
|
48
|
+
"lib/glimmer/dsl/swt/color_expression.rb",
|
49
|
+
"lib/glimmer/dsl/swt/column_properties_expression.rb",
|
50
|
+
"lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb",
|
51
|
+
"lib/glimmer/dsl/swt/cursor_expression.rb",
|
52
|
+
"lib/glimmer/dsl/swt/custom_widget_expression.rb",
|
53
|
+
"lib/glimmer/dsl/swt/data_binding_expression.rb",
|
54
|
+
"lib/glimmer/dsl/swt/dialog_expression.rb",
|
55
|
+
"lib/glimmer/dsl/swt/display_expression.rb",
|
56
|
+
"lib/glimmer/dsl/swt/dnd_expression.rb",
|
57
|
+
"lib/glimmer/dsl/swt/dsl.rb",
|
58
|
+
"lib/glimmer/dsl/swt/exec_expression.rb",
|
59
|
+
"lib/glimmer/dsl/swt/font_expression.rb",
|
60
|
+
"lib/glimmer/dsl/swt/image_expression.rb",
|
61
|
+
"lib/glimmer/dsl/swt/layout_data_expression.rb",
|
62
|
+
"lib/glimmer/dsl/swt/layout_expression.rb",
|
63
|
+
"lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb",
|
64
|
+
"lib/glimmer/dsl/swt/menu_bar_expression.rb",
|
65
|
+
"lib/glimmer/dsl/swt/menu_expression.rb",
|
66
|
+
"lib/glimmer/dsl/swt/message_box_expression.rb",
|
67
|
+
"lib/glimmer/dsl/swt/observe_expression.rb",
|
68
|
+
"lib/glimmer/dsl/swt/property_expression.rb",
|
69
|
+
"lib/glimmer/dsl/swt/rgb_expression.rb",
|
70
|
+
"lib/glimmer/dsl/swt/rgba_expression.rb",
|
71
|
+
"lib/glimmer/dsl/swt/shell_expression.rb",
|
72
|
+
"lib/glimmer/dsl/swt/swt_expression.rb",
|
73
|
+
"lib/glimmer/dsl/swt/sync_exec_expression.rb",
|
74
|
+
"lib/glimmer/dsl/swt/tab_item_expression.rb",
|
75
|
+
"lib/glimmer/dsl/swt/table_items_data_binding_expression.rb",
|
76
|
+
"lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb",
|
77
|
+
"lib/glimmer/dsl/swt/tree_properties_expression.rb",
|
78
|
+
"lib/glimmer/dsl/swt/widget_expression.rb",
|
79
|
+
"lib/glimmer/dsl/swt/widget_listener_expression.rb",
|
80
|
+
"lib/glimmer/launcher.rb",
|
81
|
+
"lib/glimmer/rake_task.rb",
|
82
|
+
"lib/glimmer/rake_task/list.rb",
|
83
|
+
"lib/glimmer/rake_task/package.rb",
|
84
|
+
"lib/glimmer/rake_task/sample.rb",
|
85
|
+
"lib/glimmer/rake_task/scaffold.rb",
|
86
|
+
"lib/glimmer/swt/color_proxy.rb",
|
87
|
+
"lib/glimmer/swt/cursor_proxy.rb",
|
88
|
+
"lib/glimmer/swt/display_proxy.rb",
|
89
|
+
"lib/glimmer/swt/dnd_proxy.rb",
|
90
|
+
"lib/glimmer/swt/font_proxy.rb",
|
91
|
+
"lib/glimmer/swt/image_proxy.rb",
|
92
|
+
"lib/glimmer/swt/layout_data_proxy.rb",
|
93
|
+
"lib/glimmer/swt/layout_proxy.rb",
|
94
|
+
"lib/glimmer/swt/menu_proxy.rb",
|
95
|
+
"lib/glimmer/swt/message_box_proxy.rb",
|
96
|
+
"lib/glimmer/swt/packages.rb",
|
97
|
+
"lib/glimmer/swt/scrolled_composite_proxy.rb",
|
98
|
+
"lib/glimmer/swt/shell_proxy.rb",
|
99
|
+
"lib/glimmer/swt/style_constantizable.rb",
|
100
|
+
"lib/glimmer/swt/swt_proxy.rb",
|
101
|
+
"lib/glimmer/swt/tab_item_proxy.rb",
|
102
|
+
"lib/glimmer/swt/table_column_proxy.rb",
|
103
|
+
"lib/glimmer/swt/table_proxy.rb",
|
104
|
+
"lib/glimmer/swt/tree_proxy.rb",
|
105
|
+
"lib/glimmer/swt/widget_listener_proxy.rb",
|
106
|
+
"lib/glimmer/swt/widget_proxy.rb",
|
107
|
+
"lib/glimmer/ui/custom_shell.rb",
|
108
|
+
"lib/glimmer/ui/custom_widget.rb",
|
109
|
+
"lib/glimmer/util/proc_tracker.rb",
|
110
|
+
"samples/elaborate/contact_manager.rb",
|
111
|
+
"samples/elaborate/contact_manager/contact.rb",
|
112
|
+
"samples/elaborate/contact_manager/contact_manager_presenter.rb",
|
113
|
+
"samples/elaborate/contact_manager/contact_repository.rb",
|
114
|
+
"samples/elaborate/login.rb",
|
115
|
+
"samples/elaborate/tic_tac_toe.rb",
|
116
|
+
"samples/elaborate/tic_tac_toe/board.rb",
|
117
|
+
"samples/elaborate/tic_tac_toe/cell.rb",
|
118
|
+
"samples/elaborate/user_profile.rb",
|
119
|
+
"samples/hello/hello_browser.rb",
|
120
|
+
"samples/hello/hello_combo.rb",
|
121
|
+
"samples/hello/hello_computed.rb",
|
122
|
+
"samples/hello/hello_computed/contact.rb",
|
123
|
+
"samples/hello/hello_custom_shell.rb",
|
124
|
+
"samples/hello/hello_custom_widget.rb",
|
125
|
+
"samples/hello/hello_drag_and_drop.rb",
|
126
|
+
"samples/hello/hello_list_multi_selection.rb",
|
127
|
+
"samples/hello/hello_list_single_selection.rb",
|
128
|
+
"samples/hello/hello_menu_bar.rb",
|
129
|
+
"samples/hello/hello_message_box.rb",
|
130
|
+
"samples/hello/hello_pop_up_context_menu.rb",
|
131
|
+
"samples/hello/hello_tab.rb",
|
132
|
+
"samples/hello/hello_world.rb",
|
133
|
+
"vendor/swt/linux/swt.jar",
|
134
|
+
"vendor/swt/mac/swt.jar",
|
135
|
+
"vendor/swt/windows/swt.jar"
|
136
|
+
]
|
137
|
+
s.homepage = "http://github.com/AndyObtiva/glimmer-dsl-swt".freeze
|
138
|
+
s.licenses = ["MIT".freeze]
|
139
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.5.3".freeze)
|
140
|
+
s.rubygems_version = "3.1.4".freeze
|
141
|
+
s.summary = "Glimmer DSL for SWT".freeze
|
142
|
+
|
143
|
+
if s.respond_to? :specification_version then
|
144
|
+
s.specification_version = 4
|
145
|
+
end
|
146
|
+
|
147
|
+
if s.respond_to? :add_runtime_dependency then
|
148
|
+
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.1"])
|
149
|
+
s.add_runtime_dependency(%q<super_module>.freeze, ["~> 1.4.1"])
|
150
|
+
s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["~> 0.3.0"])
|
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"])
|
153
|
+
s.add_runtime_dependency(%q<git-glimmer>.freeze, ["= 1.7.0"])
|
154
|
+
s.add_runtime_dependency(%q<logging>.freeze, [">= 2.3.0", "< 3.0.0"])
|
155
|
+
s.add_runtime_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
|
156
|
+
s.add_runtime_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
157
|
+
s.add_runtime_dependency(%q<text-table>.freeze, [">= 1.2.4", "< 2.0.0"])
|
158
|
+
s.add_runtime_dependency(%q<tty-markdown>.freeze, [">= 0.6.0", "< 2.0.0"])
|
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"])
|
161
|
+
s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
162
|
+
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
163
|
+
s.add_development_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
|
164
|
+
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
165
|
+
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
166
|
+
else
|
167
|
+
s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.1"])
|
168
|
+
s.add_dependency(%q<super_module>.freeze, ["~> 1.4.1"])
|
169
|
+
s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["~> 0.3.0"])
|
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"])
|
172
|
+
s.add_dependency(%q<git-glimmer>.freeze, ["= 1.7.0"])
|
173
|
+
s.add_dependency(%q<logging>.freeze, [">= 2.3.0", "< 3.0.0"])
|
174
|
+
s.add_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
|
175
|
+
s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
176
|
+
s.add_dependency(%q<text-table>.freeze, [">= 1.2.4", "< 2.0.0"])
|
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
|
+
s.add_dependency(%q<warbler>.freeze, [">= 2.0.5", "< 3.0.0"])
|
180
|
+
s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
181
|
+
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
182
|
+
s.add_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
|
183
|
+
s.add_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
184
|
+
s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
data/lib/ext/glimmer/config.rb
CHANGED
@@ -33,11 +33,6 @@ module Glimmer
|
|
33
33
|
'org.eclipse.swt.dnd',
|
34
34
|
]
|
35
35
|
|
36
|
-
# This may be configured with extra sample directories from custom widget/shell gems
|
37
|
-
# following the convention of a `samples/subdirectory` where subdirectory is the
|
38
|
-
# custom widget/shell name or something representative of a group of samples (e.g. c_date_time).
|
39
|
-
SAMPLE_DIRECTORIES = []
|
40
|
-
|
41
36
|
class << self
|
42
37
|
# Tells Glimmer to import SWT packages into including class (default: true)
|
43
38
|
def import_swt_packages=(value)
|
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'
|
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
|
|
@@ -66,15 +74,11 @@ module Glimmer
|
|
66
74
|
def swt_jar_file
|
67
75
|
@swt_jar_file ||= File.expand_path(File.join(__FILE__, '..', '..', '..', 'vendor', 'swt', platform_os, 'swt.jar'))
|
68
76
|
end
|
69
|
-
|
77
|
+
|
70
78
|
def jruby_os_specific_options
|
71
79
|
OS.mac? ? "-J-XstartOnFirstThread" : ""
|
72
80
|
end
|
73
81
|
|
74
|
-
def jruby_swt_options
|
75
|
-
"#{jruby_os_specific_options} -J-classpath \"#{swt_jar_file}\""
|
76
|
-
end
|
77
|
-
|
78
82
|
def glimmer_lib
|
79
83
|
@@mutex.synchronize do
|
80
84
|
unless @glimmer_lib
|
@@ -199,6 +203,9 @@ module Glimmer
|
|
199
203
|
|
200
204
|
def display_tasks
|
201
205
|
if OS.windows?
|
206
|
+
require 'rake'
|
207
|
+
Rake::TaskManager.record_task_metadata = true
|
208
|
+
require_relative 'rake_task'
|
202
209
|
tasks = Rake.application.tasks
|
203
210
|
task_lines = tasks.reject do |task|
|
204
211
|
task.comment.nil?
|
@@ -206,8 +213,6 @@ module Glimmer
|
|
206
213
|
max_task_size = tasks.map(&:name_with_args).map(&:size).max + 1
|
207
214
|
task_name = task.name_with_args.sub('glimmer:', '')
|
208
215
|
line = "glimmer #{task_name.ljust(max_task_size)} # #{task.comment}"
|
209
|
-
bound = TTY::Screen.width - 6
|
210
|
-
line.size <= bound ? line : "#{line[0..(bound - 3)]}..."
|
211
216
|
end
|
212
217
|
puts task_lines.to_a
|
213
218
|
else
|
data/lib/glimmer/rake_task.rb
CHANGED
@@ -19,93 +19,53 @@
|
|
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'
|
28
47
|
|
29
|
-
|
30
|
-
Glimmer::Config::SAMPLE_DIRECTORIES << File.expand_path('../../../samples/elaborate', __FILE__)
|
48
|
+
require 'puts_debuggerer' if ("#{ENV['pd']}#{ENV['PD']}").to_s.downcase.include?('true')
|
31
49
|
|
32
50
|
namespace :glimmer do
|
33
51
|
namespace :sample do
|
34
|
-
task :requires do
|
35
|
-
|
36
|
-
require 'facets/string/titlecase'
|
37
|
-
require 'facets/string/underscore'
|
38
|
-
|
39
|
-
require_relative 'launcher'
|
52
|
+
task :requires do
|
53
|
+
require_relative 'rake_task/sample'
|
40
54
|
end
|
41
55
|
|
42
|
-
task :glimmer_gems do
|
43
|
-
glimmer_cw_gems = Gem.find_latest_files('glimmer-cw-*')
|
44
|
-
glimmer_cs_gems = Gem.find_latest_files('glimmer-cs-*')
|
45
|
-
glimmer_dsl_gems = Gem.find_latest_files('glimmer-dsl-*')
|
46
|
-
glimmer_gem_lib_files = glimmer_cw_gems + glimmer_cs_gems + glimmer_dsl_gems
|
47
|
-
glimmer_gem_lib_files = glimmer_gem_lib_files.map {|file| file.sub(/\.rb$/, '')}.uniq.reject {|file| file.include?('glimmer-cs-gladiator')}
|
48
|
-
glimmer_gem_lib_files.each {|file| require file}
|
49
|
-
end
|
50
|
-
|
51
56
|
desc 'Runs a Glimmer internal sample [included in gem]. If no name is supplied, it runs all samples.'
|
52
|
-
task :run, [:name] => [:requires
|
53
|
-
|
54
|
-
name = name.underscore.downcase unless name.nil?
|
55
|
-
samples = Glimmer::Config::SAMPLE_DIRECTORIES.map {|dir| Dir.glob(File.join(dir, '*.rb'))}.reduce(:+).sort
|
56
|
-
samples = samples.select {|path| path.include?("#{name}.rb")} unless name.nil?
|
57
|
-
Rake::Task['glimmer:sample:code'].invoke(name) if samples.size == 1
|
58
|
-
Glimmer::Launcher.new(samples << '--quiet=false').launch
|
57
|
+
task :run, [:name] => [:requires] do |t, args|
|
58
|
+
Glimmer::RakeTask::Sample.run(args[:name])
|
59
59
|
end
|
60
60
|
|
61
61
|
desc 'Lists Glimmer internal samples [included in gem]. Filters by query if specified (query is optional)'
|
62
|
-
task :list, [:query] => [:requires
|
63
|
-
Glimmer::
|
64
|
-
sample_group_name = File.basename(dir)
|
65
|
-
human_sample_group_name = sample_group_name.underscore.titlecase
|
66
|
-
array_of_arrays = Dir.glob(File.join(dir, '*.rb')).map do |path|
|
67
|
-
File.basename(path, '.rb')
|
68
|
-
end.select do |path|
|
69
|
-
args[:query].nil? || path.include?(args[:query])
|
70
|
-
end.map do |path|
|
71
|
-
[path, path.underscore.titlecase, "#{'bin/' if Glimmer::Launcher.dev_mode?}glimmer sample:run[#{path}]"]
|
72
|
-
end.sort
|
73
|
-
if array_of_arrays.empty?
|
74
|
-
puts "No Glimmer #{human_sample_group_name} Samples match the query."
|
75
|
-
else
|
76
|
-
puts
|
77
|
-
puts " Glimmer #{human_sample_group_name} Samples:"
|
78
|
-
puts Text::Table.new(
|
79
|
-
:head => %w[Name Description Run],
|
80
|
-
:rows => array_of_arrays,
|
81
|
-
:horizontal_padding => 1,
|
82
|
-
:vertical_boundary => ' ',
|
83
|
-
:horizontal_boundary => ' ',
|
84
|
-
:boundary_intersection => ' '
|
85
|
-
)
|
86
|
-
end
|
87
|
-
end
|
62
|
+
task :list, [:query] => [:requires] do |t, args|
|
63
|
+
Glimmer::RakeTask::Sample.list(args[:query])
|
88
64
|
end
|
89
65
|
|
90
66
|
desc 'Outputs code for a Glimmer internal sample [included in gem] (name is required)'
|
91
|
-
task :code, [:name] => [:requires
|
92
|
-
|
93
|
-
samples = Glimmer::Config::SAMPLE_DIRECTORIES.map {|dir| Dir.glob(File.join(dir, '*.rb'))}.reduce(:+).sort
|
94
|
-
sample = samples.detect {|path| path.include?("#{args[:name].to_s.underscore.downcase}.rb")}
|
95
|
-
sample_additional_files = Dir.glob(File.join(sample.sub('.rb', ''), '**', '*.rb'))
|
96
|
-
code = ([sample] + sample_additional_files).map do |file|
|
97
|
-
<<~RUBY
|
98
|
-
|
99
|
-
# #{file}
|
100
|
-
|
101
|
-
#{File.read(file)}
|
102
|
-
|
103
|
-
# # #
|
104
|
-
|
105
|
-
RUBY
|
106
|
-
end.join("\n")
|
107
|
-
code = TTY::Markdown.parse("```ruby\n#{code}\n```") unless OS.windows?
|
108
|
-
puts code
|
67
|
+
task :code, [:name] => [:requires] do |t, args|
|
68
|
+
Glimmer::RakeTask::Sample.code(args[:name])
|
109
69
|
end
|
110
70
|
|
111
71
|
end
|
@@ -113,28 +73,28 @@ namespace :glimmer do
|
|
113
73
|
namespace :package do
|
114
74
|
desc 'Clean by removing "dist" and "packages" directories'
|
115
75
|
task :clean do
|
116
|
-
Glimmer::Package.clean
|
76
|
+
Glimmer::RakeTask::Package.clean
|
117
77
|
end
|
118
78
|
|
119
79
|
desc 'Generate JAR config file'
|
120
80
|
task :config do
|
121
|
-
Glimmer::Package.config
|
81
|
+
Glimmer::RakeTask::Package.config
|
122
82
|
end
|
123
83
|
|
124
84
|
desc 'Generate JAR file'
|
125
85
|
task :jar do
|
126
|
-
Glimmer::Package.jar
|
86
|
+
Glimmer::RakeTask::Package.jar
|
127
87
|
end
|
128
88
|
|
129
89
|
desc 'Lock JARs'
|
130
90
|
task :lock_jars do
|
131
|
-
Glimmer::Package.lock_jars
|
91
|
+
Glimmer::RakeTask::Package.lock_jars
|
132
92
|
end
|
133
93
|
|
134
94
|
desc 'Generate Native files. type can be dmg/pkg on the Mac, msi/exe on Windows, and rpm/deb on Linux (type is optional)'
|
135
95
|
task :native, [:type] do |t, args|
|
136
96
|
extra_args = ARGV.partition {|arg| arg.include?('package:native')}.last.to_a.join(' ')
|
137
|
-
Glimmer::Package.native(args[:type], extra_args)
|
97
|
+
Glimmer::RakeTask::Package.native(args[:type], extra_args)
|
138
98
|
end
|
139
99
|
end
|
140
100
|
|
@@ -149,15 +109,15 @@ namespace :glimmer do
|
|
149
109
|
|
150
110
|
desc 'Scaffold Glimmer application directory structure to build a new app'
|
151
111
|
task :scaffold, [:app_name] do |t, args|
|
152
|
-
require_relative 'scaffold'
|
153
|
-
Scaffold.app(args[:app_name])
|
112
|
+
require_relative 'rake_task/scaffold'
|
113
|
+
Glimmer::RakeTask::Scaffold.app(args[:app_name])
|
154
114
|
end
|
155
115
|
|
156
116
|
namespace :scaffold do
|
157
117
|
desc 'Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]'
|
158
118
|
task :customshell, [:name, :namespace] do |t, args|
|
159
|
-
require_relative 'scaffold'
|
160
|
-
Scaffold.custom_shell(args[:name], args[:namespace])
|
119
|
+
require_relative 'rake_task/scaffold'
|
120
|
+
Glimmer::RakeTask::Scaffold.custom_shell(args[:name], args[:namespace])
|
161
121
|
end
|
162
122
|
|
163
123
|
task :cs, [:name, :namespace] => :customshell
|
@@ -166,8 +126,8 @@ namespace :glimmer do
|
|
166
126
|
|
167
127
|
desc 'Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]'
|
168
128
|
task :customwidget, [:name, :namespace] do |t, args|
|
169
|
-
require_relative 'scaffold'
|
170
|
-
Scaffold.custom_widget(args[:name], args[:namespace])
|
129
|
+
require_relative 'rake_task/scaffold'
|
130
|
+
Glimmer::RakeTask::Scaffold.custom_widget(args[:name], args[:namespace])
|
171
131
|
end
|
172
132
|
|
173
133
|
task :cw, [:name, :namespace] => :customwidget
|
@@ -177,8 +137,8 @@ namespace :glimmer do
|
|
177
137
|
namespace :gem do
|
178
138
|
desc 'Scaffold Glimmer::UI::CustomShell subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:gem:cs]'
|
179
139
|
task :customshell, [:name, :namespace] do |t, args|
|
180
|
-
require_relative 'scaffold'
|
181
|
-
Scaffold.custom_shell_gem(args[:name], args[:namespace])
|
140
|
+
require_relative 'rake_task/scaffold'
|
141
|
+
Glimmer::RakeTask::Scaffold.custom_shell_gem(args[:name], args[:namespace])
|
182
142
|
end
|
183
143
|
|
184
144
|
task :cs, [:name, :namespace] => :customshell
|
@@ -187,8 +147,8 @@ namespace :glimmer do
|
|
187
147
|
|
188
148
|
desc 'Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cw]'
|
189
149
|
task :customwidget, [:name, :namespace] do |t, args|
|
190
|
-
require_relative 'scaffold'
|
191
|
-
Scaffold.custom_widget_gem(args[:name], args[:namespace])
|
150
|
+
require_relative 'rake_task/scaffold'
|
151
|
+
Glimmer::RakeTask::Scaffold.custom_widget_gem(args[:name], args[:namespace])
|
192
152
|
end
|
193
153
|
|
194
154
|
task :cw, [:name, :namespace] => :customwidget
|