Class: CarthageCache::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/carthage_cache.rb

Constant Summary collapse

CACHE_DIR_NAME =
"carthage_cache"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_path, verbose, config) ⇒ Application

Returns a new instance of Application.



26
27
28
29
30
31
32
# File 'lib/carthage_cache.rb', line 26

def initialize(project_path, verbose, config)
  @terminal = Terminal.new(verbose)
  @archiver = Archiver.new
  @config = Configurator.new(project_path, config).config
  @repository = Repository.new(@config.bucket_name, @config.hash_object[:aws_s3_client_options])
  @project = Project.new(project_path, CACHE_DIR_NAME, terminal)
end

Instance Attribute Details

#archiverObject (readonly)

Returns the value of attribute archiver.



21
22
23
# File 'lib/carthage_cache.rb', line 21

def archiver
  @archiver
end

#configObject (readonly)

Returns the value of attribute config.



24
25
26
# File 'lib/carthage_cache.rb', line 24

def config
  @config
end

#projectObject (readonly)

Returns the value of attribute project.



23
24
25
# File 'lib/carthage_cache.rb', line 23

def project
  @project
end

#repositoryObject (readonly)

Returns the value of attribute repository.



22
23
24
# File 'lib/carthage_cache.rb', line 22

def repository
  @repository
end

#terminalObject (readonly)

Returns the value of attribute terminal.



20
21
22
# File 'lib/carthage_cache.rb', line 20

def terminal
  @terminal
end

Instance Method Details

#archive_exist?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/carthage_cache.rb', line 34

def archive_exist?
  repository.archive_exist?(project.archive_filename)
end

#create_archive(force = false) ⇒ Object



47
48
49
# File 'lib/carthage_cache.rb', line 47

def create_archive(force = false)
  archive_builder.build if force || !archive_exist?
end

#install_archiveObject



38
39
40
41
42
43
44
45
# File 'lib/carthage_cache.rb', line 38

def install_archive
  if archive_exist?
    archive_installer.install
  else
    terminal.puts "There is no cached archive for the current Cartfile.resolved file."
    exit 1
  end
end