Module: Rails::Diff
- Defined in:
- lib/rails/diff.rb,
lib/rails/diff/cli.rb,
lib/rails/diff/shell.rb,
lib/rails/diff/logger.rb,
lib/rails/diff/version.rb,
lib/rails/diff/rails_repo.rb,
lib/rails/diff/file_tracker.rb,
lib/rails/diff/rails_app_generator.rb
Defined Under Namespace
Modules: FileTracker, Logger, Shell Classes: CLI, RailsAppGenerator, RailsRepo
Constant Summary collapse
- CACHE_DIR =
File.("#{ENV["HOME"]}/.rails-diff/cache")
- VERSION =
"0.8.0"
Class Method Summary collapse
- .file(*files, no_cache: false, ref: nil, new_app_options: nil, app_generator: RailsAppGenerator.new(ref:, new_app_options:, no_cache:), differ_class: Difftastic::Differ) ⇒ Object
- .generated(generator_name, *args, no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil, app_generator: RailsAppGenerator.new(ref:, new_app_options:, no_cache:), differ_class: Difftastic::Differ) ⇒ Object
- .infra(no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil, app_generator: RailsAppGenerator.new(ref:, new_app_options:, no_cache:), differ_class: Difftastic::Differ) ⇒ Object
Class Method Details
.file(*files, no_cache: false, ref: nil, new_app_options: nil, app_generator: RailsAppGenerator.new(ref:, new_app_options:, no_cache:), differ_class: Difftastic::Differ) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rails/diff.rb', line 19 def file(*files, no_cache: false, ref: nil, new_app_options: nil, app_generator: RailsAppGenerator.new(ref:, new_app_options:, no_cache:), differ_class: Difftastic::Differ) app_generator.create_template_app files .filter_map { |it| diff_with_header(it, app_generator.template_app_path, differ_class:) } .join("\n") end |
.generated(generator_name, *args, no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil, app_generator: RailsAppGenerator.new(ref:, new_app_options:, no_cache:), differ_class: Difftastic::Differ) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/rails/diff.rb', line 27 def generated(generator_name, *args, no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil, app_generator: RailsAppGenerator.new(ref:, new_app_options:, no_cache:), differ_class: Difftastic::Differ) app_generator.create_template_app app_generator.install_app_dependencies app_generator.run_generator(generator_name, *args, skip, only) .filter_map { |it| diff_with_header(it, app_generator.template_app_path, differ_class:) } .join("\n\n") end |
.infra(no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil, app_generator: RailsAppGenerator.new(ref:, new_app_options:, no_cache:), differ_class: Difftastic::Differ) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rails/diff.rb', line 36 def infra(no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil, app_generator: RailsAppGenerator.new(ref:, new_app_options:, no_cache:), differ_class: Difftastic::Differ) app_generator.create_template_app default_skip = %w[app lib] effective_skip = (default_skip + skip).uniq FileTracker.list_files(app_generator.template_app_path, skip: effective_skip, only:) .map { |f| f.delete_prefix("#{app_generator.template_app_path}/") } .filter_map { |it| diff_with_header(it, app_generator.template_app_path, differ_class:) } .join("\n\n") end |