Class: PodPrebuild::Lockfile
- Inherits:
-
Object
- Object
- PodPrebuild::Lockfile
- Defined in:
- lib/cocoapods-binary-cache/helper/lockfile.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#lockfile ⇒ Object
readonly
Returns the value of attribute lockfile.
Instance Method Summary collapse
- #dev_pod_names ⇒ Object
- #dev_pods ⇒ Object
- #external_sources ⇒ Object
-
#initialize(lockfile) ⇒ Lockfile
constructor
A new instance of Lockfile.
- #non_dev_pods ⇒ Object
- #pods ⇒ Object
- #subspec_pods ⇒ Object
Constructor Details
#initialize(lockfile) ⇒ Lockfile
Returns a new instance of Lockfile.
5 6 7 8 |
# File 'lib/cocoapods-binary-cache/helper/lockfile.rb', line 5 def initialize(lockfile) @lockfile = lockfile @data = lockfile.to_hash end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/cocoapods-binary-cache/helper/lockfile.rb', line 3 def data @data end |
#lockfile ⇒ Object (readonly)
Returns the value of attribute lockfile.
3 4 5 |
# File 'lib/cocoapods-binary-cache/helper/lockfile.rb', line 3 def lockfile @lockfile end |
Instance Method Details
#dev_pod_names ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cocoapods-binary-cache/helper/lockfile.rb', line 18 def dev_pod_names # There are 2 types of external sources: # - Development pods: declared with `:path` option in Podfile, corresponding to `:path` in the Lockfile # - External remote pods: declared with `:git` option in Podfile, corresponding to `:git` in the Lockfile # -------------------- # EXTERNAL SOURCES: # ADevPod: # :path: path/to/dev_pod # AnExternalRemotePod: # :git: git@remote_url # :commit: abc1234 # -------------------- @dev_pod_names ||= external_sources.select { |_, attributes| attributes.key?(:path) }.keys.to_set end |
#dev_pods ⇒ Object
33 34 35 36 |
# File 'lib/cocoapods-binary-cache/helper/lockfile.rb', line 33 def dev_pods dev_pod_names_ = dev_pod_names @dev_pods ||= pods.select { |name, _| dev_pod_names_.include?(name) } end |
#external_sources ⇒ Object
14 15 16 |
# File 'lib/cocoapods-binary-cache/helper/lockfile.rb', line 14 def external_sources @data["EXTERNAL SOURCES"] || {} end |
#non_dev_pods ⇒ Object
38 39 40 41 |
# File 'lib/cocoapods-binary-cache/helper/lockfile.rb', line 38 def non_dev_pods dev_pod_names_ = dev_pod_names @non_dev_pods ||= pods.reject { |name, _| dev_pod_names_.include?(name) } end |
#pods ⇒ Object
10 11 12 |
# File 'lib/cocoapods-binary-cache/helper/lockfile.rb', line 10 def pods @pods ||= (@data["PODS"] || []).map { |v| pod_from(v) }.to_h end |
#subspec_pods ⇒ Object
43 44 45 46 47 |
# File 'lib/cocoapods-binary-cache/helper/lockfile.rb', line 43 def subspec_pods pods.keys .select { |k| k.include?("/") } .group_by { |k| k.split("/")[0] } end |