Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
rails-diff (0.5.0)
diffy (~> 3.4)
difftastic (~> 0.7)
rails (>= 7.0)
thor (~> 1.0)

Expand Down Expand Up @@ -89,7 +89,12 @@ GEM
crass (1.0.6)
date (3.4.1)
diff-lcs (1.5.1)
diffy (3.4.3)
difftastic (0.7.0)
pretty_please
difftastic (0.7.0-x86_64-darwin)
pretty_please
dispersion (0.2.0)
prism
drb (2.2.1)
erubi (1.13.1)
globalid (1.2.1)
Expand Down Expand Up @@ -131,7 +136,10 @@ GEM
racc (~> 1.4)
pp (0.6.2)
prettyprint
pretty_please (0.2.0)
dispersion (~> 0.2)
prettyprint (0.2.0)
prism (1.4.0)
psych (5.2.3)
date
stringio
Expand Down
15 changes: 8 additions & 7 deletions lib/rails/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_relative "diff/version"
require "rails"
require "thor"
require "diffy"
require "difftastic"
require "fileutils"
require "open3"

Expand Down Expand Up @@ -148,12 +148,13 @@ def diff_file(file)
return "File not found in the Rails template" unless File.exist?(rails_file)
return "File not found in your repository" unless File.exist?(repo_file)

Diffy::Diff.new(
rails_file,
repo_file,
context: 2,
source: 'files'
).to_s(:color).chomp
differ = Difftastic::Differ.new(
color: :always,
left_label: "Rails File (#{file})",
right_label: "Repo File (#{file})",
)

differ.diff_files(rails_file, repo_file).chomp
end

def cached_app?
Expand Down
2 changes: 1 addition & 1 deletion rails-diff.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency "rails", ">= 7.0"
spec.add_dependency "diffy", "~> 3.4"
spec.add_dependency "difftastic", "~> 0.7"
spec.add_dependency "thor", "~> 1.0"

# For more information and examples about making a new gem, check out our
Expand Down