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!, #save

Constructor Details

This class inherits a constructor from XCCache::HashRepresentable

Instance Attribute Details

#in_installationObject Also known as: in_installation?

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



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

def in_installation
  @in_installation
end

#install_configObject



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

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



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

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

#default_sdkObject



112
113
114
# File 'lib/xccache/core/config.rb', line 112

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

#ignore?(item) ⇒ Boolean

Returns:

  • (Boolean)


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

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)


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

def ignore_build_errors?
  raw["ignore_build_errors"]
end

#ignore_listObject



91
92
93
# File 'lib/xccache/core/config.rb', line 91

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

#ignore_local?Boolean

Returns:

  • (Boolean)


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

def ignore_local?
  raw["ignore_local"]
end

#keep_pkgs_in_project?Boolean

Returns:

  • (Boolean)


108
109
110
# File 'lib/xccache/core/config.rb', line 108

def keep_pkgs_in_project?
  raw["keep_pkgs_in_project"]
end

#lockfileObject



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

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

#project_targetsObject



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

def project_targets
  projects.flat_map(&:targets)
end

#projectsObject



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

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

#remote_configObject



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

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

#sandboxObject



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

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

#spm_artifacts_dirObject



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

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

#spm_binaries_dirObject



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

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

#spm_build_dirObject



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

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

#spm_cache_dirObject



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

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

#spm_local_pkgs_dirObject



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

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

#spm_metadata_dirObject



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

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

#spm_sandboxObject



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

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

#spm_umbrella_sandboxObject



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

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

#spm_xcconfig_dirObject



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

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