Class: Installer
- Inherits:
-
Object
- Object
- Installer
- Defined in:
- lib/jruby_art/installer.rb
Overview
Abstract Installer class
Direct Known Subclasses
Instance Attribute Summary collapse
-
#confd ⇒ Object
readonly
Returns the value of attribute confd.
-
#gem_root ⇒ Object
readonly
Returns the value of attribute gem_root.
-
#os ⇒ Object
readonly
Returns the value of attribute os.
-
#sketch ⇒ Object
readonly
Returns the value of attribute sketch.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(root, os) ⇒ Installer
constructor
A new instance of Installer.
-
#install ⇒ Object
in place of default installer class.
- #root_exist? ⇒ Boolean
-
#set_processing_root ⇒ Object
Optimistically set processing root.
-
#show_version ⇒ Object
Display the current version of JRubyArt.
Constructor Details
#initialize(root, os) ⇒ Installer
Returns a new instance of Installer.
9 10 11 12 13 14 15 16 |
# File 'lib/jruby_art/installer.rb', line 9 def initialize(root, os) @os = os @gem_root = root @sketch = "#{HOME}/sketchbook" if os == :linux @sketch = "#{HOME}/My Documents/Processing" if os == :windows @sketch = "#{HOME}/Documents/Processing" if os == :mac @confd = "#{HOME}/.jruby_art" end |
Instance Attribute Details
#confd ⇒ Object (readonly)
Returns the value of attribute confd.
8 9 10 |
# File 'lib/jruby_art/installer.rb', line 8 def confd @confd end |
#gem_root ⇒ Object (readonly)
Returns the value of attribute gem_root.
8 9 10 |
# File 'lib/jruby_art/installer.rb', line 8 def gem_root @gem_root end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
8 9 10 |
# File 'lib/jruby_art/installer.rb', line 8 def os @os end |
#sketch ⇒ Object (readonly)
Returns the value of attribute sketch.
8 9 10 |
# File 'lib/jruby_art/installer.rb', line 8 def sketch @sketch end |
Instance Method Details
#config ⇒ Object
44 45 46 47 48 |
# File 'lib/jruby_art/installer.rb', line 44 def config k9config = File.join(confd, 'config.yml') return '' unless File.exist? k9config YAML.load_file(k9config) end |
#install ⇒ Object
in place of default installer class
51 52 53 |
# File 'lib/jruby_art/installer.rb', line 51 def install puts 'Usage: k9 [--check | --install | --help]' end |
#root_exist? ⇒ Boolean
40 41 42 |
# File 'lib/jruby_art/installer.rb', line 40 def root_exist? Core.check?(config['PROCESSING_ROOT']) end |
#set_processing_root ⇒ Object
Optimistically set processing root
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jruby_art/installer.rb', line 19 def set_processing_root folder = "#{HOME}/.jruby_art" Dir.mkdir(folder) unless File.exist? folder path = File.join(folder, 'config.yml') proot = "#{HOME}/processing-#{VERSION}" proot = "/usr/local/lib/processing-#{VERSION}" if os == :arm proot = "/Java/Processing-#{VERSION}" if os == :windows proot = '/Applications/Processing.app/Contents/Java' if os == :mac jruby = true jruby = false if os == :arm settings = %w[ PROCESSING_ROOT JRUBY sketchbook_path template MAX_WATCH sketch_title width height ] values = [ proot, true, sketch, 'bare', 32, 'JRubyArt Static Sketch', 600, 600 ] data = settings.zip(values).to_h open(path, 'w:UTF-8') { |file| file.write(data.to_yaml) } warn 'PROCESSING_ROOT set optimistically, run check to confirm' end |