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

#initialize ⇒ ConfigureSemaphore

Returns a new instance of ConfigureSemaphore.



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

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

Instance Attribute Details

#environment ⇒ Object

Returns the value of attribute environment.



5
6
7
# File 'lib/renuo/cli/app/configure_semaphore.rb', line 5

def environment
  @environment
end

#project_name ⇒ Object

Returns the value of attribute project_name.



5
6
7
# File 'lib/renuo/cli/app/configure_semaphore.rb', line 5

def project_name
  @project_name
end

Instance Method Details

#call ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/renuo/cli/app/configure_semaphore.rb', line 11

def call
  return unless semaphore_cli_installed?
  FileUtils.mkdir_p('.semaphore')
  write_or_warn('.semaphore/semaphore.yml', render('templates/semaphore.yml.erb'))
  %w[master develop testing].each do |environment|
    @environment = environment
    write_or_warn(".semaphore/#{environment}-deploy.yml", render('templates/semaphore-deploy.yml.erb'))
  end
  create_semaphore_notification
end