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.



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

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

#delete_resourcesObject



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

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

#makeObject



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

def make
  make_root
  make_framework
  make_headers
  make_resources
  make_current_version
end

#make_current_versionObject



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

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



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

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



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

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

#make_resourcesObject



49
50
51
52
# File 'lib/cocoapods-packager/framework.rb', line 49

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

#make_rootObject



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

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