picrate 0.6.0-java → 0.7.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00f6892195bf24cb8499f36e91c6bff8b26ccd9daf333134d56e56ca5a8b8276
4
- data.tar.gz: b0c035e3c0fcd805ed138c8a95407b21e33ece9ae29fffb4b4443fc60d9ce7ac
3
+ metadata.gz: 503789e011ca3a619d42a03d351463c02e8cf64c8119dab588b8e0f826415ad0
4
+ data.tar.gz: e2092cab3393155d0a29da02616755a9e4c14e1d5a9ecb9eadec68b248383348
5
5
  SHA512:
6
- metadata.gz: e57716795bb80e84a92bc40f92dffeb5c0fe43184e093b978a8b06c4003b075bf64171669ca4537488d8f2041ae3e2bb3ad802ce0013f7dcb7e81a56905a7e63
7
- data.tar.gz: 3ae4e5b88f878db84575d7eddcb03c87ddb3475a190fd269fd32a0baea9641a5debd151f4962949c98bac52ed3488049c71b772afd87752633f3077c29b91682
6
+ metadata.gz: 7459a92d1eb700e7c4c3c71f57de09453456768789b1878380e699c118a6e7f382bae314308e8a01cfbf9a601621f826ba91720b981bd049ba330d328605e7da
7
+ data.tar.gz: 9a84ceac91c0b6f3c26baf6f1eb497ef73cd872940bac442942c55c19ce329fe26a49bb2b87bcb934455de072166948fabea5b3c09594e8d8ad3b7799a214f9c
@@ -3,7 +3,7 @@
3
3
  <extension>
4
4
  <groupId>io.takari.polyglot</groupId>
5
5
  <artifactId>polyglot-ruby</artifactId>
6
- <version>0.3.1
6
+ <version>0.4.0
7
7
  </version>
8
8
  </extension>
9
9
  </extensions>
@@ -1,3 +1,5 @@
1
+ v0.7.0 Refactor sketch_writer to load params from ~/.picrate/sketch.yml. `AppRender => GfxRender` because we only need `PGraphics` in renderer.
2
+
1
3
  v0.6.0 Re-branding with new 'pick'/'eight' svg for PiCrate
2
4
 
3
5
  v0.5.0 Do geany configuration when installing samples
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: false
2
+
3
+ require 'fileutils'
2
4
  require_relative 'lib/picrate/version'
3
5
 
4
6
  HOME_DIR = ENV['HOME']
@@ -20,7 +22,7 @@ desc 'Create Manifest and Copy Jars'
20
22
  task :init do
21
23
  create_manifest
22
24
  # processing_root = File.dirname(`readlink -f $(which processing)`) # for Archlinux etc
23
- processing_root = File.join(HOME_DIR, 'processing-3.4') # alternative for debian linux etc
25
+ processing_root = File.join(HOME_DIR, 'processing-3.5.3') # alternative for debian linux etc
24
26
  jar_dir = File.join(processing_root, 'core', 'library')
25
27
  opengl = Dir.entries(jar_dir).grep(/amd64|armv6hf/).select { |jar| jar =~ /linux/ }
26
28
  opengl.concat %w[jogl-all.jar gluegen-rt.jar]
@@ -31,7 +33,7 @@ end
31
33
 
32
34
  desc 'Install'
33
35
  task :install do
34
- sh "mv target/picrate-#{PiCrate::VERSION}.jar lib"
36
+ FileUtils.mv "target/picrate-#{PiCrate::VERSION}.jar", 'lib'
35
37
  end
36
38
 
37
39
  desc 'Gem'
@@ -53,7 +55,6 @@ desc 'Test'
53
55
  task :test do
54
56
  sh 'jruby test/helper_methods_test.rb'
55
57
  sh 'jruby test/respond_to_test.rb' # Skip this test on Travis etc
56
- sh 'jruby test/create_test.rb'
57
58
  sh 'jruby test/math_tool_test.rb'
58
59
  sh 'jruby test/deglut_spec_test.rb'
59
60
  sh 'jruby test/vecmath_spec_test.rb'
@@ -4,12 +4,20 @@ title: "Geany"
4
4
  permalink: /editors/geany/
5
5
  keywords: editor, ide, ruby, picrate, vim, emacs, geany
6
6
  ---
7
- Geany is highly configurable, and we have created a `geany` project file `picrate.geany` and sketch template `picrate.rb` for you, thai get installed when you:-
7
+ Geany is highly configurable, and we have created a `geany` project file `picrate.geany` and sketch template `picrate.rb` for you, that get installed when you:-
8
8
 
9
9
  ```bash
10
10
  picrate --install samples
11
11
  ```
12
12
 
13
+ #### Using picrate.rb template ####
14
+
15
+ ![select picrate.rb]({{ site.github.url }}/assets/picrate_template.png)
16
+
17
+ Remember to give untitled sketch a new name (PS: it's easy to create your own templates):-
18
+
19
+ ![new with template]({{ site.github.url }}/assets/new_with_template.png)
20
+
13
21
  Use `make` to check syntax and `run` to run sketch
14
22
 
15
23
  See running sketch below:-
@@ -14,7 +14,7 @@ mkdir installer
14
14
  cd installer
15
15
  rake
16
16
  ```
17
- Currently installs jruby-9.2.4.1
17
+ Currently installs jruby-9.2.7.0
18
18
 
19
19
  ### Manual install ###
20
20
 
@@ -25,7 +25,7 @@ Get the latest version from [http://jruby.org/download][download]
25
25
 
26
26
  ```bash
27
27
  cd /opt
28
- sudo tar xzvf /pathToDownload/jruby-bin-9.2.4.1.tar.gz
28
+ sudo tar xzvf /pathToDownload/jruby-bin-9.2.7.0.tar.gz
29
29
  ```
30
30
 
31
31
  Then use the excellent `update-alternatives` tool to provide symbolic links to `jruby`, `jgem`, `jirb` and `rake` especially if you haven't installed `mri` ruby.
@@ -49,5 +49,5 @@ export PATH="${PATH}:${GEM_PATH}/bin"
49
49
 
50
50
  If you know better please post on wiki
51
51
 
52
- [download]:"https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.2.4.1/jruby-dist-9.2.4.1-bin.tar.gz"
52
+ [download]:"https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.2.7.0/jruby-dist-9.2.7.0-bin.tar.gz"
53
53
  [rake_gist]:https://gist.github.com/monkstone/159c5a9813c9cd181040b4715e74f6b2
@@ -8,7 +8,14 @@ PiCrate is both a `library` and an `app` that allows you to create [processing][
8
8
 
9
9
  #### Executable ####
10
10
 
11
- The executable is `picrate`, which can be used to install samples (and configure [GeanyIDE][geany]) and some processing libraries
11
+ PiCrate sketches are executable scripts that (but without the executable permission), that will run directly from jruby.
12
+
13
+
14
+ ```bash
15
+ jruby my_sketch.rb
16
+ ```
17
+
18
+ The gem executable is `picrate`, which can be used to install samples (and to configure [GeanyIDE][geany]) and some processing libraries
12
19
 
13
20
  #### Library ###
14
21
 
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'fileutils'
5
+
6
+ # module to read sketch.yml
7
+ # and or create sketch.yml with default parameters
8
+ module Parameters
9
+ PATH = File.join(ENV['HOME'], '.picrate').freeze
10
+ FILE = File.join(PATH, 'sketch.yml').freeze
11
+ PARAM = { 'sketch' =>
12
+ { 'width' => 640, 'height' => 480, 'mode' => 'P2D' } }.freeze
13
+
14
+ def self.write
15
+ FileUtils.mkdir_p PATH
16
+ File.write(FILE, PARAM.to_yaml)
17
+ end
18
+
19
+ def self.read
20
+ write unless File.exist?(FILE)
21
+ YAML.load_file(FILE)
22
+ end
23
+ end
@@ -4,7 +4,7 @@ class SketchFactory
4
4
  NAMES = %w[One Two Three]
5
5
  def initialize(argc)
6
6
  NAMES.each do |name|
7
- SketchWriter.new(File.basename(name, '.rb'), width: 300, height: 300).write
7
+ SketchWriter.new(File.basename(name, '.rb')).write
8
8
  end
9
9
  end
10
10
  end
@@ -1,21 +1,64 @@
1
- # frozen_string_literal: false
2
- require_relative 'sketch_class'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'parameters'
4
+ require 'erb'
5
+
6
+ TEMPLATE = ERB.new <<~SKETCH
7
+ require 'picrate'
8
+
9
+ class <%= @class %> < Processing::App
10
+ def settings
11
+ size <%= @width %>, <%= @height %>, <%= @mode %>
12
+ end
13
+
14
+ def setup
15
+ sketch_title '<%= @title %>'
16
+ end
17
+
18
+ def draw
19
+
20
+ end
21
+ end
22
+
23
+ <%= @class %>.new
24
+ SKETCH
25
+
26
+ # The SketchClass class knows how to format title & class name
27
+ class SketchClass
28
+ attr_reader :name
29
+ def initialize(name)
30
+ @name = name
31
+ end
32
+
33
+ def class_name
34
+ name.split('_').collect(&:capitalize).join
35
+ end
36
+
37
+ def title
38
+ name.split('_').collect(&:capitalize).join(' ')
39
+ end
40
+
41
+ def filename
42
+ name << '.rb'
43
+ end
44
+ end
3
45
 
4
46
  # The file writer can write a sketch when given instance of Sketch type
5
47
  class SketchWriter
6
- attr_reader :file, :sketch
7
-
8
- def initialize(path, args)
9
- @sketch = SketchClass.new(
10
- name: path,
11
- width: args[0].to_i,
12
- height: args[1].to_i,
13
- mode: args[2]
14
- )
15
- @file = format('%s/%s.rb', File.dirname(path), path)
48
+ attr_reader :file, :name, :width, :height, :mode, :sketch
49
+ def initialize(path)
50
+ param = Parameters.read
51
+ @sketch = SketchClass.new(path)
52
+ @class = sketch.class_name
53
+ @title = sketch.title
54
+ sketch_param = param.fetch('sketch')
55
+ @width = sketch_param.fetch('width')
56
+ @height = sketch_param.fetch('height')
57
+ @mode = sketch_param.fetch('mode')
58
+ binding
16
59
  end
17
60
 
18
61
  def write
19
- File.open(file, 'w+') { |f| f.write sketch.lines.join("\n") }
62
+ File.open(sketch.filename, 'w+') { |f| f.write TEMPLATE.result(binding) }
20
63
  end
21
64
  end
@@ -63,7 +63,8 @@ module Processing
63
63
 
64
64
  def create
65
65
  require_relative 'creators/sketch_writer'
66
- SketchWriter.new(File.basename(filename, '.rb'), argc).write
66
+ # in case user supplied extension, we remove it
67
+ SketchWriter.new(File.basename(filename, '.rb')).write
67
68
  end
68
69
 
69
70
  def show_version
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module PiCrate
3
- VERSION = '0.6.0'.freeze
3
+ VERSION = '0.7.0'.freeze
4
4
  end
@@ -4,19 +4,19 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'picrate/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.name = 'picrate'
8
- gem.version = PiCrate::VERSION
9
- gem.authors = ['monkstone']
10
- gem.email = ['mamba2928@yahoo.co.uk']
11
- gem.licenses = %w(GPL-3.0 LGPL-2.0)
12
- gem.description = <<-EOS
13
- A batteries included version of processing in ruby, for raspberrypi and linux.
14
- Install samples to configures geany ide.
7
+ gem.name = 'picrate'
8
+ gem.version = PiCrate::VERSION
9
+ gem.authors = ['monkstone']
10
+ gem.email = ['mamba2928@yahoo.co.uk']
11
+ gem.licenses = %w(GPL-3.0 LGPL-2.0)
12
+ gem.description = <<~EOS
13
+ A batteries included version of processing in ruby, for raspberrypi and
14
+ linux. Install samples to configures geany ide.
15
15
  EOS
16
- gem.summary = %q{ruby wrapper for processing-3.4 on raspberrypi and linux64}
17
- gem.homepage = 'https://ruby-processing.github.io/PiCrate/'
16
+ gem.summary = %q{ruby wrapper for processing-3.5.3 on raspberrypi and linux64}
17
+ gem.homepage = 'https://ruby-processing.github.io/PiCrate/'
18
18
  gem.post_install_message = %q{Use 'picrate --install Samples' to install samples}
19
- gem.files = `git ls-files`.split($/)
19
+ gem.files = `git ls-files`.split($/)
20
20
  gem.files << "lib/picrate-#{PiCrate::VERSION}.jar"
21
21
  gem.files << 'lib/gluegen-rt.jar'
22
22
  gem.files << 'lib/jogl-all.jar'
data/pom.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  project 'picrate', 'http://maven.apache.org' do
2
2
 
3
3
  model_version '4.0.0'
4
- id 'ruby-processing:picrate:0.6.0'
4
+ id 'ruby-processing:picrate:0.7.0'
5
5
  packaging 'jar'
6
6
 
7
7
  description 'An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.'
@@ -31,7 +31,7 @@ project 'picrate', 'http://maven.apache.org' do
31
31
  'project.build.sourceEncoding' => 'utf-8',
32
32
  'polyglot.dump.pom' => 'pom.xml',
33
33
  'maven.compiler.source' => '1.8' )
34
- pom 'org.jruby:jruby:9.2.4.0'
34
+ pom 'org.jruby:jruby:9.2.7.0'
35
35
  jar 'org.processing:video:3.2.3'
36
36
  jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
37
37
  jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
data/pom.xml CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
11
11
  <modelVersion>4.0.0</modelVersion>
12
12
  <groupId>ruby-processing</groupId>
13
13
  <artifactId>picrate</artifactId>
14
- <version>0.6.0</version>
14
+ <version>0.7.0</version>
15
15
  <name>picrate</name>
16
16
  <description>An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.</description>
17
17
  <url>http://maven.apache.org</url>
@@ -66,19 +66,19 @@ DO NOT MODIFIY - GENERATED CODE
66
66
  <properties>
67
67
  <jogl.version>2.3.2</jogl.version>
68
68
  <jruby.api>http://jruby.org/apidocs/</jruby.api>
69
- <source.directory>src/main</source.directory>
69
+ <maven.compiler.source>1.8</maven.compiler.source>
70
70
  <maven.compiler.target>1.8</maven.compiler.target>
71
+ <picrate.basedir>${project.basedir}</picrate.basedir>
72
+ <polyglot.dump.pom>pom.xml</polyglot.dump.pom>
71
73
  <processing.api>http://processing.github.io/processing-javadocs/core/</processing.api>
72
74
  <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
73
- <polyglot.dump.pom>pom.xml</polyglot.dump.pom>
74
- <maven.compiler.source>1.8</maven.compiler.source>
75
- <picrate.basedir>${project.basedir}</picrate.basedir>
75
+ <source.directory>src/main</source.directory>
76
76
  </properties>
77
77
  <dependencies>
78
78
  <dependency>
79
79
  <groupId>org.jruby</groupId>
80
80
  <artifactId>jruby</artifactId>
81
- <version>9.2.4.0</version>
81
+ <version>9.2.7.0</version>
82
82
  <type>pom</type>
83
83
  </dependency>
84
84
  <dependency>
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The purpose of this tool is to allow picrate users to use an alternative
3
3
  * to processing.org map, lerp and norm methods in their sketches
4
- * Copyright (c) 2018 Martin Prout. This tool is free software; you can
4
+ * Copyright (c) 2018-19 Martin Prout. This tool is free software; you can
5
5
  * redistribute it and/or modify it under the terms of the GNU Lesser General
6
6
  * Public License as published by the Free Software Foundation; either version
7
7
  * 2.1 of the License, or (at your option) any later version.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2018 Martin Prout
2
+ * Copyright (c) 2018-19 Martin Prout
3
3
  *
4
4
  * This library is free software; you can redistribute it and/or
5
5
  * modify it under the terms of the GNU General Public
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2018 Martin Prout
2
+ * Copyright (c) 2018-19 Martin Prout
3
3
  *
4
4
  * This library is free software; you can redistribute it and/or
5
5
  * modify it under the terms of the GNU General Public
@@ -1,7 +1,7 @@
1
1
  package monkstone.vecmath.vec3;
2
2
 
3
3
  /*
4
- * Copyright (c) 2018 Martin Prout
4
+ * Copyright (c) 2018-19 Martin Prout
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
7
7
  * modify it under the terms of the GNU General Public
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2018 Martin Prout
2
+ * Copyright (c) 2018-19 Martin Prout
3
3
  *
4
4
  * This library is free software; you can redistribute it and/or
5
5
  * modify it under the terms of the GNU General Public
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2018 Martin Prout
2
+ * Copyright (c) 2018-19 Martin Prout
3
3
  *
4
4
  * This library is free software; you can redistribute it and/or
5
5
  * modify it under the terms of the GNU General Public
@@ -1,13 +1,15 @@
1
1
  # frozen_string_literal: true
2
+
3
+ require 'fileutils'
2
4
  require 'rake/clean'
3
5
 
4
- WARNING = 'WARNING: wget download failed you could do a manual download'.freeze
5
- SOUND = 'sound.zip'.freeze
6
+ WARNING = 'WARNING: wget download failed you could do a manual download'
7
+ SOUND = 'sound.zip'
6
8
  SOUND_VERSION = 'v1.3.2'
7
9
  GLVIDEO = 'processing-glvideo.zip'
8
10
  VIDEO = 'video-2.zip'
9
11
  VIDEO_VERSION = '2'
10
- EXAMPLES = '0.0.9'.freeze
12
+ EXAMPLES = '0.2.0'
11
13
  HOME_DIR = ENV['HOME']
12
14
  CLOBBER.include(EXAMPLES, SOUND, GLVIDEO, VIDEO)
13
15
 
@@ -15,7 +17,7 @@ desc 'download, and copy picrate examples'
15
17
  task default: [:download_and_copy_samples]
16
18
 
17
19
  desc 'download and copy examples to user home'
18
- task download_and_copy_samples: [:download_examples, :copy_examples, :config_geany]
20
+ task download_and_copy_samples: %i[download_examples copy_examples config_geany]
19
21
 
20
22
  task :download_examples
21
23
  file_name = "#{EXAMPLES}.tar.gz"
@@ -30,22 +32,23 @@ file file_name do
30
32
  end
31
33
 
32
34
  desc 'download and copy sound library to ~/.picrate'
33
- task download_and_copy_sound: [:init_dir, :download_sound, :copy_sound, :clobber]
35
+ task download_and_copy_sound: %i[init_dir download_sound copy_sound clobber]
34
36
 
35
37
  desc 'download and copy video library to ~/.picrate'
36
- task download_and_copy_video: [:init_dir, :download_video, :copy_video, :clobber]
38
+ task download_and_copy_video: %i[init_dir download_video copy_video clobber]
37
39
 
38
40
  desc 'download and copy glvideo library to ~/.picrate'
39
- task download_and_copy_glvideo: [:init_dir, :download_glvideo, :copy_glvideo, :clobber]
41
+ task download_and_copy_glvideo: %i[init_dir download_glvideo copy_glvideo clobber]
40
42
 
41
43
  desc 'download sound library'
42
44
  task :download_sound do
43
- wget_base = 'wget https://github.com/processing/processing-sound'
44
- wget_string = [wget_base, 'releases/download', SOUND_VERSION, SOUND].join('/')
45
+ wget_base = 'wget https://github.com/processing/processing-sound/'
46
+ wget_string = [wget_base, 'releases/download/latest', SOUND].join('/')
45
47
  begin
46
48
  sh wget_string
47
49
  rescue
48
- warn(WARNING)
50
+ puts 'Not Currently Available'
51
+ # warn(WARNING)
49
52
  end
50
53
  end
51
54
 
@@ -74,52 +77,52 @@ end
74
77
  desc 'initialize ~/.picrate directories'
75
78
  task :init_dir do
76
79
  unless File.exist? "#{HOME_DIR}/.picrate/libraries"
77
- sh "mkdir -p #{HOME_DIR}/.picrate/libraries"
80
+ FileUtils.mkdir_p "#{HOME_DIR}/.picrate/libraries"
78
81
  end
79
82
  end
80
83
 
81
84
  desc 'configure geany'
82
85
  task :config_geany do
83
86
  unless File.exist? "#{HOME_DIR}/.config/geany/templates/files/picrate.rb"
84
- sh "mkdir -p #{HOME_DIR}/.config/geany/templates/files"
85
- sh "cp picrate.rb #{HOME_DIR}/.config/geany/templates/files"
87
+ FileUtils.mkdir_p "#{HOME_DIR}/.config/geany/templates/files"
88
+ FileUtils.cp 'picrate.rb' "#{HOME_DIR}/.config/geany/templates/files"
86
89
  end
87
90
  unless File.exist? "#{HOME_DIR}/projects/picrate.geany"
88
- sh "mkdir -p #{HOME_DIR}/projects"
89
- sh "cp picrate.geany #{HOME_DIR}/projects"
91
+ FileUtils.mkdir_p "#{HOME_DIR}/projects"
92
+ FileUtils.cp 'picrate.geany', "#{HOME_DIR}/projects"
90
93
  end
91
94
  end
92
95
 
93
96
  desc 'copy examples'
94
- task :copy_examples => file_name do
97
+ task copy_examples: file_name do
95
98
  sh "tar xzvf #{EXAMPLES}.tar.gz"
96
- sh "rm -r #{HOME_DIR}/picrate_samples" if File.exist? "#{HOME_DIR}/picrate_samples"
97
- sh "cp -r picrate-examples-#{EXAMPLES} #{HOME_DIR}/picrate_samples"
98
- sh "rm -r picrate-examples-#{EXAMPLES}"
99
+ FileUtils.rm_r "#{HOME_DIR}/picrate_samples" if File.exist? "#{HOME_DIR}/picrate_samples"
100
+ FileUtils.cp_r "picrate-examples-#{EXAMPLES}", "#{HOME_DIR}/picrate_samples"
101
+ FileUtils.rm_r "picrate-examples-#{EXAMPLES}"
99
102
  end
100
103
 
101
104
  desc 'copy sound library'
102
- task :copy_sound => SOUND do
105
+ task copy_sound: SOUND do
103
106
  sh "unzip #{SOUND}"
104
- sh "rm -r #{HOME_DIR}/.picrate/libraries/sound" if File.exist? "#{HOME_DIR}/.picrate/libraries/sound"
105
- sh "cp -r sound #{HOME_DIR}/.picrate/libraries"
106
- sh 'rm -r sound'
107
- sh 'rm -r __MACOSX'
107
+ FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/sound" if File.exist? "#{HOME_DIR}/.picrate/libraries/sound"
108
+ FileUtils.cp_r 'sound', "#{HOME_DIR}/.picrate/libraries"
109
+ FileUtils.rm_r 'sound'
110
+ FileUtils.rm_r '__MACOSX'
108
111
  end
109
112
 
110
113
  desc 'copy video library'
111
- task :copy_video => VIDEO do
114
+ task copy_video: VIDEO do
112
115
  sh "unzip #{VIDEO}"
113
- sh "rm -r #{HOME_DIR}/.picrate/libraries/video" if File.exist? "#{HOME_DIR}/.picrate/libraries/video"
114
- sh "cp -r video #{HOME_DIR}/.picrate/libraries/video"
115
- sh 'rm -r video'
116
+ FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/video" if File.exist? "#{HOME_DIR}/.picrate/libraries/video"
117
+ FileUtils.cp_r 'video', "#{HOME_DIR}/.picrate/libraries/video"
118
+ FileUtils.rm_r 'video'
116
119
  end
117
120
 
118
121
  desc 'copy glvideo library'
119
- task :copy_glvideo => GLVIDEO do
120
- directory "~/.picrate/libraries/glvideo"
122
+ task copy_glvideo: GLVIDEO do
123
+ directory "#{HOME_DIR}/.picrate/libraries/glvideo"
121
124
  sh "unzip #{GLVIDEO}"
122
- sh "rm -r #{HOME_DIR}/.picrate/libraries/glvideo" if File.exist? "#{HOME_DIR}/.picrate/libraries/glvideo"
123
- sh "cp -r glvideo #{HOME_DIR}/.picrate/libraries/glvideo"
124
- sh 'rm -r glvideo'
125
+ FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/glvideo" if File.exist? "#{HOME_DIR}/.picrate/libraries/glvideo"
126
+ FileUtils.cp_r 'glvideo', "#{HOME_DIR}/.picrate/libraries/glvideo"
127
+ FileUtils.rm_r 'glvideo'
125
128
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: java
6
6
  authors:
7
7
  - monkstone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-11 00:00:00.000000000 Z
11
+ date: 2019-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -58,9 +58,9 @@ dependencies:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '1.0'
61
- description: |2
62
- A batteries included version of processing in ruby, for raspberrypi and linux.
63
- Install samples to configures geany ide.
61
+ description: |
62
+ A batteries included version of processing in ruby, for raspberrypi and
63
+ linux. Install samples to configures geany ide.
64
64
  email:
65
65
  - mamba2928@yahoo.co.uk
66
66
  executables:
@@ -157,7 +157,9 @@ files:
157
157
  - docs/assets/favicon.ico
158
158
  - docs/assets/geany.png
159
159
  - docs/assets/jwishy_picrate.png
160
+ - docs/assets/new_with_template.png
160
161
  - docs/assets/picrate.svg
162
+ - docs/assets/picrate_template.png
161
163
  - docs/classes.md
162
164
  - docs/css/main.scss
163
165
  - docs/editors.md
@@ -177,10 +179,10 @@ files:
177
179
  - lib/jogl-all-natives-linux-amd64.jar
178
180
  - lib/jogl-all-natives-linux-armv6hf.jar
179
181
  - lib/jogl-all.jar
180
- - lib/picrate-0.6.0.jar
182
+ - lib/picrate-0.7.0.jar
181
183
  - lib/picrate.rb
182
184
  - lib/picrate/app.rb
183
- - lib/picrate/creators/sketch_class.rb
185
+ - lib/picrate/creators/parameters.rb
184
186
  - lib/picrate/creators/sketch_factory.rb
185
187
  - lib/picrate/creators/sketch_writer.rb
186
188
  - lib/picrate/helper_methods.rb
@@ -318,7 +320,6 @@ files:
318
320
  - src/main/resources/icon/icon-64.png
319
321
  - src/main/resources/license.txt
320
322
  - test/color_group_test.rb
321
- - test/create_test.rb
322
323
  - test/deglut_spec_test.rb
323
324
  - test/helper_methods_test.rb
324
325
  - test/math_tool_test.rb
@@ -351,14 +352,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
351
352
  version: '0'
352
353
  requirements:
353
354
  - java runtime >= 1.8.0_161+
354
- rubyforge_project:
355
- rubygems_version: 2.7.8
355
+ rubygems_version: 3.0.1
356
356
  signing_key:
357
357
  specification_version: 4
358
- summary: ruby wrapper for processing-3.4 on raspberrypi and linux64
358
+ summary: ruby wrapper for processing-3.5.3 on raspberrypi and linux64
359
359
  test_files:
360
360
  - test/color_group_test.rb
361
- - test/create_test.rb
362
361
  - test/deglut_spec_test.rb
363
362
  - test/helper_methods_test.rb
364
363
  - test/math_tool_test.rb
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: false
2
-
3
- # the sketch class
4
- class SketchClass
5
- attr_reader :name, :width, :height, :mode
6
-
7
- def initialize(name:, width: 150, height: 150, mode: nil)
8
- @name, @width, @height, @mode = name, width, height, mode
9
- end
10
-
11
- def class_sketch
12
- format('class %s < Processing::App', sketch_class)
13
- end
14
-
15
- def sketch_class
16
- name.split('_').collect(&:capitalize).join
17
- end
18
-
19
- def sketch_new
20
- format('%s.new', sketch_class)
21
- end
22
-
23
- def indent(line)
24
- format(' %s', line)
25
- end
26
-
27
- def size
28
- return format(' size %d, %d', width.to_i, height.to_i) unless mode
29
- format(' size %d, %d, %s', width.to_i, height.to_i, mode.upcase)
30
- end
31
-
32
- def sketch_title
33
- human = name.split('_').collect(&:capitalize).join(' ')
34
- format(" sketch_title '%s'", human)
35
- end
36
-
37
- def method_lines(name, content = nil)
38
- return [format(' def %s', name), '', ' end'] unless content
39
- [format(' def %s', name), content, ' end', '']
40
- end
41
-
42
- def lines
43
- lines = [
44
- '#!/usr/bin/env jruby',
45
- '# frozen_string_literal: false',
46
- "require 'picrate'",
47
- '',
48
- class_sketch
49
- ]
50
- lines.concat method_lines('settings', size)
51
- lines.concat method_lines('setup', sketch_title)
52
- lines.concat method_lines('draw')
53
- lines << 'end'
54
- lines << ''
55
- lines << sketch_new
56
- end
57
- end
@@ -1,68 +0,0 @@
1
- require_relative 'test_helper'
2
- require_relative '../lib/picrate/creators/sketch_class'
3
- require_relative '../lib/picrate/creators/sketch_writer'
4
-
5
- CLASS_SKETCH = <<~CODE
6
-
7
- #!/usr/bin/env jruby
8
- # frozen_string_literal: false
9
- require 'picrate'
10
-
11
- class FredSketch < Processing::App
12
- def settings
13
- size 200, 200
14
- end
15
-
16
- def setup
17
- sketch_title 'Fred Sketch'
18
- end
19
-
20
- def draw
21
-
22
- end
23
- end
24
-
25
- FredSketch.new
26
-
27
- CODE
28
-
29
- class SketchClassTest < Minitest::Test
30
-
31
- def setup
32
- @basic = SketchClass.new(name: 'fred_sketch', width: 200, height: 200)
33
- @sketch = SketchClass.new(name: 'fred_sketch', width: 200, height: 200, mode: 'p2d')
34
- end
35
-
36
- def test_class
37
- result = CLASS_SKETCH.split(/\n/, -1)
38
- class_lines = @sketch.lines
39
- class_lines.each_with_index do |line, i|
40
- assert_equal result[i], line
41
- end
42
- end
43
-
44
- def test_indent
45
- assert_equal ' indent', @sketch.indent('indent')
46
- end
47
-
48
- def test_size
49
- assert_equal ' size 200, 200, P2D', @sketch.size
50
- assert_equal ' size 200, 200', @basic.size
51
- end
52
-
53
- def test_sketch_title
54
- assert_equal " sketch_title 'Fred Sketch'", @sketch.sketch_title
55
- end
56
-
57
- def test_class
58
- assert_equal "FredSketch", @sketch.sketch_class
59
- end
60
-
61
- def test_class_new
62
- assert_equal "FredSketch.new", @sketch.sketch_new
63
- end
64
-
65
- def test_sketch_class
66
- assert_equal "class FredSketch < Processing::App", @basic.class_sketch
67
- end
68
- end