lib/gjp/project.rb in gjp-0.14.1 vs lib/gjp/project.rb in gjp-0.15.7

- old
+ new

@@ -75,11 +75,11 @@ true end # starts a dry running phase: files added to the kit will # be added to packages, while sources will be reset at the - # end + # current state when finished def dry_run from_directory do status = get_status if status == :dry_running return false @@ -128,35 +128,35 @@ end end # updates one of the files that tracks changes in src/ directories form a certain tag # list_name is the name of the list of files to update, there will be one for each - # package in src/ + # package (subdirectory) in src/ def update_changed_src_file_list(list_name, tag) Dir.foreach("src") do |entry| - if File.directory?(File.join(Dir.getwd, "src", entry)) and entry =~ /([^:\/]+:[^:]+:[^:]+)$/ - update_changed_file_list(File.join("src", entry), "#{$1}_#{list_name.to_s}", tag) + if File.directory?(File.join(Dir.getwd, "src", entry)) and entry != "." and entry != ".." + update_changed_file_list(File.join("src", entry), "#{entry}_#{list_name.to_s}", tag) end end end # updates file_name with the file names changed in directory since tag def update_changed_file_list(directory, file_name, tag) list_file = File.join("file_lists", file_name) tracked_files = if File.exists?(list_file) - File.readlines(list_file) + File.readlines(list_file).map { |line| line.strip } else [] end new_tracked_files = ( `git diff-tree --no-commit-id --name-only -r #{latest_tag(tag)} HEAD`.split("\n") .select { |file| file.start_with?(directory) } - .map { |file|file[directory.length + 1, file.length] } + .map { |file|file[directory.length + 1, file.length] } .concat(tracked_files) - .sort .uniq + .sort ) log.debug("writing file list for #{directory}: #{new_tracked_files.to_s}") File.open(list_file, "w+") do |file_list| @@ -169,10 +169,10 @@ # adds the project's whole contents to git # if tag is given, commit is tagged def take_snapshot(message, tag = nil) log.debug "committing with message: #{message}" - `git rm -r --cached .` + `git rm -r --cached --ignore-unmatch .` `git add .` `git commit -m "#{message}"` if tag != nil latest_count = if latest_tag(tag) =~ /^gjp_.*_([0-9]+)$/