lib/daddy/cucumber/diff.rb in daddy-0.1.25 vs lib/daddy/cucumber/diff.rb in daddy-0.1.26
- old
+ new
@@ -45,10 +45,16 @@
end
def show(file, options = {})
show_filename(file, options)
- lines = File.readlines(file)
+ if options[:commit].present?
+ git = Daddy::Git.new
+ content = git.show_previous(file, :commit => options[:commit], :remote => options[:remote])
+ lines = content.split(/\r\n|\r|\n/).map{|line| line + "\n"}
+ else
+ lines = File.readlines(file)
+ end
if options[:from] and options[:to]
from = options[:from] - 1
to = options[:to] - 1
lines = lines[from..to]