Class: LocalPac::Actions::ShowPacFile

Inherits:
Object
  • Object
show all
Defined in:
lib/local_pac/actions/show_pac_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(file, storage_path, options = {}, vcs_engine = GitStorage) ⇒ ShowPacFile

Returns a new instance of ShowPacFile.



11
12
13
14
15
16
# File 'lib/local_pac/actions/show_pac_file.rb', line 11

def initialize(file, storage_path, options = {}, vcs_engine = GitStorage)
  @name         = ::File.basename(file, '.pac').to_sym
  @storage_path = storage_path
  @options      = options
  @vcs_engine   = vcs_engine
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
# File 'lib/local_pac/actions/show_pac_file.rb', line 18

def run
  begin
    @repo = vcs_engine.new(storage_path)
  rescue Rugged::OSError
    raise Exceptions::RepositoryDoesNotExist, "Sorry, but the repository at #{storage_path} does not exist" unless ::Dir.exists? storage_path
  end

  puts repo[name].content
end