class CLAide::TemplateRunner

Public Class Methods

new(name, template_url) click to toggle source
# File lib/claide/command/template_runner.rb, line 9
def initialize(name, template_url)
  @name = name
  @template_url = template_url
end

Public Instance Methods

clone_template() click to toggle source

Clones the template from the remote in the working directory using the name of the plugin.

@return [void]

# File lib/claide/command/template_runner.rb, line 19
def clone_template
  UI.section("-> Creating `#{@name}` plugin") do
    UI.notice "using template '#{template_repo_url}'"
    command = ['clone', template_repo_url, @name]
    git! command
  end
end
configure_template() click to toggle source

Runs the template configuration utilities.

@return [void]

# File lib/claide/command/template_runner.rb, line 31
def configure_template
  UI.section('-> Configuring template') do
    Dir.chdir(@name) do
      if File.file? 'configure'
        system "./configure #{@name}"
      else
        UI.warn 'Template does not have a configure file.'
      end
    end
  end
end
template_repo_url() click to toggle source

Checks if a template URL is given else returns the Plugins.config URL

@return String

# File lib/claide/command/template_runner.rb, line 47
def template_repo_url
  @template_url || CLAide::Plugins.config.plugin_template_url
end