Class: FoundersTemplate::CLI

Inherits:
Thor
  • Object
show all
Includes:
Utils, Thor::Actions
Defined in:
lib/founders_template/cli.rb

Instance Method Summary collapse

Methods included from Utils

#add_to_envrc, #check_command, #system_command?, #template_file

Instance Method Details

#checkObject



36
37
38
39
40
41
# File 'lib/founders_template/cli.rb', line 36

def check
  return if REQUIRED_SYSTEM_TOOLS.all? { |command| check_command(command) }

  error 'Some dependencies were missing, please check the README for instructions.'
  exit 1
end

#ci(script_name, *args) ⇒ Object



28
29
30
31
32
33
# File 'lib/founders_template/cli.rb', line 28

def ci(script_name, *args)
  script_name = Shellwords.escape(script_name)
  file_path = File.join(SCRIPT_PATH, 'ci', "#{script_name}.sh")

  exec '/usr/bin/env', 'bash', file_path, *args
end

#installObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/founders_template/cli.rb', line 44

def install
  check

  ensure_application_config
  ensure_aws_credentials
  ensure_credentials_key
  ensure_secret_key
  ensure_github_oauth_token

  template 'buildspec.yml.erb', 'buildspec.yml'
  template 'dockerignore.erb', '.dockerignore'
  template 'docker-compose.ci.yml.erb', 'docker-compose.ci.yml'
  template 'docker-compose.yml.erb', 'docker-compose.yml'
  template 'docker-sync.yml.erb', 'docker-sync.yml'
  template 'Dockerfile.erb', 'Dockerfile'

  install_terraform_project

  directory 'docker', 'docker'
  directory 'ci', 'ci'
end