Class: Travis::CLI::Gh::Cat

Inherits:
RepoCommand
  • Object
show all
Includes:
GitHub::AutoAuth, GitHub::Error
Defined in:
lib/travis/cli/gh/cat.rb

Direct Known Subclasses

Fetch

Instance Method Summary collapse

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

#fetch(path) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/travis/cli/gh/cat.rb', line 17

def fetch(path)
  path = "repos/#{repository.slug}/contents/#{path}"
  path << "?ref=#{ref}" if ref
  Base64.decode64(gh[path]['content'])
rescue GH::Error => e
  gh_error(e)
end

#run(*paths) ⇒ Object



11
12
13
14
15
# File 'lib/travis/cli/gh/cat.rb', line 11

def run(*paths)
  paths.each do |path|
    say fetch(path)
  end
end