Class: Services::EnvironmentCloner

Inherits:
Object
  • Object
show all
Defined in:
lib/busbar_cli/services/environment_cloner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment, clone_name) ⇒ EnvironmentCloner

Returns a new instance of EnvironmentCloner.



7
8
9
10
# File 'lib/busbar_cli/services/environment_cloner.rb', line 7

def initialize(environment, clone_name)
  @environment = environment
  @clone_name = clone_name
end

Class Method Details

.call(environment, clone_name) ⇒ Object



3
4
5
# File 'lib/busbar_cli/services/environment_cloner.rb', line 3

def self.call(environment, clone_name)
  new(environment, clone_name).call
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/busbar_cli/services/environment_cloner.rb', line 12

def call
  puts "Cloning #{@environment.app_id} #{@environment.name} to " \
       "#{@environment.app_id} #{@clone_name}, stand by..."

  if EnvironmentsRepository.clone(environment: @environment, clone_name: @clone_name)
    puts 'Cloning scheduled!'
  else
    puts "Some issue happened during the cloning schedule. This operations may have failed\n" \
         "Please check your inputs and Busbar's state"
  end
end