Class: Pod::X::Source::Definition
- Inherits:
-
Object
- Object
- Pod::X::Source::Definition
- Defined in:
- lib/cocoapods-x/extension/environment/definition.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#map ⇒ Object
readonly
Returns the value of attribute map.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(domain, parent) ⇒ Definition
constructor
A new instance of Definition.
- #list ⇒ Object
- #store_pod(name = nil, *requirements) ⇒ Object
- #store_pod_git(name, group, git) ⇒ Object
- #store_pod_http(name, group, git) ⇒ Object
Constructor Details
#initialize(domain, parent) ⇒ Definition
Returns a new instance of Definition.
11 12 13 14 15 16 17 18 19 |
# File 'lib/cocoapods-x/extension/environment/definition.rb', line 11 def initialize(domain, parent) @domain = domain @parent = parent @children = [] @map = Hash::new(nil) if parent.is_a?(Pod::X::Source::Definition) parent.children << self end end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
8 9 10 |
# File 'lib/cocoapods-x/extension/environment/definition.rb', line 8 def children @children end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
6 7 8 |
# File 'lib/cocoapods-x/extension/environment/definition.rb', line 6 def domain @domain end |
#map ⇒ Object (readonly)
Returns the value of attribute map.
9 10 11 |
# File 'lib/cocoapods-x/extension/environment/definition.rb', line 9 def map @map end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
7 8 9 |
# File 'lib/cocoapods-x/extension/environment/definition.rb', line 7 def parent @parent end |
Instance Method Details
#list ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/cocoapods-x/extension/environment/definition.rb', line 21 def list hash = Hash::new(nil) hash = hash.merge(@map) for source in children do hash = hash.merge(source.map) end hash end |
#store_pod(name = nil, *requirements) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cocoapods-x/extension/environment/definition.rb', line 30 def store_pod(name = nil, *requirements) = requirements.last ||= Hash::new(nil) = .is_a?(Hash) ? : Hash::new(nil) group = [:group] || name git = [:git] || "#{name}.git" if domain.start_with? "git@" store_pod_git(name, group, git) elsif domain.size > 0 store_pod_http(name, group, git) end end |
#store_pod_git(name, group, git) ⇒ Object
45 46 47 48 |
# File 'lib/cocoapods-x/extension/environment/definition.rb', line 45 def store_pod_git(name, group, git) source = "#{domain}:#{group}/#{git}" map[name] = source end |
#store_pod_http(name, group, git) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/cocoapods-x/extension/environment/definition.rb', line 50 def store_pod_http(name, group, git) source = Pathname(domain) source += group source += git map[name] = source.to_s end |