rfix 1.4.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/exe/rfix +78 -34
  3. data/lib/rfix.rb +17 -28
  4. data/lib/rfix/branch.rb +3 -25
  5. data/lib/rfix/branch/base.rb +27 -0
  6. data/lib/rfix/branch/head.rb +15 -0
  7. data/lib/rfix/branch/main.rb +33 -0
  8. data/lib/rfix/branch/name.rb +21 -0
  9. data/lib/rfix/branch/reference.rb +15 -0
  10. data/lib/rfix/branch/upstream.rb +17 -0
  11. data/lib/rfix/cli/command.rb +19 -0
  12. data/lib/rfix/cli/command/base.rb +61 -0
  13. data/lib/rfix/cli/command/branch.rb +13 -0
  14. data/lib/rfix/cli/command/config.rb +22 -0
  15. data/lib/rfix/cli/command/extension.rb +25 -0
  16. data/lib/rfix/cli/command/help.rb +11 -0
  17. data/lib/rfix/cli/command/info.rb +11 -0
  18. data/lib/rfix/cli/command/lint.rb +17 -0
  19. data/lib/rfix/cli/command/local.rb +11 -0
  20. data/lib/rfix/cli/command/origin.rb +11 -0
  21. data/lib/rfix/cli/command/setup.rb +11 -0
  22. data/lib/rfix/error.rb +5 -1
  23. data/lib/rfix/extension/offense.rb +79 -0
  24. data/lib/rfix/extension/pastel.rb +11 -0
  25. data/lib/rfix/extension/string.rb +12 -0
  26. data/lib/rfix/extension/strings.rb +9 -0
  27. data/lib/rfix/file.rb +6 -41
  28. data/lib/rfix/file/base.rb +73 -0
  29. data/lib/rfix/file/deleted.rb +17 -0
  30. data/lib/rfix/file/ignored.rb +17 -0
  31. data/lib/rfix/file/tracked.rb +42 -0
  32. data/lib/rfix/file/untracked.rb +20 -0
  33. data/lib/rfix/formatter.rb +125 -86
  34. data/lib/rfix/highlighter.rb +118 -0
  35. data/lib/rfix/indicator.rb +19 -0
  36. data/lib/rfix/log.rb +12 -121
  37. data/lib/rfix/rake/gemfile.rb +111 -0
  38. data/lib/rfix/rake/paths.rb +25 -23
  39. data/lib/rfix/rake/support.rb +72 -57
  40. data/lib/rfix/repository.rb +114 -164
  41. data/lib/rfix/types.rb +52 -0
  42. data/lib/rfix/version.rb +1 -1
  43. data/rfix.gemspec +28 -38
  44. data/vendor/dry-cli/CHANGELOG.md +191 -0
  45. data/vendor/dry-cli/CODEOWNERS +1 -0
  46. data/vendor/dry-cli/CODE_OF_CONDUCT.md +13 -0
  47. data/vendor/dry-cli/CONTRIBUTING.md +29 -0
  48. data/vendor/dry-cli/Gemfile +14 -0
  49. data/vendor/dry-cli/Gemfile.devtools +18 -0
  50. data/vendor/dry-cli/LICENSE +20 -0
  51. data/vendor/dry-cli/README.md +29 -0
  52. data/vendor/dry-cli/Rakefile +13 -0
  53. data/vendor/dry-cli/bin/console +15 -0
  54. data/vendor/dry-cli/bin/setup +8 -0
  55. data/vendor/dry-cli/changelog.yml +97 -0
  56. data/vendor/dry-cli/docsite/source/arguments.html.md +57 -0
  57. data/vendor/dry-cli/docsite/source/callbacks.html.md +51 -0
  58. data/vendor/dry-cli/docsite/source/commands-with-subcommands-and-params.md +86 -0
  59. data/vendor/dry-cli/docsite/source/commands.html.md +41 -0
  60. data/vendor/dry-cli/docsite/source/index.html.md +302 -0
  61. data/vendor/dry-cli/docsite/source/options.html.md +51 -0
  62. data/vendor/dry-cli/docsite/source/subcommands.html.md +38 -0
  63. data/vendor/dry-cli/docsite/source/variadic-arguments.html.md +45 -0
  64. data/vendor/dry-cli/dry-cli.gemspec +36 -0
  65. data/vendor/dry-cli/lib/dry/cli.rb +224 -0
  66. data/vendor/dry-cli/lib/dry/cli/banner.rb +135 -0
  67. data/vendor/dry-cli/lib/dry/cli/command.rb +387 -0
  68. data/vendor/dry-cli/lib/dry/cli/command_registry.rb +253 -0
  69. data/vendor/dry-cli/lib/dry/cli/errors.rb +37 -0
  70. data/vendor/dry-cli/lib/dry/cli/inflector.rb +17 -0
  71. data/vendor/dry-cli/lib/dry/cli/inline.rb +75 -0
  72. data/vendor/dry-cli/lib/dry/cli/option.rb +131 -0
  73. data/vendor/dry-cli/lib/dry/cli/parser.rb +138 -0
  74. data/vendor/dry-cli/lib/dry/cli/program_name.rb +21 -0
  75. data/vendor/dry-cli/lib/dry/cli/registry.rb +338 -0
  76. data/vendor/dry-cli/lib/dry/cli/usage.rb +94 -0
  77. data/vendor/dry-cli/lib/dry/cli/version.rb +8 -0
  78. data/vendor/dry-cli/project.yml +13 -0
  79. data/vendor/dry-cli/spec/integration/commands_spec.rb +14 -0
  80. data/vendor/dry-cli/spec/integration/inherited_commands_spec.rb +24 -0
  81. data/vendor/dry-cli/spec/integration/inline_spec.rb +43 -0
  82. data/vendor/dry-cli/spec/integration/processes_errors_spec.rb +29 -0
  83. data/vendor/dry-cli/spec/integration/rendering_spec.rb +31 -0
  84. data/vendor/dry-cli/spec/integration/single_command_spec.rb +81 -0
  85. data/vendor/dry-cli/spec/integration/subcommands_spec.rb +60 -0
  86. data/vendor/dry-cli/spec/integration/third_party_gems_spec.rb +18 -0
  87. data/vendor/dry-cli/spec/spec_helper.rb +15 -0
  88. data/vendor/dry-cli/spec/support/coverage.rb +15 -0
  89. data/vendor/dry-cli/spec/support/files.rb +13 -0
  90. data/vendor/dry-cli/spec/support/fixtures/based +65 -0
  91. data/vendor/dry-cli/spec/support/fixtures/baz +9 -0
  92. data/vendor/dry-cli/spec/support/fixtures/baz_command.rb +19 -0
  93. data/vendor/dry-cli/spec/support/fixtures/foo +588 -0
  94. data/vendor/dry-cli/spec/support/fixtures/infinites +31 -0
  95. data/vendor/dry-cli/spec/support/fixtures/inline +20 -0
  96. data/vendor/dry-cli/spec/support/fixtures/registry.rb +15 -0
  97. data/vendor/dry-cli/spec/support/fixtures/shared_commands.rb +596 -0
  98. data/vendor/dry-cli/spec/support/fixtures/with_block.rb +86 -0
  99. data/vendor/dry-cli/spec/support/fixtures/with_registry.rb +90 -0
  100. data/vendor/dry-cli/spec/support/fixtures/with_zero_arity_block.rb +87 -0
  101. data/vendor/dry-cli/spec/support/helpers.rb +37 -0
  102. data/vendor/dry-cli/spec/support/path.rb +24 -0
  103. data/vendor/dry-cli/spec/support/rspec.rb +26 -0
  104. data/vendor/dry-cli/spec/support/rspec_options.rb +16 -0
  105. data/vendor/dry-cli/spec/support/shared_examples/commands.rb +300 -0
  106. data/vendor/dry-cli/spec/support/shared_examples/inherited_commands.rb +197 -0
  107. data/vendor/dry-cli/spec/support/shared_examples/rendering.rb +181 -0
  108. data/vendor/dry-cli/spec/support/shared_examples/subcommands.rb +226 -0
  109. data/vendor/dry-cli/spec/support/shared_examples/third_party_gems.rb +49 -0
  110. data/vendor/dry-cli/spec/support/warnings.rb +10 -0
  111. data/vendor/dry-cli/spec/unit/dry/cli/cli_spec.rb +123 -0
  112. data/vendor/dry-cli/spec/unit/dry/cli/inflector_spec.rb +26 -0
  113. data/vendor/dry-cli/spec/unit/dry/cli/registry_spec.rb +78 -0
  114. data/vendor/dry-cli/spec/unit/dry/cli/version_spec.rb +7 -0
  115. data/vendor/strings-ansi/CHANGELOG.md +24 -0
  116. data/vendor/strings-ansi/CODE_OF_CONDUCT.md +74 -0
  117. data/vendor/strings-ansi/Gemfile +11 -0
  118. data/{LICENSE.txt → vendor/strings-ansi/LICENSE.txt} +1 -1
  119. data/vendor/strings-ansi/README.md +155 -0
  120. data/vendor/strings-ansi/Rakefile +8 -0
  121. data/vendor/strings-ansi/appveyor.yml +32 -0
  122. data/vendor/strings-ansi/bin/console +14 -0
  123. data/vendor/strings-ansi/bin/setup +8 -0
  124. data/vendor/strings-ansi/lib/strings-ansi.rb +1 -0
  125. data/vendor/strings-ansi/lib/strings/ansi.rb +84 -0
  126. data/vendor/strings-ansi/lib/strings/ansi/extensions.rb +23 -0
  127. data/vendor/strings-ansi/lib/strings/ansi/version.rb +7 -0
  128. data/vendor/strings-ansi/spec/fixtures/ansi_codes.yaml +194 -0
  129. data/vendor/strings-ansi/spec/spec_helper.rb +51 -0
  130. data/vendor/strings-ansi/spec/unit/ansi_spec.rb +15 -0
  131. data/vendor/strings-ansi/spec/unit/extensions_spec.rb +19 -0
  132. data/vendor/strings-ansi/spec/unit/only_ansi_spec.rb +36 -0
  133. data/vendor/strings-ansi/spec/unit/sanitize_spec.rb +53 -0
  134. data/vendor/strings-ansi/strings-ansi.gemspec +34 -0
  135. data/vendor/strings-ansi/tasks/console.rake +11 -0
  136. data/vendor/strings-ansi/tasks/coverage.rake +11 -0
  137. data/vendor/strings-ansi/tasks/spec.rake +29 -0
  138. metadata +274 -188
  139. data/.github/workflows/main.yml +0 -26
  140. data/.gitignore +0 -43
  141. data/.rspec +0 -2
  142. data/.rubocop.yml +0 -87
  143. data/.travis.yml +0 -35
  144. data/Gemfile +0 -2
  145. data/Gemfile.base +0 -14
  146. data/Gemfile.base.lock +0 -172
  147. data/Gemfile.lock +0 -188
  148. data/Guardfile +0 -16
  149. data/Makefile +0 -12
  150. data/README.md +0 -85
  151. data/Rakefile +0 -31
  152. data/bin/bundle +0 -114
  153. data/bin/console +0 -29
  154. data/bin/guard +0 -29
  155. data/bin/rake +0 -29
  156. data/bin/rfix +0 -29
  157. data/bin/rspec +0 -29
  158. data/bin/setup +0 -29
  159. data/ci/Gemfile.rubocop-0.80 +0 -2
  160. data/ci/Gemfile.rubocop-0.80.lock +0 -170
  161. data/ci/Gemfile.rubocop-0.81 +0 -2
  162. data/ci/Gemfile.rubocop-0.81.lock +0 -170
  163. data/ci/Gemfile.rubocop-0.82 +0 -2
  164. data/ci/Gemfile.rubocop-0.82.lock +0 -170
  165. data/ci/Gemfile.rubocop-0.83 +0 -2
  166. data/ci/Gemfile.rubocop-0.83.lock +0 -168
  167. data/ci/Gemfile.rubocop-0.84 +0 -2
  168. data/ci/Gemfile.rubocop-0.84.lock +0 -171
  169. data/ci/Gemfile.rubocop-0.85 +0 -2
  170. data/ci/Gemfile.rubocop-0.85.1 +0 -2
  171. data/ci/Gemfile.rubocop-0.85.1.lock +0 -173
  172. data/ci/Gemfile.rubocop-0.85.lock +0 -173
  173. data/lib/rfix/box.rb +0 -112
  174. data/lib/rfix/branches/base.rb +0 -15
  175. data/lib/rfix/branches/head.rb +0 -13
  176. data/lib/rfix/branches/main.rb +0 -28
  177. data/lib/rfix/branches/name.rb +0 -23
  178. data/lib/rfix/branches/reference.rb +0 -21
  179. data/lib/rfix/branches/upstream.rb +0 -13
  180. data/lib/rfix/cmd.rb +0 -39
  181. data/lib/rfix/commands/branch.rb +0 -15
  182. data/lib/rfix/commands/extensions/options.rb +0 -8
  183. data/lib/rfix/commands/help.rb +0 -7
  184. data/lib/rfix/commands/helper/args.rb +0 -141
  185. data/lib/rfix/commands/helper/help.rb +0 -6
  186. data/lib/rfix/commands/helper/loader.rb +0 -6
  187. data/lib/rfix/commands/helper/option.rb +0 -0
  188. data/lib/rfix/commands/helper/params.rb +0 -0
  189. data/lib/rfix/commands/helper/rubocop.rb +0 -17
  190. data/lib/rfix/commands/info.rb +0 -30
  191. data/lib/rfix/commands/lint.rb +0 -22
  192. data/lib/rfix/commands/local.rb +0 -12
  193. data/lib/rfix/commands/origin.rb +0 -19
  194. data/lib/rfix/commands/setup.rb +0 -29
  195. data/lib/rfix/commands/welcome.rb +0 -24
  196. data/lib/rfix/deleted.rb +0 -13
  197. data/lib/rfix/extensions/extensions.rb +0 -18
  198. data/lib/rfix/extensions/offense.rb +0 -78
  199. data/lib/rfix/extensions/string.rb +0 -8
  200. data/lib/rfix/file_cache.rb +0 -59
  201. data/lib/rfix/git_helper.rb +0 -59
  202. data/lib/rfix/indentation.rb +0 -39
  203. data/lib/rfix/loader/bundler.rb +0 -37
  204. data/lib/rfix/loader/env.rb +0 -33
  205. data/lib/rfix/loader/spec.rb +0 -41
  206. data/lib/rfix/no_file.rb +0 -13
  207. data/lib/rfix/rfix.rb +0 -34
  208. data/lib/rfix/tracked.rb +0 -72
  209. data/lib/rfix/tracked_file.rb +0 -16
  210. data/lib/rfix/untracked.rb +0 -13
  211. data/resources/ps.png +0 -0
  212. data/tasks/bump.rake +0 -11
  213. data/tasks/bundle.rake +0 -17
  214. data/tasks/complex.rake +0 -54
  215. data/tasks/execute.rake +0 -38
  216. data/tasks/libgit2.rake +0 -33
  217. data/tasks/simple.rake +0 -62
  218. data/tasks/travis.rake +0 -74
  219. data/tasks/vendor.rake +0 -34
@@ -1,8 +0,0 @@
1
- require "rfix/log"
2
-
3
- # TODO: Use refinements instead
4
- class String
5
- def fmt
6
- Rfix::Log.fmt self
7
- end
8
- end
@@ -1,59 +0,0 @@
1
- class FileCache
2
- attr_reader :root_path
3
- include Rfix::Log
4
-
5
- def initialize(path)
6
- @files = Hash.new
7
- @paths = Hash.new
8
- @root_path = path
9
- end
10
-
11
- def add(file)
12
- key = normalized_file_path(file)
13
-
14
- if @files.key?(key)
15
- return say_debug("File already exists with path {{error:#{file.path}}} using #{key}")
16
- end
17
-
18
- say_debug("Adding file with path {{green:#{file.path}}} using key {{info:#{key}}}")
19
- @files[key] = file
20
- end
21
-
22
- def get(path)
23
- key = normalize_path(path)
24
-
25
- if file = @files[key]
26
- say_debug("Found file #{file} with path #{path}")
27
- return file
28
- end
29
-
30
- say_debug("Could {{error:NOT}} find path #{path}")
31
- nil
32
- end
33
-
34
- def pluck(&block)
35
- @files.values.map(&block)
36
- end
37
-
38
- private
39
-
40
- def normalized_file_path(file)
41
- normalize_path(file.absolute_path)
42
- end
43
-
44
- def to_abs(path)
45
- File.join(root_path, path)
46
- end
47
-
48
- def normalize_path(path)
49
- if cached = @paths[path]
50
- return cached
51
- end
52
-
53
- if Pathname.new(path).absolute?
54
- @paths[path] = File.realdirpath(path)
55
- else
56
- @paths[path] = File.realdirpath(to_abs(path))
57
- end
58
- end
59
- end
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "open3"
4
- require "rfix"
5
- require "rfix/log"
6
- require "rfix/cmd"
7
- require "shellwords"
8
-
9
- module Rfix::GitHelper
10
- include Rfix::Log
11
- include Rfix::Cmd
12
-
13
- def git(*params, root: Dir.pwd, quiet: false, &block)
14
- args = split_args(params)
15
- args.unshift *["--git-dir", File.join(root, ".git")]
16
- args.unshift *["--work-tree", root]
17
- cmd("git", *args, quiet: quiet, &block)
18
- end
19
-
20
- def split_args(params)
21
- return if params.empty?
22
- return split(params.first) if params.count == 1
23
- return params
24
- end
25
-
26
- def split(str)
27
- Shellwords.split(str)
28
- end
29
-
30
- def has_branch?(branch)
31
- cmd_succeeded?("git", "cat-file", "-t", branch)
32
- end
33
-
34
- def dirty?(path)
35
- Dir.chdir(path) do
36
- !cmd_succeeded?("git diff --quiet")
37
- end
38
- end
39
-
40
- def params
41
- [
42
- "--word-diff-regex=[^[:space:]]",
43
- "--no-renames",
44
- "--no-merges",
45
- "--first-parent",
46
- "--find-renames",
47
- "--find-copies",
48
- "--diff-filter=AMCR",
49
- "-U0",
50
- "--no-color",
51
- "-p"
52
- ]
53
- end
54
- end
55
-
56
- # TODO: Rename above to just ::Git
57
- module Rfix::Git
58
- extend Rfix::GitHelper
59
- end
@@ -1,39 +0,0 @@
1
- require "dry/core/memoizable"
2
-
3
- module Rfix
4
- class Indentation
5
- include Dry::Core::Memoizable
6
- SPACE = " ".freeze
7
-
8
- attr_reader :extra_indentation, :input
9
-
10
- def initialize(input, extra_indentation: 0)
11
- @input = input
12
- @extra_indentation = extra_indentation
13
- end
14
-
15
- def stripped
16
- lines.map do |line|
17
- line.sub(/^\s{#{min_indentation}}/, "")
18
- end.map do |line|
19
- [SPACE * extra_indentation, line].join
20
- end.join
21
- end
22
-
23
- alias call stripped
24
-
25
- private
26
-
27
- def min_indentation
28
- lines.map do |line|
29
- line.match(/^\s*/)[0].length
30
- end.min || 0
31
- end
32
-
33
- def lines
34
- input.lines
35
- end
36
-
37
- memoize :min_indentation, :lines
38
- end
39
- end
@@ -1,37 +0,0 @@
1
- begin
2
- require "bundler"
3
-
4
- module Bundler
5
- class Null
6
- def __materialize__
7
-
8
- end
9
-
10
- def version
11
- raise "#version not impl."
12
- end
13
-
14
- def activation
15
- raise "#activation not impl."
16
- end
17
- end
18
-
19
- def self.locked_specs
20
- locked_gems&.specs || []
21
- rescue Bundler::GemfileNotFound
22
- []
23
- end
24
-
25
- def self.find_locked(name)
26
- locked_specs.select do |spec|
27
- spec.name.casecmp(name).zero?
28
- end.first
29
- end
30
-
31
- def self.activate_locked(name)
32
- find_locked(name).__materialize__.tap(&:activation)
33
- end
34
- end
35
- rescue LoadError
36
- require_relative "null_bundler"
37
- end
@@ -1,33 +0,0 @@
1
- # require "pry"
2
- class Env
3
- KEY = "__RFIX_LOOP".freeze
4
-
5
- def self.spec
6
- Gem.loaded_specs.fetch("rfix")
7
- end
8
-
9
- def self.requirement
10
- spec.dependencies.select do |gem|
11
- gem.name == "rubocop"
12
- end.first&.requirement || Env.log!("RuboCop requirement not found")
13
- end
14
-
15
- def self.pretty_req
16
- requirement.as_list.join(" to ")
17
- end
18
-
19
- def self.bundle_path
20
- Gem.bin_path("bundler", "bundle")
21
- end
22
-
23
- def self.log(msg)
24
- # return unless ARGV.include?("--debug")
25
-
26
- $stderr.puts ["==>", msg].join(" ")
27
- end
28
-
29
- def self.log!(msg)
30
- $stderr.puts ["==>", msg].join(" ")
31
- exit(1)
32
- end
33
- end
@@ -1,41 +0,0 @@
1
- class Gem::Specification
2
- def self.deactivate(name)
3
- Gem.loaded_specs[name]&.deactivate
4
- end
5
-
6
- def deactivate
7
- loaded_paths.each do |path|
8
- $:.delete(path)
9
- end
10
-
11
- Gem.loaded_specs.delete(name)
12
- end
13
-
14
- def activation
15
- self.class.deactivate(name)
16
- activate
17
- rescue Gem::ConflictError => error
18
- abort error.to_s
19
- end
20
-
21
- private
22
-
23
- def loaded_paths(spec = self, prev = [])
24
- return root_loaded_path unless loaded_into_path?
25
- return root_loaded_path if prev == root_loaded_path
26
-
27
- root_loaded_path + dependent_specs.map do |spec|
28
- loaded_paths(spec, root_loaded_path)
29
- end.flatten
30
- end
31
-
32
- def loaded_into_path?
33
- @lip ||= root_loaded_path.any? do |path|
34
- $:.include?(path)
35
- end
36
- end
37
-
38
- def root_loaded_path
39
- @root ||= Dir.glob(lib_dirs_glob)
40
- end
41
- end
data/lib/rfix/no_file.rb DELETED
@@ -1,13 +0,0 @@
1
- class NoFile < Struct.new(:path)
2
- def include?(_line)
3
- return true
4
- end
5
-
6
- def divide
7
- Set.new
8
- end
9
-
10
- def empty?
11
- false
12
- end
13
- end
data/lib/rfix/rfix.rb DELETED
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubocop"
4
- require "rfix/log"
5
-
6
- module Rfix
7
- include Log
8
- attr_accessor :repo
9
- attr_accessor :test
10
-
11
- alias test? test
12
-
13
- def global_enable!
14
- @global_enable = true
15
- end
16
-
17
- def global_enable?
18
- @global_enable
19
- end
20
-
21
- def refresh!(source)
22
- return true if global_enable?
23
-
24
- repo.refresh!(source.file_path)
25
- end
26
-
27
- def enabled?(path, line)
28
- return true if global_enable?
29
-
30
- repo.include?(path, line)
31
- end
32
- end
33
-
34
- # rubocop:enable Layout/LineLength
data/lib/rfix/tracked.rb DELETED
@@ -1,72 +0,0 @@
1
- require "rfix/no_file"
2
-
3
- class Rfix::Tracked < Rfix::File
4
- include Rfix::Log
5
-
6
- def include?(line)
7
- set = diff.each_line.to_a.map(&:new_lineno).reject { |l| l == -1 }.to_set
8
- say_debug "Does {{yellow:#{set}}} contain {{red:#{line}}}"
9
- set.include?(line)
10
- end
11
-
12
- private
13
-
14
- # def set
15
- # return NoFile.new(path) if @set.empty?
16
- # return @set
17
- # end
18
-
19
- # def refresh!
20
- # @changes = diff.each_line.to_a.map{ |l| l.new_lineno }.to_set
21
- #
22
- # if @changes.empty?
23
- # @changes = NoFile.new(path)
24
- # end
25
- # rescue Rugged::TreeError
26
- # @changed = NoFile.new(path)
27
- # end
28
-
29
- # def changes
30
- # @changes or raise(Rfix::Error, "No changes found: #{self}")
31
- # end
32
-
33
- # def needs_update?
34
- # current_changed_at = changed_at
35
- # if @changed_at != current_changed_at
36
- # @changed_at = current_changed_at
37
- # return true
38
- # end
39
- #
40
- # return false
41
- # end
42
-
43
- # def changed_at
44
- # File.new(absolute_path).ctime
45
- # end
46
-
47
- def upstream
48
- @upstream ||= ref.resolve(with: repo)
49
- end
50
-
51
- def head
52
- @head ||= repo.rev_parse("HEAD")
53
- end
54
-
55
- def diff
56
- upstream.diff_workdir({
57
- include_untracked_content: true,
58
- recurse_untracked_dirs: true,
59
- include_untracked: true,
60
- ignore_submodules: true,
61
- include_ignored: false,
62
- context_lines: 0,
63
- paths: [path]
64
- }).tap do |diff|
65
- diff.find_similar!(
66
- renames_from_rewrites: true,
67
- renames: true,
68
- copies: true
69
- )
70
- end
71
- end
72
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rfix/git_file"
4
-
5
- class Rfix::TrackedFile < Rfix::GitFile
6
- def refresh!
7
- @ranges = git("--no-pager", "diff", *params, "#{ref}..HEAD", path)
8
- .grep(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/) do
9
- Regexp.last_match(1).to_i...(Regexp.last_match(1).to_i + (Regexp.last_match(2) || 1).to_i)
10
- end
11
- end
12
-
13
- def include?(line)
14
- @ranges.any? { |range| range.include?(line) }
15
- end
16
- end
@@ -1,13 +0,0 @@
1
- class Rfix::Untracked < Rfix::File
2
- def include?(_)
3
- return true
4
- end
5
-
6
- def refresh!
7
- # NOP
8
- end
9
-
10
- def inspect
11
- "<Untracked({{info:#{path}}})>"
12
- end
13
- end
data/resources/ps.png DELETED
Binary file