shoes-core 4.0.0.pre6 → 4.0.0.pre7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/shoes-picker +1 -1
- data/lib/shoes/app.rb +3 -3
- data/lib/shoes/arc.rb +6 -5
- data/lib/shoes/arrow.rb +31 -0
- data/lib/shoes/background.rb +1 -1
- data/lib/shoes/border.rb +1 -1
- data/lib/shoes/builtin_methods.rb +1 -1
- data/lib/shoes/color.rb +3 -3
- data/lib/shoes/color/dsl_helpers.rb +10 -7
- data/lib/shoes/color/hex_converter.rb +1 -1
- data/lib/shoes/common/attachable.rb +11 -0
- data/lib/shoes/common/background_element.rb +8 -0
- data/lib/shoes/common/hover.rb +7 -17
- data/lib/shoes/common/link_finder.rb +12 -0
- data/lib/shoes/common/positioning.rb +1 -1
- data/lib/shoes/common/state.rb +1 -1
- data/lib/shoes/common/style.rb +9 -4
- data/lib/shoes/common/translate.rb +24 -0
- data/lib/shoes/common/ui_element.rb +1 -0
- data/lib/shoes/common/visibility.rb +1 -1
- data/lib/shoes/configuration.rb +2 -2
- data/lib/shoes/core/version.rb +3 -1
- data/lib/shoes/dimensions.rb +6 -2
- data/lib/shoes/dsl.rb +34 -14
- data/lib/shoes/font.rb +1 -1
- data/lib/shoes/gradient.rb +2 -1
- data/lib/shoes/image.rb +2 -2
- data/lib/shoes/input_box.rb +2 -2
- data/lib/shoes/internal_app.rb +8 -8
- data/lib/shoes/line.rb +7 -6
- data/lib/shoes/link.rb +5 -6
- data/lib/shoes/list_box.rb +2 -2
- data/lib/shoes/logger.rb +2 -1
- data/lib/shoes/mock.rb +1 -0
- data/lib/shoes/mock/arrow.rb +15 -0
- data/lib/shoes/mock/rect.rb +2 -1
- data/lib/shoes/mock/slot.rb +5 -1
- data/lib/shoes/mock/star.rb +2 -1
- data/lib/shoes/oval.rb +5 -4
- data/lib/shoes/point.rb +2 -1
- data/lib/shoes/progress.rb +1 -1
- data/lib/shoes/rect.rb +3 -2
- data/lib/shoes/shape.rb +14 -9
- data/lib/shoes/slot.rb +54 -25
- data/lib/shoes/slot_contents.rb +1 -3
- data/lib/shoes/star.rb +4 -3
- data/lib/shoes/text.rb +5 -0
- data/lib/shoes/text_block.rb +9 -9
- data/lib/shoes/ui/picker.rb +5 -5
- data/lib/shoes/version.rb +3 -1
- data/lib/shoes/widget.rb +2 -2
- data/lib/shoes/window.rb +6 -0
- data/spec/shoes/app_spec.rb +16 -16
- data/spec/shoes/arc_spec.rb +1 -1
- data/spec/shoes/arrow_spec.rb +28 -0
- data/spec/shoes/background_spec.rb +2 -2
- data/spec/shoes/border_spec.rb +3 -3
- data/spec/shoes/builtin_methods_spec.rb +2 -2
- data/spec/shoes/button_spec.rb +4 -2
- data/spec/shoes/color_spec.rb +12 -12
- data/spec/shoes/common/attachable_spec.rb +32 -0
- data/spec/shoes/common/inspect_spec.rb +4 -4
- data/spec/shoes/common/remove_spec.rb +5 -5
- data/spec/shoes/common/rotate_spec.rb +1 -1
- data/spec/shoes/common/style_normalizer_spec.rb +4 -4
- data/spec/shoes/common/style_spec.rb +15 -11
- data/spec/shoes/common/translate_spec.rb +27 -0
- data/spec/shoes/dimension_spec.rb +111 -100
- data/spec/shoes/dimensions_spec.rb +344 -303
- data/spec/shoes/download_spec.rb +17 -17
- data/spec/shoes/flow_spec.rb +2 -2
- data/spec/shoes/framework_learning_spec.rb +3 -1
- data/spec/shoes/helpers/fake_absolute_element.rb +3 -2
- data/spec/shoes/helpers/fake_element.rb +3 -2
- data/spec/shoes/input_box_spec.rb +2 -2
- data/spec/shoes/internal_app_spec.rb +14 -14
- data/spec/shoes/link_spec.rb +18 -19
- data/spec/shoes/list_box_spec.rb +9 -8
- data/spec/shoes/oval_spec.rb +1 -1
- data/spec/shoes/point_spec.rb +3 -3
- data/spec/shoes/renamed_delegate_spec.rb +2 -2
- data/spec/shoes/shape_spec.rb +20 -20
- data/spec/shoes/shared_examples/common_methods.rb +2 -2
- data/spec/shoes/shared_examples/dsl.rb +2 -2
- data/spec/shoes/shared_examples/dsl/flow.rb +1 -1
- data/spec/shoes/shared_examples/dsl/pattern.rb +2 -2
- data/spec/shoes/shared_examples/dsl/rgb.rb +2 -2
- data/spec/shoes/shared_examples/dsl/shape.rb +11 -7
- data/spec/shoes/shared_examples/dsl/star.rb +44 -44
- data/spec/shoes/shared_examples/dsl/style.rb +1 -1
- data/spec/shoes/shared_examples/dsl/text_elements.rb +6 -3
- data/spec/shoes/shared_examples/dsl/video.rb +1 -1
- data/spec/shoes/shared_examples/dsl_app_context.rb +6 -5
- data/spec/shoes/shared_examples/hover.rb +2 -2
- data/spec/shoes/shared_examples/shared_element_method.rb +2 -2
- data/spec/shoes/shared_examples/slot.rb +32 -21
- data/spec/shoes/shared_examples/style.rb +1 -1
- data/spec/shoes/slot_spec.rb +24 -7
- data/spec/shoes/span_spec.rb +5 -5
- data/spec/shoes/spec_helper.rb +1 -1
- data/spec/shoes/stack_spec.rb +5 -5
- data/spec/shoes/text_block_dimensions_spec.rb +6 -3
- data/spec/shoes/text_block_spec.rb +13 -7
- data/spec/shoes/text_spec.rb +22 -0
- data/spec/shoes/ui/picker_spec.rb +3 -3
- data/spec/shoes/url_spec.rb +4 -4
- data/spec/shoes/widget_spec.rb +1 -1
- data/spec/shoes_spec.rb +3 -3
- data/spec/spec_helper.rb +8 -1
- metadata +17 -4
- data/bin/shoes +0 -1
data/lib/shoes/oval.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
class Shoes
|
2
2
|
class Oval
|
3
3
|
include Common::UIElement
|
4
|
+
include Common::Clickable
|
4
5
|
include Common::Fill
|
6
|
+
include Common::Hover
|
5
7
|
include Common::Stroke
|
6
8
|
include Common::Style
|
7
|
-
include Common::
|
8
|
-
include Common::Hover
|
9
|
+
include Common::Translate
|
9
10
|
|
10
11
|
style_with :art_styles, :center, :common_styles, :dimensions, :radius
|
11
|
-
STYLES = { fill: Shoes::COLORS[:black] }
|
12
|
+
STYLES = { fill: Shoes::COLORS[:black] }.freeze
|
12
13
|
|
13
14
|
def create_dimensions(left, top, width, height)
|
14
15
|
left ||= @style[:left]
|
@@ -20,7 +21,7 @@ class Shoes
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def needs_rotate?
|
23
|
-
rotate
|
24
|
+
rotate && rotate.nonzero?
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
data/lib/shoes/point.rb
CHANGED
data/lib/shoes/progress.rb
CHANGED
data/lib/shoes/rect.rb
CHANGED
@@ -6,9 +6,10 @@ class Shoes
|
|
6
6
|
include Common::Clickable
|
7
7
|
include Common::Hover
|
8
8
|
include Common::Style
|
9
|
+
include Common::Translate
|
9
10
|
|
10
11
|
style_with :angle, :art_styles, :curve, :common_styles, :dimensions
|
11
|
-
STYLES = { angle: 0, curve: 0, fill: Shoes::COLORS[:black] }
|
12
|
+
STYLES = { angle: 0, curve: 0, fill: Shoes::COLORS[:black] }.freeze
|
12
13
|
|
13
14
|
def create_dimensions(left, top, width, height)
|
14
15
|
left ||= @style[:left] || 0
|
@@ -20,7 +21,7 @@ class Shoes
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def needs_rotate?
|
23
|
-
rotate
|
24
|
+
rotate && rotate.nonzero?
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
data/lib/shoes/shape.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
class Shoes
|
2
2
|
class Shape
|
3
3
|
include Common::UIElement
|
4
|
+
include Common::Clickable
|
4
5
|
include Common::Fill
|
5
6
|
include Common::Stroke
|
6
7
|
include Common::Style
|
7
|
-
include Common::
|
8
|
+
include Common::Translate
|
8
9
|
|
9
10
|
attr_reader :blk, :x, :y, :left_bound, :top_bound, :right_bound, :bottom_bound
|
10
11
|
|
11
12
|
style_with :art_styles, :center, :common_styles, :dimensions
|
12
13
|
|
13
|
-
STYLES = { fill: Shoes::COLORS[:black] }
|
14
|
+
STYLES = { fill: Shoes::COLORS[:black] }.freeze
|
14
15
|
|
15
|
-
def create_dimensions
|
16
|
+
def create_dimensions
|
16
17
|
@dimensions = AbsoluteDimensions.new @style
|
17
18
|
end
|
18
19
|
|
@@ -62,7 +63,8 @@ class Shoes
|
|
62
63
|
# @return [Shoes::Shape] This shape
|
63
64
|
def line_to(x, y)
|
64
65
|
update_bounds_rect(@x, @y, x, y)
|
65
|
-
@x
|
66
|
+
@x = x
|
67
|
+
@y = y
|
66
68
|
@gui.line_to(x, y)
|
67
69
|
self
|
68
70
|
end
|
@@ -73,7 +75,8 @@ class Shoes
|
|
73
75
|
# @param [Integer] y The new point's y-value
|
74
76
|
# @return [Shoes::Shape] self This shape
|
75
77
|
def move_to(x, y)
|
76
|
-
@x
|
78
|
+
@x = x
|
79
|
+
@y = y
|
77
80
|
@gui.move_to(x, y)
|
78
81
|
self
|
79
82
|
end
|
@@ -89,7 +92,8 @@ class Shoes
|
|
89
92
|
# @return [Shoes::Shape] This shape
|
90
93
|
def curve_to(cx1, cy1, cx2, cy2, x, y)
|
91
94
|
update_bounds([@x, cx1, cx2, x], [@y, cy1, cy2, y])
|
92
|
-
@x
|
95
|
+
@x = x
|
96
|
+
@y = y
|
93
97
|
@gui.curve_to(cx1, cy1, cx2, cy2, x, y)
|
94
98
|
self
|
95
99
|
end
|
@@ -105,7 +109,8 @@ class Shoes
|
|
105
109
|
# @return [Shoes::Shape] This shape
|
106
110
|
def arc_to(x, y, width, height, start_angle, arc_angle)
|
107
111
|
update_bounds_rect(x - width / 2, y - height / 2, x + width / 2, y + height / 2)
|
108
|
-
@x
|
112
|
+
@x = x
|
113
|
+
@y = y
|
109
114
|
@gui.arc_to(x, y, width, height, start_angle, arc_angle)
|
110
115
|
self
|
111
116
|
end
|
@@ -114,8 +119,8 @@ class Shoes
|
|
114
119
|
# many possibilities of what a shape could contain, this just checks the
|
115
120
|
# outer bounding box of the shape, nothing more sophisticated.
|
116
121
|
def in_bounds?(x, y)
|
117
|
-
(@left_bound..@right_bound).
|
118
|
-
(@top_bound..@bottom_bound).
|
122
|
+
(@left_bound..@right_bound).cover?(x) &&
|
123
|
+
(@top_bound..@bottom_bound).cover?(y)
|
119
124
|
end
|
120
125
|
|
121
126
|
private
|
data/lib/shoes/slot.rb
CHANGED
@@ -13,12 +13,12 @@ class Shoes
|
|
13
13
|
attr_reader :parent, :dimensions, :gui, :contents, :blk
|
14
14
|
|
15
15
|
style_with :art_styles, :attach, :common_styles, :dimensions, :scroll
|
16
|
-
STYLES = { scroll: false, fill: Shoes::COLORS[:black] }
|
16
|
+
STYLES = { scroll: false, fill: Shoes::COLORS[:black] }.freeze
|
17
17
|
|
18
18
|
def create_dimensions(*args)
|
19
19
|
super(*args)
|
20
20
|
|
21
|
-
@fixed_height = height
|
21
|
+
@fixed_height = !height.nil?
|
22
22
|
@scroll_top = 0
|
23
23
|
set_default_dimension_values
|
24
24
|
@pass_coordinates = true
|
@@ -29,9 +29,9 @@ class Shoes
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def handle_block(blk)
|
32
|
-
@current_position =
|
33
|
-
|
34
|
-
|
32
|
+
@current_position = Position.new element_left,
|
33
|
+
element_top,
|
34
|
+
element_top
|
35
35
|
@blk = blk
|
36
36
|
eval_block blk
|
37
37
|
end
|
@@ -48,6 +48,11 @@ class Shoes
|
|
48
48
|
eval_block blk
|
49
49
|
end
|
50
50
|
|
51
|
+
def remove
|
52
|
+
clear
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
51
56
|
def eval_block(blk, *args)
|
52
57
|
old_current_slot = @app.current_slot
|
53
58
|
@app.current_slot = self
|
@@ -153,7 +158,7 @@ class Shoes
|
|
153
158
|
end
|
154
159
|
|
155
160
|
def fixed_height?
|
156
|
-
|
161
|
+
@fixed_height
|
157
162
|
end
|
158
163
|
|
159
164
|
def variable_height?
|
@@ -162,12 +167,12 @@ class Shoes
|
|
162
167
|
|
163
168
|
protected
|
164
169
|
|
165
|
-
|
170
|
+
Position = Struct.new(:x, :y, :next_line_start)
|
166
171
|
|
167
172
|
def position_contents
|
168
|
-
@current_position =
|
169
|
-
|
170
|
-
|
173
|
+
@current_position = Position.new element_left,
|
174
|
+
element_top,
|
175
|
+
element_top
|
171
176
|
|
172
177
|
contents.each do |element|
|
173
178
|
next if element.hidden?
|
@@ -178,15 +183,16 @@ class Shoes
|
|
178
183
|
|
179
184
|
def positioning(element, current_position)
|
180
185
|
if element.needs_positioning?
|
181
|
-
|
182
|
-
|
183
|
-
|
186
|
+
align_position = if element.attached_to
|
187
|
+
position_attached_element(element)
|
188
|
+
else
|
189
|
+
position_slotted_element(element, current_position)
|
190
|
+
end
|
184
191
|
|
185
|
-
|
186
|
-
update_current_position(current_position, element)
|
187
|
-
else
|
188
|
-
current_position
|
192
|
+
element.contents_alignment(align_position) if element.respond_to?(:contents_alignment)
|
189
193
|
end
|
194
|
+
|
195
|
+
update_current_position(current_position, element)
|
190
196
|
rescue => e
|
191
197
|
puts "SWALLOWED POSITIONING EXCEPTION ON #{element} - go take care of it: " + e.to_s
|
192
198
|
puts e.backtrace.join("\n\t")
|
@@ -197,7 +203,21 @@ class Shoes
|
|
197
203
|
end
|
198
204
|
|
199
205
|
def position_element(_element, _current_position)
|
200
|
-
|
206
|
+
raise 'position_element is a subclass responsibility'
|
207
|
+
end
|
208
|
+
|
209
|
+
def position_attached_element(element)
|
210
|
+
attached_left = element.attached_to.absolute_left + element.style[:left].to_i
|
211
|
+
attached_top = element.attached_to.absolute_top + element.style[:top].to_i
|
212
|
+
|
213
|
+
position_element_at element, attached_left, attached_top
|
214
|
+
|
215
|
+
Position.new attached_left, attached_top, attached_top
|
216
|
+
end
|
217
|
+
|
218
|
+
def position_slotted_element(element, current_position)
|
219
|
+
position_element element, current_position
|
220
|
+
current_position
|
201
221
|
end
|
202
222
|
|
203
223
|
def position_in_current_line(element, current_position)
|
@@ -221,14 +241,23 @@ class Shoes
|
|
221
241
|
element.absolute_left == x && element.absolute_top == y
|
222
242
|
end
|
223
243
|
|
244
|
+
def should_update_current_position?(element)
|
245
|
+
!element.attached_to &&
|
246
|
+
!element.absolutely_positioned? &&
|
247
|
+
element.takes_up_space?
|
248
|
+
end
|
249
|
+
|
224
250
|
def update_current_position(current_position, element)
|
225
|
-
return current_position
|
251
|
+
return current_position unless should_update_current_position?(element)
|
252
|
+
|
226
253
|
current_position.x = element.absolute_right + NEXT_ELEMENT_OFFSET
|
227
254
|
current_position.y = element.absolute_top
|
228
255
|
next_element_line_start = next_line_start_from element
|
256
|
+
|
229
257
|
if current_position.next_line_start < next_element_line_start
|
230
258
|
current_position.next_line_start = next_element_line_start
|
231
259
|
end
|
260
|
+
|
232
261
|
element.adjust_current_position current_position
|
233
262
|
current_position
|
234
263
|
end
|
@@ -284,14 +313,14 @@ class Shoes
|
|
284
313
|
end
|
285
314
|
|
286
315
|
def compute_content_height
|
287
|
-
max_bottom = contents
|
288
|
-
select(&:takes_up_space?)
|
289
|
-
reject(&:hidden?)
|
290
|
-
map(&:absolute_bottom)
|
291
|
-
max
|
316
|
+
max_bottom = contents
|
317
|
+
.select(&:takes_up_space?)
|
318
|
+
.reject(&:hidden?)
|
319
|
+
.map(&:absolute_bottom)
|
320
|
+
.max
|
292
321
|
|
293
322
|
if max_bottom
|
294
|
-
max_bottom -
|
323
|
+
max_bottom - element_top + NEXT_ELEMENT_OFFSET
|
295
324
|
else
|
296
325
|
0
|
297
326
|
end
|
data/lib/shoes/slot_contents.rb
CHANGED
@@ -31,9 +31,7 @@ class Shoes
|
|
31
31
|
def clear
|
32
32
|
# reverse_each is important as otherwise we always miss to delete one
|
33
33
|
# element
|
34
|
-
@contents.reverse_each
|
35
|
-
element.is_a?(Shoes::Slot) ? element.clear : element.remove
|
36
|
-
end
|
34
|
+
@contents.reverse_each(&:remove)
|
37
35
|
@contents.clear
|
38
36
|
end
|
39
37
|
|
data/lib/shoes/star.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
class Shoes
|
2
2
|
class Star
|
3
3
|
include Common::UIElement
|
4
|
+
include Common::Clickable
|
4
5
|
include Common::Fill
|
6
|
+
include Common::Hover
|
5
7
|
include Common::Stroke
|
6
8
|
include Common::Style
|
7
|
-
include Common::
|
8
|
-
include Common::Hover
|
9
|
+
include Common::Translate
|
9
10
|
|
10
11
|
style_with :angle, :art_styles, :common_styles, :dimensions, :inner, :outer, :points
|
11
|
-
STYLES = { angle: 0, fill: Shoes::COLORS[:black] }
|
12
|
+
STYLES = { angle: 0, fill: Shoes::COLORS[:black] }.freeze
|
12
13
|
|
13
14
|
def create_dimensions(left, top, points, outer, inner)
|
14
15
|
# Don't use param defaults as DSL explicit passes nil for missing params
|
data/lib/shoes/text.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Shoes
|
2
2
|
class Text
|
3
3
|
include Common::Inspect
|
4
|
+
include Common::LinkFinder
|
4
5
|
|
5
6
|
attr_reader :to_s, :texts, :color
|
6
7
|
attr_accessor :parent, :text_block
|
@@ -17,6 +18,10 @@ class Shoes
|
|
17
18
|
parent && parent.app
|
18
19
|
end
|
19
20
|
|
21
|
+
def links
|
22
|
+
find_links(@texts)
|
23
|
+
end
|
24
|
+
|
20
25
|
private
|
21
26
|
|
22
27
|
def inspect_details
|
data/lib/shoes/text_block.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
class Shoes
|
2
2
|
CENTER = "center".freeze
|
3
|
-
DEFAULT_TEXTBLOCK_FONT = "Arial"
|
3
|
+
DEFAULT_TEXTBLOCK_FONT = "Arial".freeze
|
4
4
|
|
5
5
|
class TextBlock
|
6
6
|
include Common::UIElement
|
7
|
-
include Common::Style
|
8
7
|
include Common::Clickable
|
9
8
|
include Common::Hover
|
9
|
+
include Common::LinkFinder
|
10
|
+
include Common::Style
|
11
|
+
include Common::Translate
|
10
12
|
include TextBlockDimensionsDelegations
|
11
13
|
|
12
14
|
attr_reader :text, :contents, :text_styles
|
13
15
|
attr_accessor :cursor, :textcursor
|
14
16
|
|
15
|
-
style_with :common_styles, :dimensions, :text_block_styles
|
16
|
-
STYLES = { font: DEFAULT_TEXTBLOCK_FONT } # used in TextBlock specs only
|
17
|
+
style_with :common_styles, :dimensions, :text_block_styles, :translate
|
18
|
+
STYLES = { font: DEFAULT_TEXTBLOCK_FONT }.freeze # used in TextBlock specs only
|
17
19
|
|
18
20
|
def create_dimensions(*_)
|
19
21
|
@dimensions = TextBlockDimensions.new @parent, @style
|
@@ -89,9 +91,7 @@ class Shoes
|
|
89
91
|
end
|
90
92
|
|
91
93
|
def links
|
92
|
-
contents
|
93
|
-
element.is_a?(Shoes::Link)
|
94
|
-
end
|
94
|
+
find_links(contents)
|
95
95
|
end
|
96
96
|
|
97
97
|
private
|
@@ -111,7 +111,7 @@ class Shoes
|
|
111
111
|
start_point..end_point
|
112
112
|
end
|
113
113
|
|
114
|
-
styles[range]
|
114
|
+
styles[range] ||= []
|
115
115
|
styles[range] << text
|
116
116
|
gather_text_styles(text, text.texts, styles, start_point)
|
117
117
|
end
|
@@ -132,7 +132,7 @@ class Shoes
|
|
132
132
|
.split(',').map { |x| x.strip.gsub(/["]/, '') }
|
133
133
|
|
134
134
|
@style[:font] = font_family.first unless (font_family.size == 1 &&
|
135
|
-
font_family[0] == "") || font_family.
|
135
|
+
font_family[0] == "") || font_family.empty?
|
136
136
|
|
137
137
|
fsize = size_regex.match(type)
|
138
138
|
@style[:size] = fsize[1].to_i unless fsize.nil?
|
data/lib/shoes/ui/picker.rb
CHANGED
@@ -20,7 +20,7 @@ class Shoes
|
|
20
20
|
return unless File.exist?("Gemfile")
|
21
21
|
|
22
22
|
# Only need bundler/setup to get our paths right--we don't need to
|
23
|
-
# actually require the gems, since we find the
|
23
|
+
# actually require the gems, since we find the generate_backend.rb's
|
24
24
|
# and just require them directly.
|
25
25
|
require 'bundler/setup'
|
26
26
|
end
|
@@ -29,7 +29,7 @@ class Shoes
|
|
29
29
|
candidates = find_candidates(desired_backend)
|
30
30
|
|
31
31
|
if candidates.empty?
|
32
|
-
raise ArgumentError
|
32
|
+
raise ArgumentError, "No gems found matching '#{desired_backend}'"
|
33
33
|
elsif candidates.one?
|
34
34
|
candidate = candidates.first
|
35
35
|
@output.puts "Selecting #{name_for_candidate(candidate)} backend to use. This is a one-time operation."
|
@@ -42,7 +42,7 @@ class Shoes
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def find_candidates(desired_backend)
|
45
|
-
search_string = "shoes/**/#{desired_backend}/
|
45
|
+
search_string = "shoes/**/#{desired_backend}/generate_backend.rb"
|
46
46
|
search_string.gsub!("//", "/")
|
47
47
|
Gem.find_files(search_string)
|
48
48
|
end
|
@@ -74,8 +74,8 @@ class Shoes
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def name_for_candidate(candidate)
|
77
|
-
|
78
|
-
|
77
|
+
match = %r{.*lib\/shoes\/(.*)\/generate_backend.rb}.match(candidate)[1]
|
78
|
+
"shoes-#{match.tr('/', '-')}"
|
79
79
|
end
|
80
80
|
|
81
81
|
def write_backend(generator_file, bin_dir)
|
data/lib/shoes/version.rb
CHANGED