Class: Brick::Generators::NewProjectGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/brick/generators/new_project_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#project_rootObject

Returns the value of attribute project_root.



11
12
13
# File 'lib/brick/generators/new_project_generator.rb', line 11

def project_root
  @project_root
end

Class Method Details

.source_rootObject



13
14
15
# File 'lib/brick/generators/new_project_generator.rb', line 13

def self.source_root
   File.join(File.dirname(__FILE__), "new_project_generator", "templates")
end

Instance Method Details

#create_rootObject



17
18
19
20
21
22
# 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_fileObject



24
25
26
27
# 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_gitObject



29
30
31
32
33
34
35
36
# 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