Class: CarthageArchive

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(framework_name, platform) ⇒ CarthageArchive

Returns a new instance of CarthageArchive.

Raises:



6
7
8
9
10
11
12
13
# File 'lib/carthage_archive.rb', line 6

def initialize(framework_name, platform)
  raise AppError.new, "Platform #{platform.inspect} needs to be a symbol" unless platform.kind_of?(Symbol)

  @framework_name = framework_name
  @platform = platform
  @archive_filename = "#{framework_name}-#{platform}.zip"
  @archive_path = @archive_filename
end

Instance Attribute Details

#archive_filenameObject (readonly)

Returns the value of attribute archive_filename.



4
5
6
# File 'lib/carthage_archive.rb', line 4

def archive_filename
  @archive_filename
end

#archive_pathObject (readonly)

Returns the value of attribute archive_path.



4
5
6
# File 'lib/carthage_archive.rb', line 4

def archive_path
  @archive_path
end

Instance Method Details

#archive_sizeObject

Raises:



28
29
30
31
# File 'lib/carthage_archive.rb', line 28

def archive_size
  raise AppError.new, "Archive #{@archive_path} is missing" unless File.exist?(@archive_path)
  File.size(@archive_path)
end

#delete_archiveObject



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

def delete_archive
  File.delete(@archive_path) if File.exist?(@archive_path)
end

#unpack_archive(shell, carthage_build_dir = CARTHAGE_BUILD_DIR) ⇒ Object

Raises:



15
16
17
18
19
20
21
22
# File 'lib/carthage_archive.rb', line 15

def unpack_archive(shell, carthage_build_dir = CARTHAGE_BUILD_DIR)
  raise AppError.new, "Archive #{@archive_path} is missing" unless File.exist?(@archive_path)

  delete_existing_build_framework_if_exists(carthage_build_dir)

  $LOG.debug("Unpacking #{@archive_path}, file size: #{formatted_archive_size}")
  shell.unpack(@archive_path)
end