Top Level Namespace
Defined Under Namespace
Instance Method Summary collapse
- #checkout_git_repo(destination_dir) ⇒ Object
- #rename_files_with_replacements(destination_dir, replacements) ⇒ Object
- #shallow_clone_git_repository(source_url, destination_dir) ⇒ Object
Instance Method Details
#checkout_git_repo(destination_dir) ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/eh/commands/generate_processor.rb', line 84 def checkout_git_repo(destination_dir) template_repository_url = Eh::Settings.current.processor_template_repository_url puts "Checking out latest template from #{template_repository_url}" FileUtils.rm_rf(destination_dir) FileUtils.mkdir(destination_dir) shallow_clone_git_repository(template_repository_url, destination_dir) end |
#rename_files_with_replacements(destination_dir, replacements) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/eh/commands/generate_processor.rb', line 65 def rename_files_with_replacements(destination_dir, replacements) Dir.glob(destination_dir + "/**/*") do |src_file_path| if File.file? src_file_path dir = File.dirname src_file_path file_with_replacements = File.basename src_file_path replacements.each do |find_string, replace_string| file_with_replacements.sub!(find_string, replace_string) end dest_file_path = File.join(dir, file_with_replacements) if src_file_path != dest_file_path FileUtils.mv src_file_path, dest_file_path end end end end |
#shallow_clone_git_repository(source_url, destination_dir) ⇒ Object
61 62 63 |
# File 'lib/eh/commands/generate_processor.rb', line 61 def shallow_clone_git_repository(source_url, destination_dir) system("git clone --depth 1 #{source_url} #{destination_dir}") end |