Class: Kurgan::Extend
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Kurgan::Extend
- Includes:
- Thor::Actions
- Defined in:
- lib/kurgan/extend.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_component ⇒ Object
- #create_cfhighlander_files ⇒ Object
- #create_sub_dir_for_extended_component ⇒ Object
- #get_cfhighlander_template ⇒ Object
- #get_component_name ⇒ Object
- #get_template_version ⇒ Object
Class Method Details
.source_root ⇒ Object
10 11 12 |
# File 'lib/kurgan/extend.rb', line 10 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#add_component ⇒ Object
41 42 43 |
# File 'lib/kurgan/extend.rb', line 41 def add_component insert_into_file @cfhighlander_template, "\tComponent name: '#{@name}', template: '#{@name}'\n\n", :before => /^end/ end |
#create_cfhighlander_files ⇒ Object
34 35 36 37 38 39 |
# File 'lib/kurgan/extend.rb', line 34 def create_cfhighlander_files opts = {template: @template, name: @name} template('templates/cfhighlander.extend.rb.tt', "#{@name}/#{@name}.cfhighlander.rb", opts) template('templates/config.yaml.tt', "#{@name}/#{@name}.config.yaml") template('templates/cfndsl.rb.tt', "#{@name}/#{@name}.cfndsl.rb") end |
#create_sub_dir_for_extended_component ⇒ Object
25 26 27 |
# File 'lib/kurgan/extend.rb', line 25 def create_sub_dir_for_extended_component empty_directory @name end |
#get_cfhighlander_template ⇒ Object
14 15 16 17 18 19 |
# File 'lib/kurgan/extend.rb', line 14 def get_cfhighlander_template @cfhighlander_template = Dir['*.cfhighlander.rb'][0] if @cfhighlander_template.nil? raise "No cfhighlander.rb file found in #{Dir.pwd}, are you in a cfhighlander project folder?" end end |
#get_component_name ⇒ Object
21 22 23 |
# File 'lib/kurgan/extend.rb', line 21 def get_component_name @name = [:name] || component end |
#get_template_version ⇒ Object
29 30 31 32 |
# File 'lib/kurgan/extend.rb', line 29 def get_template_version @template = [:version] ? "#{component}@#{[:version]}" : component say "extending #{@template} to the #{@cfhighlander_template.split('.')[0]} project" end |