Module: Tetra::ProjectIniter::ClassMethods
- Defined in:
- lib/tetra/project_initer.rb
Overview
class methods container
Instance Method Summary collapse
-
#init(dir, include_bundled_software = true) ⇒ Object
inits a new project directory structure.
-
#project?(dir) ⇒ Boolean
returns true if the specified directory is a valid tetra project.
Instance Method Details
#init(dir, include_bundled_software = true) ⇒ Object
inits a new project directory structure
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tetra/project_initer.rb', line 26 def init(dir, include_bundled_software = true) Dir.mkdir(dir) Dir.chdir(dir) do git = Tetra::Git.new(".") git.init FileUtils.mkdir_p("src") FileUtils.mkdir_p("kit") # populate the project with templates and commit it project = Project.new(".") project.template_files(include_bundled_software).each do |source, destination| FileUtils.cp_r(File.join(TEMPLATE_PATH, source), destination) end git.commit_directories(["."], "Template files added") end end |
#project?(dir) ⇒ Boolean
returns true if the specified directory is a valid tetra project
18 19 20 21 22 23 |
# File 'lib/tetra/project_initer.rb', line 18 def project?(dir) Tetra::Logger.instance.debug "Checking for tetra project: #{dir}, contents: #{Dir.new(dir).to_a}" File.directory?(File.join(dir, "src")) && File.directory?(File.join(dir, "kit")) && File.directory?(File.join(dir, ".git")) end |