Class: Travis::CLI::Gh::Fetch

Inherits:
Cat
  • Object
show all
Defined in:
lib/travis/cli/gh/fetch.rb

Instance Method Summary collapse

Methods inherited from Cat

#fetch

Methods included from GitHub::AutoAuth

#gh

Methods included from GitHub::Authenticated

#auth, #gh, #plugin_config

Methods included from GitHub::Error

#gh_error

Instance Method Details

#run(*paths) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/travis/cli/gh/fetch.rb', line 8

def run(*paths)
  error "no such directory #{prefix}" unless prefix.nil? or File.directory? prefix
  paths.each do |path|
    target = File.expand_path(path, prefix || Dir.pwd)
    error "#{path} already exists, use -f to override" if !force and File.exist?(target)
    say "storing contents of #{color(path, :bold)} as #{color(target, :bold)}"
    File.write(target, fetch(path))
  end
end