Class: ConfigureSemaphore

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfigureSemaphore

Returns a new instance of ConfigureSemaphore.



9
10
11
# File 'lib/renuo/cli/app/configure_semaphore.rb', line 9

def initialize
  @project_name = File.basename(Dir.getwd)
end

Instance Attribute Details

#environmentObject

Returns the value of attribute environment.



7
8
9
# File 'lib/renuo/cli/app/configure_semaphore.rb', line 7

def environment
  @environment
end

#project_nameObject

Returns the value of attribute project_name.



7
8
9
# File 'lib/renuo/cli/app/configure_semaphore.rb', line 7

def project_name
  @project_name
end

Instance Method Details

#callObject

rubocop:disable Metrics/MethodLength



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/renuo/cli/app/configure_semaphore.rb', line 14

def call
  return unless semaphore_cli_installed?

  FileUtils.mkdir_p(%w[.semaphore .semaphore/bin])

  write_or_warn(".semaphore/semaphore.yml", render("templates/semaphore/semaphore.yml.erb"))
  %w[main develop].each do |environment|
    @environment = environment
    write_or_warn(".semaphore/#{environment}-deploy.yml", render("templates/semaphore/semaphore-deploy.yml.erb"))
  end
  write_or_warn(".semaphore/bin/cache_restore", render("templates/semaphore/bin/cache_restore.erb"))
  write_or_warn(".semaphore/bin/cache_store", render("templates/semaphore/bin/cache_store.erb"))

  create_semaphore_notification
  create_semaphore_secrets
  create_semaphore_deployment_targets
end