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



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

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



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

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

#default_sdkObject



122
123
124
# File 'lib/xccache/core/config.rb', line 122

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

#ensure_file!Object



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

def ensure_file!
  Template.new("xccache.yml").render(save_to: path) unless path.exist?
end

#ignore?(item) ⇒ Boolean

Returns:

  • (Boolean)


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

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)


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

def ignore_build_errors?
  raw["ignore_build_errors"]
end

#ignore_listObject



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

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

#ignore_local?Boolean

Returns:

  • (Boolean)


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

def ignore_local?
  raw["ignore_local"]
end

#keep_pkgs_in_project?Boolean

Returns:

  • (Boolean)


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

def keep_pkgs_in_project?
  raw["keep_pkgs_in_project"]
end

#lockfileObject



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

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

#project_targetsObject



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

def project_targets
  projects.flat_map(&:targets)
end

#projectsObject



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

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

#remote_configObject



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

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

#sandboxObject



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

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

#spm_artifacts_dirObject



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

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

#spm_binaries_dirObject



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

def spm_binaries_dir
  @spm_binaries_dir ||= Dir.prepare(spm_sandbox / "binaries")
end

#spm_build_dirObject



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

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

#spm_cache_dirObject



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

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

#spm_local_pkgs_dirObject



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

def spm_local_pkgs_dir
  @spm_local_pkgs_dir ||= Dir.prepare(spm_sandbox / "local")
end

#spm_metadata_dirObject



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

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

#spm_proxy_sandboxObject



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

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

#spm_sandboxObject



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

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

#spm_umbrella_sandboxObject



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

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

#spm_xcconfigs_dirObject



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

def spm_xcconfigs_dir
  @spm_xcconfigs_dir ||= Dir.prepare(spm_sandbox / "xcconfigs")
end