rfix 1.4.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/rfix +78 -34
- data/lib/rfix.rb +17 -28
- data/lib/rfix/branch.rb +3 -25
- data/lib/rfix/branch/base.rb +27 -0
- data/lib/rfix/branch/head.rb +15 -0
- data/lib/rfix/branch/main.rb +33 -0
- data/lib/rfix/branch/name.rb +21 -0
- data/lib/rfix/branch/reference.rb +15 -0
- data/lib/rfix/branch/upstream.rb +17 -0
- data/lib/rfix/cli/command.rb +19 -0
- data/lib/rfix/cli/command/base.rb +61 -0
- data/lib/rfix/cli/command/branch.rb +13 -0
- data/lib/rfix/cli/command/config.rb +22 -0
- data/lib/rfix/cli/command/extension.rb +25 -0
- data/lib/rfix/cli/command/help.rb +11 -0
- data/lib/rfix/cli/command/info.rb +11 -0
- data/lib/rfix/cli/command/lint.rb +17 -0
- data/lib/rfix/cli/command/local.rb +11 -0
- data/lib/rfix/cli/command/origin.rb +11 -0
- data/lib/rfix/cli/command/setup.rb +11 -0
- data/lib/rfix/error.rb +5 -1
- data/lib/rfix/extension/offense.rb +79 -0
- data/lib/rfix/extension/pastel.rb +11 -0
- data/lib/rfix/extension/string.rb +12 -0
- data/lib/rfix/extension/strings.rb +9 -0
- data/lib/rfix/file.rb +6 -41
- data/lib/rfix/file/base.rb +73 -0
- data/lib/rfix/file/deleted.rb +17 -0
- data/lib/rfix/file/ignored.rb +17 -0
- data/lib/rfix/file/tracked.rb +42 -0
- data/lib/rfix/file/untracked.rb +20 -0
- data/lib/rfix/formatter.rb +125 -86
- data/lib/rfix/highlighter.rb +118 -0
- data/lib/rfix/indicator.rb +19 -0
- data/lib/rfix/log.rb +12 -121
- data/lib/rfix/rake/gemfile.rb +111 -0
- data/lib/rfix/rake/paths.rb +25 -23
- data/lib/rfix/rake/support.rb +72 -57
- data/lib/rfix/repository.rb +114 -164
- data/lib/rfix/types.rb +52 -0
- data/lib/rfix/version.rb +1 -1
- data/rfix.gemspec +28 -38
- data/vendor/dry-cli/CHANGELOG.md +191 -0
- data/vendor/dry-cli/CODEOWNERS +1 -0
- data/vendor/dry-cli/CODE_OF_CONDUCT.md +13 -0
- data/vendor/dry-cli/CONTRIBUTING.md +29 -0
- data/vendor/dry-cli/Gemfile +14 -0
- data/vendor/dry-cli/Gemfile.devtools +18 -0
- data/vendor/dry-cli/LICENSE +20 -0
- data/vendor/dry-cli/README.md +29 -0
- data/vendor/dry-cli/Rakefile +13 -0
- data/vendor/dry-cli/bin/console +15 -0
- data/vendor/dry-cli/bin/setup +8 -0
- data/vendor/dry-cli/changelog.yml +97 -0
- data/vendor/dry-cli/docsite/source/arguments.html.md +57 -0
- data/vendor/dry-cli/docsite/source/callbacks.html.md +51 -0
- data/vendor/dry-cli/docsite/source/commands-with-subcommands-and-params.md +86 -0
- data/vendor/dry-cli/docsite/source/commands.html.md +41 -0
- data/vendor/dry-cli/docsite/source/index.html.md +302 -0
- data/vendor/dry-cli/docsite/source/options.html.md +51 -0
- data/vendor/dry-cli/docsite/source/subcommands.html.md +38 -0
- data/vendor/dry-cli/docsite/source/variadic-arguments.html.md +45 -0
- data/vendor/dry-cli/dry-cli.gemspec +36 -0
- data/vendor/dry-cli/lib/dry/cli.rb +224 -0
- data/vendor/dry-cli/lib/dry/cli/banner.rb +135 -0
- data/vendor/dry-cli/lib/dry/cli/command.rb +387 -0
- data/vendor/dry-cli/lib/dry/cli/command_registry.rb +253 -0
- data/vendor/dry-cli/lib/dry/cli/errors.rb +37 -0
- data/vendor/dry-cli/lib/dry/cli/inflector.rb +17 -0
- data/vendor/dry-cli/lib/dry/cli/inline.rb +75 -0
- data/vendor/dry-cli/lib/dry/cli/option.rb +131 -0
- data/vendor/dry-cli/lib/dry/cli/parser.rb +138 -0
- data/vendor/dry-cli/lib/dry/cli/program_name.rb +21 -0
- data/vendor/dry-cli/lib/dry/cli/registry.rb +338 -0
- data/vendor/dry-cli/lib/dry/cli/usage.rb +94 -0
- data/vendor/dry-cli/lib/dry/cli/version.rb +8 -0
- data/vendor/dry-cli/project.yml +13 -0
- data/vendor/dry-cli/spec/integration/commands_spec.rb +14 -0
- data/vendor/dry-cli/spec/integration/inherited_commands_spec.rb +24 -0
- data/vendor/dry-cli/spec/integration/inline_spec.rb +43 -0
- data/vendor/dry-cli/spec/integration/processes_errors_spec.rb +29 -0
- data/vendor/dry-cli/spec/integration/rendering_spec.rb +31 -0
- data/vendor/dry-cli/spec/integration/single_command_spec.rb +81 -0
- data/vendor/dry-cli/spec/integration/subcommands_spec.rb +60 -0
- data/vendor/dry-cli/spec/integration/third_party_gems_spec.rb +18 -0
- data/vendor/dry-cli/spec/spec_helper.rb +15 -0
- data/vendor/dry-cli/spec/support/coverage.rb +15 -0
- data/vendor/dry-cli/spec/support/files.rb +13 -0
- data/vendor/dry-cli/spec/support/fixtures/based +65 -0
- data/vendor/dry-cli/spec/support/fixtures/baz +9 -0
- data/vendor/dry-cli/spec/support/fixtures/baz_command.rb +19 -0
- data/vendor/dry-cli/spec/support/fixtures/foo +588 -0
- data/vendor/dry-cli/spec/support/fixtures/infinites +31 -0
- data/vendor/dry-cli/spec/support/fixtures/inline +20 -0
- data/vendor/dry-cli/spec/support/fixtures/registry.rb +15 -0
- data/vendor/dry-cli/spec/support/fixtures/shared_commands.rb +596 -0
- data/vendor/dry-cli/spec/support/fixtures/with_block.rb +86 -0
- data/vendor/dry-cli/spec/support/fixtures/with_registry.rb +90 -0
- data/vendor/dry-cli/spec/support/fixtures/with_zero_arity_block.rb +87 -0
- data/vendor/dry-cli/spec/support/helpers.rb +37 -0
- data/vendor/dry-cli/spec/support/path.rb +24 -0
- data/vendor/dry-cli/spec/support/rspec.rb +26 -0
- data/vendor/dry-cli/spec/support/rspec_options.rb +16 -0
- data/vendor/dry-cli/spec/support/shared_examples/commands.rb +300 -0
- data/vendor/dry-cli/spec/support/shared_examples/inherited_commands.rb +197 -0
- data/vendor/dry-cli/spec/support/shared_examples/rendering.rb +181 -0
- data/vendor/dry-cli/spec/support/shared_examples/subcommands.rb +226 -0
- data/vendor/dry-cli/spec/support/shared_examples/third_party_gems.rb +49 -0
- data/vendor/dry-cli/spec/support/warnings.rb +10 -0
- data/vendor/dry-cli/spec/unit/dry/cli/cli_spec.rb +123 -0
- data/vendor/dry-cli/spec/unit/dry/cli/inflector_spec.rb +26 -0
- data/vendor/dry-cli/spec/unit/dry/cli/registry_spec.rb +78 -0
- data/vendor/dry-cli/spec/unit/dry/cli/version_spec.rb +7 -0
- data/vendor/strings-ansi/CHANGELOG.md +24 -0
- data/vendor/strings-ansi/CODE_OF_CONDUCT.md +74 -0
- data/vendor/strings-ansi/Gemfile +11 -0
- data/{LICENSE.txt → vendor/strings-ansi/LICENSE.txt} +1 -1
- data/vendor/strings-ansi/README.md +155 -0
- data/vendor/strings-ansi/Rakefile +8 -0
- data/vendor/strings-ansi/appveyor.yml +32 -0
- data/vendor/strings-ansi/bin/console +14 -0
- data/vendor/strings-ansi/bin/setup +8 -0
- data/vendor/strings-ansi/lib/strings-ansi.rb +1 -0
- data/vendor/strings-ansi/lib/strings/ansi.rb +84 -0
- data/vendor/strings-ansi/lib/strings/ansi/extensions.rb +23 -0
- data/vendor/strings-ansi/lib/strings/ansi/version.rb +7 -0
- data/vendor/strings-ansi/spec/fixtures/ansi_codes.yaml +194 -0
- data/vendor/strings-ansi/spec/spec_helper.rb +51 -0
- data/vendor/strings-ansi/spec/unit/ansi_spec.rb +15 -0
- data/vendor/strings-ansi/spec/unit/extensions_spec.rb +19 -0
- data/vendor/strings-ansi/spec/unit/only_ansi_spec.rb +36 -0
- data/vendor/strings-ansi/spec/unit/sanitize_spec.rb +53 -0
- data/vendor/strings-ansi/strings-ansi.gemspec +34 -0
- data/vendor/strings-ansi/tasks/console.rake +11 -0
- data/vendor/strings-ansi/tasks/coverage.rake +11 -0
- data/vendor/strings-ansi/tasks/spec.rake +29 -0
- metadata +274 -188
- data/.github/workflows/main.yml +0 -26
- data/.gitignore +0 -43
- data/.rspec +0 -2
- data/.rubocop.yml +0 -87
- data/.travis.yml +0 -35
- data/Gemfile +0 -2
- data/Gemfile.base +0 -14
- data/Gemfile.base.lock +0 -172
- data/Gemfile.lock +0 -188
- data/Guardfile +0 -16
- data/Makefile +0 -12
- data/README.md +0 -85
- data/Rakefile +0 -31
- data/bin/bundle +0 -114
- data/bin/console +0 -29
- data/bin/guard +0 -29
- data/bin/rake +0 -29
- data/bin/rfix +0 -29
- data/bin/rspec +0 -29
- data/bin/setup +0 -29
- data/ci/Gemfile.rubocop-0.80 +0 -2
- data/ci/Gemfile.rubocop-0.80.lock +0 -170
- data/ci/Gemfile.rubocop-0.81 +0 -2
- data/ci/Gemfile.rubocop-0.81.lock +0 -170
- data/ci/Gemfile.rubocop-0.82 +0 -2
- data/ci/Gemfile.rubocop-0.82.lock +0 -170
- data/ci/Gemfile.rubocop-0.83 +0 -2
- data/ci/Gemfile.rubocop-0.83.lock +0 -168
- data/ci/Gemfile.rubocop-0.84 +0 -2
- data/ci/Gemfile.rubocop-0.84.lock +0 -171
- data/ci/Gemfile.rubocop-0.85 +0 -2
- data/ci/Gemfile.rubocop-0.85.1 +0 -2
- data/ci/Gemfile.rubocop-0.85.1.lock +0 -173
- data/ci/Gemfile.rubocop-0.85.lock +0 -173
- data/lib/rfix/box.rb +0 -112
- data/lib/rfix/branches/base.rb +0 -15
- data/lib/rfix/branches/head.rb +0 -13
- data/lib/rfix/branches/main.rb +0 -28
- data/lib/rfix/branches/name.rb +0 -23
- data/lib/rfix/branches/reference.rb +0 -21
- data/lib/rfix/branches/upstream.rb +0 -13
- data/lib/rfix/cmd.rb +0 -39
- data/lib/rfix/commands/branch.rb +0 -15
- data/lib/rfix/commands/extensions/options.rb +0 -8
- data/lib/rfix/commands/help.rb +0 -7
- data/lib/rfix/commands/helper/args.rb +0 -141
- data/lib/rfix/commands/helper/help.rb +0 -6
- data/lib/rfix/commands/helper/loader.rb +0 -6
- data/lib/rfix/commands/helper/option.rb +0 -0
- data/lib/rfix/commands/helper/params.rb +0 -0
- data/lib/rfix/commands/helper/rubocop.rb +0 -17
- data/lib/rfix/commands/info.rb +0 -30
- data/lib/rfix/commands/lint.rb +0 -22
- data/lib/rfix/commands/local.rb +0 -12
- data/lib/rfix/commands/origin.rb +0 -19
- data/lib/rfix/commands/setup.rb +0 -29
- data/lib/rfix/commands/welcome.rb +0 -24
- data/lib/rfix/deleted.rb +0 -13
- data/lib/rfix/extensions/extensions.rb +0 -18
- data/lib/rfix/extensions/offense.rb +0 -78
- data/lib/rfix/extensions/string.rb +0 -8
- data/lib/rfix/file_cache.rb +0 -59
- data/lib/rfix/git_helper.rb +0 -59
- data/lib/rfix/indentation.rb +0 -39
- data/lib/rfix/loader/bundler.rb +0 -37
- data/lib/rfix/loader/env.rb +0 -33
- data/lib/rfix/loader/spec.rb +0 -41
- data/lib/rfix/no_file.rb +0 -13
- data/lib/rfix/rfix.rb +0 -34
- data/lib/rfix/tracked.rb +0 -72
- data/lib/rfix/tracked_file.rb +0 -16
- data/lib/rfix/untracked.rb +0 -13
- data/resources/ps.png +0 -0
- data/tasks/bump.rake +0 -11
- data/tasks/bundle.rake +0 -17
- data/tasks/complex.rake +0 -54
- data/tasks/execute.rake +0 -38
- data/tasks/libgit2.rake +0 -33
- data/tasks/simple.rake +0 -62
- data/tasks/travis.rake +0 -74
- data/tasks/vendor.rake +0 -34
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rfix
|
4
|
+
module CLI
|
5
|
+
module Command
|
6
|
+
class Config < RuboCop::CommentConfig
|
7
|
+
include Log
|
8
|
+
|
9
|
+
def initialize(rfix, *rest)
|
10
|
+
super(*rest)
|
11
|
+
@rfix = rfix
|
12
|
+
end
|
13
|
+
|
14
|
+
def cop_enabled_at_line?(_, line)
|
15
|
+
@rfix.include?(processed_source.file_path, line) && super
|
16
|
+
rescue StandardError => e
|
17
|
+
puts e.message
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/core/constants"
|
4
|
+
|
5
|
+
module Rfix
|
6
|
+
module CLI
|
7
|
+
module Command
|
8
|
+
class Extension < Module
|
9
|
+
include Dry::Core::Constants
|
10
|
+
|
11
|
+
def initialize(method, &block)
|
12
|
+
define_method(method, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.call(source, method, value = Undefined, &block)
|
16
|
+
unless block_given?
|
17
|
+
return call(source, method, &value.method(:itself))
|
18
|
+
end
|
19
|
+
|
20
|
+
source.include(new(method, &block))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rfix
|
4
|
+
module CLI
|
5
|
+
module Command
|
6
|
+
class Lint < Base
|
7
|
+
option :auto_correct_all, type: :boolean, default: false
|
8
|
+
option :auto_correct, type: :boolean, default: false
|
9
|
+
argument :branch, type: :string, required: true
|
10
|
+
|
11
|
+
def call(branch:, **params)
|
12
|
+
define(Rfix::Branch::Reference.new(name: branch), **params, lint: true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/rfix/error.rb
CHANGED
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/string/inflections"
|
4
|
+
require "shellwords"
|
5
|
+
require "pathname"
|
6
|
+
require "tty-link"
|
7
|
+
require "rainbow"
|
8
|
+
|
9
|
+
module Rfix
|
10
|
+
module Extension
|
11
|
+
module Offense
|
12
|
+
STAR = Rainbow("⭑").yellow
|
13
|
+
CROSS = Rainbow("✗").red
|
14
|
+
CHECK = Rainbow("✓").green
|
15
|
+
CIRCLE = Rainbow("⍟").blue
|
16
|
+
|
17
|
+
include Dry::Core::Constants
|
18
|
+
|
19
|
+
def where
|
20
|
+
"#{line}:#{real_column}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def info
|
24
|
+
message.split(": ", 2).last.delete("\n")
|
25
|
+
end
|
26
|
+
|
27
|
+
def msg
|
28
|
+
Rainbow(info).italic
|
29
|
+
end
|
30
|
+
|
31
|
+
def code
|
32
|
+
message.split(": ", 2).first
|
33
|
+
end
|
34
|
+
|
35
|
+
def relative_path
|
36
|
+
return EMPTY_STRING unless location.respond_to?(:source_buffer)
|
37
|
+
|
38
|
+
location.source_buffer.name.sub(Dir.pwd, EMPTY_STRING).chars.drop_while do |char|
|
39
|
+
char == "/"
|
40
|
+
end.join
|
41
|
+
rescue ArgumentError
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def clickable_path
|
46
|
+
Rainbow("#{relative_path}:#{where}").italic
|
47
|
+
end
|
48
|
+
|
49
|
+
def clickable_plain_severity
|
50
|
+
cop_name.split("/", 2).then do |department, cop|
|
51
|
+
return nil if [cop, department].any?(&:nil?)
|
52
|
+
|
53
|
+
{ type: department.parameterize, cop: cop.parameterize }
|
54
|
+
end.then do |options|
|
55
|
+
"https://docs.rubocop.org/rubocop/cops_%<type>s.html#%<type>s%<cop>s" % options
|
56
|
+
end.then do |url|
|
57
|
+
TTY::Link.link_to(cop_name, url)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def clickable_severity
|
62
|
+
clickable_plain_severity && Rainbow(clickable_plain_severity).italic
|
63
|
+
end
|
64
|
+
|
65
|
+
def icon
|
66
|
+
{
|
67
|
+
uncorrected: CIRCLE,
|
68
|
+
unsupported: CROSS,
|
69
|
+
correctable: STAR,
|
70
|
+
corrected: CHECK
|
71
|
+
}.fetch(status)
|
72
|
+
end
|
73
|
+
|
74
|
+
def escape(str)
|
75
|
+
Shellwords.escape(str)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/rfix/file.rb
CHANGED
@@ -1,46 +1,11 @@
|
|
1
|
-
|
2
|
-
require "shellwords"
|
3
|
-
require "digest"
|
4
|
-
require "listen"
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
|
7
|
-
|
3
|
+
module Rfix
|
4
|
+
module File
|
5
|
+
Self = Deleted | Ignored | Tracked | Untracked
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
super(path, repo, ref)
|
12
|
-
end
|
13
|
-
|
14
|
-
def check_absolute!(path)
|
15
|
-
if Pathname.new(path).absolute?
|
16
|
-
say_abort "Path must be relative #{path}"
|
7
|
+
def self.call(input)
|
8
|
+
Self.call(input)
|
17
9
|
end
|
18
10
|
end
|
19
|
-
|
20
|
-
def include?(_)
|
21
|
-
raise Rfix::Error, "#include? not implemented"
|
22
|
-
end
|
23
|
-
|
24
|
-
def refresh!
|
25
|
-
raise Rfix::Error, "#refresh! not implemented"
|
26
|
-
end
|
27
|
-
|
28
|
-
def inspect
|
29
|
-
raise Rfix::Error, "#inspect not implemented"
|
30
|
-
end
|
31
|
-
|
32
|
-
def git_path
|
33
|
-
@git_path ||= Pathname.new(repo.workdir)
|
34
|
-
end
|
35
|
-
|
36
|
-
def absolute_path
|
37
|
-
path
|
38
|
-
# @absolute_path ||= to_abs(path)
|
39
|
-
end
|
40
|
-
|
41
|
-
def to_abs(path)
|
42
|
-
File.join(repo.workdir, path)
|
43
|
-
end
|
44
|
-
|
45
|
-
alias to_s path
|
46
11
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rugged"
|
4
|
+
require "pathname"
|
5
|
+
require "dry/struct"
|
6
|
+
|
7
|
+
module Rfix
|
8
|
+
module File
|
9
|
+
class Base < Dry::Struct
|
10
|
+
include Dry::Core::Constants
|
11
|
+
include Log
|
12
|
+
|
13
|
+
# https://github.com/libgit2/rugged/blob/35102c0ca10ab87c4c4ffe2e25221d26993c069c/test/status_test.rb
|
14
|
+
# - +:index_new+: the file is new in the index
|
15
|
+
# - +:index_modified+: the file has been modified in the index
|
16
|
+
# - +:index_deleted+: the file has been deleted from the index
|
17
|
+
# - +:worktree_new+: the file is new in the working directory
|
18
|
+
# - +:worktree_modified+: the file has been modified in the working directory
|
19
|
+
# - +:worktree_deleted+: the file has been deleted from the working directory
|
20
|
+
# STATUSES = {
|
21
|
+
# "staged_new_file" => [:index_new],
|
22
|
+
# "staged_new_file_deleted_file" => [:index_new, :worktree_deleted],
|
23
|
+
# "staged_new_file_modified_file" => [:index_new, :worktree_modified],
|
24
|
+
# "file_deleted" => [:worktree_deleted],
|
25
|
+
# "modified_file" => [:worktree_modified],
|
26
|
+
# "new_file" => [:worktree_new],
|
27
|
+
# "ignored_file" => [:ignored],
|
28
|
+
# "subdir/deleted_file" => [:worktree_deleted],
|
29
|
+
# "subdir/modified_file" => [:worktree_modified],
|
30
|
+
# "subdir/new_file" => [:worktree_new],
|
31
|
+
# "\xe8\xbf\x99" => [:worktree_new]
|
32
|
+
# }
|
33
|
+
|
34
|
+
schema schema.strict
|
35
|
+
abstract_class self
|
36
|
+
|
37
|
+
attribute :repository, Repository
|
38
|
+
attribute :basename, Types::String
|
39
|
+
|
40
|
+
UNTRACKED = [:worktree_new, :index_new]
|
41
|
+
DELETED = [:deleted, :worktree_deleted]
|
42
|
+
IGNORED = [:ignored, :unmodified].freeze
|
43
|
+
TRACKED = [:added].freeze
|
44
|
+
|
45
|
+
def key
|
46
|
+
path.to_s
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return [Pathnane]
|
50
|
+
def path
|
51
|
+
repository.path.join(basename)
|
52
|
+
end
|
53
|
+
|
54
|
+
def include?(*, **)
|
55
|
+
raise NotImplementedError, self.class.name
|
56
|
+
end
|
57
|
+
|
58
|
+
def refresh!(*)
|
59
|
+
# NOP
|
60
|
+
end
|
61
|
+
|
62
|
+
def inspect
|
63
|
+
"<#{self.class.name}(#{status.join(', ')}:#{basename})>"
|
64
|
+
end
|
65
|
+
|
66
|
+
%i[untracked? tracked? ignored? deleted?].each do |name|
|
67
|
+
define_method(name) do
|
68
|
+
false
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rfix
|
4
|
+
module File
|
5
|
+
class Tracked < Base
|
6
|
+
attribute :status, Types::Status::Tracked
|
7
|
+
|
8
|
+
OPTIONS = {
|
9
|
+
include_untracked_content: true,
|
10
|
+
recurse_untracked_dirs: true,
|
11
|
+
include_untracked: true,
|
12
|
+
ignore_submodules: true,
|
13
|
+
include_ignored: false,
|
14
|
+
context_lines: 0
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
def include?(line)
|
18
|
+
diff.each_line.map(&:new_lineno).select(&:positive?).to_set.include?(line)
|
19
|
+
end
|
20
|
+
|
21
|
+
def tracked?
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def options
|
28
|
+
OPTIONS.dup.merge(paths: [basename])
|
29
|
+
end
|
30
|
+
|
31
|
+
def diff
|
32
|
+
repository.origin.diff_workdir(**options).tap do |diff|
|
33
|
+
diff.find_similar!(
|
34
|
+
renames_from_rewrites: true,
|
35
|
+
renames: true,
|
36
|
+
copies: true
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|