class FsTemplate::Project
Attributes
path[RW]
Public Instance Methods
commands(phase)
click to toggle source
# File lib/fs_template/project.rb, line 27 def commands(phase) config.commands.select { |x| x[:phase] == phase }.map { |x| x[:command] } end
config_body()
click to toggle source
# File lib/fs_template/project.rb, line 6 def config_body if FileTest.exist?("#{path}/.fstemplate") File.read("#{path}/.fstemplate") elsif FileTest.exist?("#{path}/.overlay") File.read("#{path}/.overlay") else raise "no config" end end
git_commit(output_path,message,init=false)
click to toggle source
# File lib/fs_template/project.rb, line 51 def git_commit(output_path,message,init=false) if init `rm -rf #{output_path}/.git` ec "cd #{output_path} && git init && git config user.email johnsmith@fake.com && git config user.name 'John Smith'", :silent => true end ec "cd #{output_path} && git add . && git commit -m '#{message}'", :silent => true end
overlay_paths()
click to toggle source
# File lib/fs_template/project.rb, line 23 def overlay_paths config.overlays + [path] end
write_to!(output_path)
click to toggle source
# File lib/fs_template/project.rb, line 60 def write_to!(output_path) commands(:before).each do |cmd| FsTemplate.ec "cd #{output_path} && #{cmd}", :silent => true git_commit output_path, "Ran Command: #{cmd}" end base_files.write_to! output_path git_commit output_path, "Base Files #{config.base}", true combined_files.write_to!(output_path) git_commit output_path, "Overlay Files #{path}" commands(:after).each do |cmd| FsTemplate.ec "cd #{output_path} && #{cmd}", :silent => true git_commit output_path, "Ran Command: #{cmd}" end end