Class: MotionSwifty::Cart

Inherits:
Object
  • Object
show all
Defined in:
lib/motion/swifty/cart.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition, options = {}) ⇒ Cart

Returns a new instance of Cart.



6
7
8
9
# File 'lib/motion/swifty/cart.rb', line 6

def initialize(definition, options = {})
  @definition = definition
  @options = options
end

Instance Attribute Details

#definitionObject

Returns the value of attribute definition.



3
4
5
# File 'lib/motion/swifty/cart.rb', line 3

def definition
  @definition
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/motion/swifty/cart.rb', line 4

def options
  @options
end

Instance Method Details

#nameObject



11
12
13
14
15
16
17
18
19
# File 'lib/motion/swifty/cart.rb', line 11

def name
  self.options.fetch(:name) do
    if match = @definition.match(/.* ".*\/(.*?)"/i)
      match.captures.first
    else
      raise "Couldn’t extract cart name from its Cartfile definition"
    end
  end
end

#path(plaform = "iOS") ⇒ Object



21
22
23
# File 'lib/motion/swifty/cart.rb', line 21

def path(plaform = "iOS")
  File.expand_path("./Carthage/Build/#{plaform}/#{name}.framework")
end