class Brick::Generators::NewProjectGenerator
Attributes
project_root[RW]
Public Class Methods
source_root()
click to toggle source
# File lib/brick/generators/new_project_generator.rb, line 13 def self.source_root File.join(File.dirname(__FILE__), "new_project_generator", "templates") end
Public Instance Methods
create_root()
click to toggle source
# File lib/brick/generators/new_project_generator.rb, line 17 def create_root self.destination_root = File.expand_path(working_dir) empty_directory(project_name) self.project_root=File.join(working_dir,project_name) FileUtils.cd(project_root) end
fig_file()
click to toggle source
# File lib/brick/generators/new_project_generator.rb, line 24 def fig_file copy_file("fig.yml","#{project_name}/fig.yml") puts "the project is created at #{project_root}" end
init_git()
click to toggle source
# File lib/brick/generators/new_project_generator.rb, line 29 def init_git puts "Initializing git repo in #{project_root}" FileUtils.cd(project_root) git :init git :add => "." git :commit => "-m 'Initial commit'" end
Private Instance Methods
git(commands={})
click to toggle source
# File lib/brick/generators/new_project_generator.rb, line 40 def git(commands={}) if commands.is_a?(Symbol) `git #{commands}` else commands.each do |cmd, options| `git #{cmd} #{options}` end end end