shoes-swt 4.0.0.pre10 → 4.0.0.pre11

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: 5568168dba00b066067857b6851707061f81ce275c5433c703bf6f063cf676b6
4
- data.tar.gz: '08a5ab31927b65327622b913cd240b1cc7065bf672b638ce11dfd2ffa11a60bc'
3
+ metadata.gz: c09977e2aa7d8d84bfc7a5c71fc8aaa3ec8c31f88616266febf0e0d9684139f1
4
+ data.tar.gz: 816a6a60e7d9a29314c2dcc532cfba105d674ff2d0c282defd2c8ef32123f527
5
5
  SHA512:
6
- metadata.gz: 165e28c2286c5983066af12851ac288da3fb4800e1112bf2177876873ffc3467fe2b6d3a196a91b0b8902f900602ea208642cbb51b66ace23e2b2c62ae0a51db
7
- data.tar.gz: afbf71d8d6436e73bd5a34ea2366e2027e983aa215e00b32d7c006905a8a961714abd5bb4c51ef03880626a10ec4206ddf99ff8b2c755962f9fb4e8b82092cc0
6
+ metadata.gz: da4721c20e3aaadf9a866435e8230ea1a57eb2849d8990975c3be081c251164a5e4772cd091bc1dba2e50982603a9dd0114dd4edffca112c1c35b3fa74dde0f9
7
+ data.tar.gz: a686968991a518351c2ef7b51a8e87ddf3c703e98db5f6df553fb9da451ede1b9541eb04582f43195bfde6d96bd60f290f81eb8a2fa376a455c5acfd7938140c
@@ -3,7 +3,31 @@
3
3
  lib_directory = File.expand_path('../../lib', __FILE__)
4
4
  $LOAD_PATH << lib_directory
5
5
 
6
- if File.exist?("Gemfile")
6
+ # We want the Gemfile alongside the Shoes code that we're executing, not
7
+ # necessarily the Gemfile in our current directory. This helps in both running
8
+ # and packaging apps that have their own Gemfiles, even if we run `shoes` from
9
+ # another location.
10
+ candidates = (ARGV + ["."]).map do |candidate|
11
+ File.expand_path(File.join(File.dirname(candidate), "Gemfile"))
12
+ end
13
+
14
+ gemfile = candidates.uniq.find do |candidate|
15
+ File.exist?(candidate)
16
+ end
17
+
18
+ if gemfile
19
+ if defined?(Bundler) && gemfile != Bundler.default_gemfile.to_s
20
+ puts <<~EOS
21
+ Shoes wants to load the Gemfile from '#{gemfile}'
22
+ But you've already loaded Gemfile at '#{Bundler.default_gemfile}'
23
+
24
+ Instead of `bundle exec shoes`, try just `shoes` instead. We'll load Bundler for you.
25
+
26
+ EOS
27
+ end
28
+
29
+ # Thanks Bundler for the ENV vars! <3
30
+ ENV["BUNDLE_GEMFILE"] = gemfile
7
31
  require "bundler/setup"
8
32
  Bundler.require
9
33
  end
@@ -52,7 +52,12 @@ class Shoes
52
52
  end
53
53
  end
54
54
 
55
+ def dispose
56
+ clear_path
57
+ end
58
+
55
59
  def clear_path
60
+ @path.dispose unless @path.nil? || @path.disposed?
56
61
  @path = nil
57
62
  end
58
63
  end
@@ -45,7 +45,7 @@ class Shoes
45
45
  return if handlers.nil? || handlers.empty?
46
46
 
47
47
  handlers = handlers.to_a
48
- .select { |dsl, _| !dsl.hidden? }
48
+ .reject { |dsl, _| dsl.hidden? }
49
49
  .select { |dsl, _| dsl.in_bounds?(event.x, event.y) }
50
50
 
51
51
  # Take the last handler as an approximation of the "top-most" element
@@ -12,7 +12,7 @@ class Shoes
12
12
  end
13
13
 
14
14
  def dispose_held_resources
15
- @color_factory.dispose unless @color_factory.nil?
15
+ @color_factory&.dispose
16
16
  end
17
17
 
18
18
  # Classes should override to dispose of any Swt resources they create
@@ -13,7 +13,7 @@ class Shoes
13
13
 
14
14
  def dispose_previous_contexts
15
15
  @graphic_contexts ||= []
16
- @graphic_contexts.each { |g| g.dispose if g }
16
+ @graphic_contexts.each { |g| g&.dispose }
17
17
  @graphic_contexts.clear
18
18
  end
19
19
 
@@ -20,7 +20,7 @@ class Shoes
20
20
  #
21
21
  # @return [Integer] The alpha value of this object's stroke color (0-255)
22
22
  def stroke_alpha
23
- dsl.stroke.alpha if dsl.stroke
23
+ dsl&.stroke&.alpha
24
24
  end
25
25
 
26
26
  # This object's strokewidth
@@ -10,8 +10,8 @@ class Shoes
10
10
  end
11
11
 
12
12
  def dispose
13
- @color1.dispose if @color1
14
- @color2.dispose if @color2
13
+ @color1&.dispose
14
+ @color2&.dispose
15
15
 
16
16
  @patterns.each do |pattern|
17
17
  pattern.dispose unless pattern.disposed?
@@ -62,7 +62,7 @@ class Shoes
62
62
 
63
63
  def determine_args_based_on_angle(angle, left, top, width, height)
64
64
  x, y = calculate_x_and_y(angle, height, width)
65
- if 0 <= angle && angle < Math::PI * 0.5
65
+ if angle >= 0 && angle < Math::PI * 0.5
66
66
  args = [left + width + x, top + height - y, left + width - x, top + height + y]
67
67
  elsif Math::PI * 0.5 <= angle && angle < Math::PI
68
68
  args = [left + width + y, top + height + x, left + width - y, top + height - x]
@@ -10,8 +10,8 @@ class Shoes
10
10
  end
11
11
 
12
12
  def dispose
13
- @image.dispose if @image
14
- @pattern.dispose if @pattern
13
+ @image&.dispose
14
+ @pattern&.dispose
15
15
  end
16
16
 
17
17
  # Since colors are bound up (at least in specs) with image patterns,
@@ -88,23 +88,23 @@ class Shoes
88
88
  end
89
89
 
90
90
  def alt?(event)
91
- is_this_modifier_key?(event, ::Swt::SWT::ALT)
91
+ this_modifier_key?(event, ::Swt::SWT::ALT)
92
92
  end
93
93
 
94
94
  def control?(event)
95
- is_this_modifier_key?(event, ::Swt::SWT::CTRL)
95
+ this_modifier_key?(event, ::Swt::SWT::CTRL)
96
96
  end
97
97
 
98
98
  def shift?(event)
99
- is_this_modifier_key?(event, ::Swt::SWT::SHIFT)
99
+ this_modifier_key?(event, ::Swt::SWT::SHIFT)
100
100
  end
101
101
 
102
102
  def super?(event)
103
- is_this_modifier_key?(event, ::Swt::SWT::COMMAND)
103
+ this_modifier_key?(event, ::Swt::SWT::COMMAND)
104
104
  end
105
105
 
106
106
  # NOTE: state_mask and key_code error for me so the java version is used
107
- def is_this_modifier_key?(event, key)
107
+ def this_modifier_key?(event, key)
108
108
  (event.stateMask & key) == key
109
109
  end
110
110
 
@@ -8,7 +8,7 @@ class Shoes
8
8
  @text_segment = text_segment
9
9
 
10
10
  # Don't create regions for empty links!
11
- return unless @range.count > 0
11
+ return unless @range.count.positive?
12
12
 
13
13
  add_regions_for_lines(lines_for_link)
14
14
  offset_regions(text_segment.element_left, text_segment.element_top)
@@ -31,6 +31,11 @@ class Shoes
31
31
  end
32
32
 
33
33
  def run(path)
34
+ if @packages.empty?
35
+ puts "You must select at least one packaging format.\n\n#{::Shoes::UI::CLI::PackageCommand.help}"
36
+ return
37
+ end
38
+
34
39
  begin
35
40
  require 'shoes/package'
36
41
  require 'shoes/package/configuration'
@@ -31,11 +31,11 @@ class Shoes
31
31
  end
32
32
 
33
33
  def rounded?
34
- (@obj.corners || 0) > 0
34
+ (@obj.corners || 0).positive?
35
35
  end
36
36
 
37
37
  def strokewidth?
38
- (@obj.dsl.style[:strokewidth] || 0) > 0
38
+ (@obj.dsl.style[:strokewidth] || 0).positive?
39
39
  end
40
40
  end
41
41
  end
@@ -151,7 +151,7 @@ class Shoes
151
151
  # Try to find a parent container we fit in.
152
152
  # If that doesn't work, just bail with [0,0] so we don't crash.
153
153
  width = width_from_ancestor if width <= 0
154
- return [0, 0] if width < 0
154
+ return [0, 0] if width.negative?
155
155
  end
156
156
 
157
157
  [width, height]
@@ -162,7 +162,7 @@ class Shoes
162
162
  def width_from_ancestor
163
163
  width = -1
164
164
  current_ancestor = @dsl.parent
165
- until width > 0 || current_ancestor.nil?
165
+ until width.positive? || current_ancestor.nil?
166
166
  width = @dsl.desired_width(current_ancestor.width)
167
167
 
168
168
  break unless current_ancestor.respond_to?(:parent)
@@ -68,7 +68,7 @@ class Shoes
68
68
 
69
69
  def set_style(styles, range = (0...text.length))
70
70
  # If we've been given an empty/nonsense range, just ignore it
71
- return unless range.count > 0
71
+ return unless range.count.positive?
72
72
 
73
73
  font = @font_factory.create_font(styles[:font_detail])
74
74
  style = @style_factory.create_style(font, styles[:fg], styles[:bg], styles)
@@ -88,7 +88,7 @@ class Shoes
88
88
  end
89
89
 
90
90
  def segment_at_text_position(index)
91
- return @segments.last if index < 0
91
+ return @segments.last if index.negative?
92
92
  segment_ranges(index..index).first.first
93
93
  end
94
94
 
@@ -149,7 +149,7 @@ class Shoes
149
149
  end
150
150
 
151
151
  def at_end?(index)
152
- index < 0 || index > @dsl.text.length
152
+ index.negative? || index > @dsl.text.length
153
153
  end
154
154
 
155
155
  def relative_end_position
@@ -87,7 +87,7 @@ class Shoes
87
87
  end
88
88
 
89
89
  def style_present?(style)
90
- !style.nil? && !(style == 'none')
90
+ !style.nil? && (style != 'none')
91
91
  end
92
92
  end
93
93
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  class Shoes
4
4
  module Swt
5
- VERSION = "4.0.0.pre10"
5
+ VERSION = "4.0.0.pre11"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoes-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.pre10
4
+ version: 4.0.0.pre11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Shoes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-17 00:00:00.000000000 Z
11
+ date: 2017-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 4.0.0.pre10
46
+ version: 4.0.0.pre11
47
47
  name: shoes-core
48
48
  prerelease: false
49
49
  type: :runtime
@@ -51,13 +51,13 @@ dependencies:
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 4.0.0.pre10
54
+ version: 4.0.0.pre11
55
55
  - !ruby/object:Gem::Dependency
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: 4.0.0.pre10
60
+ version: 4.0.0.pre11
61
61
  name: shoes-package
62
62
  prerelease: false
63
63
  type: :runtime
@@ -65,7 +65,7 @@ dependencies:
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 4.0.0.pre10
68
+ version: 4.0.0.pre11
69
69
  description: A JRuby and Swt backend for Shoes, the best little GUI toolkit for Ruby.
70
70
  Shoes makes building for Mac, Windows, and Linux super simple.
71
71
  email: