Class: Servitor::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/cli.rb

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



8
9
10
# File 'lib/cli/cli.rb', line 8

def initialize
  Servitor.root = Dir.pwd
end

Instance Method Details

#autoconfigureObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cli/cli.rb', line 12

def autoconfigure

  SshKey.new(Servitor.ssh_dir).deploy
  vagrantfile = Vagrantfile.new(services, Servitor.ssh_dir).generate

  File.open(Servitor.vagrantfile, 'w') do |f|
    f.write(vagrantfile)
  end

    #AppDeployer.deploy(service_definition, infrastructure, shared_service_info)
    #AppBuilder.build(service_definition, infrastructure, shared_service_info)
    #AppReleaser.release(service_definition, infrastructure, shared_service_info)

end

#deployObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/cli/cli.rb', line 31

def deploy
  configuration_provider = YamlConfigurationProvider.new(File.join(Servitor.data_root, 'variables.yml'))

  service_nodes.each do |service_node|
    configuration_resolver = ConfigurationResolver.new(
      service_node.service_definition,
      configuration_provider,
      services)
    variables = configuration_resolver.variables

    service = services.find {|s| s.name == service_node.service_definition.name}
    box = VagrantBox.new(service.name)
    EnvdirDeployer.new(main_box, service.name, service.vm_root, '.envdir', variables).deploy
  end
end

#destroyObject



57
58
59
# File 'lib/cli/cli.rb', line 57

def destroy
  main_box.destroy
end

#haltObject



53
54
55
# File 'lib/cli/cli.rb', line 53

def halt
  main_box.halt
end

#reupObject



61
62
63
64
# File 'lib/cli/cli.rb', line 61

def reup
  destroy
  up
end

#startObject



27
28
29
# File 'lib/cli/cli.rb', line 27

def start
  main_box.up
end

#upObject



47
48
49
50
51
# File 'lib/cli/cli.rb', line 47

def up
  autoconfigure
  start
  deploy
end