Class: RailsAppGenerator::Diff::Processor
- Inherits:
-
Object
- Object
- RailsAppGenerator::Diff::Processor
- Defined in:
- lib/rails_app_generator/diff/processor.rb
Overview
Diff Processor
Constant Summary collapse
- DEFAULT_EXCLUSION =
def show_diff(destination, content) #:nodoc:
diff_cmd = ENV["THOR_DIFF"] || ENV["RAILS_DIFF"] || "diff -u" require "tempfile" Tempfile.open(File.basename(destination), File.dirname(destination)) do |temp| temp.write content temp.rewind system %(#{diff_cmd} "#{destination}" "#{temp.path}") end
end
lambda do |_file, relative_file| relative_file.start_with?('tmp') || relative_file.start_with?('node_modules') || relative_file.start_with?('log') || relative_file.start_with?('db') || relative_file.start_with?('app/assets/builds') || relative_file.casecmp?('gemfile.lock') || relative_file.casecmp?('package.lock') || relative_file.casecmp?('package-lock.json') || relative_file.casecmp?('yarn.lock') || relative_file == 'config/master.key' || relative_file == 'config/credentials.yml.enc' end
Instance Attribute Summary collapse
-
#exclusion_handler ⇒ Object
writeonly
Sets the attribute exclusion_handler.
-
#lhs_path ⇒ Object
readonly
Returns the value of attribute lhs_path.
-
#rhs_path ⇒ Object
readonly
Returns the value of attribute rhs_path.
Instance Method Summary collapse
- #compare ⇒ Object
- #debug ⇒ Object
-
#initialize(lhs_path, rhs_path) ⇒ Processor
constructor
A new instance of Processor.
Constructor Details
#initialize(lhs_path, rhs_path) ⇒ Processor
Returns a new instance of Processor.
37 38 39 40 |
# File 'lib/rails_app_generator/diff/processor.rb', line 37 def initialize(lhs_path, rhs_path) @lhs_path = lhs_path @rhs_path = rhs_path end |
Instance Attribute Details
#exclusion_handler=(value) ⇒ Object
Sets the attribute exclusion_handler
42 43 44 |
# File 'lib/rails_app_generator/diff/processor.rb', line 42 def exclusion_handler=(value) @exclusion_handler = value end |
#lhs_path ⇒ Object (readonly)
Returns the value of attribute lhs_path.
7 8 9 |
# File 'lib/rails_app_generator/diff/processor.rb', line 7 def lhs_path @lhs_path end |
#rhs_path ⇒ Object (readonly)
Returns the value of attribute rhs_path.
8 9 10 |
# File 'lib/rails_app_generator/diff/processor.rb', line 8 def rhs_path @rhs_path end |
Instance Method Details
#compare ⇒ Object
44 45 46 47 48 49 |
# File 'lib/rails_app_generator/diff/processor.rb', line 44 def compare @info ||= RailsAppGenerator::Diff::CompareInfo.new( lhs_path, file_list(lhs_path), rhs_path, file_list(rhs_path) ) end |
#debug ⇒ Object
51 52 53 |
# File 'lib/rails_app_generator/diff/processor.rb', line 51 def debug compare.debug end |