class Deano::NewProjectGenerator
Public Class Methods
command()
click to toggle source
# File lib/deano/commands/new_project_generator_command.rb, line 4 def self.command "new" end
help()
click to toggle source
# File lib/deano/commands/new_project_generator_command.rb, line 8 def self.help "name" end
new(*args)
click to toggle source
Calls superclass method
Deano::NameCommand::new
# File lib/deano/commands/new_project_generator_command.rb, line 12 def initialize(*args) super @app_dir = File.expand_path(File.join(FileUtils.pwd, self.underscored)) end
Public Instance Methods
call()
click to toggle source
# File lib/deano/commands/new_project_generator_command.rb, line 21 def call FileUtils.mkdir self.underscored, verbose: true Dir[template_path("**", "*")].each do |f| if File.directory?(f) FileUtils.mkdir_p clean_string(f), verbose: true else FileUtils.mkdir_p clean_string(File.dirname(f)), verbose: true File.open(clean_string(f), 'w') do |file| file.puts clean_string(File.read(f)) end end end File.open(app_path(".gitignore"), "w") do |f| f.puts File.read(template_path(".gitignore")) end rm app_path("Gemfile.lock") Dir[app_path("**", "*")].each do |file| if File.directory?(file) if Dir[File.join(file, "**", "*")].empty? File.open(File.join(file, ".git-keep"), 'w') {|f| f.puts ""} end end end FileUtils.cd app_path system "bundle" system "git init" system "git add ." system "git commit -a -m 'Initial Commit'" end
classified()
click to toggle source
# File lib/deano/commands/new_project_generator_command.rb, line 17 def classified "#{self.name.classify}App" end