Top Level Namespace

Defined Under Namespace

Modules: Debot, Setup

Instance Method Summary collapse

Instance Method Details

#erb_path(from) ⇒ Object



11
12
13
# File 'lib/debot/helpers/utils.rb', line 11

def erb_path(from)
  File.read(File.expand_path("../../../../generators/templates/#{from}", __FILE__))
end

#set_default(name, *args, &block) ⇒ Object



15
16
17
# File 'lib/debot/helpers/utils.rb', line 15

def set_default(name, *args, &block)
  set(name, *args, &block) unless exists?(name)
end

#template(from, to) ⇒ Object



7
8
9
# File 'lib/debot/helpers/utils.rb', line 7

def template(from, to)
  put ERB.new(erb_path(from)).result(binding), to
end

#template_rake(from, to) ⇒ Object



3
4
5
# File 'lib/debot/helpers/utils.rb', line 3

def template_rake(from, to)
  File.open(to, 'w') { |f| f.write(ERB.new(erb_path(from)).result(binding)) } 
end