Class: Kurgan::Add

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/kurgan/add.rb

Instance Method Summary collapse

Instance Method Details

#add_componentObject



26
27
28
# File 'lib/kurgan/add.rb', line 26

def add_component
  insert_into_file @cfhighlander_template, "  Component name: '#{@name}', template: '#{@template}'\n\n", :before => /^end/
end

#create_configObject



30
31
32
# File 'lib/kurgan/add.rb', line 30

def create_config
  create_file "#{@name}.config.yaml"
end

#get_cfhighlander_templateObject



10
11
12
13
14
15
# File 'lib/kurgan/add.rb', line 10

def get_cfhighlander_template
  @cfhighlander_template = Dir['*.cfhighlander.rb'][0]
  if @cfhighlander_template.nil?
    raise "No cfhighlander.rb file found in #{Dir.pwd}"
  end
end

#get_component_nameObject



17
18
19
# File 'lib/kurgan/add.rb', line 17

def get_component_name
  @name = options[:name] || component
end

#get_template_versionObject



21
22
23
24
# File 'lib/kurgan/add.rb', line 21

def get_template_version
  @template = options[:version] ? "#{component}@#{options[:version]}" : component
  say "adding #{@template} to the #{@cfhighlander_template.split('.')[0]} project"
end