/
config.rb
49 lines (41 loc) · 1001 Bytes
/
config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'pathname'
module Pod
class Config
def self.instance
@instance ||= new
end
def self.instance=(instance)
@instance = instance
end
attr_accessor :repos_dir, :project_pods_root, :clean, :verbose, :silent
alias_method :clean?, :clean
alias_method :verbose?, :verbose
alias_method :silent?, :silent
def initialize
@repos_dir = Pathname.new(File.expand_path("~/.cocoa-pods"))
@clean = true
@verbose = false
@silent = false
end
def project_root
Pathname.pwd
end
def project_pods_root
@project_pods_root ||= project_root + 'Pods'
end
def project_podfile
unless @project_podfile
@project_podfile = project_root + 'Podfile'
unless @project_podfile.exist?
@project_podfile = project_root.glob('*.podspec').first
end
end
@project_podfile
end
module Mixin
def config
Config.instance
end
end
end
end