4
4
VERSION = '3.1.1' # processing version
5
5
6
6
class Installer
7
- attr_reader :os , :jruby , :sketch , :gem_root
8
- def initialize ( os : :linux , jruby : true , root :)
7
+ attr_reader :os , :sketch , :gem_root , :home
8
+ def initialize ( os : :linux , root :)
9
9
@os = os
10
- @jruby = jruby
11
10
@gem_root = root
12
- @sketch = "#{ ENV [ 'HOME' ] } /sketchbook" if os == :linux
13
- @sketch = "#{ ENV [ 'HOME' ] } /My Documents/Processing" if os == :windows
14
- @sketch = "#{ ENV [ 'HOME' ] } /Documents/Processing" if os == :mac
11
+ @home = ENV [ 'HOME' ]
12
+ @sketch = "#{ home } /sketchbook" if os == :linux
13
+ @sketch = "#{ home } /My Documents/Processing" if os == :windows
14
+ @sketch = "#{ home } /Documents/Processing" if os == :mac
15
15
end
16
16
17
17
def install
@@ -28,15 +28,15 @@ def install_examples
28
28
# Optimistically set processing root
29
29
def set_processing_root
30
30
require 'psych'
31
- folder = File . expand_path ( "#{ ENV [ 'HOME' ] } /.jruby_art" )
31
+ folder = File . expand_path ( "#{ home } /.jruby_art" )
32
32
Dir . mkdir ( folder ) unless File . exist? folder
33
33
path = File . join ( folder , 'config.yml' )
34
- proot = "#{ ENV [ 'HOME' ] } /processing-#{ VERSION } "
34
+ proot = "#{ home } /processing-#{ VERSION } "
35
35
proot = "/Java/Processing-#{ VERSION } " if os == :windows
36
36
proot = "/Applications/Processing.app/Contents/Java" if os == :mac
37
37
data = {
38
38
'PROCESSING_ROOT' => proot ,
39
- 'JRUBY' => jruby . to_s ,
39
+ 'JRUBY' => true . to_s ,
40
40
'sketchbook_path' => sketch ,
41
41
'MAX_WATCH' => '20'
42
42
}
@@ -49,7 +49,7 @@ def root_exist?
49
49
end
50
50
51
51
def config
52
- k9config = File . expand_path ( "#{ ENV [ 'HOME' ] } /.jruby_art/config.yml" )
52
+ k9config = File . expand_path ( "#{ home } /.jruby_art/config.yml" )
53
53
return nil unless File . exist? k9config
54
54
YAML . load_file ( k9config )
55
55
end
0 commit comments