File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131 'project.build.sourceEncoding' => 'utf-8' ,
3232 'polyglot.dump.pom' => 'pom.xml' )
3333
34- pom 'org.jruby:jruby:9.2.11 .0'
34+ pom 'org.jruby:jruby:9.2.12 .0'
3535 jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
3636 jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
3737 jar 'org.processing:video:3.0.2'
Original file line number Diff line number Diff line change 22
33require 'fileutils'
44require 'rake/clean'
5+ relative_require 'geany'
56WARNING = 'WARNING: wget download failed you could do a manual download'
67SOUND = 'sound.zip'
78SOUND_VERSION = 'v1.3.2'
@@ -69,9 +70,11 @@ task :install_config do
6970 FileUtils . mkdir_p "#{ HOME_DIR } /.config/geany/templates/files"
7071 FileUtils . cp 'picrate.rb' , "#{ HOME_DIR } /.config/geany/templates/files"
7172 end
72- unless File . exist? "#{ HOME_DIR } /projects/sketchbook/picrate_sketches.geany"
73- FileUtils . mkdir_p "#{ HOME_DIR } /projects/sketchbook"
74- FileUtils . cp 'picrate_sketches.geany' , "#{ HOME_DIR } /projects/sketchbook"
73+ project_dir = File . join ( HOME_DIR , 'projects' )
74+ unless File . exist? File . join ( project_dir , 'examples' , 'picrate_sketches.geany' )
75+ FileUtils . mkdir_p "#{ HOME_DIR } /projects/examples"
76+ config = GeanyConfig . new ( project_dir , 'examples' )
77+ config . save ( File . join ( project_dir , 'examples' , 'picrate_sketches.geany' ) ) "
7578 end
7679end
7780
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require 'erb'
4+
5+ def geany_config
6+ %(
17[editor]
28line_wrapping=false
39line_break_column=72
1925
2026[project]
2127name=picrate_samples
22- base_path=/ home/pi/projects/picrate_sketches
28+ base_path=<%= home %>
2329description=Exploring PiCrate
2430file_patterns=*.rb;*.glsl;*.txt;
2531
2834long_line_column=72
2935
3036[files]
31- current_page=3
32- FILE_NAME_0=667;Ruby;0;EUTF-8;0;1;0;%2Fhome%2Fpi%2Fprojects%2Fpicrate_sketches%2Fbasics%2Farrays%2Farray.rb;0;2
33- FILE_NAME_1=1664;Ruby;0;EUTF-8;0;1;0;%2Fhome%2Fpi%2Fprojects%2Fpicrate_sketches%2Fadvanced_data%2Fload_save_json.rb;0;2
34- FILE_NAME_2=259;Sh;0;EUTF-8;0;1;0;%2Fhome%2Fpi%2Fjruby_install.sh;0;2
35- FILE_NAME_3=236;Sh;0;EUTF-8;0;1;0;%2Fhome%2Fpi%2Ftest.sh;0;2
3637
3738[VTE]
38- last_dir=/home/pi
39+ last_dir=<%= directory %>
3940
4041[build-menu]
4142EX_00_LB=_Execute
6061RubyFT_02_LB=_Reek
6162RubyFT_02_CM=reek --failure-exit-code=0 "%f"
6263RubyFT_02_WD=
64+ )
65+ end
66+
67+ # Class to merge ERB template and write config to file
68+ class GeanyConfig
69+ include ERB ::Util
70+ attr_accessor :home , :directory , :template
71+
72+ def initialize ( home , directory , template = geany_config )
73+ @home = home
74+ @directory = File . join ( home , directory )
75+ @template = template
76+ end
77+
78+ def render
79+ ERB . new ( @template ) . result ( binding )
80+ end
81+
82+ def save ( file )
83+ File . open ( file , 'w+' ) do |f |
84+ f . write ( render )
85+ end
86+ end
87+ end
You can’t perform that action at this time.
0 commit comments