Class: Pod::Command::Package

Inherits:
Pod::Command show all
Defined in:
lib/pod/command/package.rb,
lib/cocoapods-packager/pod_utils.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Package

Returns a new instance of Package.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/pod/command/package.rb', line 32

def initialize(argv)
  @embedded = argv.flag?('embedded')
  @force = argv.flag?('force')
  @library = argv.flag?('library')
  @dynamic = argv.flag?('dynamic')
  @mangle = argv.flag?('mangle', true)
  @bundle_identifier = argv.option('bundle-identifier', nil)
  @exclude_deps = argv.flag?('exclude-deps', false)
  @name = argv.shift_argument
  @source = argv.shift_argument
  @spec_sources = argv.option('spec-sources', 'https://github.com/CocoaPods/Specs.git').split(',')

  subspecs = argv.option('subspecs')
  @subspecs = subspecs.split(',') unless subspecs.nil?

  @config = argv.option('configuration', 'Release')
  @rcltfile = argv.option('rclt')
  puts "rclt file is #{@rcltfile}"

  @source_dir = Dir.pwd
  @spec = spec_with_path(@name)
  @spec = spec_with_name(@name) unless @spec
  if @rcltfile
    @allLocalDependencies = Qricker.dependency(@rcltfile, [@spec.name])
    puts "dependencies #{@allLocalDependencies}"
  end
  @targetDir = nil
  super
end

Instance Attribute Details

#originPathObject

Returns the value of attribute originPath.



4
5
6
# File 'lib/cocoapods-packager/pod_utils.rb', line 4

def originPath
  @originPath
end

Class Method Details

.optionsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pod/command/package.rb', line 15

def self.options
  [
    ['--force',     'Overwrite existing files.'],
    ['--no-mangle', 'Do not mangle symbols of depedendant Pods.'],
    ['--embedded',  'Generate embedded frameworks.'],
    ['--library',   'Generate static libraries.'],
    ['--dynamic',   'Generate dynamic framework.'],
    ['--bundle-identifier', 'Bundle identifier for dynamic framework'],
    ['--exclude-deps', 'Exclude symbols from dependencies.'],
    ['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
    ['--subspecs', 'Only include the given subspecs'],
    ['--spec-sources=private,https://github.com/CocoaPods/Specs.git', 'The sources to pull dependant ' \
      'pods from (defaults to https://github.com/CocoaPods/Specs.git)'],
    ['--rclt=rclt-file-path', "rclt file, Collected local speces list"]
  ]
end

Instance Method Details

#create_target_directoryObject



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/pod/command/package.rb', line 96

def create_target_directory
  target_dir = "#{@source_dir}/#{@spec.name}-#{@spec.version}"
  if File.exist? target_dir
    if @force
      Pathname.new(target_dir).rmtree
    else
      UI.puts "Target directory '#{target_dir}' already exists."
      return nil
    end
  end
  target_dir
end

#runObject



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/pod/command/package.rb', line 70

def run
  if @path.nil? || @spec.nil?
    help! 'Unable to find a podspec with path or name.'
    return
  end

  target_dir, work_dir = create_working_directory
  @targetDir = target_dir
  return if target_dir.nil?
  build_package
  `mv  "#{work_dir}" "#{target_dir}"`
  copyVandoredLibaries(@spec)
  copyVendoredFrameworks(@spec)
  Dir.chdir(@source_dir)

end

#targetDirObject



87
88
89
90
91
92
# File 'lib/pod/command/package.rb', line 87

def targetDir
  if @targetDir.nil?
    return nil
  end
  return @targetDir
end

#validate!Object



62
63
64
65
66
67
68
# File 'lib/pod/command/package.rb', line 62

def validate!
  super
  help! 'A podspec name or path is required.' unless @spec
  help! 'podspec has binary-only depedencies, mangling not possible.' if @mangle && binary_only?(@spec)
  help! '--bundle-identifier option can only be used for dynamic frameworks' if @bundle_identifier && !@dynamic
  help! '--exclude-deps option can only be used for static libraries' if @exclude_deps && @dynamic
end