Module: Daddy::Cucumber::Diff

Defined in:
lib/daddy/cucumber/diff.rb

Instance Method Summary collapse

Instance Method Details

#git_diff(local_file, git_path) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/daddy/cucumber/diff.rb', line 7

def git_diff(local_file, git_path)
  git = Daddy::Git.new
  a = File.read(local_file).gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;')
  b = git.show_previous(git_path, true).gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;')
  diff = Differ.diff(a, b)

  puts local_file
  puts "<pre>#{diff}</pre>"
end

#show(file) ⇒ Object



17
18
19
20
# File 'lib/daddy/cucumber/diff.rb', line 17

def show(file)
  puts file
  puts "<pre>#{File.read(file).gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;')}</pre>"
end