Sha256: bf91f527b8d79cf73be207094d189151e252d9edb00df630fc0cdee050a37f39
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
require 'blueprint/generator/base/template_rendering' module Blueprint module Generator class Base attr_reader :name, :config def initialize(name:) @name = name @config = {} end def run! ask_questions execute end def self.template_path '' end private def ask_questions end def execute end def shell(cmd) cmd_title("Run #{cmd}") system(cmd) end def copy_file(from, to = nil) cmd_title("Copy file #{from}") to = from if to.nil? FileUtils.cp(template_path + from, to) end def copy_file_from_template(from, to = nil) cmd_title("Copy file #{from} from template") to = from if to.nil? template = TemplateRendering.new(name, config) template.save(template_path + from + '.erb', to) end def cd_path(path) cmd_title("Cnahge the current directory to #{path}") FileUtils.cd(path) end def template_path File.expand_path(File.dirname(__FILE__)) + '/templates/' + self.class.template_path + '/' end def cmd_title(title) puts puts title puts end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blueprint-0.2.0 | lib/blueprint/generator/base.rb |