Class: Framework::Tree

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-packager/framework.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, platform, embedded) ⇒ Tree



8
9
10
11
12
# File 'lib/cocoapods-packager/framework.rb', line 8

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

Instance Attribute Details

#headers_pathObject (readonly)

Returns the value of attribute headers_path.



3
4
5
# File 'lib/cocoapods-packager/framework.rb', line 3

def headers_path
  @headers_path
end

#resources_pathObject (readonly)

Returns the value of attribute resources_path.



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

def resources_path
  @resources_path
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



5
6
7
# File 'lib/cocoapods-packager/framework.rb', line 5

def root_path
  @root_path
end

#versions_pathObject (readonly)

Returns the value of attribute versions_path.



6
7
8
# File 'lib/cocoapods-packager/framework.rb', line 6

def versions_path
  @versions_path
end

Instance Method Details

#makeObject



14
15
16
17
18
19
20
# File 'lib/cocoapods-packager/framework.rb', line 14

def make
  make_root
  make_framework
  make_headers
  make_resources
  make_current_version
end

#make_current_versionObject



24
25
26
27
28
29
30
# File 'lib/cocoapods-packager/framework.rb', line 24

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

#make_frameworkObject



32
33
34
35
36
37
# File 'lib/cocoapods-packager/framework.rb', line 32

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

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

#make_headersObject



39
40
41
42
# File 'lib/cocoapods-packager/framework.rb', line 39

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

#make_resourcesObject



44
45
46
47
# File 'lib/cocoapods-packager/framework.rb', line 44

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

#make_rootObject



49
50
51
52
53
54
55
56
57
# File 'lib/cocoapods-packager/framework.rb', line 49

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