propane 0.8.0-java → 0.9.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -1
  3. data/README.md +1 -1
  4. data/lib/propane/app.rb +56 -55
  5. data/lib/propane/creators/sketch_writer.rb +7 -3
  6. data/lib/propane/helper_methods.rb +40 -29
  7. data/lib/propane/runner.rb +3 -2
  8. data/lib/propane/version.rb +1 -1
  9. data/pom.rb +1 -1
  10. data/pom.xml +1 -1
  11. data/vendors/Rakefile +31 -1
  12. metadata +2 -59
  13. data/examples/data_path/Rakefile +0 -32
  14. data/examples/data_path/bw_shader.rb +0 -47
  15. data/examples/data_path/data/Texture01.jpg +0 -0
  16. data/examples/data_path/data/Texture02.jpg +0 -0
  17. data/examples/data_path/data/Univers45.vlw +0 -0
  18. data/examples/data_path/data/bwfrag.glsl +0 -23
  19. data/examples/data_path/data/displaceFrag.glsl +0 -8
  20. data/examples/data_path/data/displaceVert.glsl +0 -201
  21. data/examples/data_path/data/lachoy.jpg +0 -0
  22. data/examples/data_path/data/landscape.glsl +0 -352
  23. data/examples/data_path/data/monjori.glsl +0 -30
  24. data/examples/data_path/data/moon.jpg +0 -0
  25. data/examples/data_path/data/sea.jpg +0 -0
  26. data/examples/data_path/edge_detection.rb +0 -49
  27. data/examples/data_path/glsl_heightmap_noise.rb +0 -125
  28. data/examples/data_path/kinetic_type.rb +0 -79
  29. data/examples/data_path/landscape.rb +0 -34
  30. data/examples/data_path/linear_image.rb +0 -51
  31. data/examples/data_path/monjori.rb +0 -35
  32. data/examples/regular/Rakefile +0 -30
  33. data/examples/regular/arcball_box.rb +0 -28
  34. data/examples/regular/arcball_constrain.rb +0 -29
  35. data/examples/regular/bezier_playground.rb +0 -206
  36. data/examples/regular/circle_collision.rb +0 -118
  37. data/examples/regular/colors_two.rb +0 -60
  38. data/examples/regular/creating_colors.rb +0 -64
  39. data/examples/regular/drawolver.rb +0 -93
  40. data/examples/regular/elegant_ball.rb +0 -159
  41. data/examples/regular/empathy.rb +0 -80
  42. data/examples/regular/fern.rb +0 -57
  43. data/examples/regular/fibonacci_sphere.rb +0 -91
  44. data/examples/regular/flight_patterns.rb +0 -64
  45. data/examples/regular/fractions.rb +0 -32
  46. data/examples/regular/grapher.rb +0 -40
  47. data/examples/regular/gravity.rb +0 -120
  48. data/examples/regular/grey_circles.rb +0 -28
  49. data/examples/regular/jwishy.rb +0 -99
  50. data/examples/regular/letters.rb +0 -42
  51. data/examples/regular/lib/boundary.rb +0 -38
  52. data/examples/regular/lib/particle.rb +0 -77
  53. data/examples/regular/lib/particle_system.rb +0 -111
  54. data/examples/regular/lib/rain_drops.rb +0 -54
  55. data/examples/regular/liquidy.rb +0 -41
  56. data/examples/regular/mouse_button_demo.rb +0 -32
  57. data/examples/regular/polyhedrons.rb +0 -249
  58. data/examples/regular/raining.rb +0 -60
  59. data/examples/regular/ribbon_doodle.rb +0 -89
  60. data/examples/regular/select_file.rb +0 -32
  61. data/examples/regular/select_image.rb +0 -40
  62. data/examples/regular/slider_demo.rb +0 -61
  63. data/examples/regular/slider_example.rb +0 -53
  64. data/examples/regular/slider_simple.rb +0 -47
  65. data/examples/regular/tree.rb +0 -76
  66. data/examples/regular/vector_math.rb +0 -37
  67. data/examples/regular/words.rb +0 -41
  68. data/lib/propane/helpers/string_extra.rb +0 -45
  69. data/lib/propane/underscorer.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25e44d0b96666b6c45b686f6ae303be7283a795a
4
- data.tar.gz: e5f305b7cffdc904312fe7ad21f47017d5ca7db0
3
+ metadata.gz: d55e929fe62c064db2482e12276e11c9af804a2f
4
+ data.tar.gz: d4e5eb42b58d0facb55478ab69d6fd86ee351e44
5
5
  SHA512:
6
- metadata.gz: ac4bf37b116eed1296a1023cff3ae9c6eb8b59db426085801e30e696e6592057d4f7d8f24c75536e0e61f8b82d29c7096f599a44b36b04fb199f276110923fca
7
- data.tar.gz: c5a4797c0d6b96ff95083f840d9e3805437581c7beb0983473cfdd0a9ebe76d9b08a62a37824fbb850c15b7c16f325885e42118aa9f7119ca1e992c6dd739f3c
6
+ metadata.gz: c618476e0aed79e32708d33d942f3b107c0278f48b7a645868eac68e7de756bb74caf53f25fd2dd3533040e16382d29d2bcc58ad003e7dfbe71e124fd6dbc492
7
+ data.tar.gz: 24be94385e35ad5d7ffdcd985890df606b3cf66d5afb65727f89924d2f3e4526e2752cdace3ad5b428624a318007fa1b0a6d0f395e193f34b33ac584c57bbca1
@@ -1,5 +1,7 @@
1
- **v0.8.0** Complete samples refactored to `data_path` folder, no longer require jruby-complete to run because we provide an absolute path to `data` folder, but it still probably requires that you run the sketch from the directory. Future direction might be to create a `~/.propane` folder, which would support additionalvanilla processing libraries, also integration with `atom` editor.
2
1
 
2
+ **v0.9.0** Implements `data_path` in ruby, you should use this method to return the absolute path to the `data` folder (read and write). Prefer JRubyArt methods, in the main. Moved samples to own repo (under ruby-processing group), samplesget installed with jruby-complete on `propane --install`.
3
+
4
+ **v0.8.0** Complete samples refactored to `data_path` folder, no longer require jruby-complete to run because we provide an absolute path to `data` folder, but it still probably requires that you run the sketch from the directory. Future direction might be to create a `~/.propane` folder, which would support additionalvanilla processing libraries, also integration with `atom` editor.
3
5
  **v0.7.0** Update to JRuby-Complete-9.1.2.0.
4
6
 
5
7
  **v0.6.0** Includes a sketch creator utility 3D still only for linux64 and macosx, any Windows developers are welcome to extend to windows (should be easy), includes slider in sketch library, change to requiring jdk8. Update to JRuby-Complete-9.1.0.0, request updated arcball (to run samples).
data/README.md CHANGED
@@ -58,7 +58,7 @@ end
58
58
  FlashingLightsSketch.new title: "Flashing Lights"
59
59
  ```
60
60
 
61
- Many sketches will run just using an installed jruby, but shader sketches must be run using jruby-complete, but don't worry we make it easy, to install jruby-complete:
61
+ To install the samples and jruby-complete. The samples get copied to `~/propane_samples`.
62
62
  ```bash
63
63
  propane --install
64
64
  ```
@@ -1,9 +1,8 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: false
3
- require_relative 'underscorer'
4
2
  require_relative 'helper_methods'
5
3
  require_relative 'library_loader'
6
4
 
5
+ # A wrapper module for the processing App
7
6
  module Propane
8
7
  include_package 'processing.core' # imports the processing jar.
9
8
  # Load vecmath, fastmath and mathtool modules
@@ -14,6 +13,8 @@ module Propane
14
13
  java_import 'monkstone.vecmath.ShapeRender'
15
14
  end
16
15
 
16
+ SKETCH_ROOT = File.absolute_path('.')
17
+
17
18
  # This class is the base class the user should inherit from when making
18
19
  # their own sketch.
19
20
  #
@@ -26,8 +27,28 @@ module Propane
26
27
  # end
27
28
  #
28
29
  # end
30
+
31
+ # Watch the definition of these methods, to make sure
32
+ # that Processing is able to call them during events.
33
+ METHODS_TO_ALIAS ||= {
34
+ mouse_pressed: :mousePressed,
35
+ mouse_dragged: :mouseDragged,
36
+ mouse_clicked: :mouseClicked,
37
+ mouse_moved: :mouseMoved,
38
+ mouse_released: :mouseReleased,
39
+ key_pressed: :keyPressed,
40
+ key_released: :keyReleased,
41
+ key_typed: :keyTyped
42
+ }.freeze
43
+
44
+ # All sketches extend this class
29
45
  class App < PApplet
30
46
  include Math, MathTool, HelperMethods
47
+ # Alias some methods for familiarity for Shoes coders.
48
+ alias oval ellipse
49
+ alias stroke_width stroke_weight
50
+ alias rgb color
51
+ alias gray color
31
52
  attr_reader :title, :arguments, :options
32
53
  # App should be instantiated with an optional list of options
33
54
  # and array of arguments.
@@ -42,7 +63,7 @@ module Propane
42
63
  library_loader ||= LibraryLoader.new
43
64
  library_loader.load_library(*args)
44
65
  end
45
- alias_method :load_library, :load_libraries
66
+ alias load_library load_libraries
46
67
 
47
68
  def library_loaded?(library_name)
48
69
  library_loader.library_loaded?(library_name)
@@ -55,17 +76,23 @@ module Propane
55
76
  def load_java_library(*args)
56
77
  library_loader.load_java_library(*args)
57
78
  end
79
+
80
+ # When certain special methods get added to the sketch, we need to let
81
+ # Processing call them by their expected Java names.
82
+ def method_added(method_name) #:nodoc:
83
+ return unless METHODS_TO_ALIAS.key?(method_name)
84
+ alias_method METHODS_TO_ALIAS[method_name], method_name
85
+ end
58
86
  end
59
87
 
60
88
  def library_loaded?(library_name)
61
89
  self.class.library_loaded?(library_name)
62
90
  end
63
-
64
-
91
+
65
92
  def initialize(options = {}, arguments = [])
66
93
  # Guard against invalid input.
67
94
  proxy_java_fields
68
- raise TypeError unless options.is_a? Hash
95
+ raise TypeError unless options.is_a? Hash
69
96
  raise TypeError unless arguments.is_a? Array
70
97
  # Set up the sketch.
71
98
  super()
@@ -77,39 +104,28 @@ module Propane
77
104
  end
78
105
 
79
106
  def size(*args)
80
- w, h, mode = *args
81
- @width ||= w
82
- @height ||= h
83
- @render_mode ||= mode
107
+ w, h, mode = *args
108
+ @width ||= w
109
+ @height ||= h
110
+ @render_mode ||= mode
84
111
  import_opengl if /opengl/ =~ mode
85
112
  super(*args)
86
113
  end
87
114
 
115
+ def data_path(dat)
116
+ dat_root = File.join(SKETCH_ROOT, 'data')
117
+ Dir.mkdir(dat_root) unless File.exist?(dat_root)
118
+ File.join(dat_root, dat)
119
+ end
120
+
88
121
  # This method runs the processing sketch.
89
122
  #
90
123
  def run_sketch
91
124
  PApplet.run_sketch(arguments, self)
92
125
  end
93
-
94
- # Is the mouse pressed for this frame?
95
- def mouse_pressed?
96
- @declared_fields['mousePressed'].value(java_self)
97
- end
98
126
 
99
- # Is a key pressed for this frame?
100
- def key_pressed?
101
- @declared_fields['keyPressed'].value(java_self)
102
- end
103
-
104
- # Fix java conversion problems getting the last key
105
- # If it's ASCII, return the character, otherwise the integer
106
- def key
107
- int = @declared_fields['key'].value(java_self)
108
- int < 256 ? int.chr : int
109
- end
127
+ private
110
128
 
111
- private
112
-
113
129
  def import_opengl
114
130
  # Include processing opengl classes that we'd like to use:
115
131
  %w(FontTexture FrameBuffer LinePath LineStroker PGL
@@ -139,37 +155,18 @@ module Propane
139
155
  arguments.concat [title_string]
140
156
  end
141
157
 
142
- %w(displayHeight displayWidth frameCount keyCode
143
- mouseButton mouseX mouseY pmouseX pmouseY).each do |name|
144
- sc_name = name.split(/(?![a-z])(?=[A-Z])/).map(&:downcase).join('_')
145
- alias_method sc_name, name
146
- end
147
-
148
- def self.method_added(name)
149
- name = name.to_s
150
- if name.include?('_')
151
- lcc_name = name.split('_').map(&:capitalize).join('')
152
- lcc_name[0] = lcc_name[0].downcase
153
- alias_method lcc_name, name if lcc_name != name
154
- end
155
- end
156
-
157
- def method_missing(name, *args)
158
- self.class.__send__(name, *args) if PApplet.public_methods.include?(name)
159
- end
160
-
161
158
  def proxy_java_fields
162
159
  fields = %w(sketchPath key frameRate mousePressed keyPressed)
163
- methods = fields.map { |field| java_class.declared_field(field) }
160
+ methods = fields.map { |field| java_class.declared_field(field) }
164
161
  @declared_fields = Hash[fields.zip(methods)]
165
162
  end
166
-
167
- # Fix java conversion problems getting the last key
168
- # If it's ASCII, return the character, otherwise the integer
169
- # def self.key
170
- # int = @declared_fields['key'].value(java_self)
171
- # int < 256 ? int.chr : int
172
- # end
163
+
164
+ # When certain special methods get added to the sketch, we need to let
165
+ # Processing call them by their expected Java names.
166
+ def method_added(method_name) #:nodoc:
167
+ return unless METHODS_TO_ALIAS.key?(method_name)
168
+ alias_method METHODS_TO_ALIAS[method_name], method_name
169
+ end
173
170
  end
174
171
 
175
172
  # Importing PConstants to access to processing constants,
@@ -181,6 +178,10 @@ module Propane
181
178
  module Proxy
182
179
  java_import 'processing.core.PConstants'
183
180
 
181
+ def respond_to_missing?(name, include_private = false)
182
+ $app.respond_to?(name) || super
183
+ end
184
+
184
185
  def method_missing(name, *args)
185
186
  return $app.send(name, *args) if $app && $app.respond_to?(name)
186
187
  super
@@ -11,9 +11,8 @@ class SketchParameters
11
11
  name.split('_').collect(&:capitalize).join
12
12
  end
13
13
 
14
- def sketch_title
15
- human = name.split('_').collect(&:capitalize).join(' ')
16
- format("sketch_title '%s'", human)
14
+ def title
15
+ name.split('_').collect(&:capitalize).join(' ')
17
16
  end
18
17
 
19
18
  def sketch_size
@@ -51,6 +50,7 @@ class ClassSketch
51
50
  lines.concat method_lines('setup', param.sketch_size)
52
51
  lines.concat method_lines('draw', '')
53
52
  lines << 'end'
53
+ lines.concat new(param)
54
54
  end
55
55
 
56
56
  private
@@ -62,5 +62,9 @@ class ClassSketch
62
62
  return [one, two, three] if /draw/ =~ name
63
63
  [one, two, three, '']
64
64
  end
65
+
66
+ def new(param)
67
+ ['', format("%s.new title: '%s'", param.class_name, param.title)]
68
+ end
65
69
  end
66
70
 
@@ -1,9 +1,12 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: false
2
+ # processing module wrapper
3
+ require_relative '../propane'
4
+
3
5
  module Propane
6
+ # Provides some convenience methods
4
7
  module HelperMethods
5
8
  # processings epsilon may not be defined yet
6
- EPSILON ||= 1.0e-04
9
+ EPSILON ||= 9.999999747378752e-05
7
10
  # Nice block method to draw to a buffer.
8
11
  # You can optionally pass it a width, a height, and a renderer.
9
12
  # Takes care of starting and ending the draw for you.
@@ -18,7 +21,8 @@ module Propane
18
21
  def kamera(
19
22
  eye: Vec3D.new(width / 2.0, height / 2.0, (height / 2.0) / tan(PI * 30.0 / 180.0)),
20
23
  center: Vec3D.new(width / 2.0, height / 2.0, 0),
21
- up: Vec3D.new(0, 1.0, 0))
24
+ up: Vec3D.new(0, 1.0, 0)
25
+ )
22
26
  camera(eye.x, eye.y, eye.z, center.x, center.y, center.z, up.x, up.y, up.z)
23
27
  end
24
28
 
@@ -26,7 +30,8 @@ module Propane
26
30
  fov: Math::PI / 3.0,
27
31
  aspect_ratio: width.to_f / height,
28
32
  near_z: (height / 20.0) / tan(fov / 2.0),
29
- far_z: (height * 5) / tan(fov / 2.0))
33
+ far_z: (height * 5) / tan(fov / 2.0)
34
+ )
30
35
  perspective(fov, aspect_ratio, near_z, far_z)
31
36
  end
32
37
 
@@ -46,6 +51,11 @@ module Propane
46
51
  args.length > 3 ? self.class.lerp_color(*args) : super(*args)
47
52
  end
48
53
 
54
+ # hue, sat, brightness in range 0..1.0 returns RGB color int
55
+ def hsb_color(hue, sat, brightness)
56
+ Java::Monkstone::ColorUtil.hsbToRgB(hue, sat, brightness)
57
+ end
58
+
49
59
  def color(*args)
50
60
  return super(*args) unless args.length == 1
51
61
  super(hex_color(args[0]))
@@ -59,7 +69,6 @@ module Propane
59
69
  Java::Monkstone::ColorUtil.rubyString(hex)
60
70
  end
61
71
 
62
-
63
72
  # Overrides Processing convenience function thread, which takes a String
64
73
  # arg (for a function) to more rubylike version, takes a block...
65
74
  def thread(&block)
@@ -86,10 +95,14 @@ module Propane
86
95
 
87
96
  # explicitly provide 'processing.org' dist instance method
88
97
  def dist(*args)
89
- len = args.length
90
- return dist2d(*args) if len == 4
91
- return dist3d(*args) if len == 6
92
- raise ArgumentError, 'takes 4 or 6 parameters'
98
+ case args.length
99
+ when 4
100
+ return dist2d(*args)
101
+ when 6
102
+ return dist3d(*args)
103
+ else
104
+ raise ArgumentError, 'takes 4 or 6 parameters'
105
+ end
93
106
  end
94
107
 
95
108
  # Uses PImage class method under hood
@@ -107,23 +120,16 @@ module Propane
107
120
  # Proxy over a list of Java declared fields that have the same name as
108
121
  # some methods. Add to this list as needed.
109
122
  def proxy_java_fields
110
- fields = %w(sketchPath key frameRate frame mousePressed keyPressed)
123
+ fields = %w(key frameRate mousePressed keyPressed)
111
124
  methods = fields.map { |field| java_class.declared_field(field) }
112
125
  @declared_fields = Hash[fields.zip(methods)]
113
126
  end
114
127
 
115
- class VersionError < StandardError
116
- end
117
-
118
- # By default, your sketch path is the folder that your sketch is in.
119
- # If you'd like to do something fancy, feel free.
120
- def set_sketch_path(spath = nil)
121
- field = @declared_fields['sketchPath']
122
- begin
123
- field.set_value(java_self, spath || SKETCH_ROOT)
124
- rescue TypeError
125
- raise VersionError, 'Use JRubyArt for processing-3.0'
126
- end
128
+ # Fix java conversion problems getting the last key
129
+ # If it's ASCII, return the character, otherwise the integer
130
+ def key
131
+ int = @declared_fields['key'].value(java_self)
132
+ int < 256 ? int.chr : int
127
133
  end
128
134
 
129
135
  # Provide a convenient handle for the Java-space version of self.
@@ -131,11 +137,6 @@ module Propane
131
137
  @java_self ||= to_java(Java::ProcessingCore::PApplet)
132
138
  end
133
139
 
134
- # Get the sketch path
135
- def sketch_path
136
- @declared_fields['sketchPath'].value(java_self)
137
- end
138
-
139
140
  # Fields that should be made accessible as under_scored.
140
141
  define_method(:mouse_x) { mouseX }
141
142
 
@@ -168,6 +169,16 @@ module Propane
168
169
  super(fps)
169
170
  end
170
171
 
172
+ # Is the mouse pressed for this frame?
173
+ def mouse_pressed?
174
+ @declared_fields['mousePressed'].value(java_self)
175
+ end
176
+
177
+ # Is a key pressed for this frame?
178
+ def key_pressed?
179
+ @declared_fields['keyPressed'].value(java_self)
180
+ end
181
+
171
182
  private
172
183
 
173
184
  FIXNUM_COL = -> (x) { x.is_a?(Fixnum) }
@@ -180,11 +191,11 @@ module Propane
180
191
  Java::Monkstone::ColorUtil.colorLong(a)
181
192
  when STRING_COL
182
193
  return Java::Monkstone::ColorUtil.colorString(a) if a =~ /#\h+/
183
- fail StandardError, 'Dodgy Hexstring'
194
+ raise StandardError, 'Dodgy Hexstring'
184
195
  when FLOAT_COL
185
196
  Java::Monkstone::ColorUtil.colorDouble(a)
186
197
  else
187
- fail StandardError, 'Dodgy Color Conversion'
198
+ raise StandardError, 'Dodgy Color Conversion'
188
199
  end
189
200
  end
190
201
 
@@ -94,8 +94,9 @@ module Propane
94
94
  end
95
95
 
96
96
  def run_sketch
97
- root = File.absolute_path(File.dirname(filename))
98
- sketch = File.join(root, filename)
97
+ # root = File.absolute_path(File.dirname(filename))
98
+ # sketch = File.join(root, filename)
99
+ sketch = File.join(SKETCH_ROOT, filename)
99
100
  warn_format = 'File %s does not not Exist!'
100
101
  return warn(format(warn_format, sketch)) unless File.exist?(sketch)
101
102
  command = [
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
  module Propane
4
- VERSION = '0.8.0'.freeze
4
+ VERSION = '0.9.0'.freeze
5
5
  end
data/pom.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
  project 'rp5extras', 'https://github.com/monkstone/propane' do
3
3
  model_version '4.0.0'
4
- id 'propane:rp5extras', '0.8.0'
4
+ id 'propane:rp5extras', '0.9.0'
5
5
  packaging 'jar'
6
6
  description 'rp5extras for propane'
7
7
  organization 'ruby-processing', 'https://ruby-processing.github.io'
data/pom.xml CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
11
11
  <modelVersion>4.0.0</modelVersion>
12
12
  <groupId>propane</groupId>
13
13
  <artifactId>rp5extras</artifactId>
14
- <version>0.8.0</version>
14
+ <version>0.9.0</version>
15
15
  <name>rp5extras</name>
16
16
  <description>rp5extras for propane</description>
17
17
  <url>https://github.com/monkstone/propane</url>
@@ -8,12 +8,15 @@ WARNING = <<-EOS
8
8
  re-run
9
9
  EOS
10
10
 
11
+ EXAMPLES = '0.1'.freeze
11
12
  JRUBYC_VERSION = '9.1.2.0'.freeze
13
+ HOME_DIR = ENV['HOME']
14
+ MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
12
15
 
13
16
  CLOBBER.include("jruby-complete-#{JRUBYC_VERSION}.jar")
14
17
 
15
18
  desc 'download, and copy to propane'
16
- task default: [:download, :copy_ruby]
19
+ task default: [:download, :copy_ruby, :download_examples, :copy_examples]
17
20
 
18
21
  desc 'download JRuby upstream sources'
19
22
  task download: ["jruby-complete-#{JRUBYC_VERSION}.jar"]
@@ -46,3 +49,30 @@ def check_sha256(filename, expected_hash)
46
49
  raise "bad sha256 checksum for #{filename} (expected #{expected_hash} got #{sha256.hexdigest})"
47
50
  end
48
51
  end
52
+
53
+ desc 'download and copy examples to user home'
54
+ task :download_examples
55
+ file_name = (MAC_OR_LINUX.nil?) ? "#{EXAMPLES}.zip" : "#{EXAMPLES}.tar.gz"
56
+ file file_name do
57
+ begin
58
+ if MAC_OR_LINUX.nil?
59
+ sh "wget https://github.com/ruby-processing/propane-examples/archive/#{EXAMPLES}.zip"
60
+ else
61
+ sh "wget https://github.com/ruby-processing/propane-examples/archive/#{EXAMPLES}.tar.gz"
62
+ end
63
+ rescue
64
+ warn(WARNING)
65
+ end
66
+ end
67
+
68
+ desc "copy examples"
69
+ task :copy_examples => file_name do
70
+ if MAC_OR_LINUX.nil?
71
+ sh "unzip #{EXAMPLES},zip"
72
+ else
73
+ sh "tar xzvf #{EXAMPLES}.tar.gz"
74
+ end
75
+ sh "rm -r #{HOME_DIR}/k9_samples" if File.exist? "#{HOME_DIR}/propane_samples"
76
+ sh "cp -r propane-examples-#{EXAMPLES} #{HOME_DIR}/propane_samples"
77
+ sh "rm -r propane-examples-#{EXAMPLES}"
78
+ end