Class: Slideshow::Update
- Inherits:
-
Object
- Object
- Slideshow::Update
- Includes:
- LogUtils::Logging
- Defined in:
- lib/slideshow/commands/update.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ Update
constructor
A new instance of Update.
-
#update ⇒ Object
update shortcut index.
Constructor Details
#initialize(config) ⇒ Update
Returns a new instance of Update.
22 23 24 |
# File 'lib/slideshow/commands/update.rb', line 22 def initialize( config ) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
26 27 28 |
# File 'lib/slideshow/commands/update.rb', line 26 def config @config end |
Instance Method Details
#update ⇒ Object
update shortcut index
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/slideshow/commands/update.rb', line 29 def update # update shortcut index dest = config.shortcut_index_file destfull = File.( dest ) destpath = File.dirname( destfull ) FileUtils.makedirs( destpath ) unless File.directory?( destpath ) logger.debug "destfull=>#{destfull}<" logger.debug "destpath=>#{destpath}<" ## todo/fix: use a config setting for index url (do NOT hard core) src = 'https://raw.github.com/slideshow-s9/registry/master/slideshow.index.yml' puts "Updating shortcut index - downloading '#{src}'..." ::Fetcher::Worker.new.copy( src, destfull ) end |