rfix 1.4.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,173 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rfix (1.0.20)
5
- cri (~> 2.15.10)
6
- listen (~> 3.0)
7
- rainbow (~> 3.0)
8
- rouge (~> 3.20)
9
- rubocop (>= 0.80)
10
- rugged (~> 1.0.0)
11
-
12
- GEM
13
- remote: https://rubygems.org/
14
- specs:
15
- activesupport (6.0.3.2)
16
- concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (>= 0.7, < 2)
18
- minitest (~> 5.1)
19
- tzinfo (~> 1.1)
20
- zeitwerk (~> 2.2, >= 2.2.2)
21
- aruba (1.0.2)
22
- childprocess (>= 2.0, < 5.0)
23
- contracts (~> 0.16.0)
24
- cucumber (>= 2.4, < 5.0)
25
- ffi (~> 1.9)
26
- rspec-expectations (~> 3.4)
27
- thor (~> 1.0)
28
- ast (2.4.1)
29
- builder (3.2.4)
30
- childprocess (4.0.0)
31
- coderay (1.1.3)
32
- colorize (0.8.1)
33
- concurrent-ruby (1.1.6)
34
- contracts (0.16.0)
35
- cri (2.15.10)
36
- cucumber (4.0.0)
37
- builder (~> 3.2, >= 3.2.3)
38
- cucumber-core (~> 7.0, >= 7.0.0)
39
- cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
40
- cucumber-gherkin (~> 13.0, >= 13.0.0)
41
- cucumber-html-formatter (~> 6.0, >= 6.0.1)
42
- cucumber-messages (~> 12.1, >= 12.1.1)
43
- cucumber-wire (~> 3.0, >= 3.0.0)
44
- diff-lcs (~> 1.3, >= 1.3)
45
- multi_test (~> 0.1, >= 0.1.2)
46
- sys-uname (~> 1.0, >= 1.0.2)
47
- cucumber-core (7.0.0)
48
- cucumber-gherkin (~> 13.0, >= 13.0.0)
49
- cucumber-messages (~> 12.1, >= 12.1.1)
50
- cucumber-tag-expressions (~> 2.0, >= 2.0.4)
51
- cucumber-cucumber-expressions (10.2.0)
52
- cucumber-gherkin (13.0.0)
53
- cucumber-messages (~> 12.0, >= 12.0.0)
54
- cucumber-html-formatter (6.0.3)
55
- cucumber-messages (~> 12.1, >= 12.1.1)
56
- cucumber-messages (12.1.1)
57
- protobuf-cucumber (~> 3.10, >= 3.10.8)
58
- cucumber-tag-expressions (2.0.4)
59
- cucumber-wire (3.0.0)
60
- cucumber-core (~> 7.0, >= 7.0.0)
61
- cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
62
- cucumber-messages (~> 12.1, >= 12.1.1)
63
- diff-lcs (1.3)
64
- faker (2.13.0)
65
- i18n (>= 1.6, < 2)
66
- ffi (1.13.1)
67
- formatador (0.2.5)
68
- gem-release (2.1.1)
69
- git (1.7.0)
70
- rchardet (~> 1.8)
71
- guard (2.16.2)
72
- formatador (>= 0.2.4)
73
- listen (>= 2.7, < 4.0)
74
- lumberjack (>= 1.0.12, < 2.0)
75
- nenv (~> 0.1)
76
- notiffany (~> 0.0)
77
- pry (>= 0.9.12)
78
- shellany (~> 0.0)
79
- thor (>= 0.18.1)
80
- guard-compat (1.2.1)
81
- guard-rspec (4.7.3)
82
- guard (~> 2.1)
83
- guard-compat (~> 1.1)
84
- rspec (>= 2.99.0, < 4.0)
85
- i18n (1.8.3)
86
- concurrent-ruby (~> 1.0)
87
- listen (3.2.1)
88
- rb-fsevent (~> 0.10, >= 0.10.3)
89
- rb-inotify (~> 0.9, >= 0.9.10)
90
- lumberjack (1.2.6)
91
- method_source (1.0.0)
92
- middleware (0.1.0)
93
- minitest (5.14.1)
94
- multi_test (0.1.2)
95
- nenv (0.3.0)
96
- notiffany (0.1.3)
97
- nenv (~> 0.1)
98
- shellany (~> 0.0)
99
- parallel (1.19.2)
100
- parser (2.7.1.4)
101
- ast (~> 2.4.1)
102
- protobuf-cucumber (3.10.8)
103
- activesupport (>= 3.2)
104
- middleware
105
- thor
106
- thread_safe
107
- pry (0.13.1)
108
- coderay (~> 1.1)
109
- method_source (~> 1.0)
110
- rainbow (3.0.0)
111
- rake (12.3.3)
112
- rb-fsevent (0.10.4)
113
- rb-inotify (0.10.1)
114
- ffi (~> 1.0)
115
- rchardet (1.8.0)
116
- regexp_parser (1.7.1)
117
- rexml (3.2.4)
118
- rouge (3.20.0)
119
- rspec (3.9.0)
120
- rspec-core (~> 3.9.0)
121
- rspec-expectations (~> 3.9.0)
122
- rspec-mocks (~> 3.9.0)
123
- rspec-core (3.9.2)
124
- rspec-support (~> 3.9.3)
125
- rspec-expectations (3.9.2)
126
- diff-lcs (>= 1.2.0, < 2.0)
127
- rspec-support (~> 3.9.0)
128
- rspec-mocks (3.9.1)
129
- diff-lcs (>= 1.2.0, < 2.0)
130
- rspec-support (~> 3.9.0)
131
- rspec-support (3.9.3)
132
- rubocop (0.85.0)
133
- parallel (~> 1.10)
134
- parser (>= 2.7.0.1)
135
- rainbow (>= 2.2.2, < 4.0)
136
- regexp_parser (>= 1.7)
137
- rexml
138
- rubocop-ast (>= 0.0.3)
139
- ruby-progressbar (~> 1.7)
140
- unicode-display_width (>= 1.4.0, < 2.0)
141
- rubocop-ast (0.0.3)
142
- parser (>= 2.7.0.1)
143
- ruby-progressbar (1.10.1)
144
- rugged (1.0.1)
145
- shellany (0.0.1)
146
- sys-uname (1.2.1)
147
- ffi (>= 1.0.0)
148
- thor (1.0.1)
149
- thread_safe (0.3.6)
150
- tzinfo (1.2.7)
151
- thread_safe (~> 0.1)
152
- unicode-display_width (1.7.0)
153
- zeitwerk (2.3.0)
154
-
155
- PLATFORMS
156
- ruby
157
-
158
- DEPENDENCIES
159
- aruba (~> 1.0)
160
- colorize
161
- faker
162
- gem-release
163
- git (~> 1.7.0)
164
- guard
165
- guard-rspec
166
- pry
167
- rake (~> 12.3)
168
- rfix!
169
- rspec (~> 3.0)
170
- rubocop (= 0.85.0)
171
-
172
- BUNDLED WITH
173
- 2.1.4
data/lib/rfix/box.rb DELETED
@@ -1,112 +0,0 @@
1
- class Rfix::Box < Struct.new(:out, :err, :status, :args, :quiet)
2
- include Rfix::Log
3
-
4
- def render(color: :reset, debug: false)
5
- return if Rfix.debug? && !debug
6
-
7
- @render ||= box(title, color: color) do
8
- margin do
9
- prt cmd_lines
10
- end
11
-
12
- div("{{info:STDOUT}}") do
13
- prt lines_or_none(stdout)
14
- end
15
-
16
- div("{{error:STDERR}}") do
17
- prt lines_or_none(stderr)
18
- end
19
- end
20
- end
21
-
22
- def lines_or_none(lines)
23
- if lines.join.chomp.empty?
24
- return "{{italic:<none>}}"
25
- end
26
-
27
- lines.map(&method(:strip)).join("\n")
28
- end
29
-
30
- def title
31
- "#{quiet_icon}#{icon} #{bin} (#{exit_status}) @ {{italic:#{pwd}}}"
32
- end
33
-
34
- def quiet_icon
35
- return "" unless quiet
36
-
37
- "{{warning:[silent]}} "
38
- end
39
-
40
- def stdout
41
- @stdout ||= dumpable(out.lines.map(&:chomp))
42
- end
43
-
44
- def stderr
45
- @stderr ||= dumpable(err.lines.map(&:chomp))
46
- end
47
-
48
- def dumpable(lines)
49
- box = self
50
- lines.tap do
51
- lines.define_singleton_method(:dump!) do
52
- tap do
53
- box.render
54
- end
55
- end
56
- end
57
- end
58
-
59
- def icon
60
- success? ? "{{v}}" : "{{x}}"
61
- end
62
-
63
- def success?
64
- status.success?
65
- end
66
-
67
- def bin
68
- clean_args.first
69
- end
70
-
71
- def tail
72
- clean_args[1..-1]
73
- end
74
-
75
- def exit_status
76
- status.exitstatus
77
- end
78
-
79
- def pwd
80
- if Dir.getwd == Dir.pwd
81
- return "{{italic:#{Dir.getwd}}}"
82
- end
83
-
84
- Dir.getwd.sub(Dir.pwd, "")
85
- end
86
-
87
- private
88
-
89
- def longest_arg
90
- @longest_arg ||= clean_args.reduce(0) do |acc, arg|
91
- acc < arg.length ? arg.length : acc
92
- end
93
- end
94
-
95
- def clean_args
96
- @clean_args ||= args.map(&method(:strip))
97
- end
98
-
99
- def rest
100
- tail.each_slice(2).map do |args|
101
- args.map do |arg|
102
- arg.ljust(longest_arg + 5)
103
- end.join(" ")
104
- end.map do |tail|
105
- " {{italic:#{tail}}}"
106
- end.join("\n")
107
- end
108
-
109
- def cmd_lines
110
- "{{command:$ #{bin} \n#{rest}}}"
111
- end
112
- end
@@ -1,15 +0,0 @@
1
- class Rfix::Branch::Base
2
- def resolve(with:)
3
- raise Rfix::NotYetImplementedError, "#resolved"
4
- end
5
-
6
- def to_s
7
- raise Rfix::NotYetImplementedError, "#to_s"
8
- end
9
-
10
- def revparse(using:, ref:)
11
- using.rev_parse(ref)
12
- rescue Rugged::InvalidError
13
- raise Rfix::Branch::UnknownBranchError, "Could not find reference {{error:#{ref}}}"
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- require_relative "base"
2
-
3
- module Rfix
4
- class Branch::Head < Branch::Base
5
- def resolve(with:)
6
- with.lookup(with.head.target_id)
7
- end
8
-
9
- def to_s
10
- "HEAD"
11
- end
12
- end
13
- end
@@ -1,28 +0,0 @@
1
- require "rugged"
2
- require_relative "base"
3
-
4
- module Rfix
5
- class Branch::Main < Branch::Base
6
- KEY = "rfix.main.branch".freeze
7
-
8
- def resolve(with:)
9
- unless name = with.config[KEY]
10
- raise Error, "Please run {{command:rfix setup}} first"
11
- end
12
-
13
- Branch::Name.new(name).resolve(with: with)
14
- end
15
-
16
- def self.set(branch, at: Dir.pwd)
17
- Branch.repo(at: at).config[KEY] = branch
18
- end
19
-
20
- def self.get(at: Dir.pwd)
21
- Branch.repo(at: at).config[KEY]
22
- end
23
-
24
- def to_s
25
- "configured main branch"
26
- end
27
- end
28
- end
@@ -1,23 +0,0 @@
1
- require_relative "base"
2
-
3
- module Rfix
4
- class Branch::Name < Branch::Base
5
- attr_reader :name
6
-
7
- def initialize(name)
8
- @name = name
9
- end
10
-
11
- def resolve(with:)
12
- unless branch = with.branches[name]
13
- raise Branch::UnknownBranchError, "Could not find branch {{error:#{name}}}"
14
- end
15
-
16
- with.lookup(with.merge_base(branch.target_id, with.head.target_id))
17
- rescue Rugged::ReferenceError
18
- raise Branch::UnknownBranchError, "Could not find branch {{error:#{name}}}"
19
- end
20
-
21
- alias to_s name
22
- end
23
- end
@@ -1,21 +0,0 @@
1
- require_relative "base"
2
-
3
- module Rfix
4
- class Branch::Reference < Branch::Base
5
- attr_reader :reference
6
-
7
- def initialize(reference)
8
- @reference = reference
9
- end
10
-
11
- def resolve(with:)
12
- Branch::Name.new(reference).resolve(with: with)
13
- rescue Branch::UnknownBranchError
14
- revparse(using: with, ref: reference)
15
- rescue Rugged::InvalidError
16
- raise Branch::UnknownBranchError, "Branch with reference {{error:#{reference}}} not found"
17
- end
18
-
19
- alias to_s reference
20
- end
21
- end
@@ -1,13 +0,0 @@
1
- require_relative "base"
2
-
3
- module Rfix
4
- class Branch::Upstream < Branch::Base
5
- def resolve(with:)
6
- with.rev_parse("@{upstream}")
7
- end
8
-
9
- def to_s
10
- "upstream"
11
- end
12
- end
13
- end
data/lib/rfix/cmd.rb DELETED
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "open3"
4
- require "rfix"
5
- require "rfix/log"
6
-
7
- module Rfix::Cmd
8
- include Rfix::Log
9
-
10
- def cmd(*args, quiet: false)
11
- out, err, status = Open3.capture3(*args)
12
- box = Rfix::Box.new(out, err, status, args, quiet)
13
- return box.stdout if box.success?
14
- return yield if block_given?
15
- return if quiet
16
-
17
- box.render(color: :red)
18
- exit box.exit_status
19
- ensure
20
- # box.render(debug: false)
21
- end
22
-
23
- def cmd_succeeded?(*cmd)
24
- Open3.capture2e(*cmd).last.success?
25
- end
26
-
27
- def params
28
- [
29
- "--word-diff-regex=[^[:space:]]",
30
- "--no-renames",
31
- "--no-merges",
32
- "--first-parent",
33
- "--diff-filter=AM",
34
- "-U0",
35
- "--no-color",
36
- "-p"
37
- ]
38
- end
39
- end