Class: LtiTemplateBuilder::Recipe

Inherits:
Object
  • Object
show all
Defined in:
lib/lti_template_builder/recipe.rb

Direct Known Subclasses

BootstrapSass, CorsSupport, Extra, Gems, LtiExtension, Rspec

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecipe

Returns a new instance of Recipe.



7
8
9
10
11
# File 'lib/lti_template_builder/recipe.rb', line 7

def initialize
  @gem_dependencies = []
  @gem_dev_dependencies = []
  @after_bundle_commands = []
end

Instance Attribute Details

#after_bundle_commandsObject

Returns the value of attribute after_bundle_commands.



5
6
7
# File 'lib/lti_template_builder/recipe.rb', line 5

def after_bundle_commands
  @after_bundle_commands
end

#gem_dependenciesObject

Returns the value of attribute gem_dependencies.



5
6
7
# File 'lib/lti_template_builder/recipe.rb', line 5

def gem_dependencies
  @gem_dependencies
end

#gem_dev_dependenciesObject

Returns the value of attribute gem_dev_dependencies.



5
6
7
# File 'lib/lti_template_builder/recipe.rb', line 5

def gem_dev_dependencies
  @gem_dev_dependencies
end

Instance Method Details

#renderObject



22
23
24
25
26
# File 'lib/lti_template_builder/recipe.rb', line 22

def render
  puts "CLASS: #{self.class.name}"
  erb = ERB.new(File.read(File.expand_path("../recipes/#{recipe_name}/template.erb", __FILE__)))
  erb.result(self.instance_eval { binding })
end

#setup(args = {}) ⇒ Object



13
14
15
# File 'lib/lti_template_builder/recipe.rb', line 13

def setup(args={})
  raise "Please override this method!!!"
end

#template(template_name) ⇒ Object



17
18
19
20
# File 'lib/lti_template_builder/recipe.rb', line 17

def template(template_name)
  erb = ERB.new(File.read(File.expand_path("../recipes/#{recipe_name}/#{template_name}.erb", __FILE__)))
  erb.result(self.instance_eval { binding })
end