lib/advance.rb in advance-0.1.1 vs lib/advance.rb in advance-0.1.3

- old
+ new

@@ -1,8 +1,8 @@ require "advance/version" -require 'open3' - +require "find" +require "open3" require "team_effort" module Advance RESET="\e[0m" @@ -46,21 +46,22 @@ end File.expand_path(relative_path) end def previous_file_path - dir_entries = Dir.glob(File.join(previous_dir_path, "*")) - dir_entries_clean = dir_entries.reject { |f| File.directory?(f) || f =~ %r{^\.\.?|log} } - dir_entries_clean.first + Find.find(previous_dir_path).reject { |p| FileTest.directory?(p) || File.basename(p) == "log" }.first end def single(label, command) step(label) do if command =~ /\{previous_file\}/ command.gsub!("{previous_file}", previous_file_path) end if command =~ /\{previous_dir\}/ command.gsub!("{previous_dir}", previous_dir_path) + end + if command =~ /\{file\}/ + command.gsub!("{file}", File.basename(previous_file_path)) end do_command command end end