Sha256: 75699fd6161f888101a0963954dc133ad4f1e5f4a2f10b83382f3b7d5067769b

Contents?: true

Size: 1.95 KB

Versions: 3

Compression:

Stored size: 1.95 KB

Contents

require 'fileutils'
module Framework
  class Tree
    attr_reader :headers_path
    attr_reader :module_map_path
    attr_reader :resources_path
    attr_reader :root_path
    attr_reader :versions_path
    attr_accessor :fwk_path
    def delete_resources
      Pathname.new(@resources_path).rmtree
      (Pathname.new(@fwk_path) + Pathname.new('Resources')).delete
    end

    def initialize(name, platform, embedded)
      @name = name
      @platform = platform
      @embedded = embedded
    end

    def make
      make_root
      make_framework
      make_headers
      make_resources
      make_current_version
    end

    def process_static_framework
      `rm -rf #{@fwk_path}/Headers`
      `rm -rf #{@fwk_path}/Resources`
      `rm -rf #{@fwk_path}/#{@name}`
      `cp -r #{@versions_path}/* #{fwk_path}`
      `rm -rf #{@fwk_path}/Versions`
    end

    private

    def make_current_version
      current_version_path = @versions_path + Pathname.new('../Current')
      `ln -sf A #{current_version_path}`
      `ln -sf Versions/Current/Headers #{@fwk_path}/`
      `ln -sf Versions/Current/Resources #{@fwk_path}/`
      `ln -sf Versions/Current/#{@name} #{@fwk_path}/`
    end

    def make_framework
      @fwk_path = @root_path + Pathname.new(@name + '.framework')
      @fwk_path.mkdir unless @fwk_path.exist?

      @module_map_path = @fwk_path + Pathname.new('Modules')
      @versions_path = @fwk_path + Pathname.new('Versions/A')
    end

    def make_headers
      @headers_path = @versions_path + Pathname.new('Headers')
      @headers_path.mkpath unless @headers_path.exist?
    end

    def make_resources
      @resources_path = @versions_path + Pathname.new('Resources')
      @resources_path.mkpath unless @resources_path.exist?
    end

    def make_root
      @root_path = Pathname.new(@platform)

      if @embedded
        @root_path += Pathname.new(@name + '.embeddedframework')
      end

      @root_path.mkpath unless @root_path.exist?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cocoapods-xzpackager-1.0.2 lib/cocoapods-packager/framework.rb
cocoapods-xzpackager-1.0.1 lib/cocoapods-packager/framework.rb
cocoapods-xzpackager-1.0.0 lib/cocoapods-packager/framework.rb