Class: Pluto::Installer
- Inherits:
-
Object
- Object
- Pluto::Installer
- Includes:
- LogUtils::Logging
- Defined in:
- lib/pluto/installer.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Installer
constructor
A new instance of Installer.
- #install(shortcut_or_source) ⇒ Object
- #install_template(src) ⇒ Object
Constructor Details
#initialize(opts) ⇒ Installer
Returns a new instance of Installer.
9 10 11 |
# File 'lib/pluto/installer.rb', line 9 def initialize( opts ) @opts = opts end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
13 14 15 |
# File 'lib/pluto/installer.rb', line 13 def opts @opts end |
Instance Method Details
#install(shortcut_or_source) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pluto/installer.rb', line 16 def install( shortcut_or_source ) logger.debug "fetch >#{shortcut_or_source}<" ## check for builtin shortcut (assume no / or \) if shortcut_or_source.index( '/' ).nil? && shortcut_or_source.index( '\\' ).nil? shortcut = shortcut_or_source sources = opts.map_fetch_shortcut( shortcut ) if sources.empty? puts "** Error: No mapping found for shortcut '#{shortcut}'." return end puts " Mapping fetch shortcut '#{shortcut}' to: #{sources.join(',')}" else sources = [shortcut_or_source] # pass arg through unmapped end sources.each do |source| install_template( source ) end end |
#install_template(src) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/pluto/installer.rb', line 41 def install_template( src ) # src = 'http://github.com/geraldb/slideshow/raw/d98e5b02b87ee66485431b1bee8fb6378297bfe4/code/templates/fullerscreen.txt' # src = 'http://github.com/geraldb/sandbox/raw/13d4fec0908fbfcc456b74dfe2f88621614b5244/s5blank/s5blank.txt' uri = URI.parse( src ) logger.debug "scheme: #{uri.scheme}, host: #{uri.host}, port: #{uri.port}, path: #{uri.path}" pakname = File.basename( uri.path ).downcase.gsub('.txt','') pakpath = File.( "#{opts.config_path}/#{pakname}" ) logger.debug "packname >#{pakname}<" logger.debug "pakpath >#{pakpath}<" Pakman::Fetcher.new.fetch_pak( src, pakpath ) end |