class Kurgan::Init

Public Class Methods

source_root() click to toggle source
# File lib/kurgan/init.rb, line 12
def self.source_root
  File.dirname(__FILE__)
end

Public Instance Methods

ci_init() click to toggle source
# File lib/kurgan/init.rb, line 59
def ci_init
  if yes? "Setup a CI pipeline?"
    ci = ask "CI flavour", limited_to: ['github', 'jenkins', 'codebuild']
    case ci
    when 'github'
      template 'templates/github_actions.yaml.tt', "#{@dir}/.github/workflows/rspec.yaml"
      insert_into_file "#{@dir}/README.md", 
        "![cftest](https://github.com/theonestack/hl-component-#{name}/actions/workflows/rspec.yaml/badge.svg)\n\n", 
        :after => /^# #{name} CfHighlander Component\n\n/
    when 'jenkins'
      template 'templates/Jenkinsfile.tt', "#{@dir}/Jenkinsfile"
    when 'codebuild'
      template 'templates/codebuild.yaml.tt', "#{@dir}/.codebuild.yaml"
    end
  else
    say "Skipping CI setup", :yellow
  end
end
create_cfhighlander_template() click to toggle source
# File lib/kurgan/init.rb, line 37
def create_cfhighlander_template
  opts = {parameters: @parameters, components: @components, description: @description}
  template 'templates/cfhighlander.rb.tt', "#{@dir}/#{name}.cfhighlander.rb", opts
end
create_config_yaml() click to toggle source
# File lib/kurgan/init.rb, line 42
def create_config_yaml
  template 'templates/config.yaml.tt', "#{@dir}/#{name}.config.yaml"
end
create_readme() click to toggle source
# File lib/kurgan/init.rb, line 46
def create_readme
  template "templates/README.md.project.tt", "#{@dir}/README.md"
end
git_init() click to toggle source
# File lib/kurgan/init.rb, line 50
def git_init
  if yes? "git init project?"
    run "git init #{@dir}"
    template 'templates/gitignore.tt', "#{@dir}/.gitignore"
  else
    say "Skipping git init", :yellow
  end
end
set_description() click to toggle source
# File lib/kurgan/init.rb, line 25
def set_description
  @description = ask "template description ", default: name
end
set_directory() click to toggle source
# File lib/kurgan/init.rb, line 20
def set_directory
  @dir = ask "directory name ", default: name
  empty_directory @dir
end
set_template_components() click to toggle source
# File lib/kurgan/init.rb, line 33
def set_template_components
  @components = Kurgan::Projects.properties[options['project'].to_sym][:components]
end
set_template_parameters() click to toggle source
# File lib/kurgan/init.rb, line 29
def set_template_parameters
  @parameters = Kurgan::Projects.properties[options['project'].to_sym][:parameters]
end
set_type() click to toggle source
# File lib/kurgan/init.rb, line 16
def set_type
  @type = 'project'
end