Class: XCCache::Config

Inherits:
YAMLRepresentable show all
Defined in:
lib/xccache/core/config.rb

Defined Under Namespace

Modules: Mixin

Instance Attribute Summary collapse

Attributes inherited from HashRepresentable

#path, #raw

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from YAMLRepresentable

#load, #save

Methods inherited from HashRepresentable

#[], #[]=, #initialize, #load, #merge!, #reload, #save

Constructor Details

This class inherits a constructor from XCCache::HashRepresentable

Instance Attribute Details

#ansiObject Also known as: ansi?

Returns the value of attribute ansi.



16
17
18
# File 'lib/xccache/core/config.rb', line 16

def ansi
  @ansi
end

#in_installationObject Also known as: in_installation?

To distinguish if it’s within an installation, or standalone like ‘xccache pkg build`



21
22
23
# File 'lib/xccache/core/config.rb', line 21

def in_installation
  @in_installation
end

#install_configObject



26
27
28
# File 'lib/xccache/core/config.rb', line 26

def install_config
  @install_config || "debug"
end

#verboseObject Also known as: verbose?

Returns the value of attribute verbose.



16
17
18
# File 'lib/xccache/core/config.rb', line 16

def verbose
  @verbose
end

Class Method Details

.instanceObject



12
13
14
# File 'lib/xccache/core/config.rb', line 12

def self.instance
  @instance ||= new(Pathname("xccache.yml").expand_path)
end

Instance Method Details

#cachemapObject



78
79
80
81
# File 'lib/xccache/core/config.rb', line 78

def cachemap
  require "xccache/cache/cachemap"
  @cachemap ||= Cache::Cachemap.new(sandbox / "cachemap.json")
end

#default_sdkObject



118
119
120
# File 'lib/xccache/core/config.rb', line 118

def default_sdk
  raw["default_sdk"] || "iphonesimulator"
end

#ignore?(item) ⇒ Boolean

Returns:

  • (Boolean)


101
102
103
104
# File 'lib/xccache/core/config.rb', line 101

def ignore?(item)
  return true if ignore_local? && lockfile.local_pkg_slugs.include?(item.split("/").first)
  ignore_list.any? { |p| File.fnmatch(p, item) }
end

#ignore_build_errors?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/xccache/core/config.rb', line 110

def ignore_build_errors?
  raw["ignore_build_errors"]
end

#ignore_listObject



97
98
99
# File 'lib/xccache/core/config.rb', line 97

def ignore_list
  raw["ignore"] || []
end

#ignore_local?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/xccache/core/config.rb', line 106

def ignore_local?
  raw["ignore_local"]
end

#keep_pkgs_in_project?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/xccache/core/config.rb', line 114

def keep_pkgs_in_project?
  raw["keep_pkgs_in_project"]
end

#lockfileObject



74
75
76
# File 'lib/xccache/core/config.rb', line 74

def lockfile
  @lockfile ||= Lockfile.new(Pathname("xccache.lock").expand_path)
end

#project_targetsObject



89
90
91
# File 'lib/xccache/core/config.rb', line 89

def project_targets
  projects.flat_map(&:targets)
end

#projectsObject



83
84
85
86
87
# File 'lib/xccache/core/config.rb', line 83

def projects
  @projects ||= Pathname(".").glob("*.xcodeproj").map do |p|
    Xcodeproj::Project.open(p)
  end
end

#remote_configObject



93
94
95
# File 'lib/xccache/core/config.rb', line 93

def remote_config
  pick_per_install_config(raw["remote"] || {})
end

#sandboxObject



30
31
32
# File 'lib/xccache/core/config.rb', line 30

def sandbox
  @sandbox = Dir.prepare("xccache").expand_path
end

#spm_artifacts_dirObject



58
59
60
# File 'lib/xccache/core/config.rb', line 58

def spm_artifacts_dir
  @spm_artifacts_dir ||= spm_build_dir / "artifacts"
end

#spm_binaries_dirObject



50
51
52
# File 'lib/xccache/core/config.rb', line 50

def spm_binaries_dir
  @spm_binaries_dir ||= Dir.prepare(spm_sandbox / "binaries", clean: true)
end

#spm_build_dirObject



54
55
56
# File 'lib/xccache/core/config.rb', line 54

def spm_build_dir
  @spm_build_dir ||= spm_umbrella_sandbox / ".build"
end

#spm_cache_dirObject



46
47
48
# File 'lib/xccache/core/config.rb', line 46

def spm_cache_dir
  @spm_cache_dir ||= Dir.prepare(Pathname("~/.xccache/#{install_config}").expand_path)
end

#spm_local_pkgs_dirObject



38
39
40
# File 'lib/xccache/core/config.rb', line 38

def spm_local_pkgs_dir
  @spm_local_pkgs_dir ||= Dir.prepare(spm_sandbox / "local", clean: true)
end

#spm_metadata_dirObject



70
71
72
# File 'lib/xccache/core/config.rb', line 70

def 
  @spm_metadata_dir ||= Dir.prepare(spm_sandbox / "metadata")
end

#spm_proxy_sandboxObject



62
63
64
# File 'lib/xccache/core/config.rb', line 62

def spm_proxy_sandbox
  @spm_proxy_sandbox ||= Dir.prepare(spm_sandbox / "proxy")
end

#spm_sandboxObject



34
35
36
# File 'lib/xccache/core/config.rb', line 34

def spm_sandbox
  @spm_sandbox ||= Dir.prepare(sandbox / "packages").expand_path
end

#spm_umbrella_sandboxObject



66
67
68
# File 'lib/xccache/core/config.rb', line 66

def spm_umbrella_sandbox
  @spm_umbrella_sandbox ||= Dir.prepare(spm_sandbox / "umbrella")
end

#spm_xcconfig_dirObject



42
43
44
# File 'lib/xccache/core/config.rb', line 42

def spm_xcconfig_dir
  @spm_xcconfig_dir ||= Dir.prepare(spm_sandbox / "xcconfigs", clean: true)
end