Sha256: 9fc8d36445a6caa75842e44a43d633767a930da8bb4d3c717b991b35ab3b258f

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

module Pod
  class Command
    class Package < Command
      :private

      def install_pod(platform_name)
        podfile = podfile_from_spec(
          File.basename(@path),
          @spec.name,
          platform_name,
          @spec.deployment_target(platform_name))

        sandbox = Sandbox.new(config.sandbox_root)
        installer = Installer.new(sandbox, podfile)
        installer.install!

        sandbox
      end

      def podfile_from_spec(path, spec_name, platform_name, deployment_target)
        Pod::Podfile.new do
          platform(platform_name, deployment_target)
          if path
            pod spec_name, :podspec => path
          else
            pod spec_name, :path => '.'
          end
        end
      end

      def source_files_available?(spec)
        deps = spec.dependencies.map { |dep| spec_with_name(dep.name) }

        [spec, *deps].each do |specification|
          source_files = specification.attributes_hash['source_files']
          if source_files.nil?
            return false
          end
        end

        true
      end

      def spec_with_name(name)
        return if name.nil?

        set = SourcesManager.search(Dependency.new(name))
        return nil if set.nil?

        set.specification.root
      end

      def spec_with_path(path)
        return if path.nil? || !Pathname.new(path).exist?

        @path = path

        if Pathname.new(path).directory?
          help! path + ': is a directory.'
          return
        end

        if !['.podspec', '.json'].include? Pathname.new(path).extname 
          help! path + ': is not a podspec.'
          return
        end

        Specification.from_file(path)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-packager-0.9.0 lib/cocoapods-packager/pod_utils.rb