Class: XCBootstrap::Bootstrap
- Inherits:
-
Object
- Object
- XCBootstrap::Bootstrap
- Defined in:
- lib/xcbootstrap/bootstrap.rb
Instance Attribute Summary collapse
-
#project_dir ⇒ Object
Returns the value of attribute project_dir.
-
#template_dir ⇒ Object
Returns the value of attribute template_dir.
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(template_root, template_name, project_dir) ⇒ Bootstrap
constructor
A new instance of Bootstrap.
- #process ⇒ Object
Constructor Details
#initialize(template_root, template_name, project_dir) ⇒ Bootstrap
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/xcbootstrap/bootstrap.rb', line 10 def initialize template_root, template_name, project_dir # FileUtils.mkdir_p project_dir @template_dir = File.join template_root, template_name raise "Invalid template: could not find template directory #{@template_dir}" unless File.directory?(@template_dir) manifest_file = File.join @template_dir, "manifest.yml" raise "Invalid template: could not find template manifest #{manifest_file}" unless File.exists?(manifest_file) @manifest = YAML.load_file manifest_file raise "Invalid template: manifest file did not contain a hash of file mappings #{manifest_file}" unless manifest_data_is_valid(@manifest) @project_dir = File.(project_dir, Dir.getwd) end |
Instance Attribute Details
#project_dir ⇒ Object
Returns the value of attribute project_dir.
8 9 10 |
# File 'lib/xcbootstrap/bootstrap.rb', line 8 def project_dir @project_dir end |
#template_dir ⇒ Object
Returns the value of attribute template_dir.
7 8 9 |
# File 'lib/xcbootstrap/bootstrap.rb', line 7 def template_dir @template_dir end |
Instance Method Details
#finish ⇒ Object
33 34 35 36 |
# File 'lib/xcbootstrap/bootstrap.rb', line 33 def finish print_output_project_files print_next_steps end |
#process ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/xcbootstrap/bootstrap.rb', line 25 def process FileUtils.mkdir_p project_dir @manifest["files"].each do |file| Template.new(file, @template_dir, @project_dir).process end end |