Sha256: c5b042d1466375bc022b8e6ad6791c598c259ab769e1743f351a2524a952abbc
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require "fileutils" module Hisyo def self.generate_project(options = {}) root = options[:root] || Dir.pwd klass = options[:dryrun] ? FileUtils::NoWrite : FileUtils %w!lib config views public spec app/views app/assets db tmp log!.each do |dir| dir = File.join(root, dir) if File.directory?(dir) puts "\e[31mskip: \e[0m#{dir.gsub(root + "/", "")}/" if options[:verbose] else puts "\e[1m\e[32mcreate: \e[0m#{dir.gsub(root + "/", "")}/" if options[:verbose] klass.mkdir_p dir end end skelton = File.expand_path("../../../data/generators/project", __FILE__) Dir.glob("#{skelton}/**/*", File::FNM_DOTMATCH) do |file| next if File.directory?(file) path = File.join(root, file.gsub(skelton, "")) if File.file?(path) puts "\e[31mskip: \e[0m#{path.gsub(root + "/", "")}/" if options[:verbose] else puts "\e[1m\e[32mcopy to: \e[0m#{path.gsub(root + "/", "")}" if options[:verbose] klass.cp(file, path) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hisyo-0.0.3 | lib/hisyo/generator.rb |