Class: CarthageArchive
- Inherits:
-
Object
- Object
- CarthageArchive
- Defined in:
- lib/carthage_archive.rb
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
-
#create_archive(shell, should_include_dsym, carthage_build_dir = CARTHAGE_BUILD_DIR) ⇒ Object
Aggregate following files: - Carthage/Build/iOS/Alamofire.framework - Carthage/Build/iOS/Alamofire.framework/Alamofire - Carthage/Build/iOS/618BEB79-4C7F-3692-B140-131FB983AC5E.bcsymbolmap into Alamofire-iOS.zip.
- #delete_archive ⇒ Object
-
#initialize(framework_name, platform) ⇒ CarthageArchive
constructor
A new instance of CarthageArchive.
- #unpack_archive(shell) ⇒ Object
Constructor Details
#initialize(framework_name, platform) ⇒ CarthageArchive
Returns a new instance of CarthageArchive.
4 5 6 7 8 9 10 11 |
# File 'lib/carthage_archive.rb', line 4 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.
2 3 4 |
# File 'lib/carthage_archive.rb', line 2 def archive_filename @archive_filename end |
#archive_path ⇒ Object (readonly)
Returns the value of attribute archive_path.
2 3 4 |
# File 'lib/carthage_archive.rb', line 2 def archive_path @archive_path end |
Instance Method Details
#archive_size ⇒ Object
63 64 65 66 |
# File 'lib/carthage_archive.rb', line 63 def archive_size raise AppError.new, "Archive #{@archive_path} is missing" unless File.exist?(@archive_path) File.size(@archive_path) end |
#create_archive(shell, should_include_dsym, carthage_build_dir = CARTHAGE_BUILD_DIR) ⇒ Object
Aggregate following files:
-
Carthage/Build/iOS/Alamofire.framework
-
Carthage/Build/iOS/Alamofire.framework/Alamofire
-
Carthage/Build/iOS/618BEB79-4C7F-3692-B140-131FB983AC5E.bcsymbolmap
into Alamofire-iOS.zip
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/carthage_archive.rb', line 18 def create_archive(shell, should_include_dsym, carthage_build_dir = CARTHAGE_BUILD_DIR) $LOG.debug("Archiving #{@framework_name} for #{@platform}") platform_path = File.join(carthage_build_dir, platform_to_carthage_dir_string(@platform)) framework_path = File.join(platform_path, "#{@framework_name}.framework") raise MissingFrameworkDirectoryError.new, "Archive can't be created, no framework directory at #{framework_path}" unless Dir.exist?(framework_path) # It's very likely, that binary releases don't contain DSYMs. dsym_path = File.join(platform_path, "#{@framework_name}.framework.dSYM") unless File.exist?(dsym_path) if should_include_dsym raise AppError.new, "DSYM File #{dsym_path} not found" else $LOG.error("DSYM File #{dsym_path} not found, continuing") dsym_path = nil end end binary_path = File.join(framework_path, @framework_name) raise AppError.new, "Binary #{binary_path} is missing, failed to read .bcsymbolmap files" unless File.exist?(binary_path) bcsymbolmap_paths = find_bcsymbolmap_paths(shell, platform_path, binary_path) input_paths = [] input_paths << framework_path input_paths << dsym_path unless dsym_path.nil? input_paths += bcsymbolmap_paths $LOG.debug("Adding > #{input_paths.inspect}") delete_archive shell.archive(input_paths, @archive_path) $LOG.debug("Created #{@archive_path} archive, file size: #{formatted_archive_size}") end |
#delete_archive ⇒ Object
59 60 61 |
# File 'lib/carthage_archive.rb', line 59 def delete_archive File.delete(@archive_path) if File.exist?(@archive_path) end |
#unpack_archive(shell) ⇒ Object
53 54 55 56 57 |
# File 'lib/carthage_archive.rb', line 53 def unpack_archive(shell) raise AppError.new, "Archive #{@archive_path} is missing" unless File.exist?(@archive_path) $LOG.debug("Unpacking #{@archive_path}, file size: #{formatted_archive_size}") shell.unpack(@archive_path) end |