Class: Ancor::CLI::Environment

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

Instance Method Summary collapse

Instance Method Details

#add(slug) ⇒ Object



11
12
13
# File 'lib/ancor/cli/environment.rb', line 11

def add(slug)
  connection.add_env(slug)
end

#commitObject



33
34
35
# File 'lib/ancor/cli/environment.rb', line 33

def commit
  connection.commit(options[:environment])
end

#listObject



5
6
7
8
# File 'lib/ancor/cli/environment.rb', line 5

def list
  parsed = JSON.parse(connection.list_envs.body)
  Formatador.display_table(parsed, ['id', 'slug', 'name','locked'])
end

#plan(path_to_file) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/ancor/cli/environment.rb', line 22

def plan(path_to_file)
  begin
    spec = File.read(path_to_file)
    connection.plan(options[:environment], spec)
  rescue IOError, Errno::ENOENT
    puts 'Could not read specification, make sure file path is correct'
  end
end

#remove(slug) ⇒ Object



16
17
18
# File 'lib/ancor/cli/environment.rb', line 16

def remove(slug)
  connection.remove_env(slug)
end