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

Returns a new instance of Tree.



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

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

#module_map_pathObject (readonly)

Returns the value of attribute module_map_path.



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

def module_map_path
  @module_map_path
end

#resources_pathObject (readonly)

Returns the value of attribute resources_path.



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

def resources_path
  @resources_path
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



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

def root_path
  @root_path
end

#versions_pathObject (readonly)

Returns the value of attribute versions_path.



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

def versions_path
  @versions_path
end

Instance Method Details

#delete_resourcesObject



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

def delete_resources
  Pathname.new(@resources_path).rmtree
  (Pathname.new(@fwk_path) + Pathname.new('Resources')).delete
end

#makeObject



20
21
22
23
24
25
26
# File 'lib/cocoapods-packager/framework.rb', line 20

def make
  make_root
  make_framework
  make_headers
  make_resources
  make_current_version
end

#make_current_versionObject



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

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



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

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

#make_headersObject



46
47
48
49
# File 'lib/cocoapods-packager/framework.rb', line 46

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

#make_resourcesObject



51
52
53
54
# File 'lib/cocoapods-packager/framework.rb', line 51

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

#make_rootObject



56
57
58
59
60
61
62
63
64
# File 'lib/cocoapods-packager/framework.rb', line 56

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