Module: Bork

Defined in:
lib/bork.rb,
lib/bork/cli.rb,
lib/bork/errors.rb,
lib/bork/server.rb,
lib/bork/version.rb,
lib/bork/environment.rb

Defined Under Namespace

Classes: CLI, Environment, Server, ServerNotFoundError

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.environmentsObject (readonly)

Returns the value of attribute environments.



9
10
11
# File 'lib/bork.rb', line 9

def environments
  @environments
end

Class Method Details

.application(*args) ⇒ Object



25
26
27
28
29
# File 'lib/bork.rb', line 25

def application(*args)
  return @application unless args.length > 0
  options = args.extract_options!
  @application = args.first
end

.bootstrap!Object



43
44
45
46
47
# File 'lib/bork.rb', line 43

def bootstrap!
  @environments.each do |name,env|
    env.build!
  end
end

.configure(&block) ⇒ Object



20
21
22
23
# File 'lib/bork.rb', line 20

def configure(&block)
  @environments = {} 
  instance_eval &block
end

.environment(name, &block) ⇒ Object



31
32
33
34
35
# File 'lib/bork.rb', line 31

def environment(name, &block)
  require 'bork/environment'

  @environments[name.to_sym] = Bork::Environment.new(name.to_sym, &block)
end

.loggerObject



13
14
15
16
17
18
# File 'lib/bork.rb', line 13

def logger
  return @logger if @logger 
  @logger = ::Logger.new(STDOUT)
  @logger.level = ::Logger::INFO
  @logger
end

.provider(*args) ⇒ Object



37
38
39
40
41
# File 'lib/bork.rb', line 37

def provider(*args)
  return @provider unless args.length > 1
  options = args.extract_options!
  @provider = Fog::Compute.new(options.merge(:provider => args.first)) 
end

.restore!Object



49
50
51
52
53
# File 'lib/bork.rb', line 49

def restore!
  @environments.each do |name,env|
    env.restore!
  end
end

.setup!Object



55
56
57
58
59
# File 'lib/bork.rb', line 55

def setup!
  @environments.each do |name,env|
    env.setup!
  end
end