shoes-core 4.0.0.pre7 → 4.0.0.pre8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/lib/shoes/arc.rb +10 -13
  3. data/lib/shoes/arrow.rb +1 -11
  4. data/lib/shoes/background.rb +0 -3
  5. data/lib/shoes/border.rb +0 -3
  6. data/lib/shoes/button.rb +4 -1
  7. data/lib/shoes/check_button.rb +0 -1
  8. data/lib/shoes/common/art_element.rb +21 -0
  9. data/lib/shoes/common/background_element.rb +10 -0
  10. data/lib/shoes/common/clickable.rb +2 -0
  11. data/lib/shoes/common/rotate.rb +1 -2
  12. data/lib/shoes/common/ui_element.rb +10 -1
  13. data/lib/shoes/core/version.rb +1 -1
  14. data/lib/shoes/download.rb +47 -29
  15. data/lib/shoes/dsl.rb +99 -40
  16. data/lib/shoes/font.rb +0 -4
  17. data/lib/shoes/http_request.rb +91 -0
  18. data/lib/shoes/image.rb +0 -1
  19. data/lib/shoes/input_box.rb +0 -1
  20. data/lib/shoes/internal_app.rb +1 -1
  21. data/lib/shoes/line.rb +25 -11
  22. data/lib/shoes/link.rb +10 -4
  23. data/lib/shoes/list_box.rb +0 -1
  24. data/lib/shoes/mock/app.rb +6 -0
  25. data/lib/shoes/mock/clickable.rb +3 -0
  26. data/lib/shoes/mock/font.rb +0 -4
  27. data/lib/shoes/oval.rb +3 -13
  28. data/lib/shoes/progress.rb +0 -1
  29. data/lib/shoes/rect.rb +1 -11
  30. data/lib/shoes/shape.rb +16 -8
  31. data/lib/shoes/slot.rb +2 -1
  32. data/lib/shoes/star.rb +8 -11
  33. data/lib/shoes/text_block.rb +0 -1
  34. data/lib/shoes/ui/picker.rb +29 -8
  35. data/lib/shoes/version.rb +1 -1
  36. metadata +8 -231
  37. data/Guardfile +0 -5
  38. data/Rakefile +0 -1
  39. data/bin/shoes-stub +0 -62
  40. data/ext/install/Rakefile +0 -39
  41. data/ext/install/shoes.bat +0 -17
  42. data/lib/rubygems_plugin.rb +0 -24
  43. data/shoes-core.gemspec +0 -22
  44. data/spec/shoes/animation_spec.rb +0 -71
  45. data/spec/shoes/app_spec.rb +0 -454
  46. data/spec/shoes/arc_spec.rb +0 -52
  47. data/spec/shoes/arrow_spec.rb +0 -28
  48. data/spec/shoes/background_spec.rb +0 -47
  49. data/spec/shoes/border_spec.rb +0 -46
  50. data/spec/shoes/builtin_methods_spec.rb +0 -122
  51. data/spec/shoes/button_spec.rb +0 -55
  52. data/spec/shoes/check_spec.rb +0 -36
  53. data/spec/shoes/color_spec.rb +0 -429
  54. data/spec/shoes/common/attachable_spec.rb +0 -32
  55. data/spec/shoes/common/inspect_spec.rb +0 -26
  56. data/spec/shoes/common/remove_spec.rb +0 -37
  57. data/spec/shoes/common/rotate_spec.rb +0 -13
  58. data/spec/shoes/common/style_normalizer_spec.rb +0 -28
  59. data/spec/shoes/common/style_spec.rb +0 -197
  60. data/spec/shoes/common/translate_spec.rb +0 -27
  61. data/spec/shoes/configuration_spec.rb +0 -51
  62. data/spec/shoes/constants_spec.rb +0 -39
  63. data/spec/shoes/dialog_spec.rb +0 -169
  64. data/spec/shoes/dimension_spec.rb +0 -451
  65. data/spec/shoes/dimensions_spec.rb +0 -868
  66. data/spec/shoes/download_spec.rb +0 -198
  67. data/spec/shoes/flow_spec.rb +0 -132
  68. data/spec/shoes/font_spec.rb +0 -36
  69. data/spec/shoes/framework_learning_spec.rb +0 -31
  70. data/spec/shoes/gradient_spec.rb +0 -31
  71. data/spec/shoes/helpers/fake_absolute_element.rb +0 -31
  72. data/spec/shoes/helpers/fake_element.rb +0 -25
  73. data/spec/shoes/helpers/inspect_helpers.rb +0 -5
  74. data/spec/shoes/helpers/sample17_helper.rb +0 -65
  75. data/spec/shoes/image_spec.rb +0 -69
  76. data/spec/shoes/images/shoe.jpg +0 -0
  77. data/spec/shoes/input_box_spec.rb +0 -80
  78. data/spec/shoes/integration_spec.rb +0 -19
  79. data/spec/shoes/internal_app_spec.rb +0 -148
  80. data/spec/shoes/keypress_spec.rb +0 -11
  81. data/spec/shoes/keyrelease_spec.rb +0 -11
  82. data/spec/shoes/line_spec.rb +0 -120
  83. data/spec/shoes/link_spec.rb +0 -149
  84. data/spec/shoes/list_box_spec.rb +0 -87
  85. data/spec/shoes/logger/ruby_spec.rb +0 -8
  86. data/spec/shoes/logger_spec.rb +0 -45
  87. data/spec/shoes/oval_spec.rb +0 -25
  88. data/spec/shoes/packager_spec.rb +0 -25
  89. data/spec/shoes/point_spec.rb +0 -99
  90. data/spec/shoes/progress_spec.rb +0 -54
  91. data/spec/shoes/radio_spec.rb +0 -32
  92. data/spec/shoes/rect_spec.rb +0 -40
  93. data/spec/shoes/renamed_delegate_spec.rb +0 -69
  94. data/spec/shoes/shape_spec.rb +0 -119
  95. data/spec/shoes/shared_examples/button.rb +0 -6
  96. data/spec/shoes/shared_examples/changeable.rb +0 -26
  97. data/spec/shoes/shared_examples/clickable.rb +0 -5
  98. data/spec/shoes/shared_examples/common_methods.rb +0 -35
  99. data/spec/shoes/shared_examples/dimensions.rb +0 -32
  100. data/spec/shoes/shared_examples/dsl.rb +0 -44
  101. data/spec/shoes/shared_examples/dsl/animate.rb +0 -29
  102. data/spec/shoes/shared_examples/dsl/arc.rb +0 -45
  103. data/spec/shoes/shared_examples/dsl/background.rb +0 -26
  104. data/spec/shoes/shared_examples/dsl/border.rb +0 -10
  105. data/spec/shoes/shared_examples/dsl/button.rb +0 -5
  106. data/spec/shoes/shared_examples/dsl/cap.rb +0 -6
  107. data/spec/shoes/shared_examples/dsl/check.rb +0 -11
  108. data/spec/shoes/shared_examples/dsl/edit_box.rb +0 -8
  109. data/spec/shoes/shared_examples/dsl/edit_line.rb +0 -8
  110. data/spec/shoes/shared_examples/dsl/editable_element.rb +0 -29
  111. data/spec/shoes/shared_examples/dsl/fill.rb +0 -27
  112. data/spec/shoes/shared_examples/dsl/flow.rb +0 -15
  113. data/spec/shoes/shared_examples/dsl/gradient.rb +0 -62
  114. data/spec/shoes/shared_examples/dsl/image.rb +0 -21
  115. data/spec/shoes/shared_examples/dsl/line.rb +0 -9
  116. data/spec/shoes/shared_examples/dsl/nofill.rb +0 -6
  117. data/spec/shoes/shared_examples/dsl/nostroke.rb +0 -6
  118. data/spec/shoes/shared_examples/dsl/oval.rb +0 -88
  119. data/spec/shoes/shared_examples/dsl/pattern.rb +0 -34
  120. data/spec/shoes/shared_examples/dsl/progress.rb +0 -7
  121. data/spec/shoes/shared_examples/dsl/rect.rb +0 -92
  122. data/spec/shoes/shared_examples/dsl/rgb.rb +0 -28
  123. data/spec/shoes/shared_examples/dsl/shape.rb +0 -61
  124. data/spec/shoes/shared_examples/dsl/star.rb +0 -110
  125. data/spec/shoes/shared_examples/dsl/stroke.rb +0 -30
  126. data/spec/shoes/shared_examples/dsl/strokewidth.rb +0 -19
  127. data/spec/shoes/shared_examples/dsl/style.rb +0 -32
  128. data/spec/shoes/shared_examples/dsl/text_elements.rb +0 -84
  129. data/spec/shoes/shared_examples/dsl/video.rb +0 -5
  130. data/spec/shoes/shared_examples/dsl_app_context.rb +0 -11
  131. data/spec/shoes/shared_examples/hover.rb +0 -78
  132. data/spec/shoes/shared_examples/parent.rb +0 -6
  133. data/spec/shoes/shared_examples/scroll.rb +0 -41
  134. data/spec/shoes/shared_examples/shared_element_method.rb +0 -60
  135. data/spec/shoes/shared_examples/slot.rb +0 -441
  136. data/spec/shoes/shared_examples/state.rb +0 -26
  137. data/spec/shoes/shared_examples/style.rb +0 -77
  138. data/spec/shoes/slot_spec.rb +0 -176
  139. data/spec/shoes/sound_spec.rb +0 -16
  140. data/spec/shoes/span_spec.rb +0 -112
  141. data/spec/shoes/spec_helper.rb +0 -24
  142. data/spec/shoes/stack_spec.rb +0 -79
  143. data/spec/shoes/star_spec.rb +0 -49
  144. data/spec/shoes/text_block_dimensions_spec.rb +0 -77
  145. data/spec/shoes/text_block_spec.rb +0 -314
  146. data/spec/shoes/text_spec.rb +0 -22
  147. data/spec/shoes/ui/picker_spec.rb +0 -69
  148. data/spec/shoes/url_spec.rb +0 -67
  149. data/spec/shoes/widget_spec.rb +0 -78
  150. data/spec/shoes_spec.rb +0 -41
  151. data/spec/spec_helper.rb +0 -27
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
- require 'shoes/ui/picker'
3
-
4
- describe Shoes::UI::Picker do
5
- let(:swt_backend) { "/gems/lib/shoes/swt/generate_backend.rb" }
6
- let(:faux_backend) { "/gems/lib/shoes/faux/generate_backend.rb" }
7
-
8
- let(:output) { StringIO.new }
9
- let(:input) { StringIO.new }
10
-
11
- subject { Shoes::UI::Picker.new(input, output) }
12
-
13
- it "selects single backend generator" do
14
- allow(Gem).to receive(:find_files) { [swt_backend] }
15
- expect(subject.select_generator).to eq(swt_backend)
16
- end
17
-
18
- describe "with multiple backend generators" do
19
- before do
20
- allow(Gem).to receive(:find_files) { [faux_backend, swt_backend] }
21
- end
22
-
23
- it "prompts with multiple backend generators" do
24
- select("1")
25
- subject.select_generator
26
-
27
- output.rewind
28
- result = output.read
29
-
30
- expect(result).to include("shoes-faux")
31
- expect(result).to include("shoes-swt")
32
- end
33
-
34
- it "selects from multiple backend generators" do
35
- select("2")
36
- expect(subject.select_generator).to eq(swt_backend)
37
- end
38
-
39
- it "retries for index past bounds" do
40
- select("3\n1")
41
- expect(subject.select_generator).to eq(faux_backend)
42
- end
43
-
44
- it "retries for index before bounds" do
45
- select("0\n1")
46
- expect(subject.select_generator).to eq(faux_backend)
47
- end
48
-
49
- it "retries for junk" do
50
- select("junk\n1")
51
- expect(subject.select_generator).to eq(faux_backend)
52
- end
53
-
54
- it "fails if no matches" do
55
- allow(Gem).to receive(:find_files) { [] }
56
- expect { subject.select_generator }.to raise_error(ArgumentError)
57
- end
58
-
59
- it "selects by name" do
60
- allow(Gem).to receive(:find_files) { [swt_backend] }
61
- expect(subject.select_generator("swt")).to eq(swt_backend)
62
- end
63
-
64
- def select(typed_input)
65
- input.write(typed_input)
66
- input.rewind
67
- end
68
- end
69
- end
@@ -1,67 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Shoes.url' do
4
- let(:klazz) do
5
- Class.new(Shoes) do
6
- include RSpec::Matchers
7
-
8
- url '/', :index
9
- url '/path', :path
10
- url '/number/(\d+)', :number
11
- url '/foo', :foo
12
- url '/visit_me', :visit_me
13
-
14
- def index
15
- end
16
-
17
- def path
18
- end
19
-
20
- def number(i)
21
- end
22
-
23
- def foo
24
- some_method
25
- end
26
-
27
- def visit_me
28
- expect(location).to eq '/visit_me'
29
- end
30
-
31
- def some_method
32
- end
33
- end
34
- end
35
-
36
- subject do
37
- Shoes.app
38
- end
39
-
40
- it "should call index upon startup" do
41
- expect_any_instance_of(klazz).to receive(:index)
42
- subject
43
- end
44
-
45
- it 'should receive path when visitting path' do
46
- expect_any_instance_of(klazz).to receive(:path)
47
- Shoes.app { visit '/path' }
48
- end
49
-
50
- it 'handles the arguments given in the regexes' do
51
- expect_any_instance_of(klazz).to receive(:number).with('7')
52
- Shoes.app { visit '/number/7' }
53
- end
54
-
55
- it 'can call methods defined in the URL class when visitting a URL' do
56
- expect_any_instance_of(klazz).to receive(:some_method)
57
- Shoes.app { visit '/foo' }
58
- end
59
-
60
- it 'has a location method that returns the current URL' do
61
- Shoes.app { visit('/visit_me') }
62
- end
63
-
64
- it 'instances report class as klazz (regression, do not ask...)' do
65
- expect(klazz.new.class).to eq klazz
66
- end
67
- end
@@ -1,78 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class Smile < Shoes::Widget
4
- def initialize(caption)
5
- smile_magic caption
6
- end
7
-
8
- def smile_magic(caption)
9
- banner caption
10
- end
11
- end
12
-
13
- class Face < Shoes::Widget
14
- def initialize
15
- para "Hair"
16
- smile "Toothsome"
17
- end
18
- end
19
-
20
- describe Shoes::Widget do
21
- let(:app) { Shoes::App.new }
22
-
23
- it "creates dsl method on App" do
24
- expect(app).to respond_to(:smile)
25
- end
26
-
27
- it "generates instances of its subclass" do
28
- expect(app.smile("Cheese!")).to be_instance_of(Smile)
29
- end
30
-
31
- it "passes missing methods to app" do
32
- expect(app).to receive(:banner).with("Pickles!")
33
- app.smile("Pickles!")
34
- end
35
-
36
- it 'sets the current slot as the parent' do
37
- slot = nil
38
- widget = nil
39
- Shoes.app do
40
- slot = instance_variable_get(:@__app__).current_slot
41
- widget = smile 'lalala'
42
- end
43
- expect(widget.parent).to eq slot
44
- end
45
-
46
- it "allows can use other widgets from widget initialize" do
47
- expect(app).to receive(:smile)
48
- app.face
49
- end
50
-
51
- describe 'together with the URL sub system' do
52
- let!(:klazz) do
53
- Class.new(Shoes) do
54
- include RSpec::Matchers
55
-
56
- url '/', :check_smile
57
- url '/smile', :smile_little_one
58
-
59
- def check_smile
60
- expect(self).to respond_to :smile
61
- end
62
-
63
- def smile_little_one
64
- smile 'little one'
65
- end
66
- end
67
- end
68
-
69
- it 'responds to widget defined methods like smile' do
70
- Shoes.app
71
- end
72
-
73
- it 'really smiles' do
74
- expect_any_instance_of(Smile).to receive(:smile_magic)
75
- Shoes.app { visit '/smile' }
76
- end
77
- end
78
- end
data/spec/shoes_spec.rb DELETED
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Shoes, 'load_backend' do
4
- it "raises on bad input" do
5
- expect { Shoes.load_backend :bogus }.to raise_error(LoadError)
6
- end
7
- end
8
-
9
- describe Shoes, 'setup' do
10
- it 'knows this method' do
11
- expect(Shoes).to respond_to :setup
12
- end
13
-
14
- describe 'outputting on standard error' do
15
- def expect_stderr_puts(regex)
16
- expect($stderr).to receive(:puts).with(regex)
17
- end
18
-
19
- before :each do
20
- expect_stderr_puts(/WARN.+deprecated/)
21
- end
22
-
23
- it 'puts a warning message to $stderr' do
24
- Shoes.setup {}
25
- end
26
-
27
- it 'warns for individual gems' do
28
- expect_stderr_puts(/WARN.+foo.+gem install foo/)
29
- Shoes.setup do
30
- gem 'foo'
31
- end
32
- end
33
-
34
- it 'even reports the version number' do
35
- expect_stderr_puts(/gem install foo --version \"~>2.10.0\"/)
36
- Shoes.setup do
37
- gem 'foo ~>2.10.0'
38
- end
39
- end
40
- end
41
- end
data/spec/spec_helper.rb DELETED
@@ -1,27 +0,0 @@
1
- SHOESSPEC_ROOT = File.expand_path('..', __FILE__)
2
- $LOAD_PATH << File.join(SHOESSPEC_ROOT)
3
- $LOAD_PATH << File.join(SHOESSPEC_ROOT, "../lib")
4
-
5
- # loaded again when executing DSL specs with the SWT backend, therefore
6
- # we souldn't start the test coverage again or override the command as it'd
7
- # mess up merging
8
- unless defined?(SimpleCov)
9
- require_relative '../../spec/code_coverage'
10
- SimpleCov.command_name 'spec:shoes'
11
- end
12
-
13
- require 'rspec'
14
- require 'rspec/its'
15
- require 'pry'
16
- require 'shoes/core'
17
- require 'shoes/ui/cli'
18
- require 'fileutils'
19
- require 'shoes/helpers/fake_element'
20
- require 'shoes/helpers/fake_absolute_element'
21
- require 'shoes/helpers/inspect_helpers'
22
-
23
- require 'webmock/rspec'
24
- WebMock.disable_net_connect!(allow: "codeclimate.com")
25
-
26
- shared_examples = File.expand_path('../shoes/shared_examples/**/*.rb', __FILE__)
27
- Dir[shared_examples].each { |f| require f }