Method: Slideshow::Fetch#fetch

Defined in:
lib/slideshow/commands/fetch.rb

#fetch(shortcut_or_source) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/slideshow/commands/fetch.rb', line 24

def fetch( 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 = config.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|
    
    ## if manifest includes .plugin assume it's a plugin
    if source.include?( '.txt.plugin' ) || source.include?( '.plugin.txt' )
      fetch_plugin( source )
    elsif source.include?( '.txt.quick' ) || source.include?( '.quick.txt' )
      fetch_quick( source )
    else # otherwise assume it's a template pack
      fetch_template( source )
    end

  end

end