Module: Tetra::ProjectIniter
Overview
takes care of intiializing a tetra project
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- TEMPLATE_PATH =
path of the project template files
File.join(File.dirname(__FILE__), "..", "template")
Class Method Summary collapse
-
.included(base) ⇒ Object
includers get class methods defined in ClassMethods.
Instance Method Summary collapse
-
#commit_source_archive(file, message) ⇒ Object
adds a source archive at the project, both in original and unpacked forms.
-
#template_files(include_bundled_software) ⇒ Object
returns a hash that maps filenames that should be copied from TEMPLATE_PATH to the value directory.
Methods included from Logging
Class Method Details
.included(base) ⇒ Object
includers get class methods defined in ClassMethods
12 13 14 |
# File 'lib/tetra/project_initer.rb', line 12 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#commit_source_archive(file, message) ⇒ Object
adds a source archive at the project, both in original and unpacked forms
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/tetra/project_initer.rb', line 69 def commit_source_archive(file, ) from_directory do result_dir = File.join(packages_dir, name) FileUtils.mkdir_p(result_dir) result_path = File.join(result_dir, File.basename(file)) FileUtils.cp(file, result_path) @git.commit_file(result_path, "Source archive added") unarchiver = if file =~ /\.zip$/ Tetra::Unzip.new else Tetra::Tar.new end Dir.glob(File.join("src", "*")).each { |f| FileUtils.rm_rf(f) } unarchiver.decompress(file, "src") commit_sources(, true) end end |
#template_files(include_bundled_software) ⇒ Object
returns a hash that maps filenames that should be copied from TEMPLATE_PATH to the value directory
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/tetra/project_initer.rb', line 50 def template_files(include_bundled_software) result = { "kit" => ".", "packages" => ".", "src" => "." } if include_bundled_software Dir.chdir(TEMPLATE_PATH) do Dir.glob(File.join("bundled", "*")).each do |file| result[file] = "kit" end end end result end |