glimmer-dsl-swt 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c023dda45b9c92e69ef9a44ef07fde1f45f5161284cf1b46b70d15a661b3ccc
4
- data.tar.gz: 77be63700930812f4da66669003df863d77a1644495e2d37b776e97a5e5f145b
3
+ metadata.gz: 470667c11a2cadd8113d2067cffbf7db92647712dab8367a5b71ce0cbb990c02
4
+ data.tar.gz: 634143f2c4adbe46aeb5b09cbf373b20d1e513584fbfc405ceb5d74212d7ffd1
5
5
  SHA512:
6
- metadata.gz: ce300717322a9a905a67c589bf1a9398adcd09abf33421283c5d3265ed68b8ce4dbdf25ac33a37812de355c00ba027d7fe33ce284a9c2eb2932817087130a281
7
- data.tar.gz: 353b5a6f43cf7d070ae9a2f775ea2430a4eda54bf346210a8ca5e1ee899a35c44f639fbca3e2cd5338aa73c3f1c9b97209c84ea669c436f36f4ce31a0bf9b1b8
6
+ metadata.gz: cbe32cbaf2d2f2bc7670a982abbaac8c490f41b307a2500b08158aa30bc775425d29be576411ef9618e0a3c9cc1118913f2017b4374c90e70fb196dd76beff95
7
+ data.tar.gz: 6656c29c0221adc159007c3e8f728e355d8d5cb8dbe193d049e5e24d4da0b53c30525e2ee79fc5b303be3d0e2787bc890321d0b83ca0d1783052f680e3f3fefd
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 0.6.0 (Desktop GUI)
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 0.6.1 (Desktop GUI)
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
3
3
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer-dsl-swt/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer-dsl-swt?branch=master)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
Binary file
@@ -110,7 +110,7 @@ module Glimmer
110
110
  end
111
111
  command = "#{env_vars_string} jruby #{jruby_options_string}#{jruby_os_specific_options} #{devmode_require}-r #{the_glimmer_lib} -S #{application}"
112
112
  puts command if jruby_options_string.to_s.include?('--debug')
113
- system command
113
+ exec command
114
114
  end
115
115
  end
116
116
  end
@@ -41,7 +41,15 @@ module Glimmer
41
41
  system('warble')
42
42
  end
43
43
 
44
- def native
44
+ def lock_jars
45
+ puts 'Locking JARs with jar-dependencies...'
46
+ command = "lock_jars --vendor-dir vendor"
47
+ puts command
48
+ system command
49
+ end
50
+
51
+ def native(native_type=nil)
52
+ puts "Generating native executable with javapackager..."
45
53
  require 'facets/string/titlecase'
46
54
  require 'facets/string/underscore'
47
55
  project_name = File.basename(File.expand_path('.'))
@@ -51,14 +59,13 @@ module Glimmer
51
59
  license = (File.read(license_file).strip if File.exists?(license_file) && File.file?(license_file)) rescue nil
52
60
  copyright = license.split("\n").first
53
61
  human_name = project_name.underscore.titlecase
54
- command = "javapackager -deploy -native -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}\" -BsystemWide=#{OS.mac?} "
62
+ 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}\" -BsystemWide=#{OS.mac?} "
55
63
  command += " -BjvmOptions=-XstartOnFirstThread " if OS.mac?
56
64
  command += " -BappVersion=#{version} -Bmac.CFBundleVersion=#{version} " if version
57
65
  command += " -srcfiles LICENSE.txt -BlicenseFile=LICENSE.txt " if license
58
66
  command += " -Bcopyright=\"#{copyright}\" " if copyright
59
67
  command += " #{javapackager_extra_args} " if javapackager_extra_args
60
68
  command += " #{ENV['JAVAPACKAGER_EXTRA_ARGS']} " if ENV['JAVAPACKAGER_EXTRA_ARGS']
61
- puts "Generating DMG/PKG/APP/JNLP with javapackager..."
62
69
  puts command
63
70
  system command
64
71
  end
@@ -19,17 +19,24 @@ namespace :glimmer do
19
19
  Glimmer::Package.jar
20
20
  end
21
21
 
22
- desc 'Generate Native files (DMG/PKG/APP on the Mac, EXE on Windows, RPM/DEB on Linux)'
23
- task :native do
24
- Glimmer::Package.native
22
+ desc 'Lock JARs'
23
+ task :lock_jars do
24
+ Glimmer::Package.lock_jars
25
+ end
26
+
27
+ desc 'Generate Native files (DMG/PKG/APP on the Mac, MSI/EXE/IMAGE on Windows, RPM/DEB on Linux) (type is optional)'
28
+ task :native, [:type] do |t, args|
29
+ Glimmer::Package.native(args[:type])
25
30
  end
26
31
  end
27
32
 
28
- desc 'Package app for distribution (generating config, jar, and native files)'
29
- task :package do
33
+ desc 'Package app for distribution (generating config, jar, and native files) (type is optional)'
34
+ task :package, [:type] do |t, args|
30
35
  Rake::Task['glimmer:package:config'].execute
31
36
  Rake::Task['glimmer:package:jar'].execute
32
- Rake::Task['glimmer:package:native'].execute
37
+ Rake::Task['glimmer:package:lock_jars'].execute
38
+ Rake::Task['gemspec:generate'].execute
39
+ Rake::Task['glimmer:package:native'].execute(args)
33
40
  end
34
41
 
35
42
 
@@ -76,21 +76,7 @@ class Scaffold
76
76
  packages
77
77
  MULTI_LINE_STRING
78
78
 
79
- GEMFILE_APP = <<~MULTI_LINE_STRING
80
- # frozen_string_literal: true
81
-
82
- source 'https://rubygems.org'
83
-
84
- git_source(:github) {|repo_name| "https://github.com/\#{repo_name}" }
85
-
86
- gem 'glimmer-dsl-swt', '~> #{VERSION}'
87
-
88
- group :test do
89
- gem 'rspec'
90
- end
91
- MULTI_LINE_STRING
92
-
93
- GEMFILE_GEM = <<~MULTI_LINE_STRING
79
+ GEMFILE = <<~MULTI_LINE_STRING
94
80
  # frozen_string_literal: true
95
81
 
96
82
  source 'https://rubygems.org'
@@ -101,24 +87,12 @@ class Scaffold
101
87
 
102
88
  group :development do
103
89
  gem 'rspec', '~> 3.5.0'
90
+ gem 'git-glimmer', '1.7.0'
104
91
  gem 'jeweler', '2.3.9'
105
92
  gem 'simplecov', '>= 0'
106
93
  end
107
94
  MULTI_LINE_STRING
108
95
 
109
- RAKEFILE = <<~MULTI_LINE_STRING
110
- require 'glimmer/rake_task'
111
-
112
- ## Use the following configuration if you would like to customize javapackager
113
- ## arguments for `glimmer package` command.
114
- #
115
- # Glimmer::Package.javapackager_extra_args =
116
- # " -BlicenseType=" +
117
- # " -Bmac.CFBundleIdentifier=" +
118
- # " -Bmac.category=" +
119
- # " -Bmac.signing-key-developer-id-app="
120
- MULTI_LINE_STRING
121
-
122
96
  RVM_FUNCTION = <<~MULTI_LINE_STRING
123
97
  # Load RVM into a shell session *as a function*
124
98
  if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
@@ -135,21 +109,30 @@ class Scaffold
135
109
  MULTI_LINE_STRING
136
110
 
137
111
  def app(app_name)
138
- mkdir app_name
139
- cd app_name
112
+ return puts('Namespace is required! Usage: glimmer scaffold:custom_shell_gem[custom_shell_name,namespace]') unless `git config --get github.user`.to_s.strip == 'AndyObtiva'
113
+ gem_name = file_name(app_name)
114
+ gem_summary = human_name(app_name)
115
+ system "jruby -r git-glimmer -S jeweler --rspec --summary '#{gem_summary}' --description '#{gem_summary}' #{gem_name}"
116
+ cd gem_name
117
+ rm_rf 'lib'
140
118
  write '.gitignore', GITIGNORE
141
119
  write '.ruby-version', RUBY_VERSION
142
120
  write '.ruby-gemset', app_name
143
121
  write 'VERSION', '1.0.0'
144
122
  write 'LICENSE.txt', "Copyright (c) #{Time.now.year} #{app_name}"
145
- write 'Gemfile', GEMFILE_APP
146
- write 'Rakefile', RAKEFILE
123
+ write 'Gemfile', GEMFILE
124
+ write 'Rakefile', gem_rakefile(app_name, nil, gem_name)
147
125
  mkdir 'app'
148
126
  write "app/#{file_name(app_name)}.rb", app_main_file(app_name)
149
127
  mkdir 'app/models'
150
128
  mkdir 'app/views'
151
129
  custom_shell('AppView', current_dir_name, :app)
152
- if OS.mac?
130
+ if OS::Underlying.windows?
131
+ mkdir_p 'package/windows'
132
+ icon_file = "package/windows/#{human_name(app_name)}.ico"
133
+ cp File.expand_path('../../../icons/scaffold_app.ico', __FILE__), icon_file
134
+ puts "Created #{current_dir_name}/#{icon_file}"
135
+ elsif OS.mac?
153
136
  mkdir_p 'package/macosx'
154
137
  icon_file = "package/macosx/#{human_name(app_name)}.icns"
155
138
  cp File.expand_path('../../../icons/scaffold_app.icns', __FILE__), icon_file
@@ -157,8 +140,15 @@ class Scaffold
157
140
  end
158
141
  mkdir 'bin'
159
142
  write "bin/#{file_name(app_name)}", app_bin_file(app_name)
160
- system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n glimmer package\n'"
161
- system "open packages/bundles/#{human_name(app_name).gsub(' ', '\ ')}.app"
143
+ write 'spec/spec_helper.rb', spec_helper_file
144
+ if OS.windows?
145
+ system "bundle"
146
+ system "glimmer package[image]"
147
+ system "\"packages/bundles/#{human_name(app_name)}/#{human_name(app_name)}.exe\""
148
+ else
149
+ system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n glimmer package\n'"
150
+ system "open packages/bundles/#{human_name(app_name).gsub(' ', '\ ')}.app" if OS.mac?
151
+ end
162
152
  # TODO generate rspec test suite
163
153
  end
164
154
 
@@ -188,13 +178,13 @@ class Scaffold
188
178
  else
189
179
  namespace = 'glimmer'
190
180
  end
191
- system "jeweler --rspec --summary '#{gem_summary}' --description '#{gem_summary}' #{gem_name}"
181
+ system "jruby -r git-glimmer -S jeweler --rspec --summary '#{gem_summary}' --description '#{gem_summary}' #{gem_name}"
192
182
  cd gem_name
193
183
  write '.gitignore', GITIGNORE
194
184
  write '.ruby-version', RUBY_VERSION
195
185
  write '.ruby-gemset', gem_name
196
186
  write 'VERSION', '1.0.0'
197
- write 'Gemfile', GEMFILE_GEM
187
+ write 'Gemfile', GEMFILE
198
188
  write 'Rakefile', gem_rakefile(custom_shell_name, namespace, gem_name)
199
189
  append "lib/#{gem_name}.rb", gem_main_file(custom_shell_name, namespace)
200
190
  mkdir 'lib/views'
@@ -203,14 +193,26 @@ class Scaffold
203
193
  write "bin/#{gem_name}", gem_bin_file(gem_name, custom_shell_name, namespace)
204
194
  write "bin/#{file_name(custom_shell_name)}", gem_bin_command_file(gem_name)
205
195
  FileUtils.chmod 0755, "bin/#{file_name(custom_shell_name)}"
206
- if OS.mac?
196
+ write 'spec/spec_helper.rb', spec_helper_file
197
+ if OS::Underlying.windows?
198
+ mkdir_p 'package/windows'
199
+ icon_file = "package/windows/#{human_name(custom_shell_name)}.ico"
200
+ cp File.expand_path('../../../icons/scaffold_app.ico', __FILE__), icon_file
201
+ puts "Created #{current_dir_name}/#{icon_file}"
202
+ elsif OS.mac?
207
203
  mkdir_p 'package/macosx'
208
204
  icon_file = "package/macosx/#{human_name(custom_shell_name)}.icns"
209
205
  cp File.expand_path('../../../icons/scaffold_app.icns', __FILE__), icon_file
210
206
  puts "Created #{current_dir_name}/#{icon_file}"
211
207
  end
212
- system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n glimmer package\n'"
213
- system "open packages/bundles/#{human_name(custom_shell_name).gsub(' ', '\ ')}.app"
208
+ if OS.windows?
209
+ system "bundle"
210
+ system "glimmer package[image]"
211
+ system "\"packages/bundles/#{human_name(custom_shell_name)}/#{human_name(custom_shell_name)}.exe\""
212
+ else
213
+ system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n glimmer package\n'"
214
+ system "open packages/bundles/#{human_name(custom_shell_name).gsub(' ', '\ ')}.app" if OS.mac?
215
+ end
214
216
  puts "Finished creating #{gem_name} Ruby gem."
215
217
  puts 'Edit Rakefile to configure gem details.'
216
218
  puts 'Run `rake` to execute specs.'
@@ -228,19 +230,23 @@ class Scaffold
228
230
  else
229
231
  namespace = 'glimmer'
230
232
  end
231
- system "jeweler --rspec --summary '#{gem_summary}' --description '#{gem_summary}' #{gem_name}"
233
+ system "jruby -r git-glimmer -S jeweler --rspec --summary '#{gem_summary}' --description '#{gem_summary}' #{gem_name}"
232
234
  cd gem_name
233
235
  write '.gitignore', GITIGNORE
234
236
  write '.ruby-version', RUBY_VERSION
235
237
  write '.ruby-gemset', gem_name
236
238
  write 'VERSION', '1.0.0'
237
- write 'Gemfile', GEMFILE_GEM
239
+ write 'Gemfile', GEMFILE
238
240
  write 'Rakefile', gem_rakefile
239
241
  write 'spec/spec_helper.rb', spec_helper_file
240
242
  append "lib/#{gem_name}.rb", gem_main_file(custom_widget_name, namespace)
241
243
  mkdir 'lib/views'
242
244
  custom_widget(custom_widget_name, namespace)
243
- system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n'"
245
+ if OS.windows?
246
+ system "bundle"
247
+ else
248
+ system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n'"
249
+ end
244
250
  puts "Finished creating #{gem_name} Ruby gem."
245
251
  puts 'Edit Rakefile to configure gem details.'
246
252
  puts 'Run `rake` to execute specs.'
@@ -355,10 +361,11 @@ class Scaffold
355
361
  lines.insert(require_rake_line_index, "require 'glimmer/launcher'")
356
362
  gem_files_line_index = lines.index(lines.detect {|l| l.include?('# dependencies defined in Gemfile') })
357
363
  if custom_shell_name
358
- lines.insert(gem_files_line_index, " gem.files = Dir['VERSION', 'LICENSE.txt', 'lib/**/*.rb', 'bin/**/*']")
364
+ lines.insert(gem_files_line_index, " gem.files = Dir['VERSION', 'LICENSE.txt', 'lib/**/*', 'app/**/*', 'bin/**/*', 'vendor/**/*', 'package/**/*']")
359
365
  lines.insert(gem_files_line_index+1, " gem.executables = ['#{gem_name}', '#{file_name(custom_shell_name)}']")
366
+ lines.insert(gem_files_line_index+2, " gem.require_paths = ['vendor', 'lib', 'app']")
360
367
  else
361
- lines.insert(gem_files_line_index, " gem.files = Dir['lib/**/*.rb']")
368
+ lines.insert(gem_files_line_index, " gem.files = Dir['VERSION', 'LICENSE.txt', 'lib/**/*']")
362
369
  end
363
370
  spec_pattern_line_index = lines.index(lines.detect {|l| l.include?('spec.pattern =') })
364
371
  lines.insert(spec_pattern_line_index+1, " spec.ruby_opts = [Glimmer::Launcher.jruby_swt_options]")
@@ -383,7 +390,7 @@ class Scaffold
383
390
  content = File.read('spec/spec_helper.rb')
384
391
  lines = content.split("\n")
385
392
  require_line_index = lines.index(lines.detect {|l| l.include?(current_dir_name) })
386
- lines[require_line_index...require_line_index] = [
393
+ lines[require_line_index..require_line_index] = [
387
394
  "require 'bundler/setup'",
388
395
  'Bundler.require(:default, :development)',
389
396
  ]
@@ -412,9 +419,9 @@ class Scaffold
412
419
 
413
420
  if shell_type == :gem
414
421
  custom_shell_file_content += <<-MULTI_LINE_STRING
415
- GEM_ROOT = File.expand_path('../../../..', __FILE__)
416
- VERSION = File.read(File.join(GEM_ROOT, 'VERSION'))
417
- LICENSE = File.read(File.join(GEM_ROOT, 'LICENSE.txt'))
422
+ APP_ROOT = File.expand_path('../../../..', __FILE__)
423
+ VERSION = File.read(File.join(APP_ROOT, 'VERSION'))
424
+ LICENSE = File.read(File.join(APP_ROOT, 'LICENSE.txt'))
418
425
 
419
426
  MULTI_LINE_STRING
420
427
  end
@@ -470,6 +477,7 @@ class Scaffold
470
477
  shell {
471
478
  # Replace example content below with custom shell content
472
479
  minimum_size 320, 240
480
+ image File.join(APP_ROOT, 'package', 'windows', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.ico") if OS.windows?
473
481
  text "#{human_name(namespace)} - #{human_name(custom_shell_name)}"
474
482
  grid_layout
475
483
  label(:center) {
@@ -477,6 +485,17 @@ class Scaffold
477
485
  font height: 40
478
486
  layout_data :fill, :center, true, true
479
487
  }
488
+ menu_bar {
489
+ menu {
490
+ text '&File'
491
+ menu_item {
492
+ text 'Preferences...'
493
+ on_widget_selected {
494
+ display_preferences_dialog
495
+ }
496
+ }
497
+ }
498
+ }
480
499
  }
481
500
  }
482
501
  MULTI_LINE_STRING
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-04 00:00:00.000000000 Z
11
+ date: 2020-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.9.0
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '='
73
+ - !ruby/object:Gem::Version
74
+ version: 1.7.0
75
+ name: git-glimmer
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.7.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  requirement: !ruby/object:Gem::Requirement
71
85
  requirements:
@@ -294,6 +308,7 @@ files:
294
308
  - bin/girb_runner.rb
295
309
  - bin/glimmer
296
310
  - icons/scaffold_app.icns
311
+ - icons/scaffold_app.ico
297
312
  - lib/ext/glimmer.rb
298
313
  - lib/ext/glimmer/config.rb
299
314
  - lib/glimmer-dsl-swt.rb