Class: EY::Serverside::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/engineyard-serverside/source.rb

Direct Known Subclasses

Archive, Git

Defined Under Namespace

Classes: Archive, Git

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell, opts = {}) ⇒ Source

Returns a new instance of Source.


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/engineyard-serverside/source.rb', line 16

def initialize(shell, opts={})
  @shell = shell
  @opts = opts

  missing = self.class.required_opts && self.class.required_opts.reject {|name| @opts[name] }
  if missing and missing.any?
    raise ArgumentError,
      "Internal error: Missing keys #{missing.join(',')}. Required: #{self.class.required_opts.join(', ')}"
  end

  @ref = @opts[:ref].to_s.strip
  @uri = @opts[:uri].to_s if @opts[:uri]
  @source_cache = Pathname.new(@opts[:repository_cache]) if @opts[:repository_cache]
end

Class Attribute Details

.required_optsObject (readonly)

Returns the value of attribute required_opts


9
10
11
# File 'lib/engineyard-serverside/source.rb', line 9

def required_opts
  @required_opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts


5
6
7
# File 'lib/engineyard-serverside/source.rb', line 5

def opts
  @opts
end

#refObject (readonly)

Returns the value of attribute ref


5
6
7
# File 'lib/engineyard-serverside/source.rb', line 5

def ref
  @ref
end

#shellObject (readonly)

Returns the value of attribute shell


5
6
7
# File 'lib/engineyard-serverside/source.rb', line 5

def shell
  @shell
end

#source_cacheObject (readonly) Also known as: repository_cache

Returns the value of attribute source_cache


5
6
7
# File 'lib/engineyard-serverside/source.rb', line 5

def source_cache
  @source_cache
end

#uriObject (readonly)

Returns the value of attribute uri


5
6
7
# File 'lib/engineyard-serverside/source.rb', line 5

def uri
  @uri
end

Class Method Details

.require_opts(*names) ⇒ Object


10
11
12
13
# File 'lib/engineyard-serverside/source.rb', line 10

def require_opts(*names)
  @required_opts ||= []
  @required_opts += names
end