glimmer-dsl-swt 0.6.7 → 0.6.8

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: eb75003a6ed29f05d26a63307423121409b114157a50df69501310a93fcb27fe
4
- data.tar.gz: 0e14fe3b080a81f4795a6a9703bd499aaa17e0e512034cf570560238bb5841ad
3
+ metadata.gz: 8f75e570d4a595c012b464d8dffa7149200385d8053dc39640d5be59d8f4980c
4
+ data.tar.gz: 1fbd61272f851ffa8aa1f6dbcf0afa57e898147c3982f69a180018a2d5d0e6c3
5
5
  SHA512:
6
- metadata.gz: ad51599c93c102b01c2a0756dbd030c705c85e7b4b2d2e2791d24a4281f01311fbddb155c08b13f6f58b3952d0340fd3403c3f47b7ec1348c86c95cf9a920fa0
7
- data.tar.gz: a2f25a0ad0c9557dc41b4cf1bbbef162946d6cd112379f261cf9f862663924aed1af2006ff8ea41b13c910eed386a94c46c009d1e5727e66b1907c22e7373244
6
+ metadata.gz: 3c78fc793f87813acaf59b2732a362fc37da683c79b2610dc7d9d74c37ddd56ee1ac5d33209ee509d2cc1a3c62a0fb5db56b8275d88a93b6c4d7e8c5906511b0
7
+ data.tar.gz: 90941e2906ecc6c87e6685f8c8ff62fda790a43c3af519761011cefa56466336e5705e8deb49e25eeef60020a7cf6ab65c19c7c3f1c1a0f325158053bcf778c4
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.7 (JRuby 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.8 (JRuby 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.7
1
+ 0.6.8
@@ -1,9 +1,5 @@
1
1
  #!/usr/bin/env jruby
2
2
 
3
- if ARGV.empty?
4
- require 'rake-tui'
5
- require 'tty-screen'
6
- end
7
3
  require_relative '../lib/glimmer/launcher'
8
4
 
9
5
  Glimmer::Launcher.new(ARGV).launch
@@ -1,3 +1,5 @@
1
+ require 'glimmer/config'
2
+
1
3
  module Glimmer
2
4
  module Config
3
5
  DEFAULT_IMPORT_SWT_PACKAGES = [
@@ -9,6 +11,11 @@ module Glimmer
9
11
  'org.eclipse.swt.custom',
10
12
  'org.eclipse.swt.dnd',
11
13
  ]
14
+
15
+ # This may be configured with extra sample directories from custom widget/shell gems
16
+ # following the convention of a `samples/subdirectory` where subdirectory is the
17
+ # custom widget/shell name or something representative of a group of samples (e.g. c_date_time).
18
+ SAMPLE_DIRECTORIES = []
12
19
 
13
20
  class << self
14
21
  # Tells Glimmer to import SWT packages into including class (default: true)
@@ -103,7 +110,7 @@ module Glimmer
103
110
 
104
111
  end
105
112
 
106
- Glimmer::Config.reset_logger!
113
+ Glimmer::Config.reset_logger! unless ENV['GLIMMER_LOGGER_ENABLED'].to_s.downcase == 'false'
107
114
  if ENV['GLIMMER_LOGGER_LEVEL']
108
115
  # if glimmer log level is being overridden for debugging purposes, then disable async logging making logging immediate
109
116
  Glimmer::Config.logging_appender_options = Glimmer::Config.logging_appender_options.merge(async: false, auto_flushing: 1)
@@ -114,6 +121,7 @@ if ENV['GLIMMER_LOGGER_LEVEL']
114
121
  puts e.message
115
122
  end
116
123
  end
124
+
117
125
  Glimmer::Config.excluded_keyword_checkers << lambda do |method_symbol, *args|
118
126
  method = method_symbol.to_s
119
127
  result = false
@@ -1,6 +1,5 @@
1
1
  require 'fileutils'
2
-
3
- require_relative 'rake_task'
2
+ require 'os'
4
3
 
5
4
  module Glimmer
6
5
  class Launcher
@@ -100,6 +99,7 @@ module Glimmer
100
99
  if the_glimmer_lib == GLIMMER_LIB_LOCAL
101
100
  devmode_require = '-r puts_debuggerer '
102
101
  end
102
+ require_relative 'rake_task'
103
103
  rake_tasks = Rake.application.tasks.map(&:to_s).map {|t| t.sub('glimmer:', '')}
104
104
 
105
105
  # handle a bash quirk with calling package[msi] while there is a "packages" directory locally (it passes package[msi] as packages)
@@ -190,6 +190,9 @@ module Glimmer
190
190
  end
191
191
  puts task_lines.to_a
192
192
  else
193
+ require 'rake-tui'
194
+ require 'tty-screen'
195
+ require_relative 'rake_task'
193
196
  Rake::TUI.run(branding_header: nil, prompt_question: 'Select a Glimmer task to run:') do |task, tasks|
194
197
  max_task_size = tasks.map(&:name_with_args).map(&:size).max + 1
195
198
  task_name = task.name_with_args.sub('glimmer:', '')
@@ -2,39 +2,49 @@ require 'rake'
2
2
 
3
3
  require_relative 'package'
4
4
 
5
+ ENV['GLIMMER_LOGGER_ENABLED'] = 'false'
6
+ require_relative '../ext/glimmer/config.rb'
7
+
8
+ Glimmer::Config::SAMPLE_DIRECTORIES << File.expand_path('../../../samples/hello', __FILE__)
9
+ Glimmer::Config::SAMPLE_DIRECTORIES << File.expand_path('../../../samples/elaborate', __FILE__)
10
+
5
11
  namespace :glimmer do
6
12
  namespace :sample do
13
+ task :requires do
14
+ require 'text-table'
15
+ require 'facets/string/titlecase'
16
+ require 'facets/string/underscore'
17
+
18
+ require_relative 'launcher'
19
+ end
20
+
21
+ task :glimmer_gems do
22
+ glimmer_gem_lib_files = Dir.glob(File.join(Gem.dir, 'gems', '*')).to_a.select do |gem_path|
23
+ !!File.basename(gem_path).match(/glimmer-cw|glimmer-cs|glimmer-dsl/)
24
+ end.map do |gem_path|
25
+ Dir.glob(File.join(gem_path, 'lib/*.rb')).detect {|lib| gem_path.include?(File.basename(lib, '.rb')) }
26
+ end.uniq do |gem_lib_file|
27
+ File.basename(gem_lib_file)
28
+ end
29
+ glimmer_gem_lib_files.each {|file| require file.sub(/\.rb$/, '')}
30
+ end
31
+
7
32
  desc 'Runs a Glimmer internal sample [included in gem]. If no name is supplied, it runs all samples.'
8
- task :run, [:name] => :requires do |t, args|
33
+ task :run, [:name] => [:requires, :glimmer_gems] do |t, args|
9
34
  name = args[:name]
10
35
  name = name.underscore.downcase unless name.nil?
11
- samples = (Dir.glob(File.expand_path('../../../samples/hello/*.rb', __FILE__)) + Dir.glob(File.expand_path('../../../samples/elaborate/*.rb', __FILE__))).sort
36
+ samples = Glimmer::Config::SAMPLE_DIRECTORIES.map {|dir| Dir.glob(File.join(dir, '*.rb'))}.reduce(:+).sort
12
37
  samples = samples.select {|path| path.include?("#{name}.rb")} unless name.nil?
13
38
  Rake::Task['glimmer:sample:code'].invoke(name) if samples.size == 1
14
39
  Glimmer::Launcher.new(samples << '--quiet=false').launch
15
40
  end
16
41
 
17
- namespace :run do
18
- task :hello do
19
- samples = Dir.glob(File.expand_path('../../../samples/hello/*.rb', __FILE__)).sort
20
- Glimmer::Launcher.new(samples << '--quiet=false').launch
21
- end
22
-
23
- task :elaborate do
24
- samples = Dir.glob(File.expand_path('../../../samples/elaborate/*.rb', __FILE__)).sort
25
- Glimmer::Launcher.new(samples << '--quiet=false').launch
26
- end
27
- end
28
-
29
42
  desc 'Lists Glimmer internal samples [included in gem]. Filters by query if specified (query is optional)'
30
- task :list, [:query] do |t, args|
31
- Rake::Task['glimmer:sample:list:hello'].invoke(args[:query])
32
- Rake::Task['glimmer:sample:list:elaborate'].invoke(args[:query])
33
- end
34
-
35
- namespace :list do
36
- task :hello, [:query] => :requires do |t, args|
37
- array_of_arrays = Dir.glob(File.expand_path('../../../samples/hello/*.rb', __FILE__)).map do |path|
43
+ task :list, [:query] => [:requires, :glimmer_gems] do |t, args|
44
+ Glimmer::Config::SAMPLE_DIRECTORIES.each do |dir|
45
+ sample_group_name = File.basename(dir)
46
+ human_sample_group_name = sample_group_name.underscore.titlecase
47
+ array_of_arrays = Dir.glob(File.join(dir, '*.rb')).map do |path|
38
48
  File.basename(path, '.rb')
39
49
  end.select do |path|
40
50
  args[:query].nil? || path.include?(args[:query])
@@ -42,10 +52,10 @@ namespace :glimmer do
42
52
  [path, path.underscore.titlecase, "#{'bin/' if Glimmer::Launcher.dev_mode?}glimmer sample:run[#{path}]"]
43
53
  end.sort
44
54
  if array_of_arrays.empty?
45
- puts "No Glimmer Hello Samples match the query."
55
+ puts "No Glimmer #{human_sample_group_name} Samples match the query."
46
56
  else
47
57
  puts
48
- puts " Glimmer Hello Samples (run all via: #{'bin/' if Glimmer::Launcher.dev_mode?}glimmer sample:run:hello):"
58
+ puts " Glimmer #{human_sample_group_name} Samples:"
49
59
  puts Text::Table.new(
50
60
  :head => %w[Name Description Run],
51
61
  :rows => array_of_arrays,
@@ -56,36 +66,12 @@ namespace :glimmer do
56
66
  )
57
67
  end
58
68
  end
59
-
60
- task :elaborate, [:query] => :requires do |t, args|
61
- array_of_arrays = Dir.glob(File.expand_path('../../../samples/elaborate/*.rb', __FILE__)).map do |path|
62
- File.basename(path, '.rb')
63
- end.select do |path|
64
- args[:query].nil? || path.include?(args[:query])
65
- end.map do |path|
66
- [path, path.underscore.titlecase, "#{'bin/' if Glimmer::Launcher.dev_mode?}glimmer sample:run[#{path}]"]
67
- end.sort
68
- if array_of_arrays.empty?
69
- puts "No Glimmer Elaborate Samples match the query."
70
- else
71
- puts
72
- puts " Glimmer Elaborate Samples (run all via: #{'bin/' if Glimmer::Launcher.dev_mode?}glimmer sample:run:elaborate):"
73
- puts Text::Table.new(
74
- :head => %w[Name Description Run],
75
- :rows => array_of_arrays,
76
- :horizontal_padding => 1,
77
- :vertical_boundary => ' ',
78
- :horizontal_boundary => ' ',
79
- :boundary_intersection => ' '
80
- )
81
- end
82
- end
83
69
  end
84
-
70
+
85
71
  desc 'Outputs code for a Glimmer internal sample [included in gem] (name is required)'
86
- task :code, [:name] => :requires do |t, args|
72
+ task :code, [:name] => [:requires, :glimmer_gems] do |t, args|
87
73
  require 'tty-markdown' unless OS.windows?
88
- samples = (Dir.glob(File.expand_path('../../../samples/hello/*.rb', __FILE__)) + Dir.glob(File.expand_path('../../../samples/elaborate/*.rb', __FILE__))).sort
74
+ samples = Glimmer::Config::SAMPLE_DIRECTORIES.map {|dir| Dir.glob(File.join(dir, '*.rb'))}.reduce(:+).sort
89
75
  sample = samples.detect {|path| path.include?("#{args[:name].to_s.underscore.downcase}.rb")}
90
76
  sample_additional_files = Dir.glob(File.join(sample.sub('.rb', ''), '**', '*.rb'))
91
77
  code = ([sample] + sample_additional_files).map do |file|
@@ -103,14 +89,6 @@ namespace :glimmer do
103
89
  puts code
104
90
  end
105
91
 
106
- task :requires do
107
- require 'text-table'
108
- require 'facets/string/titlecase'
109
- require 'facets/string/underscore'
110
-
111
- require_relative 'launcher'
112
- end
113
-
114
92
  end
115
93
 
116
94
  namespace :package do
@@ -18,6 +18,7 @@ module Glimmer
18
18
  end
19
19
 
20
20
  def constant_value_none
21
+ # TODO instead of raising error try a convention instead like CLASSNAME::NONE by default
21
22
  raise 'Not implemented! Mixer must implement!'
22
23
  end
23
24
 
@@ -65,6 +65,14 @@ module Glimmer
65
65
  end,
66
66
  }
67
67
 
68
+ KEYWORD_ALIASES = {
69
+ 'radio' => 'button',
70
+ 'checkbox' => 'button',
71
+ 'check' => 'button',
72
+ 'toggle' => 'button',
73
+ 'arrow' => 'button',
74
+ }
75
+
68
76
  class << self
69
77
  def create(keyword, parent, args)
70
78
  widget_proxy_class(keyword).new(keyword, parent, args)
@@ -72,6 +80,7 @@ module Glimmer
72
80
 
73
81
  def widget_proxy_class(keyword)
74
82
  begin
83
+ keyword = KEYWORD_ALIASES[keyword] if KEYWORD_ALIASES[keyword]
75
84
  class_name = "#{keyword.camelcase(:upper)}Proxy".to_sym
76
85
  Glimmer::SWT.const_get(class_name)
77
86
  rescue
@@ -312,7 +321,7 @@ module Glimmer
312
321
 
313
322
  # This supports widgets in and out of basic SWT
314
323
  def self.swt_widget_class_for(underscored_widget_name)
315
- underscored_widget_name = 'button' if %w[radio checkbox check toggle arrow].include?(underscored_widget_name)
324
+ underscored_widget_name = KEYWORD_ALIASES[underscored_widget_name] if KEYWORD_ALIASES[underscored_widget_name]
316
325
  swt_widget_name = underscored_widget_name.camelcase(:upper)
317
326
  swt_widget_class = eval(swt_widget_name)
318
327
  unless swt_widget_class.ancestors.include?(org.eclipse.swt.widgets.Widget)
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.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-15 00:00:00.000000000 Z
11
+ date: 2020-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement