Class: CLAide::TemplateRunner
- Inherits:
-
Object
- Object
- CLAide::TemplateRunner
- Extended by:
- Executable
- Defined in:
- lib/claide/command/template_runner.rb
Instance Method Summary collapse
-
#clone_template ⇒ void
Clones the template from the remote in the working directory using the name of the plugin.
-
#configure_template ⇒ void
Runs the template configuration utilities.
-
#initialize(name, template_url) ⇒ TemplateRunner
constructor
A new instance of TemplateRunner.
-
#template_repo_url ⇒ Object
Checks if a template URL is given else returns the Plugins.config URL.
Methods included from Executable
Constructor Details
#initialize(name, template_url) ⇒ TemplateRunner
Returns a new instance of TemplateRunner.
9 10 11 12 |
# File 'lib/claide/command/template_runner.rb', line 9 def initialize(name, template_url) @name = name @template_url = template_url end |
Instance Method Details
#clone_template ⇒ void
This method returns an undefined value.
Clones the template from the remote in the working directory using the name of the plugin.
19 20 21 22 23 24 25 |
# 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 ⇒ void
This method returns an undefined value.
Runs the template configuration utilities.
31 32 33 34 35 36 37 38 39 40 41 |
# 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 ⇒ Object
Checks if a template URL is given else returns the Plugins.config URL
47 48 49 |
# File 'lib/claide/command/template_runner.rb', line 47 def template_repo_url @template_url || CLAide::Plugins.config.plugin_template_url end |