Class: Bosh::Deployer::Stub

Inherits:
Object
  • Object
show all
Includes:
Cancun::Highline
Defined in:
lib/bosh-deployer/stub.rb

Direct Known Subclasses

BoshStub, CFStub

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = '~/.bosh-deployer/stubs') ⇒ Stub

Returns a new instance of Stub.



13
14
15
16
# File 'lib/bosh-deployer/stub.rb', line 13

def initialize(path = '~/.bosh-deployer/stubs')
  path = path[0..-2] if path[-1] == '/'
  @filename = "#{path}/#{name}.yml"
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



11
12
13
# File 'lib/bosh-deployer/stub.rb', line 11

def filename
  @filename
end

Instance Method Details

#generateObject



22
23
24
25
26
27
28
29
# File 'lib/bosh-deployer/stub.rb', line 22

def generate
  if File.exists?(filename) and !agree "#{filename} already exists, do you want to overwrite it?"
    say 'Stub generation cancelled!'
    return
  end

  save_stub
end

#nameObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/bosh-deployer/stub.rb', line 18

def name
  raise NotImplementedError
end