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.expand_path("#{ENV["HOME"]}/.rails-diff/cache")
- VERSION =
"0.7.0"
Class Method Summary
collapse
-
.file(*files, no_cache: false, ref: nil, new_app_options: nil) ⇒ Object
-
.generated(generator_name, *args, no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil) ⇒ Object
-
.infra(no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil) ⇒ Object
Class Method Details
.file(*files, no_cache: false, ref: nil, new_app_options: nil) ⇒ Object
19
20
21
22
23
24
25
26
|
# 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:)
app_generator.create_template_app
files
.filter_map { |it| (it, app_generator.template_app_path) }
.join("\n")
end
|
.generated(generator_name, *args, no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/rails/diff.rb', line 28
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:)
app_generator.create_template_app
app_generator.install_app_dependencies
app_generator.run_generator(generator_name, *args, skip, only)
.filter_map { |it| (it, app_generator.template_app_path) }
.join("\n\n")
end
|
.infra(no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/rails/diff.rb', line 38
def infra(no_cache: false, skip: [], only: [], ref: nil, new_app_options: nil)
app_generator = RailsAppGenerator.new(ref:, new_app_options:, no_cache:)
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| (it, app_generator.template_app_path) }
.join("\n\n")
end
|