lib/gjp/script_generator.rb in gjp-0.37.0 vs lib/gjp/script_generator.rb in gjp-0.38.0

- old
+ new

@@ -1,29 +1,29 @@ # encoding: UTF-8 module Gjp # generates build scripts from bash_history class ScriptGenerator - include Logger + include Logging def initialize(project, history_path) @project = project @ant_runner = Gjp::AntRunner.new(project) @maven_runner = Gjp::MavenRunner.new(project) @history_path = history_path end - + def generate_build_script(name) @project.from_directory do history_lines = File.readlines(@history_path).map { |e| e.strip } relevant_lines = history_lines .reverse - .take_while { |e| e.match(/gjp +dry-run/) == nil } + .take_while { |e| e.match(/gjp +dry-run/).nil? } .reverse - .take_while { |e| e.match(/gjp +finish/) == nil } - .select { |e| e.match(/^#/) == nil } + .take_while { |e| e.match(/gjp +finish/).nil? } + .select { |e| e.match(/^#/).nil? } script_lines = [ "#!/bin/bash", "PROJECT_PREFIX=`readlink -e .`", "cd #{@project.latest_dry_run_directory}" @@ -40,16 +40,16 @@ new_content = script_lines.join("\n") + "\n" script_name = "build.sh" result_path = File.join("src", name, script_name) - conflict_count = @project.merge_new_content(new_content, result_path, "Build script generated", + conflict_count = @project.merge_new_content(new_content, result_path, "Build script generated", "generate_#{name}_build_script") destination_dir = File.join("output", name) FileUtils.mkdir_p(destination_dir) - destination_script_path = File.join(destination_dir, script_name) - FileUtils.symlink(File.expand_path(result_path), destination_script_path, :force => true) + destination_script_path = File.join(destination_dir, script_name) + FileUtils.symlink(File.expand_path(result_path), destination_script_path, force: true) [result_path, conflict_count] end end end