Sha256: 39d923fe6a71db684168f79662b0da645062580cd3e60182320f2f480caf39d1
Contents?: true
Size: 953 Bytes
Versions: 3
Compression:
Stored size: 953 Bytes
Contents
module Tabby class Creator TEMPLATE = ROOT.join("templates/project.rb.erb") attr_reader :project, :template def initialize(name) @project = name @template = ERB.new(TEMPLATE.expand_path.read) end def run! if exists? puts ">> Project already exists." else create_project_directory create_project_file puts ">> Successfully created #{@project}." Tabby::Editor.new(@project).run! end end def exist? project_path.exist? end alias :exists? :exist? def create_project_directory FileUtils.mkdir_p(TABBYDIR) unless File.directory?(TABBYDIR) end def create_project_file project_path.open("w") { |f| f << template.result(binding) } end def project_path TABBYDIR.join("#{project}.rb").expand_path end def klass project.gsub(/_|-/, " ").split.map { |w| w.capitalize }.join end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
tabby2-0.3.0 | lib/tabby/creator.rb |
tabby2-0.2.1 | lib/tabby/creator.rb |
tabby-0.1.0 | lib/tabby/creator.rb |