class Hooligan::Cli::InitCommand
Public Instance Methods
execute()
click to toggle source
# File lib/hooligan/cli/init_command.rb, line 8 def execute puts "Project: #{Project.project_name}" puts "- Source dir: #{Project.project_dir}" puts "- Settings dir: #{Project.hooligan_dir}" create_hooligan_dir create_skaffold_dirs import_from_gist end
Private Instance Methods
create_hooligan_dir()
click to toggle source
# File lib/hooligan/cli/init_command.rb, line 55 def create_hooligan_dir if Dir.exist? Project.hooligan_dir # raise ArgumentError, "Project already initialised in #{hooligan_dir}" end FileUtils.mkdir_p Project.hooligan_dir end
create_skaffold_dirs()
click to toggle source
# File lib/hooligan/cli/init_command.rb, line 49 def create_skaffold_dirs skaffold_dirs.each do |dir| FileUtils.mkdir_p File.join(Project.hooligan_dir, 'k8s', dir) end end
import(filepath, url)
click to toggle source
# File lib/hooligan/cli/init_command.rb, line 32 def import(filepath, url) content = `curl #{url}` result = ERB.new(content).result_with_hash( application_name: Project.project_name, application_hostname: "#{Project.project_name}.localtest.me", settings_path: Project.hooligan_dir, application_path: Project.project_dir, # TODO: fix temporary secret # It's ok for this deploy token to be public for now. application_git_url: 'https://gitlab+deploy-token-31258:6bYd6x8F7KQhsSgUBBdX@gitlab.com/rdxnet/php-customer-app' ) full_path = File.join(Project.hooligan_dir, filepath) File.write full_path, result end
import_from_gist()
click to toggle source
# File lib/hooligan/cli/init_command.rb, line 20 def import_from_gist import 'skaffold.yaml', 'https://gist.githubusercontent.com/pre/5ff4cdf75ac8371352e04cdfc4e7b856/raw/1ebdb0f86ed7a747229e6582d52693945a4758fd/skaffold.yaml' import '/k8s/local/ingress.yaml', 'https://gist.githubusercontent.com/pre/5ff4cdf75ac8371352e04cdfc4e7b856/raw/b2613f580d5aecf11e1d5bfd4a68683208ff4b96/local_ingress.yaml' import '/k8s/local/deployment.yaml', 'https://gist.githubusercontent.com/pre/5ff4cdf75ac8371352e04cdfc4e7b856/raw/b2613f580d5aecf11e1d5bfd4a68683208ff4b96/local_deployment.yaml' import '/k8s/base/configmap.yaml', 'https://gist.githubusercontent.com/pre/5ff4cdf75ac8371352e04cdfc4e7b856/raw/3d29ffcd282d2cab4d70812cc3726b063a161c2a/base_configmap.yaml' import '/k8s/base-remote/100-deployment.yaml', 'https://gist.githubusercontent.com/pre/5ff4cdf75ac8371352e04cdfc4e7b856/raw/e89ab5273d1070ade300537bcd92225969e843f0/base-remote_deployment.yaml' # TODO: App name is hard coded as "php-apache" in Exo import '/k8s/exo/150-cert.yaml', 'https://gist.githubusercontent.com/pre/5ff4cdf75ac8371352e04cdfc4e7b856/raw/3e23be8a2051ac66e06385802d4ed6b7a3c5528f/exo_cert.yaml' import '/k8s/exo/200-ingress.yaml', 'https://gist.githubusercontent.com/pre/5ff4cdf75ac8371352e04cdfc4e7b856/raw/81861a158fe77e7e3954a51ba5248962291379f2/exo_ingress.yaml' end
skaffold_dirs()
click to toggle source
# File lib/hooligan/cli/init_command.rb, line 63 def skaffold_dirs %w[base base-remote local exo gke] end