Class: CarthageCache::Application

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

Constant Summary collapse

CACHE_DIR_NAME =
"carthage_cache"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_path, verbose, config, repository: Repository, terminal: Terminal, swift_version_resolver: SwiftVersionResolver) ⇒ Application

Returns a new instance of Application.



13
14
15
16
17
18
19
# File 'lib/carthage_cache/application.rb', line 13

def initialize(project_path, verbose, config, repository: Repository, terminal: Terminal, swift_version_resolver: SwiftVersionResolver)
  @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, @config.tmpdir, swift_version_resolver.new)
end

Instance Attribute Details

#archiverObject (readonly)

Returns the value of attribute archiver.



8
9
10
# File 'lib/carthage_cache/application.rb', line 8

def archiver
  @archiver
end

#configObject (readonly)

Returns the value of attribute config.



11
12
13
# File 'lib/carthage_cache/application.rb', line 11

def config
  @config
end

#projectObject (readonly)

Returns the value of attribute project.



10
11
12
# File 'lib/carthage_cache/application.rb', line 10

def project
  @project
end

#repositoryObject (readonly)

Returns the value of attribute repository.



9
10
11
# File 'lib/carthage_cache/application.rb', line 9

def repository
  @repository
end

#terminalObject (readonly)

Returns the value of attribute terminal.



7
8
9
# File 'lib/carthage_cache/application.rb', line 7

def terminal
  @terminal
end

Instance Method Details

#archive_exist?Boolean

Returns:



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

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

#create_archive(force = false) ⇒ Object



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

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

#install_archiveObject



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

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