jruby_art 0.2.6.pre → 0.3.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/bin/k9 +2 -2
  3. data/lib/jruby_art.rb +18 -23
  4. data/lib/jruby_art/app.rb +118 -130
  5. data/lib/jruby_art/config.rb +7 -9
  6. data/lib/jruby_art/creators/creator.rb +189 -0
  7. data/lib/jruby_art/helper_methods.rb +41 -31
  8. data/lib/jruby_art/helpers/camel_string.rb +2 -1
  9. data/lib/jruby_art/helpers/numeric.rb +1 -2
  10. data/lib/jruby_art/helpers/range.rb +3 -7
  11. data/lib/jruby_art/helpers/string_extra.rb +1 -1
  12. data/lib/jruby_art/library_loader.rb +127 -96
  13. data/lib/jruby_art/runner.rb +208 -63
  14. data/lib/jruby_art/runners/base.rb +51 -0
  15. data/lib/jruby_art/runners/run.rb +6 -0
  16. data/lib/jruby_art/runners/watch.rb +59 -0
  17. data/lib/jruby_art/version.rb +1 -2
  18. data/lib/rpextras.jar +0 -0
  19. data/library/library_proxy/README.md +97 -0
  20. data/library/library_proxy/library_proxy.rb +8 -1
  21. data/library/video_event/video_event.rb +4 -0
  22. data/vendors/Rakefile +33 -78
  23. metadata +54 -60
  24. data/CHANGELOG.md +0 -60
  25. data/LICENSE.md +0 -39
  26. data/README.md +0 -91
  27. data/Rakefile +0 -85
  28. data/lib/core.jar +0 -0
  29. data/lib/gluegen-rt-natives-linux-amd64.jar +0 -0
  30. data/lib/gluegen-rt-natives-linux-armv6hf.jar +0 -0
  31. data/lib/gluegen-rt-natives-linux-i586.jar +0 -0
  32. data/lib/gluegen-rt-natives-macosx-universal.jar +0 -0
  33. data/lib/gluegen-rt-natives-windows-amd64.jar +0 -0
  34. data/lib/gluegen-rt-natives-windows-i586.jar +0 -0
  35. data/lib/gluegen-rt.jar +0 -0
  36. data/lib/jogl-all-natives-linux-amd64.jar +0 -0
  37. data/lib/jogl-all-natives-linux-armv6hf.jar +0 -0
  38. data/lib/jogl-all-natives-linux-i586.jar +0 -0
  39. data/lib/jogl-all-natives-macosx-universal.jar +0 -0
  40. data/lib/jogl-all-natives-windows-amd64.jar +0 -0
  41. data/lib/jogl-all-natives-windows-i586.jar +0 -0
  42. data/lib/jogl-all.jar +0 -0
  43. data/lib/jruby_art/creator.rb +0 -100
  44. data/lib/jruby_art/parse.rb +0 -59
  45. data/lib/jruby_art/writer.rb +0 -40
  46. data/library/file_chooser/file_chooser.rb +0 -82
  47. data/library/grammar/grammar.rb +0 -31
  48. data/library/video/lib/export.txt +0 -1
  49. data/library/video/lib/macosx64.txt +0 -1
  50. data/library/video/lib/windows.txt +0 -3
  51. data/library/video/video.rb +0 -12
  52. data/spec/app_spec.rb +0 -208
  53. data/spec/deglut_spec.rb +0 -25
  54. data/spec/library_loader_spec.rb +0 -23
  55. data/spec/spec_helper.rb +0 -96
  56. data/spec/vecmath_spec.rb +0 -483
  57. data/vendors/config.tar.gz +0 -0
@@ -1,40 +0,0 @@
1
- require_relative './helpers/camel_string'
2
- require_relative './helpers/string_extra'
3
-
4
- module Processing
5
- # Wraps bare sketch with class wrapper etc
6
- class Writer
7
- attr_reader :code, :file
8
- REQ = "require 'jruby_art'\n\n"
9
- KLASS = "class %s < %s \n\n"
10
-
11
- def initialize
12
- @code = []
13
- code << REQ
14
- end
15
-
16
- def read(input)
17
- @file = input
18
- source = File.read(input)
19
- default = source.match(/P(2|3)D/).nil?
20
- name = File.basename(input).sub(/(\.rb)$/, '')
21
- mode = default ? 'Processing::App' : 'Processing::AppGL'
22
- camel_name = CamelString.new(name).camelize
23
- code << format(KLASS, camel_name, mode)
24
- IO.foreach(input) do |line|
25
- code << format(' %s', line)
26
- end
27
- code << "end\n\n"
28
- title = StringExtra.new(name).titleize
29
- code << "#{camel_name}.new(title: \"#{title}\")"
30
- end
31
-
32
- def write
33
- File.open(file, 'w:UTF-8') do |out|
34
- code.each do |line|
35
- out.write(line)
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,82 +0,0 @@
1
- # Here's a little library for using swing JFileChooser.
2
- # in ruby-processing, borrows heavily from control_panel
3
-
4
- module FileChooser
5
- ##
6
- # FileFilter is abstract, requires accept and getDescription
7
- ##
8
-
9
- require 'pathname'
10
- JXChooser = Java::javax::swing::JFileChooser
11
- JFile = Java::java::io::File
12
- System = Java::JavaLang::System
13
-
14
- class Filter < Java::javax::swing::filechooser::FileFilter
15
- attr_reader :description, :extensions
16
- def define(description, extensions)
17
- @description, @extensions = description, extensions
18
- end
19
-
20
- def accept(fobj)
21
- return true if extensions.include? File.extname(fobj.to_s).downcase
22
- return true if fobj.isDirectory
23
- end
24
-
25
- def getDescription
26
- description
27
- end
28
- end
29
-
30
- class RXChooser
31
- java_import javax.swing.UIManager
32
- require 'rbconfig'
33
- HOST = 'host_os'
34
- UHOME = 'user.home'
35
- UDIR = 'user.dir'
36
- OS = :unix
37
- case RbConfig::CONFIG[HOST]
38
- when /darwin/ then OS = :mac
39
- when /mswin|mingw/ then OS = :windows
40
- end
41
-
42
- def initialize
43
- javax.swing.UIManager.setLookAndFeel(
44
- javax.swing.UIManager.getSystemLookAndFeelClassName)
45
- @chooser = JXChooser.new
46
- end
47
-
48
- def set_filter(description, extensions)
49
- filter = FileChooser::Filter.new
50
- filter.define(description, extensions)
51
- @chooser.setFileFilter(filter)
52
- end
53
-
54
- def display
55
- if :windows == OS
56
- @chooser.setCurrentDirectory(JFile.new(System.getProperty(UDIR)))
57
- else
58
- @chooser.setCurrentDirectory(JFile.new(System.getProperty(UHOME)))
59
- end
60
- success = @chooser.show_open_dialog($app)
61
- if success == JXChooser::APPROVE_OPTION
62
- return Pathname.new(@chooser.get_selected_file.get_absolute_path).to_s
63
- else
64
- nil
65
- end
66
- end
67
-
68
- def dispose
69
- @chooser = nil
70
- end
71
- end
72
-
73
- module InstanceMethods
74
- def file_chooser
75
- @chooser = RXChooser.new
76
- return @chooser unless block_given?
77
- yield(@chooser)
78
- end
79
- end
80
- end
81
-
82
- Processing::App.send :include, FileChooser::InstanceMethods
@@ -1,31 +0,0 @@
1
- ############################
2
- # Simple lsystem grammar
3
- ############################
4
- class Grammar
5
-
6
- attr_reader :axiom, :rules
7
- def initialize(axiom, rules)
8
- @axiom = axiom
9
- @rules = rules
10
- end
11
-
12
- def expand(production, iterations, &block)
13
- production.each_char do |token|
14
- if rules.key?(token) && iterations > 0
15
- expand(rules[token], iterations - 1, &block)
16
- else
17
- yield token
18
- end
19
- end
20
- end
21
-
22
- def each(gen)
23
- expand(axiom, gen) { |token| yield token }
24
- end
25
-
26
- def generate(gen)
27
- output = []
28
- each(gen) { |token| output << token }
29
- return output
30
- end
31
- end
@@ -1 +0,0 @@
1
- name = Video
@@ -1 +0,0 @@
1
- Macosx requires binary blobs to use this library, copy the macosx64 folder from the
@@ -1,3 +0,0 @@
1
- windows requires binary blobs to use this library, copy either the windows32 or windows64
2
- folder from https://github.com/processing/processing-video/releases/download/latest/video.zip
3
- available since processing-3.0a5 video library here (as appropriate for your system).
@@ -1,12 +0,0 @@
1
- require 'rpextras'
2
- require_relative 'lib/video.jar'
3
- require_relative 'lib/gstreamer-java.jar'
4
- require_relative 'lib/jna.jar'
5
-
6
- class Processing::App
7
- include Java::ProcessingCore::VideoInterface
8
- end
9
-
10
- class Processing::AppGL
11
- include Java::ProcessingCore::VideoInterface
12
- end
data/spec/app_spec.rb DELETED
@@ -1,208 +0,0 @@
1
- require_relative '../lib/jruby_art'
2
- require 'spec_helper'
3
-
4
- describe Processing::App do
5
-
6
- class TestSketch < Processing::App
7
- def draw
8
- # nothing to see here...
9
- end
10
- end
11
-
12
- before :all do
13
- @processing_sketch = TestSketch.new title: 'sketch'
14
- end
15
-
16
- METHODS = %i(
17
- alpha
18
- ambient
19
- ambient_light
20
- apply_matrix
21
- arc
22
- background
23
- begin_camera
24
- begin_contour
25
- begin_raw
26
- begin_record
27
- begin_shape
28
- bezier
29
- bezier_detail
30
- bezier_point
31
- bezier_tangent
32
- bezier_vertex
33
- blend
34
- blend_mode
35
- blue
36
- box
37
- brightness
38
- camera
39
- color
40
- color_mode
41
- copy
42
- create_font
43
- create_graphics
44
- create_image
45
- create_input
46
- create_output
47
- create_reader
48
- create_shape
49
- create_writer
50
- cursor
51
- curve
52
- curve_detail
53
- curve_point
54
- curve_tangent
55
- curve_tightness
56
- curve_vertex
57
- directional_light
58
- display_height
59
- display_width
60
- ellipse
61
- ellipse_mode
62
- emissive
63
- end_camera
64
- end_contour
65
- end_raw
66
- end_record
67
- end_shape
68
- fill
69
- filter
70
- focused
71
- frame_count
72
- frame_rate
73
- frame_rate
74
- frustum
75
- get
76
- green
77
- height
78
- hue
79
- image
80
- image_mode
81
- key
82
- key_code
83
- key_pressed
84
- key_pressed?
85
- key_released
86
- key_typed
87
- lerp_color
88
- light_falloff
89
- light_specular
90
- lights
91
- line
92
- load_bytes
93
- load_font
94
- load_image
95
- load_pixels
96
- load_shader
97
- load_shape
98
- load_strings
99
- load_table
100
- load_xml
101
- model_x
102
- model_y
103
- model_z
104
- mouse_button
105
- mouse_clicked
106
- mouse_dragged
107
- mouse_moved
108
- mouse_pressed
109
- mouse_pressed?
110
- mouse_released
111
- mouse_x
112
- mouse_y
113
- no_cursor
114
- no_fill
115
- no_lights
116
- no_smooth
117
- no_stroke
118
- no_tint
119
- noise
120
- noise_detail
121
- noise_seed
122
- normal
123
- ortho
124
- perspective
125
- pixels
126
- pmouse_x
127
- pmouse_y
128
- point
129
- point_light
130
- pop_matrix
131
- print_camera
132
- print_matrix
133
- print_projection
134
- push_matrix
135
- quad
136
- quadratic_vertex
137
- random
138
- random_seed
139
- rect
140
- rect_mode
141
- red
142
- request_image
143
- reset_matrix
144
- reset_shader
145
- rotate
146
- rotate_x
147
- rotate_y
148
- rotate_z
149
- saturation
150
- save
151
- save_bytes
152
- save_frame
153
- save_stream
154
- save_strings
155
- scale
156
- screen_x
157
- screen_y
158
- screen_z
159
- select_folder
160
- select_input
161
- select_output
162
- set
163
- shader
164
- shape
165
- shape_mode
166
- shear_x
167
- shear_y
168
- shininess
169
- size
170
- smooth
171
- specular
172
- sphere
173
- sphere_detail
174
- spot_light
175
- stroke
176
- stroke_cap
177
- stroke_join
178
- stroke_weight
179
- text_align
180
- text_ascent
181
- text_descent
182
- text_font
183
- text_leading
184
- text_mode
185
- text_size
186
- text_width
187
- texture
188
- texture_mode
189
- texture_wrap
190
- tint
191
- translate
192
- triangle
193
- update_pixels
194
- vertex
195
- width
196
- )
197
-
198
- METHODS.each { |method_string|
199
- it "method: .#{method_string}" do
200
- expect(@processing_sketch).to respond_to(method_string)
201
- end
202
- }
203
-
204
- after :all do
205
- @processing_sketch.exit
206
- end
207
-
208
- end
data/spec/deglut_spec.rb DELETED
@@ -1,25 +0,0 @@
1
- require_relative '../lib/jruby_art'
2
-
3
- Java::ProcessingFastmath::DeglutLibrary.new.load(JRuby.runtime, false)
4
-
5
- EPSILON = 1.0e-04
6
- TO_RADIAN = Math::PI / 180
7
-
8
- describe '#DegLut.sin(-720 .. 720) test' do
9
- (-720 .. 720).step(1) do |deg|
10
- it "should work #{deg}" do
11
- sine = DegLut.sin(deg)
12
- expect(sine).to be_within(EPSILON).of(Math.sin(deg * TO_RADIAN))
13
- end
14
- end
15
- end
16
-
17
-
18
- describe '#DegLut.cos(-720 .. 720) test' do
19
- (-720 .. 720).step(1) do |deg|
20
- it "should work #{deg}" do
21
- cosine = DegLut.cos(deg)
22
- expect(cosine).to be_within(EPSILON).of(Math.cos(deg * TO_RADIAN))
23
- end
24
- end
25
- end
@@ -1,23 +0,0 @@
1
- require_relative '../lib/jruby_art/library_loader'
2
- require_relative '../lib/jruby_art/config'
3
- require 'spec_helper'
4
-
5
- describe LibraryLoader do
6
-
7
- before :all do
8
- K9_ROOT = "../"
9
- @library_loader = LibraryLoader.new
10
- end
11
-
12
- METHODS = %i(local_java_lib local_ruby_lib installed_java_lib installed_java_lib load_libraries)
13
-
14
- METHODS.each { |method_string|
15
- it "method: .#{method_string}" do
16
- expect(@library_loader).to respond_to(method_string)
17
- end
18
- }
19
-
20
- after :all do
21
- @library_loader = nil
22
- end
23
- end
data/spec/spec_helper.rb DELETED
@@ -1,96 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
- # file to always be loaded, without a need to explicitly require it in any files.
5
- #
6
- # Given that it is always loaded, you are encouraged to keep this file as
7
- # light-weight as possible. Requiring heavyweight dependencies from this file
8
- # will add to the boot time of your test suite on EVERY test run, even for an
9
- # individual file that may not need all of that loaded. Instead, consider making
10
- # a separate helper file that requires the additional dependencies and performs
11
- # the additional setup, and require it from the spec files that actually need it.
12
- #
13
- # The `.rspec` file also contains a few flags that are not defaults but that
14
- # users commonly want.
15
- #
16
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
- RSpec.configure do |config|
18
- # rspec-expectations config goes here. You can use an alternate
19
- # assertion/expectation library such as wrong or the stdlib/minitest
20
- # assertions if you prefer.
21
- config.expect_with :rspec do |expectations|
22
- # This option will default to `true` in RSpec 4. It makes the `description`
23
- # and `failure_message` of custom matchers include text for helper methods
24
- # defined using `chain`, e.g.:
25
- # be_bigger_than(2).and_smaller_than(4).description
26
- # # => "be bigger than 2 and smaller than 4"
27
- # ...rather than:
28
- # # => "be bigger than 2"
29
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
30
- end
31
-
32
- # rspec-mocks config goes here. You can use an alternate test double
33
- # library (such as bogus or mocha) by changing the `mock_with` option here.
34
- config.mock_with :rspec do |mocks|
35
- # Prevents you from mocking or stubbing a method that does not exist on
36
- # a real object. This is generally recommended, and will default to
37
- # `true` in RSpec 4.
38
- mocks.verify_partial_doubles = true
39
- end
40
-
41
- # The settings below are suggested to provide a good initial experience
42
- # with RSpec, but feel free to customize to your heart's content.
43
- =begin
44
- # These two settings work together to allow you to limit a spec run
45
- # to individual examples or groups you care about by tagging them with
46
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
47
- # get run.
48
- config.filter_run :focus
49
- config.run_all_when_everything_filtered = true
50
-
51
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
52
- # For more details, see:
53
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
54
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
55
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
56
- config.disable_monkey_patching!
57
-
58
- # This setting enables warnings. It's recommended, but in some cases may
59
- # be too noisy due to issues in dependencies.
60
- config.warnings = true
61
-
62
- # Many RSpec users commonly either run the entire suite or an individual
63
- # file, and it's useful to allow more verbose output when running an
64
- # individual spec file.
65
- if config.files_to_run.one?
66
- # Use the documentation formatter for detailed output,
67
- # unless a formatter has already been configured
68
- # (e.g. via a command-line flag).
69
- config.default_formatter = 'doc'
70
- end
71
-
72
- # Print the 10 slowest examples and example groups at the
73
- # end of the spec run, to help surface which specs are running
74
- # particularly slow.
75
- config.profile_examples = 10
76
-
77
- # Run specs in random order to surface order dependencies. If you find an
78
- # order dependency and want to debug it, you can fix the order by providing
79
- # the seed, which is printed after each run.
80
- # --seed 1234
81
- config.order = :random
82
-
83
- # Seed global randomization in this process using the `--seed` CLI option.
84
- # Setting this allows you to use `--seed` to deterministically reproduce
85
- # test failures related to randomization by passing the same `--seed` value
86
- # as the one that triggered the failure.
87
- Kernel.srand config.seed
88
- =end
89
-
90
- if config.files_to_run.one?
91
- # Use the documentation formatter for detailed output,
92
- # unless a formatter has already been configured
93
- # (e.g. via a command-line flag).
94
- config.default_formatter = 'doc'
95
- end
96
- end