Class: CarthageArchive
- Inherits:
-
Object
- Object
- CarthageArchive
- Defined in:
- lib/carthage_archive.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#archive_filename ⇒ Object
readonly
Returns the value of attribute archive_filename.
-
#archive_path ⇒ Object
readonly
Returns the value of attribute archive_path.
Instance Method Summary collapse
- #archive_size ⇒ Object
- #delete_archive ⇒ Object
-
#initialize(framework_name, platform) ⇒ CarthageArchive
constructor
A new instance of CarthageArchive.
- #unpack_archive(shell, carthage_build_dir = CARTHAGE_BUILD_DIR) ⇒ Object
Constructor Details
#initialize(framework_name, platform) ⇒ CarthageArchive
Returns a new instance of CarthageArchive.
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_filename ⇒ Object (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_path ⇒ Object (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_size ⇒ Object
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_archive ⇒ Object
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
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 |