propane 2.0.1-java → 2.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/propane/creators/sketch_class.rb +54 -0
- data/lib/propane/creators/sketch_writer.rb +10 -60
- data/lib/propane/runner.rb +1 -2
- data/lib/propane/version.rb +1 -1
- data/pom.rb +4 -5
- data/pom.xml +3 -14
- data/propane.gemspec +1 -1
- data/test/create_test.rb +54 -17
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f847eb7d415cbd0c0ee989ebf5c5da70a68de20
|
4
|
+
data.tar.gz: cddade51d46516647451f40532d18e0d351bbe2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9445e29c40600d55147c13434f253b517791d9ffd7dba8cdabca8b2ccb81128b4915cf773daf7fca3763104aec9c40d483ed280fa12d6d406ef7f7d018970f60
|
7
|
+
data.tar.gz: 583bceb0eeeacdbf4e1b1d3cbdb18bde2fe5b08c3b67f7c7e5917bd626618d7a46c1606ee6ebecd299d78726052cb2949de9d908fc2d30a9b8fd3e18e74e3e4b
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
**v2.0.
|
1
|
+
**v2.0.2** Using processing-3.2 core from local maven repository, refactored sketch creator
|
2
|
+
|
3
|
+
**v2.0.1** Refactored to work with processing-3.0, `--install samples` and/or vanilla processing `sound` and `video` libraries
|
2
4
|
|
3
5
|
**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.
|
4
6
|
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ propane -c my_sketch 200 200 p2d # for opengl 2D renderer
|
|
56
56
|
propane -c my_sketch 200 200 p3d # for opengl 3D renderer
|
57
57
|
```
|
58
58
|
|
59
|
-
To run sketches
|
59
|
+
To run sketches (works just fine from atom editor)
|
60
60
|
|
61
61
|
```bash
|
62
62
|
jruby -S propane --run my_sketch.rb # belt and braces version
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ def create_manifest
|
|
7
7
|
File.open('MANIFEST.MF', 'w') do |f|
|
8
8
|
f.puts(title)
|
9
9
|
f.puts(version)
|
10
|
-
f.puts('Class-Path: core-3.
|
10
|
+
f.puts('Class-Path: core-3.2.0.jar gluegen-rt-2.3.2.jar jog-all-2.3.2.jar')
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
# the sketch class
|
3
|
+
class SketchClass
|
4
|
+
attr_reader :name, :width, :height, :mode
|
5
|
+
|
6
|
+
def initialize(name:, width: 150, height: 150, mode: nil)
|
7
|
+
@name, @width, @height, @mode = name, width, height, mode
|
8
|
+
end
|
9
|
+
|
10
|
+
def class_sketch
|
11
|
+
format('class %s < Propane::App', sketch_class)
|
12
|
+
end
|
13
|
+
|
14
|
+
def sketch_class
|
15
|
+
name.split('_').collect(&:capitalize).join
|
16
|
+
end
|
17
|
+
|
18
|
+
def sketch_new
|
19
|
+
format('%s.new', sketch_class)
|
20
|
+
end
|
21
|
+
|
22
|
+
def indent(line)
|
23
|
+
format(' %s', line)
|
24
|
+
end
|
25
|
+
|
26
|
+
def size
|
27
|
+
return format(' size %d, %d', width.to_i, height.to_i) if mode.nil?
|
28
|
+
format(' size %d, %d, %s', width.to_i, height.to_i, mode.upcase)
|
29
|
+
end
|
30
|
+
|
31
|
+
def sketch_title
|
32
|
+
human = name.split('_').collect(&:capitalize).join(' ')
|
33
|
+
format(" sketch_title '%s'", human)
|
34
|
+
end
|
35
|
+
|
36
|
+
def method_lines(name, content = '')
|
37
|
+
return [format(' def %s', name), content, ' end'] if content.empty?
|
38
|
+
[format(' def %s', name), content, ' end', '']
|
39
|
+
end
|
40
|
+
|
41
|
+
def lines
|
42
|
+
lines = [
|
43
|
+
'# frozen_string_literal: false',
|
44
|
+
"require 'propane'",
|
45
|
+
'',
|
46
|
+
class_sketch
|
47
|
+
]
|
48
|
+
lines.concat method_lines('settings', size)
|
49
|
+
lines.concat method_lines('setup', sketch_title)
|
50
|
+
lines.concat method_lines('draw')
|
51
|
+
lines << 'end'
|
52
|
+
lines << sketch_new
|
53
|
+
end
|
54
|
+
end
|
@@ -1,71 +1,21 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
-
|
3
|
-
class SketchParameters
|
4
|
-
attr_reader :name, :args
|
5
|
-
def initialize(name:, args:)
|
6
|
-
@name = name
|
7
|
-
@args = args
|
8
|
-
end
|
9
|
-
|
10
|
-
def class_name
|
11
|
-
name.split('_').collect(&:capitalize).join
|
12
|
-
end
|
13
|
-
|
14
|
-
def sketch_title
|
15
|
-
human = name.split('_').collect(&:capitalize).join(' ')
|
16
|
-
format("sketch_title '%s'", human)
|
17
|
-
end
|
18
|
-
|
19
|
-
def sketch_size
|
20
|
-
mode = args.length == 3 ? format(', %s', args[2].upcase) : ''
|
21
|
-
return 'size 200, 200' if args.empty?
|
22
|
-
format('size %d, %d%s', args[0].to_i, args[1].to_i, mode)
|
23
|
-
end
|
24
|
-
end
|
2
|
+
require_relative 'sketch_class'
|
25
3
|
|
26
4
|
# The file writer can write a sketch when given instance of Sketch type
|
27
5
|
class SketchWriter
|
28
|
-
attr_reader :file, :
|
6
|
+
attr_reader :file, :sketch
|
29
7
|
|
30
8
|
def initialize(path, args)
|
31
|
-
@
|
9
|
+
@sketch = SketchClass.new(
|
10
|
+
name: path,
|
11
|
+
width: args[0].to_i,
|
12
|
+
height: args[1].to_i,
|
13
|
+
mode: args[2]
|
14
|
+
)
|
32
15
|
@file = format('%s/%s.rb', File.dirname(path), path)
|
33
16
|
end
|
34
17
|
|
35
|
-
def write
|
36
|
-
|
37
|
-
File.open(file, 'w+') { |f| f.write sketch.join("\n") }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# A simple class wrapped sketch
|
42
|
-
class ClassSketch
|
43
|
-
INDENT ||= ' '
|
44
|
-
def code(param)
|
45
|
-
lines = [
|
46
|
-
'# frozen_string_literal: false',
|
47
|
-
"require 'propane'",
|
48
|
-
''
|
49
|
-
]
|
50
|
-
lines << format('class %s < Propane::App', param.class_name)
|
51
|
-
lines.concat method_lines('settings', param.sketch_size)
|
52
|
-
lines.concat method_lines('setup', param.sketch_title)
|
53
|
-
lines.concat method_lines('draw', '')
|
54
|
-
lines << 'end'
|
55
|
-
lines.concat new(param)
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
def method_lines(name, content)
|
61
|
-
one = format('%sdef %s', INDENT, name)
|
62
|
-
two = content.empty? ? '' : format(' %s%s', INDENT, content)
|
63
|
-
three = format('%send', INDENT)
|
64
|
-
return [one, two, three] if /draw/ =~ name
|
65
|
-
[one, two, three, '']
|
66
|
-
end
|
67
|
-
|
68
|
-
def new(param)
|
69
|
-
['', format('%s.new', param.class_name)]
|
18
|
+
def write
|
19
|
+
File.open(file, 'w+') { |f| f.write sketch.lines.join("\n") }
|
70
20
|
end
|
71
21
|
end
|
data/lib/propane/runner.rb
CHANGED
@@ -63,8 +63,7 @@ module Propane
|
|
63
63
|
|
64
64
|
def create
|
65
65
|
require_relative 'creators/sketch_writer'
|
66
|
-
|
67
|
-
SketchWriter.new(File.basename(filename, '.rb'), argc).write(sketch)
|
66
|
+
SketchWriter.new(File.basename(filename, '.rb'), argc).write
|
68
67
|
end
|
69
68
|
|
70
69
|
def show_version
|
data/lib/propane/version.rb
CHANGED
data/pom.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
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', '2.0.
|
4
|
+
id 'propane:rp5extras', '2.0.2'
|
5
5
|
packaging 'jar'
|
6
6
|
description 'rp5extras for propane'
|
7
7
|
organization 'ruby-processing', 'https://ruby-processing.github.io'
|
8
|
-
{ 'monkstone' => 'Martin Prout'
|
8
|
+
{ 'monkstone' => 'Martin Prout' }.each do |key, value|
|
9
9
|
developer key do
|
10
10
|
name value
|
11
11
|
roles 'developer'
|
12
12
|
end
|
13
13
|
end
|
14
|
-
license 'MIT', 'http://www.opensource.org/licenses/mit-license.php'
|
15
14
|
license 'GPL 3', 'http://www.gnu.org/licenses/gpl-3.0-standalone.html'
|
16
15
|
issue_management 'https://github.com/ruby-processing/propane/issues', 'Github'
|
17
16
|
|
@@ -34,7 +33,7 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
|
|
34
33
|
)
|
35
34
|
|
36
35
|
pom 'org.jruby:jruby:9.1.2.0'
|
37
|
-
jar 'org.processing:core:3.
|
36
|
+
jar 'org.processing:core:3.2.0'
|
38
37
|
jar 'org.processing:video:3.0.2'
|
39
38
|
jar('org.jogamp.jogl:jogl-all:${jogl.version}')
|
40
39
|
jar('org.jogamp.gluegen:gluegen-rt-main:${jogl.version}')
|
@@ -45,7 +44,7 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
|
|
45
44
|
execute_goals( id: 'default-cli',
|
46
45
|
artifactItems: [ { groupId: 'org.processing',
|
47
46
|
artifactId: 'core',
|
48
|
-
version: '3.
|
47
|
+
version: '3.2.0',
|
49
48
|
type: 'jar',
|
50
49
|
outputDirectory: '${propane.basedir}/lib'
|
51
50
|
},
|
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>2.0.
|
14
|
+
<version>2.0.2</version>
|
15
15
|
<name>rp5extras</name>
|
16
16
|
<description>rp5extras for propane</description>
|
17
17
|
<url>https://github.com/monkstone/propane</url>
|
@@ -20,10 +20,6 @@ DO NOT MODIFIY - GENERATED CODE
|
|
20
20
|
<url>https://ruby-processing.github.io</url>
|
21
21
|
</organization>
|
22
22
|
<licenses>
|
23
|
-
<license>
|
24
|
-
<name>MIT</name>
|
25
|
-
<url>http://www.opensource.org/licenses/mit-license.php</url>
|
26
|
-
</license>
|
27
23
|
<license>
|
28
24
|
<name>GPL 3</name>
|
29
25
|
<url>http://www.gnu.org/licenses/gpl-3.0-standalone.html</url>
|
@@ -37,13 +33,6 @@ DO NOT MODIFIY - GENERATED CODE
|
|
37
33
|
<role>developer</role>
|
38
34
|
</roles>
|
39
35
|
</developer>
|
40
|
-
<developer>
|
41
|
-
<id>filib</id>
|
42
|
-
<name>Phillip Cunningham</name>
|
43
|
-
<roles>
|
44
|
-
<role>developer</role>
|
45
|
-
</roles>
|
46
|
-
</developer>
|
47
36
|
</developers>
|
48
37
|
<scm>
|
49
38
|
<connection>scm:git:git://github.com/ruby-processing/propane.git</connection>
|
@@ -75,7 +64,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
75
64
|
<dependency>
|
76
65
|
<groupId>org.processing</groupId>
|
77
66
|
<artifactId>core</artifactId>
|
78
|
-
<version>3.
|
67
|
+
<version>3.2.0</version>
|
79
68
|
</dependency>
|
80
69
|
<dependency>
|
81
70
|
<groupId>org.processing</groupId>
|
@@ -114,7 +103,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
114
103
|
<artifactItem>
|
115
104
|
<groupId>org.processing</groupId>
|
116
105
|
<artifactId>core</artifactId>
|
117
|
-
<version>3.
|
106
|
+
<version>3.2.0</version>
|
118
107
|
<type>jar</type>
|
119
108
|
<outputDirectory>${propane.basedir}/lib</outputDirectory>
|
120
109
|
</artifactItem>
|
data/propane.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.homepage = 'https://ruby-processing.github.io/propane/'
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.files << 'lib/propane.jar'
|
17
|
-
gem.files << 'lib/core-3.
|
17
|
+
gem.files << 'lib/core-3.2.0.jar'
|
18
18
|
gem.files << 'lib/gluegen-rt-2.3.2.jar'
|
19
19
|
gem.files << 'lib/jogl-all-2.3.2.jar'
|
20
20
|
gem.files << 'lib/gluegen-rt-2.3.2-natives-linux-amd64.jar'
|
data/test/create_test.rb
CHANGED
@@ -3,7 +3,7 @@ require 'minitest/autorun'
|
|
3
3
|
require 'minitest/pride'
|
4
4
|
|
5
5
|
|
6
|
-
require_relative '../lib/propane/creators/
|
6
|
+
require_relative '../lib/propane/creators/sketch_class'
|
7
7
|
|
8
8
|
CLASS_SKETCH = <<~CODE
|
9
9
|
# frozen_string_literal: false
|
@@ -11,7 +11,7 @@ require 'propane'
|
|
11
11
|
|
12
12
|
class FredSketch < Propane::App
|
13
13
|
def settings
|
14
|
-
size 200, 200
|
14
|
+
size 200, 200
|
15
15
|
end
|
16
16
|
|
17
17
|
def setup
|
@@ -27,29 +27,66 @@ FredSketch.new
|
|
27
27
|
|
28
28
|
CODE
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
BARE_SKETCH = <<~CODE
|
31
|
+
def settings
|
32
|
+
size 200, 200, P2D
|
33
|
+
end
|
34
|
+
|
35
|
+
def setup
|
36
|
+
sketch_title 'Fred Sketch'
|
37
|
+
end
|
38
|
+
|
39
|
+
def draw
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
CODE
|
44
|
+
|
45
|
+
class SketchClassTest < Minitest::Test
|
32
46
|
|
33
47
|
def setup
|
34
|
-
@
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
)
|
48
|
+
@basic = SketchClass.new(name: 'fred_sketch', width: 200, height: 200)
|
49
|
+
@sketch = SketchClass.new(name: 'fred_sketch', width: 200, height: 200, mode: 'p2d')
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_class
|
53
|
+
result = CLASS_SKETCH.split(/\n/, -1)
|
54
|
+
class_lines = @sketch.lines
|
55
|
+
class_lines.each_with_index do |line, i|
|
56
|
+
assert_equal result[i], line
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_indent
|
61
|
+
assert_equal ' indent', @sketch.indent('indent')
|
40
62
|
end
|
41
63
|
|
42
|
-
def
|
43
|
-
|
44
|
-
assert_equal 'size 200, 200
|
45
|
-
|
64
|
+
def test_size
|
65
|
+
assert_equal ' size 200, 200, P2D', @sketch.size
|
66
|
+
assert_equal ' size 200, 200', @basic.size
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_sketch_title
|
70
|
+
assert_equal " sketch_title 'Fred Sketch'", @sketch.sketch_title
|
46
71
|
end
|
47
72
|
|
48
73
|
def test_class
|
74
|
+
assert_equal "FredSketch", @sketch.sketch_class
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_class_new
|
78
|
+
assert_equal "FredSketch.new", @sketch.sketch_new
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_method_lines
|
49
82
|
result = CLASS_SKETCH.split(/\n/, -1)
|
50
|
-
|
51
|
-
|
52
|
-
assert_equal result[i], line
|
83
|
+
@basic.method_lines('settings', @basic.size).each_with_index do |line, i|
|
84
|
+
assert_equal result[i + 4], line
|
53
85
|
end
|
54
86
|
end
|
87
|
+
|
88
|
+
|
89
|
+
def test_sketch_class
|
90
|
+
assert_equal "class FredSketch < Propane::App", @basic.class_sketch
|
91
|
+
end
|
55
92
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: propane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- monkstone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arcball
|
@@ -45,7 +45,7 @@ files:
|
|
45
45
|
- Rakefile
|
46
46
|
- bin/propane
|
47
47
|
- lib/PROCESSING_LICENSE.txt
|
48
|
-
- lib/core-3.
|
48
|
+
- lib/core-3.2.0.jar
|
49
49
|
- lib/export.txt
|
50
50
|
- lib/gluegen-rt-2.3.2-natives-linux-amd64.jar
|
51
51
|
- lib/gluegen-rt-2.3.2-natives-macosx-universal.jar
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/propane.jar
|
57
57
|
- lib/propane.rb
|
58
58
|
- lib/propane/app.rb
|
59
|
+
- lib/propane/creators/sketch_class.rb
|
59
60
|
- lib/propane/creators/sketch_writer.rb
|
60
61
|
- lib/propane/helper_methods.rb
|
61
62
|
- lib/propane/helpers/numeric.rb
|