glimmer-dsl-swt 4.18.0.2 → 4.18.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 +48 -0
- data/README.md +234 -16
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +15 -7
- data/lib/ext/glimmer/config.rb +6 -6
- data/lib/glimmer-dsl-swt.rb +1 -0
- data/lib/glimmer/dsl/swt/animation_expression.rb +43 -0
- data/lib/glimmer/dsl/swt/dsl.rb +4 -3
- data/lib/glimmer/dsl/swt/font_expression.rb +7 -5
- data/lib/glimmer/dsl/swt/property_expression.rb +5 -4
- data/lib/glimmer/dsl/swt/shape_expression.rb +56 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +6 -2
- data/lib/glimmer/rake_task/list.rb +5 -5
- data/lib/glimmer/rake_task/package.rb +9 -9
- data/lib/glimmer/rake_task/scaffold.rb +32 -33
- data/lib/glimmer/swt/custom/animation.rb +243 -0
- data/lib/glimmer/swt/custom/code_text.rb +2 -1
- data/lib/glimmer/swt/custom/drawable.rb +43 -0
- data/lib/glimmer/swt/custom/shape.rb +200 -0
- data/lib/glimmer/swt/display_proxy.rb +16 -0
- data/lib/glimmer/swt/font_proxy.rb +3 -3
- data/lib/glimmer/swt/properties.rb +49 -0
- data/lib/glimmer/swt/shell_proxy.rb +2 -1
- data/lib/glimmer/swt/widget_proxy.rb +4 -22
- data/samples/elaborate/meta_sample.rb +1 -1
- data/samples/hello/hello_canvas.rb +63 -0
- data/samples/hello/hello_canvas_animation.rb +66 -0
- metadata +26 -16
data/lib/ext/glimmer/config.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -30,7 +30,7 @@ module Glimmer
|
|
30
30
|
'org.eclipse.swt.graphics',
|
31
31
|
'org.eclipse.swt.browser',
|
32
32
|
'org.eclipse.swt.custom',
|
33
|
-
'org.eclipse.swt.dnd',
|
33
|
+
'org.eclipse.swt.dnd',
|
34
34
|
]
|
35
35
|
|
36
36
|
class << self
|
@@ -99,9 +99,9 @@ module Glimmer
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def reset_logger!
|
102
|
-
@first_time = !defined?(@@logger)
|
102
|
+
@first_time = !defined?(@@logger)
|
103
103
|
old_level = logger.level unless @first_time
|
104
|
-
self.logger = Logging.logger['glimmer'].tap do |logger|
|
104
|
+
self.logger = Logging.logger['glimmer'].tap do |logger|
|
105
105
|
logger.level = old_level || :error
|
106
106
|
appenders = []
|
107
107
|
appenders << Logging.appenders.stdout(logging_appender_options) if logging_devices.include?(:stdout)
|
data/lib/glimmer-dsl-swt.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) 2007-2021 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 'glimmer/dsl/static_expression'
|
23
|
+
require 'glimmer/dsl/parent_expression'
|
24
|
+
require 'glimmer/swt/custom/animation'
|
25
|
+
|
26
|
+
module Glimmer
|
27
|
+
module DSL
|
28
|
+
module SWT
|
29
|
+
class AnimationExpression < StaticExpression
|
30
|
+
include ParentExpression
|
31
|
+
|
32
|
+
def interpret(parent, keyword, *args, &block)
|
33
|
+
Glimmer::SWT::Custom::Animation.new(parent)
|
34
|
+
end
|
35
|
+
|
36
|
+
def add_content(parent, &block)
|
37
|
+
super
|
38
|
+
parent.post_add_content
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/glimmer/dsl/swt/dsl.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -54,6 +54,7 @@ module Glimmer
|
|
54
54
|
block_property
|
55
55
|
widget
|
56
56
|
custom_widget
|
57
|
+
shape
|
57
58
|
]
|
58
59
|
)
|
59
60
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -22,6 +22,7 @@
|
|
22
22
|
require 'glimmer/dsl/expression'
|
23
23
|
require 'glimmer/dsl/top_level_expression'
|
24
24
|
require 'glimmer/swt/font_proxy'
|
25
|
+
require 'glimmer/swt/custom/shape'
|
25
26
|
|
26
27
|
module Glimmer
|
27
28
|
module DSL
|
@@ -32,9 +33,10 @@ module Glimmer
|
|
32
33
|
include TopLevelExpression
|
33
34
|
|
34
35
|
def can_interpret?(parent, keyword, *args, &block)
|
35
|
-
keyword.to_s == 'font' and
|
36
|
+
keyword.to_s == 'font' and
|
36
37
|
(parent.nil? || !parent.respond_to?('font')) and
|
37
|
-
|
38
|
+
!parent.is_a?(Glimmer::SWT::Custom::Shape) and
|
39
|
+
args.size == 1 and
|
38
40
|
args.first.is_a?(Hash)
|
39
41
|
end
|
40
42
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -30,7 +30,8 @@ module Glimmer
|
|
30
30
|
args.size > 0 and
|
31
31
|
parent.respond_to?(:set_attribute) and
|
32
32
|
parent.respond_to?(:has_attribute?) and
|
33
|
-
parent.has_attribute?(keyword, *args)
|
33
|
+
parent.has_attribute?(keyword, *args) and
|
34
|
+
!(parent.respond_to?(:swt_widget) && parent.swt_widget.class == org.eclipse.swt.widgets.Canvas && keyword == 'image')
|
34
35
|
end
|
35
36
|
|
36
37
|
def interpret(parent, keyword, *args, &block)
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Copyright (c) 2007-2021 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 'glimmer/dsl/expression'
|
23
|
+
require 'glimmer/dsl/parent_expression'
|
24
|
+
require 'glimmer/swt/swt_proxy'
|
25
|
+
require 'glimmer/swt/custom/shape'
|
26
|
+
|
27
|
+
module Glimmer
|
28
|
+
module DSL
|
29
|
+
module SWT
|
30
|
+
class ShapeExpression < Expression
|
31
|
+
include ParentExpression
|
32
|
+
|
33
|
+
def can_interpret?(parent, keyword, *args, &block)
|
34
|
+
(
|
35
|
+
(parent.respond_to?(:swt_widget) and parent.swt_widget.is_a?(org.eclipse.swt.graphics.Drawable)) or
|
36
|
+
(parent.respond_to?(:swt_display) and parent.swt_display.is_a?(org.eclipse.swt.graphics.Drawable))
|
37
|
+
) and
|
38
|
+
Glimmer::SWT::Custom::Shape.valid?(parent, keyword, *args, &block)
|
39
|
+
end
|
40
|
+
|
41
|
+
def interpret(parent, keyword, *args, &block)
|
42
|
+
Glimmer::SWT::Custom::Shape.new(parent, keyword, *args, &block)
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_content(parent, &block)
|
46
|
+
super
|
47
|
+
parent.post_add_content
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -32,9 +32,10 @@ module Glimmer
|
|
32
32
|
EXCLUDED_KEYWORDS = %w[shell display tab_item]
|
33
33
|
|
34
34
|
def can_interpret?(parent, keyword, *args, &block)
|
35
|
-
!EXCLUDED_KEYWORDS.include?(keyword)
|
36
|
-
parent.respond_to?(:swt_widget)
|
35
|
+
result = !EXCLUDED_KEYWORDS.include?(keyword) &&
|
36
|
+
parent.respond_to?(:swt_widget) && #TODO change to composite?(parent)
|
37
37
|
Glimmer::SWT::WidgetProxy.widget_exists?(keyword)
|
38
|
+
(keyword.to_s == 'text' && args.first.is_a?(String)) ? false : result
|
38
39
|
end
|
39
40
|
|
40
41
|
def interpret(parent, keyword, *args, &block)
|
@@ -47,8 +48,11 @@ module Glimmer
|
|
47
48
|
end
|
48
49
|
|
49
50
|
end
|
51
|
+
|
50
52
|
end
|
53
|
+
|
51
54
|
end
|
55
|
+
|
52
56
|
end
|
53
57
|
|
54
58
|
require 'glimmer/swt/widget_proxy'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -57,11 +57,11 @@ module Glimmer
|
|
57
57
|
lines = `gem search -d #{gem_prefix}`.split("\n")
|
58
58
|
gems = lines.slice_before {|l| l.match(REGEX_GEM_LINE) }.to_a
|
59
59
|
gems = gems.map do |gem|
|
60
|
-
{
|
60
|
+
{
|
61
61
|
name: gem[0].match(REGEX_GEM_LINE)[1],
|
62
62
|
version: gem[0].match(REGEX_GEM_LINE)[2],
|
63
63
|
author: gem[1].strip,
|
64
|
-
description: gem[4..-1]
|
64
|
+
description: gem[4..-1]&.map(&:strip)&.join(' ').to_s
|
65
65
|
}
|
66
66
|
end.select do |gem|
|
67
67
|
query.nil? || "#{gem[:name]} #{gem[:author]} #{gem[:description]}".downcase.include?(query.to_s.downcase)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -27,7 +27,7 @@ module Glimmer
|
|
27
27
|
module Package
|
28
28
|
class << self
|
29
29
|
attr_accessor :javapackager_extra_args
|
30
|
-
alias jpackage_extra_args
|
30
|
+
alias jpackage_extra_args javapackager_extra_args
|
31
31
|
|
32
32
|
def clean
|
33
33
|
require 'fileutils'
|
@@ -48,7 +48,7 @@ module Glimmer
|
|
48
48
|
FileUtils.mkdir_p('vendor/jars')
|
49
49
|
command = "lock_jars --vendor-dir vendor/jars"
|
50
50
|
puts command
|
51
|
-
system command
|
51
|
+
system command
|
52
52
|
end
|
53
53
|
|
54
54
|
def config
|
@@ -78,18 +78,18 @@ module Glimmer
|
|
78
78
|
else
|
79
79
|
puts 'Warbler executable "warble" is missing!'
|
80
80
|
end
|
81
|
-
end
|
81
|
+
end
|
82
82
|
end
|
83
83
|
|
84
84
|
def jar
|
85
85
|
FileUtils.mkdir_p('dist')
|
86
86
|
puts "Generating JAR with Warbler..."
|
87
87
|
system "jruby -S gem install warbler -v2.0.5 --no-document" unless warbler_exists?
|
88
|
-
system('warble')
|
88
|
+
system('warble')
|
89
89
|
end
|
90
90
|
|
91
91
|
def native(native_type=nil, native_extra_args)
|
92
|
-
puts "Generating native executable with javapackager/jpackage..."
|
92
|
+
puts "Generating native executable with javapackager/jpackage..."
|
93
93
|
java_version = `java -version`
|
94
94
|
puts "WARNING! Glimmer Packaging Pre-Requisite Java Version 1.8.0_241 Is Not Found!" unless java_version.include?('1.8.0_241')
|
95
95
|
require 'facets/string/titlecase'
|
@@ -125,7 +125,7 @@ module Glimmer
|
|
125
125
|
command += " #{ENV['JAVAPACKAGER_EXTRA_ARGS']} " if ENV['JAVAPACKAGER_EXTRA_ARGS']
|
126
126
|
command += " #{native_extra_args} " if native_extra_args
|
127
127
|
puts command
|
128
|
-
system command
|
128
|
+
system command
|
129
129
|
end
|
130
130
|
|
131
131
|
private
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -113,7 +113,6 @@ module Glimmer
|
|
113
113
|
|
114
114
|
group :development do
|
115
115
|
gem 'rspec', '~> 3.5.0'
|
116
|
-
gem 'git-glimmer', '1.7.0'
|
117
116
|
gem 'juwelier', '2.4.9'
|
118
117
|
gem 'warbler', '2.0.5'
|
119
118
|
gem 'simplecov', '>= 0'
|
@@ -133,12 +132,12 @@ module Glimmer
|
|
133
132
|
gem_summary = human_name(app_name)
|
134
133
|
return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
|
135
134
|
system "jruby -S gem install juwelier -v2.4.9 --no-document" unless juwelier_exists?
|
136
|
-
system "jruby -
|
135
|
+
system "jruby -S juwelier --markdown --rspec --summary '#{gem_summary}' --description '#{gem_summary}' #{gem_name}"
|
137
136
|
return puts('Your Git user.name and/or github.user are missing! Please add in for Juwelier to help Glimmer with Scaffolding.') if `git config --get github.user`.strip.empty? && `git config --get user.name`.strip.empty?
|
138
137
|
cd gem_name
|
139
138
|
rm_rf 'lib'
|
140
139
|
write '.gitignore', GITIGNORE
|
141
|
-
write '.ruby-version', RUBY_VERSION
|
140
|
+
write '.ruby-version', RUBY_VERSION
|
142
141
|
write '.ruby-gemset', app_name
|
143
142
|
write 'VERSION', '1.0.0'
|
144
143
|
write 'LICENSE.txt', "Copyright (c) #{Time.now.year} #{app_name}"
|
@@ -178,7 +177,7 @@ module Glimmer
|
|
178
177
|
system "bundle"
|
179
178
|
system "rspec --init"
|
180
179
|
else
|
181
|
-
system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n rspec --init\n'"
|
180
|
+
system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n rspec --init\n'"
|
182
181
|
end
|
183
182
|
write 'spec/spec_helper.rb', spec_helper_file
|
184
183
|
if OS.windows?
|
@@ -191,7 +190,7 @@ module Glimmer
|
|
191
190
|
else
|
192
191
|
system "glimmer run"
|
193
192
|
end
|
194
|
-
end
|
193
|
+
end
|
195
194
|
end
|
196
195
|
|
197
196
|
def custom_shell(custom_shell_name, namespace, shell_type = nil, shell_options = {})
|
@@ -231,11 +230,11 @@ module Glimmer
|
|
231
230
|
end
|
232
231
|
return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
|
233
232
|
system "jruby -S gem install juwelier -v2.4.9 --no-document" unless juwelier_exists?
|
234
|
-
system "jruby -
|
233
|
+
system "jruby -S juwelier --markdown --rspec --summary '#{gem_summary}' --description '#{gem_summary}' #{gem_name}"
|
235
234
|
return puts('Your Git user.name and/or github.user are missing! Please add in for Juwelier to help Glimmer with Scaffolding.') if `git config --get github.user`.strip.empty? && `git config --get user.name`.strip.empty?
|
236
235
|
cd gem_name
|
237
236
|
write '.gitignore', GITIGNORE
|
238
|
-
write '.ruby-version', RUBY_VERSION
|
237
|
+
write '.ruby-version', RUBY_VERSION
|
239
238
|
write '.ruby-gemset', gem_name
|
240
239
|
write 'VERSION', '1.0.0'
|
241
240
|
write 'Gemfile', GEMFILE
|
@@ -256,7 +255,7 @@ module Glimmer
|
|
256
255
|
system "rspec --init"
|
257
256
|
else
|
258
257
|
system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n rspec --init\n'"
|
259
|
-
end
|
258
|
+
end
|
260
259
|
write 'spec/spec_helper.rb', spec_helper_file
|
261
260
|
|
262
261
|
mkdir_p 'package/windows'
|
@@ -283,7 +282,7 @@ module Glimmer
|
|
283
282
|
system "open packages/bundles/#{human_name(custom_shell_name).gsub(' ', '\ ')}.app" if OS.mac?
|
284
283
|
else
|
285
284
|
system "glimmer run"
|
286
|
-
end
|
285
|
+
end
|
287
286
|
end
|
288
287
|
puts "Finished creating #{gem_name} Ruby gem."
|
289
288
|
puts 'Edit Rakefile to configure gem details.'
|
@@ -305,11 +304,11 @@ module Glimmer
|
|
305
304
|
|
306
305
|
return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
|
307
306
|
system "jruby -S gem install juwelier -v2.4.9 --no-document" unless juwelier_exists?
|
308
|
-
system "jruby -
|
307
|
+
system "jruby -S juwelier --markdown --rspec --summary '#{gem_summary}' --description '#{gem_summary}' #{gem_name}"
|
309
308
|
return puts('Your Git user.name and/or github.user are missing! Please add in for Juwelier to help Glimmer with Scaffolding.') if `git config --get github.user`.strip.empty? && `git config --get user.name`.strip.empty?
|
310
309
|
cd gem_name
|
311
310
|
write '.gitignore', GITIGNORE
|
312
|
-
write '.ruby-version', RUBY_VERSION
|
311
|
+
write '.ruby-version', RUBY_VERSION
|
313
312
|
write '.ruby-gemset', gem_name
|
314
313
|
write 'VERSION', '1.0.0'
|
315
314
|
write 'Gemfile', GEMFILE
|
@@ -397,9 +396,9 @@ module Glimmer
|
|
397
396
|
class #{class_name(app_name)}
|
398
397
|
include Glimmer
|
399
398
|
|
400
|
-
APP_ROOT = File.expand_path('../..', __FILE__)
|
399
|
+
APP_ROOT = File.expand_path('../..', __FILE__)
|
401
400
|
VERSION = File.read(File.join(APP_ROOT, 'VERSION'))
|
402
|
-
LICENSE = File.read(File.join(APP_ROOT, 'LICENSE.txt'))
|
401
|
+
LICENSE = File.read(File.join(APP_ROOT, 'LICENSE.txt'))
|
403
402
|
|
404
403
|
def open
|
405
404
|
app_view.open
|
@@ -443,7 +442,7 @@ module Glimmer
|
|
443
442
|
|
444
443
|
launcher = Glimmer::Launcher.new([runner] + ARGV)
|
445
444
|
launcher.launch
|
446
|
-
end
|
445
|
+
end
|
447
446
|
MULTI_LINE_STRING
|
448
447
|
end
|
449
448
|
|
@@ -482,7 +481,7 @@ module Glimmer
|
|
482
481
|
|
483
482
|
launcher = Glimmer::Launcher.new([runner] + ARGV)
|
484
483
|
launcher.launch
|
485
|
-
end
|
484
|
+
end
|
486
485
|
MULTI_LINE_STRING
|
487
486
|
end
|
488
487
|
|
@@ -502,15 +501,15 @@ module Glimmer
|
|
502
501
|
end
|
503
502
|
spec_pattern_line_index = lines.index(lines.detect {|l| l.include?('spec.pattern =') })
|
504
503
|
lines.insert(spec_pattern_line_index+1, " spec.ruby_opts = [Glimmer::Launcher.jruby_os_specific_options]")
|
505
|
-
lines << "\nrequire 'glimmer/rake_task'\n"
|
504
|
+
lines << "\nrequire 'glimmer/rake_task'\n"
|
506
505
|
file_content = lines.join("\n")
|
507
506
|
if custom_shell_name
|
508
|
-
file_content << <<~MULTI_LINE_STRING
|
507
|
+
file_content << <<~MULTI_LINE_STRING
|
509
508
|
Glimmer::RakeTask::Package.javapackager_extra_args =
|
510
509
|
" -name '#{human_name(custom_shell_name)}'" +
|
511
510
|
" -title '#{human_name(custom_shell_name)}'" +
|
512
511
|
" -Bmac.CFBundleName='#{human_name(custom_shell_name)}'" +
|
513
|
-
" -Bmac.CFBundleIdentifier='org.#{namespace ? compact_name(namespace) : compact_name(custom_shell_name)}.application.#{compact_name(custom_shell_name).camelcase(:upper)}'"
|
512
|
+
" -Bmac.CFBundleIdentifier='org.#{namespace ? compact_name(namespace) : compact_name(custom_shell_name)}.application.#{compact_name(custom_shell_name).camelcase(:upper)}'"
|
514
513
|
# " -BlicenseType=" +
|
515
514
|
# " -Bmac.category=" +
|
516
515
|
# " -Bmac.signing-key-developer-id-app="
|
@@ -575,8 +574,8 @@ module Glimmer
|
|
575
574
|
if %i[gem app desktopify].include?(shell_type)
|
576
575
|
custom_shell_file_content += <<-MULTI_LINE_STRING
|
577
576
|
before_body {
|
578
|
-
Display.
|
579
|
-
Display.
|
577
|
+
Display.app_name = '#{shell_type == :gem ? human_name(custom_shell_name) : human_name(namespace)}'
|
578
|
+
Display.app_version = VERSION
|
580
579
|
@display = display {
|
581
580
|
on_about {
|
582
581
|
display_about_dialog
|
@@ -600,7 +599,7 @@ module Glimmer
|
|
600
599
|
## Use after_body block to setup observers for widgets in body
|
601
600
|
#
|
602
601
|
# after_body {
|
603
|
-
#
|
602
|
+
#
|
604
603
|
# }
|
605
604
|
|
606
605
|
## Add widget content inside custom shell body
|
@@ -616,10 +615,10 @@ module Glimmer
|
|
616
615
|
MULTI_LINE_STRING
|
617
616
|
|
618
617
|
if shell_type == :desktopify
|
619
|
-
custom_shell_file_content += <<-MULTI_LINE_STRING
|
618
|
+
custom_shell_file_content += <<-MULTI_LINE_STRING
|
620
619
|
browser {
|
621
|
-
url "#{shell_options[:website]}"
|
622
|
-
}
|
620
|
+
url "#{shell_options[:website]}"
|
621
|
+
}
|
623
622
|
MULTI_LINE_STRING
|
624
623
|
else
|
625
624
|
custom_shell_file_content += <<-MULTI_LINE_STRING
|
@@ -628,7 +627,7 @@ module Glimmer
|
|
628
627
|
text bind(self, :greeting)
|
629
628
|
font height: 40
|
630
629
|
layout_data :fill, :center, true, true
|
631
|
-
}
|
630
|
+
}
|
632
631
|
MULTI_LINE_STRING
|
633
632
|
end
|
634
633
|
|
@@ -690,7 +689,7 @@ module Glimmer
|
|
690
689
|
text 'Greeting'
|
691
690
|
font style: :bold
|
692
691
|
[
|
693
|
-
'Hello, World!',
|
692
|
+
'Hello, World!',
|
694
693
|
'Howdy, Partner!'
|
695
694
|
].each do |greeting_text|
|
696
695
|
button(:radio) {
|
@@ -733,19 +732,19 @@ module Glimmer
|
|
733
732
|
#
|
734
733
|
#
|
735
734
|
# before_body {
|
736
|
-
#
|
735
|
+
#
|
737
736
|
# }
|
738
737
|
|
739
738
|
## Use after_body block to setup observers for widgets in body
|
740
739
|
#
|
741
740
|
# after_body {
|
742
|
-
#
|
741
|
+
#
|
743
742
|
# }
|
744
743
|
|
745
744
|
## Add widget content under custom widget body
|
746
745
|
##
|
747
|
-
## If you want to add a shell as the top-most widget,
|
748
|
-
## consider creating a custom shell instead
|
746
|
+
## If you want to add a shell as the top-most widget,
|
747
|
+
## consider creating a custom shell instead
|
749
748
|
## (Glimmer::UI::CustomShell offers shell convenience methods, like show and hide)
|
750
749
|
#
|
751
750
|
body {
|