Class: CreateGate

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/gates/create_gate.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



4
5
6
# File 'lib/gates/create_gate.rb', line 4

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_directoryObject



8
9
10
11
12
# File 'lib/gates/create_gate.rb', line 8

def create_directory
  say "✍️  Setting up your gate..."
  
  directory "../templates/gate", 'gate'
end

#create_infraObject



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

def create_infra
  namespace_id = ConfigHelper.get_namespace_id
  sucess, res = Infra.create_project(namespace_id, 'gate', 'graph')
  
  if sucess
    ConfigHelper.save_config('gate', res)
    
    say "👍 Gate created successfully!"      
  else
    say "⚠️  Error creating gate. Reason: #{res['error']}"
  end
end