Sha256: ccd77006ea073aa26405746f7b216c1fd921e4c8cdcc3f9199cb35a05ddbcd78
Contents?: true
Size: 764 Bytes
Versions: 4
Compression:
Stored size: 764 Bytes
Contents
require 'fileutils' command :new do |c| c.syntax = 'helios new path/to/app' c.summary = 'Creates a new Helios project' c.description = '' c.action do |args, options| say_error "Missing argument" and abort if args.empty? path = args.first app_name = path.split(/\//).last begin FileUtils.mkdir_p(path) and Dir.chdir(path) Dir.glob(File.join(File.dirname(__FILE__), "../templates/") + "*.erb", File::FNM_DOTMATCH).each do |file| template = ERB.new(File.read(file)) log "create", File.basename(file, ".erb") File.open(File.basename(file, ".erb"), 'w') do |f| f.puts template.result end end rescue => exception say_error exception.message and abort end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
helios-0.0.5 | ./lib/helios/commands/new.rb |
helios-0.0.4 | ./lib/helios/commands/new.rb |
helios-0.0.3 | ./lib/helios/commands/new.rb |
helios-0.0.2 | ./lib/helios/commands/new.rb |