glimmer 0.7.6 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -19
- data/VERSION +1 -1
- data/lib/glimmer/scaffold.rb +49 -13
- metadata +2 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76d86f5e3e322edba85aee815e28a0bb19b6ed56694ff44b1311a759b249b189
|
4
|
+
data.tar.gz: ad84ddf98c7a9da150f1dd4897e7a7df0e7d8cf06d317a1a748929c1446895ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbbd46186a07700fed156566a5a0de4fb5ad90720ae2e24eb0662bc1ef3a64850f29d4f91fa577f388136511e3ec20689a97e1686e25f34112fabf35c05c2981
|
7
|
+
data.tar.gz: f484803847e17525090f815ea117d429f10abc87f12a5c38343c9d6e2f56ff6bf055b153f5fa3f250ae60adde2b5ff4cba7b209b0b1693bc98d0f619cc1d15db
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
# Glimmer 0.7.
|
1
|
+
# Glimmer 0.7.7 Beta (Desktop Development Library for Ruby)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
|
3
3
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer)
|
4
|
-
|
4
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/38fbc278022862794414/test_coverage)](https://codeclimate.com/github/AndyObtiva/glimmer/test_coverage)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/38fbc278022862794414/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer/maintainability)
|
5
6
|
|
6
|
-
Glimmer is a native-
|
7
|
+
Glimmer is a native-GUI cross-platform desktop development library written in Ruby. Glimmer's main innovation is a JRuby DSL that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support to greatly facilitate synchronizing the GUI with domain models. As a result, that achieves true decoupling of object oriented components, enabling developers to solve business problems without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models test-first afterwards.
|
7
8
|
|
8
9
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
9
10
|
Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do)
|
@@ -74,7 +75,7 @@ NOTE: Glimmer is in beta mode. Please help make better by adopting for small or
|
|
74
75
|
|
75
76
|
## Table of Contents
|
76
77
|
|
77
|
-
- [Glimmer 0.7.
|
78
|
+
- [Glimmer 0.7.7 Beta (Desktop Development Library for Ruby)](#glimmer-075-beta-desktop-development-library-for-ruby)
|
78
79
|
- [Examples](#examples)
|
79
80
|
- [Hello, World!](#hello-world)
|
80
81
|
- [Tic Tac Toe](#tic-tac-toe)
|
@@ -125,6 +126,7 @@ NOTE: Glimmer is in beta mode. Please help make better by adopting for small or
|
|
125
126
|
- [Contributing](#contributing)
|
126
127
|
- [Contributors](#contributors)
|
127
128
|
- [License](#license)
|
129
|
+
|
128
130
|
## Background
|
129
131
|
|
130
132
|
Ruby is a dynamically-typed object-oriented language, which provides great productivity gains due to its powerful expressive syntax and dynamic nature. While it is proven by the Ruby on Rails framework for web development, it currently lacks a robust platform-independent framework for building desktop applications. Given that Java libraries can now be utilized in Ruby code through JRuby, Eclipse technologies, such as SWT, JFace, and RCP can help fill the gap of desktop application development with Ruby.
|
@@ -136,12 +138,12 @@ Glimmer runs on the following platforms:
|
|
136
138
|
- Windows
|
137
139
|
- Linux
|
138
140
|
|
139
|
-
Glimmer's
|
141
|
+
Glimmer's GUI has the native look and feel of each operating system it runs on since it uses SWT behind the scenes, which leverages the following native libraries:
|
140
142
|
- Win32 on Windows
|
141
143
|
- Cocoa on Mac
|
142
144
|
- GTK on Linux
|
143
145
|
|
144
|
-
More info about the SWT
|
146
|
+
More info about the SWT GUI on various platforms can be found on the Eclipse WIKI and SWT FAQ:
|
145
147
|
|
146
148
|
https://wiki.eclipse.org/SWT/Devel/Gtk/Dev_guide#Win32.2FCocoa.2FGTK
|
147
149
|
https://www.eclipse.org/swt/faq.php
|
@@ -169,7 +171,7 @@ Please follow these instructions to make the `glimmer` command available on your
|
|
169
171
|
|
170
172
|
Run this command to install directly:
|
171
173
|
```
|
172
|
-
jgem install glimmer -v 0.7.
|
174
|
+
jgem install glimmer -v 0.7.7
|
173
175
|
```
|
174
176
|
|
175
177
|
`jgem` is JRuby's version of `gem` command.
|
@@ -180,7 +182,7 @@ Otherwise, you may also run `jruby -S gem install ...`
|
|
180
182
|
|
181
183
|
Add the following to `Gemfile`:
|
182
184
|
```
|
183
|
-
gem 'glimmer', '~> 0.7.
|
185
|
+
gem 'glimmer', '~> 0.7.7'
|
184
186
|
```
|
185
187
|
|
186
188
|
And, then run:
|
@@ -341,9 +343,11 @@ glimmer scaffold:custom_widget[custom_widget_name]
|
|
341
343
|
|
342
344
|
#### Custom Shell Gem
|
343
345
|
|
344
|
-
Custom shell gems are self-contained Glimmer apps as well as reusable custom shells.
|
346
|
+
Custom shell gems are self-contained Glimmer apps as well as reusable custom shells.
|
347
|
+
As such, they are packaged as both a native executable (e.g. Mac DMG/PKG/APP) and a Ruby gem.
|
348
|
+
Of course, you can build a Ruby gem and disregard its native executable packaging if you do not need it.
|
345
349
|
|
346
|
-
To scaffold a Glimmer custom shell gem (full window view
|
350
|
+
To scaffold a Glimmer custom shell gem (full window view distributed as a Ruby gem), run the following command:
|
347
351
|
|
348
352
|
```
|
349
353
|
glimmer scaffold:custom_shell_gem[custom_shell_name, namespace]
|
@@ -351,7 +355,7 @@ glimmer scaffold:custom_shell_gem[custom_shell_name, namespace]
|
|
351
355
|
|
352
356
|
It is important to specify a namespace to avoid having your gem clash with existing gems.
|
353
357
|
|
354
|
-
The Ruby gem name will follow the convention "glimmer-cs-customwidgetname-namespace" (the 'cs' is for Custom Shell)
|
358
|
+
The Ruby gem name will follow the convention "glimmer-cs-customwidgetname-namespace" (the 'cs' is for Custom Shell).
|
355
359
|
|
356
360
|
Only official Glimmer gems created by the Glimmer project committers will have no namespace (e.g. [glimmer-cs-gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) Ruby gem)
|
357
361
|
|
@@ -359,7 +363,7 @@ Example: [https://github.com/AndyObtiva/glimmer-cs-gladiator](https://github.com
|
|
359
363
|
|
360
364
|
#### Custom Widget Gem
|
361
365
|
|
362
|
-
To scaffold a Glimmer custom widget gem (part of a view
|
366
|
+
To scaffold a Glimmer custom widget gem (part of a view distributed as a Ruby gem), run the following command:
|
363
367
|
|
364
368
|
```
|
365
369
|
glimmer scaffold:custom_widget_gem[custom_widget_name, namespace]
|
@@ -409,7 +413,7 @@ You will learn more about widgets next.
|
|
409
413
|
|
410
414
|
### Widgets
|
411
415
|
|
412
|
-
Glimmer
|
416
|
+
Glimmer GUIs (user interfaces) are modeled with widgets, which are wrappers around the SWT library widgets found here:
|
413
417
|
|
414
418
|
https://www.eclipse.org/swt/widgets/
|
415
419
|
|
@@ -518,7 +522,7 @@ shell {
|
|
518
522
|
|
519
523
|
#### Display
|
520
524
|
|
521
|
-
SWT Display is a singleton in Glimmer. It is used in SWT to represent your display device, allowing you to manage
|
525
|
+
SWT Display is a singleton in Glimmer. It is used in SWT to represent your display device, allowing you to manage GUI globally
|
522
526
|
and access available monitors.
|
523
527
|
It is automatically instantiated upon first instantiation of a `shell` widget.
|
524
528
|
Alternatively, for advanced use cases, it can be created explicitly with Glimmer `display` keyword. When a `shell` is later declared, it
|
@@ -546,7 +550,7 @@ Glimmer follows Proxy Design Pattern by having Ruby proxy wrappers for all SWT o
|
|
546
550
|
- `Glimmer::SWT:TabItemProxy` wraps `org.eclipse.swt.widget.TabItem` (also adds a composite to enable adding content under tab items directly in Glimmer)
|
547
551
|
- `Glimmer::SWT:LayoutProxy` wraps all descendants of `org.eclipse.swt.widget.Layout`
|
548
552
|
- `Glimmer::SWT:LayoutDataProxy` wraps all layout data objects
|
549
|
-
- `Glimmer::SWT:DisplayProxy` wraps `org.eclipse.swt.widget.Display` (manages displaying
|
553
|
+
- `Glimmer::SWT:DisplayProxy` wraps `org.eclipse.swt.widget.Display` (manages displaying GUI)
|
550
554
|
- `Glimmer::SWT:ColorProxy` wraps `org.eclipse.swt.graphics.Color`
|
551
555
|
- `Glimmer::SWT:FontProxy` wraps `org.eclipse.swt.graphics.Font`
|
552
556
|
- `Glimmer::SWT::WidgetListenerProxy` wraps all widget listeners
|
@@ -1405,7 +1409,7 @@ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
|
1405
1409
|
|
1406
1410
|
The shell declared above has been modified so that the minimize button works just like the close button. Once you minimize the shell (iconify it), it closes.
|
1407
1411
|
|
1408
|
-
The alternative syntax can be helpful if you prefer to separate Glimmer observer declarations from Glimmer
|
1412
|
+
The alternative syntax can be helpful if you prefer to separate Glimmer observer declarations from Glimmer GUI declarations, or would like to add observers dynamically based on some logic later on.
|
1409
1413
|
|
1410
1414
|
#### Observing Models
|
1411
1415
|
|
@@ -1939,7 +1943,7 @@ This relies on Glimmer's [Multi-DSL Support](https://github.com/AndyObtiva/glimm
|
|
1939
1943
|
- Widget property declarations always have arguments and never take a block
|
1940
1944
|
- Widget property arguments are never wrapped inside parentheses
|
1941
1945
|
- Widget listeners are always declared starting with `on_` prefix and affixing listener event method name afterwards in underscored lowercase form
|
1942
|
-
- Widget listeners are always followed by a block using curly braces (Only when declared in DSL. When invoked on widget object directly outside of
|
1946
|
+
- Widget listeners are always followed by a block using curly braces (Only when declared in DSL. When invoked on widget object directly outside of GUI declarations, standard Ruby conventions apply)
|
1943
1947
|
- Data-binding is done via `bind` keyword, which always takes arguments wrapped in parentheses
|
1944
1948
|
- Custom widget body, before_body, and after_body blocks open their blocks and close them with curly braces.
|
1945
1949
|
- Custom widgets receive additional arguments to SWT style called options. These are passed as the last argument inside the parentheses, a hash of option names pointing to values.
|
@@ -2283,8 +2287,10 @@ These features have been suggested. You might see them in a future version of Gl
|
|
2283
2287
|
|
2284
2288
|
## Contributors
|
2285
2289
|
|
2286
|
-
* Andy Maleh (Founder)
|
2287
|
-
* Dennis Theisen
|
2290
|
+
* [Andy Maleh](https://github.com/AndyObtiva) (Founder)
|
2291
|
+
* [Dennis Theisen](https://github.com/Soleone) (Contributor)
|
2292
|
+
|
2293
|
+
[Click here to view contributor commits.](https://github.com/AndyObtiva/glimmer/graphs/contributors)
|
2288
2294
|
|
2289
2295
|
## License
|
2290
2296
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.7
|
data/lib/glimmer/scaffold.rb
CHANGED
@@ -77,7 +77,7 @@ class Scaffold
|
|
77
77
|
GEMFILE_APP = <<~MULTI_LINE_STRING
|
78
78
|
# frozen_string_literal: true
|
79
79
|
|
80
|
-
source
|
80
|
+
source 'https://rubygems.org'
|
81
81
|
|
82
82
|
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}" }
|
83
83
|
|
@@ -91,16 +91,16 @@ class Scaffold
|
|
91
91
|
GEMFILE_GEM = <<~MULTI_LINE_STRING
|
92
92
|
# frozen_string_literal: true
|
93
93
|
|
94
|
-
source
|
94
|
+
source 'https://rubygems.org'
|
95
95
|
|
96
96
|
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}" }
|
97
97
|
|
98
98
|
gem 'glimmer', '~> #{VERSION}'
|
99
99
|
|
100
100
|
group :development do
|
101
|
-
gem
|
102
|
-
gem
|
103
|
-
gem
|
101
|
+
gem 'rspec', '~> 3.5.0'
|
102
|
+
gem 'jeweler', '2.3.9'
|
103
|
+
gem 'simplecov', '>= 0'
|
104
104
|
end
|
105
105
|
MULTI_LINE_STRING
|
106
106
|
|
@@ -155,7 +155,7 @@ class Scaffold
|
|
155
155
|
end
|
156
156
|
mkdir 'bin'
|
157
157
|
write "bin/#{file_name(app_name)}", app_bin_file(app_name)
|
158
|
-
FileUtils.chmod 0755, "bin/#{app_name
|
158
|
+
FileUtils.chmod 0755, "bin/#{file_name(app_name)}"
|
159
159
|
system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n glimmer package\n'"
|
160
160
|
system "open packages/bundles/#{human_name(app_name).gsub(' ', '\ ')}.app"
|
161
161
|
# TODO generate rspec test suite
|
@@ -193,11 +193,21 @@ class Scaffold
|
|
193
193
|
write '.ruby-gemset', gem_name
|
194
194
|
write 'VERSION', '1.0.0'
|
195
195
|
write 'Gemfile', GEMFILE_GEM
|
196
|
-
write 'Rakefile', gem_rakefile
|
196
|
+
write 'Rakefile', gem_rakefile(custom_shell_name, namespace)
|
197
197
|
append "lib/#{gem_name}.rb", gem_main_file(custom_shell_name, namespace)
|
198
198
|
mkdir 'lib/views'
|
199
199
|
custom_shell(custom_shell_name, namespace)
|
200
|
-
|
200
|
+
mkdir 'bin'
|
201
|
+
write "bin/#{file_name(custom_shell_name)}", gem_bin_file(gem_name, custom_shell_name, namespace)
|
202
|
+
FileUtils.chmod 0755, "bin/#{file_name(custom_shell_name)}"
|
203
|
+
if OS.mac?
|
204
|
+
mkdir_p 'package/macosx'
|
205
|
+
icon_file = "package/macosx/#{human_name(custom_shell_name)}.icns"
|
206
|
+
cp File.expand_path('../../../icons/scaffold_app.icns', __FILE__), icon_file
|
207
|
+
puts "Created #{current_dir_name}/#{icon_file}"
|
208
|
+
end
|
209
|
+
system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n glimmer package\n'"
|
210
|
+
system "open packages/bundles/#{human_name(custom_shell_name).gsub(' ', '\ ')}.app"
|
201
211
|
puts "Finished creating #{gem_name} Ruby gem."
|
202
212
|
puts 'Edit Rakefile to configure gem details.'
|
203
213
|
puts 'Run `rake` to execute specs.'
|
@@ -253,19 +263,20 @@ class Scaffold
|
|
253
263
|
end
|
254
264
|
|
255
265
|
def class_name(app_name)
|
256
|
-
app_name.camelcase(:upper)
|
266
|
+
app_name.underscore.camelcase(:upper)
|
257
267
|
end
|
258
268
|
|
259
269
|
def file_name(app_name)
|
260
270
|
app_name.underscore
|
261
271
|
end
|
272
|
+
alias dsl_widget_name file_name
|
262
273
|
|
263
274
|
def human_name(app_name)
|
264
275
|
app_name.underscore.titlecase
|
265
276
|
end
|
266
277
|
|
267
278
|
def compact_name(gem_name)
|
268
|
-
gem_name.camelcase.downcase
|
279
|
+
gem_name.underscore.camelcase.downcase
|
269
280
|
end
|
270
281
|
|
271
282
|
def app_main_file(app_name)
|
@@ -312,7 +323,19 @@ class Scaffold
|
|
312
323
|
MULTI_LINE_STRING
|
313
324
|
end
|
314
325
|
|
315
|
-
def
|
326
|
+
def gem_bin_file(gem_name, custom_shell_name, namespace)
|
327
|
+
<<~MULTI_LINE_STRING
|
328
|
+
#!/usr/bin/env ruby
|
329
|
+
|
330
|
+
require_relative '../lib/#{gem_name}'
|
331
|
+
|
332
|
+
include Glimmer
|
333
|
+
|
334
|
+
#{dsl_widget_name(custom_shell_name)}.open
|
335
|
+
MULTI_LINE_STRING
|
336
|
+
end
|
337
|
+
|
338
|
+
def gem_rakefile(custom_shell_name = nil, namespace = nil)
|
316
339
|
rakefile_content = File.read('Rakefile')
|
317
340
|
lines = rakefile_content.split("\n")
|
318
341
|
require_rake_line_index = lines.index(lines.detect {|l| l.include?("require 'rake'") })
|
@@ -321,8 +344,21 @@ class Scaffold
|
|
321
344
|
lines.insert(gem_files_line_index, " gem.files = Dir['lib/**/*.rb']")
|
322
345
|
spec_pattern_line_index = lines.index(lines.detect {|l| l.include?('spec.pattern =') })
|
323
346
|
lines.insert(spec_pattern_line_index+1, " spec.ruby_opts = [Glimmer::Launcher.jruby_swt_options]")
|
324
|
-
lines << "\nrequire 'glimmer/rake_task'\n"
|
325
|
-
lines.join("\n")
|
347
|
+
lines << "\nrequire 'glimmer/rake_task'\n"
|
348
|
+
file_content = lines.join("\n")
|
349
|
+
if custom_shell_name
|
350
|
+
file_content << <<~MULTI_LINE_STRING
|
351
|
+
Glimmer::Package.javapackager_extra_args =
|
352
|
+
" -name '#{human_name(custom_shell_name)}'" +
|
353
|
+
" -title '#{human_name(custom_shell_name)}'" +
|
354
|
+
" -Bmac.CFBundleName='#{human_name(custom_shell_name)}'" +
|
355
|
+
" -Bmac.CFBundleIdentifier='org.#{namespace ? compact_name(namespace) : compact_name(custom_shell_name)}.application.#{compact_name(custom_shell_name)}'"
|
356
|
+
# " -BlicenseType=" +
|
357
|
+
# " -Bmac.category=" +
|
358
|
+
# " -Bmac.signing-key-developer-id-app="
|
359
|
+
MULTI_LINE_STRING
|
360
|
+
end
|
361
|
+
file_content
|
326
362
|
end
|
327
363
|
|
328
364
|
def spec_helper_file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,34 +150,6 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 3.5.0
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
requirement: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - '='
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: 0.8.5
|
159
|
-
name: coveralls
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - '='
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 0.8.5
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
requirement: !ruby/object:Gem::Requirement
|
169
|
-
requirements:
|
170
|
-
- - "~>"
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: 0.10.0
|
173
|
-
name: simplecov
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - "~>"
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: 0.10.0
|
181
153
|
- !ruby/object:Gem::Dependency
|
182
154
|
requirement: !ruby/object:Gem::Requirement
|
183
155
|
requirements:
|