Class: TemplateBuilder::App::Helper::Framework

Inherits:
Object
  • Object
show all
Defined in:
lib/template_builder/app/helper/framework.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Framework

Returns a new instance of Framework.



13
14
15
16
17
18
# File 'lib/template_builder/app/helper/framework.rb', line 13

def initialize(opts = {})
  @name = opts[:name]
  @gems = opts[:gems]
  @action = opts[:action]
  @command = opts[:command]
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



12
13
14
# File 'lib/template_builder/app/helper/framework.rb', line 12

def command
  @command
end

Instance Method Details

#actionObject



25
26
27
28
29
30
# File 'lib/template_builder/app/helper/framework.rb', line 25

def action
  ret = []
  @gems.each { |gem| ret <<  gem.action if gem.action}
  @action.each {  |act| ret << act if act}
  ret
end

#run(fileManager) ⇒ Object



20
21
22
23
# File 'lib/template_builder/app/helper/framework.rb', line 20

def run(fileManager)
  @gems.each { |gem| fileManager.write_gem gem.to_s }
  fileManager.write_action action if action.length>0
end

#to_sObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/template_builder/app/helper/framework.rb', line 32

def to_s
  msg = @name+"\n"
  msg += "\tAll gems for this plugin : \n" 
  @gems.each do |gem|  
    msg +="\t\tname => #{gem.name}\n"
    msg +="\t\t\t-source => #{gem.source}\n"
    msg +="\t\t\t-version => #{gem.version}\n"
    msg +="\t\t\t-action => #{gem.action}\n"
  end 
  msg +="\n"
  msg += "\tcommand => #{@command}\n"
  msg +="\n"
  msg += "\tAll actions for this plugin : \n"
  @action.each {  |act| msg+="\taction => #{act.to_s}\n"}
  msg
end