rfix 1.0.15 → 1.1.0.pre.147

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/.rspec +0 -1
  4. data/.rubocop.yml +46 -31
  5. data/.travis.yml +5 -12
  6. data/Gemfile.base +10 -3
  7. data/Gemfile.base.lock +172 -0
  8. data/Gemfile.lock +28 -7
  9. data/Guardfile +1 -1
  10. data/Makefile +4 -13
  11. data/Rakefile +16 -95
  12. data/ci/Gemfile.rubocop-0.80.lock +16 -1
  13. data/ci/Gemfile.rubocop-0.81.lock +16 -1
  14. data/ci/Gemfile.rubocop-0.82.lock +16 -1
  15. data/ci/Gemfile.rubocop-0.83.lock +19 -4
  16. data/ci/Gemfile.rubocop-0.84.lock +19 -4
  17. data/ci/Gemfile.rubocop-0.85.1.lock +19 -4
  18. data/ci/Gemfile.rubocop-0.85.lock +16 -1
  19. data/exe/rfix +18 -144
  20. data/lib/rfix.rb +10 -3
  21. data/lib/rfix/box.rb +112 -0
  22. data/lib/rfix/branch.rb +30 -0
  23. data/lib/rfix/branches/base.rb +29 -0
  24. data/lib/rfix/branches/head.rb +11 -0
  25. data/lib/rfix/branches/main.rb +33 -0
  26. data/lib/rfix/branches/name.rb +21 -0
  27. data/lib/rfix/branches/reference.rb +19 -0
  28. data/lib/rfix/branches/upstream.rb +11 -0
  29. data/lib/rfix/cmd.rb +9 -14
  30. data/lib/rfix/commands/all.rb +26 -0
  31. data/lib/rfix/commands/branch.rb +15 -0
  32. data/lib/rfix/commands/extensions/options.rb +8 -0
  33. data/lib/rfix/commands/help.rb +7 -0
  34. data/lib/rfix/commands/helper/args.rb +137 -0
  35. data/lib/rfix/commands/helper/help.rb +6 -0
  36. data/lib/rfix/commands/helper/loader.rb +6 -0
  37. data/lib/rfix/commands/helper/option.rb +0 -0
  38. data/lib/rfix/commands/helper/params.rb +0 -0
  39. data/lib/rfix/commands/helper/rubocop.rb +17 -0
  40. data/lib/rfix/commands/info.rb +30 -0
  41. data/lib/rfix/commands/lint.rb +23 -0
  42. data/lib/rfix/commands/local.rb +12 -0
  43. data/lib/rfix/commands/origin.rb +19 -0
  44. data/lib/rfix/commands/setup.rb +29 -0
  45. data/lib/rfix/commands/welcome.rb +24 -0
  46. data/lib/rfix/deleted.rb +13 -0
  47. data/lib/rfix/error.rb +2 -0
  48. data/lib/rfix/extensions/extensions.rb +4 -26
  49. data/lib/rfix/extensions/offense.rb +2 -1
  50. data/lib/rfix/extensions/string.rb +8 -0
  51. data/lib/rfix/file.rb +46 -0
  52. data/lib/rfix/file_cache.rb +59 -0
  53. data/lib/rfix/formatter.rb +37 -10
  54. data/lib/rfix/git_helper.rb +13 -1
  55. data/lib/rfix/log.rb +104 -7
  56. data/lib/rfix/no_file.rb +13 -0
  57. data/lib/rfix/rake/paths.rb +50 -0
  58. data/lib/rfix/rake/support.rb +75 -0
  59. data/lib/rfix/repository.rb +201 -0
  60. data/lib/rfix/rfix.rb +7 -198
  61. data/lib/rfix/tracked.rb +76 -0
  62. data/lib/rfix/tracked_file.rb +1 -1
  63. data/lib/rfix/untracked.rb +13 -0
  64. data/lib/rfix/version.rb +1 -1
  65. data/path.rb +7 -0
  66. data/rfix.gemspec +6 -2
  67. data/rugged.rb +206 -0
  68. data/tasks/bump.rake +11 -0
  69. data/tasks/bundle.rake +17 -0
  70. data/tasks/complex.rake +54 -0
  71. data/tasks/simple.rake +58 -0
  72. data/tasks/travis.rake +74 -0
  73. data/tasks/vendor.rake +34 -0
  74. metadata +136 -13
  75. data/file.rb +0 -1
  76. data/lib/rfix/gem_helper.rb +0 -12
  77. data/lib/rfix/git_file.rb +0 -36
  78. data/lib/rfix/rake_helper.rb +0 -56
  79. data/lib/rfix/untracked_file.rb +0 -13
@@ -0,0 +1,74 @@
1
+ RSpec::Core::RakeTask.new(:rspec)
2
+
3
+ namespace :travis do
4
+ desc "Set up dependencies"
5
+ task setup: [Vendor::BUILD, Bundle::BUILD, Travis::GIT]
6
+
7
+ desc "Install gem"
8
+ task Travis::INSTALL => Travis::SETUP do
9
+ Rake::Task[:install].invoke
10
+ end
11
+
12
+ desc "Run test suite"
13
+ task spec: Travis::SETUP do
14
+ Rake::Task[:rspec].invoke
15
+ end
16
+
17
+ desc "Verify bin on CI"
18
+ task verify: [Travis::INSTALL, Travis::TASKS]
19
+
20
+ namespace :git do
21
+ task :config do
22
+ sh "git config --global user.email 'not-my@real-email.com'"
23
+ sh "git config --global user.name 'John Doe'"
24
+ end
25
+ end
26
+
27
+ namespace :tasks do
28
+ desc "Run this"
29
+ task all: [:welcome, :info]
30
+
31
+ task :rfix do
32
+ clone_and_run do
33
+ sh "rfix"
34
+ end
35
+ end
36
+
37
+ task :info do
38
+ clone_and_run do
39
+ sh "rfix info"
40
+ end
41
+ end
42
+
43
+ task :help do
44
+ clone_and_run do
45
+ sh "rfix --help"
46
+ end
47
+ end
48
+
49
+ task :welcome do
50
+ clone_and_run do
51
+ sh "rfix welcome"
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ task :codeGen do
58
+ sleep rand
59
+ end
60
+
61
+ task compile: :codeGen do
62
+ say "in compile"
63
+ sleep rand
64
+ end
65
+
66
+ task dataLoad: :codeGen do
67
+ say "in data"
68
+ # sleep rand
69
+ end
70
+
71
+ task gtest: [:compile, :dataLoad] do
72
+ say "in test"
73
+ sleep rand
74
+ end
@@ -0,0 +1,34 @@
1
+ namespace :vendor do
2
+ namespace :shopify do
3
+ directory Vendor::DIR
4
+
5
+ desc "Downloads shopify repository"
6
+ task build: [Vendor::REPO, Vendor::TEST]
7
+
8
+ desc "Re-download shopify repository"
9
+ task rebuild: [:flush, Vendor::BUILD]
10
+
11
+ desc "Remove shopify repository"
12
+ task :flush do
13
+ rm_rf Vendor::REPO
14
+ end
15
+
16
+ desc "Test validity of repo"
17
+ task test: Vendor::REPO do
18
+ cd Vendor::REPO do
19
+ sh "git rev-list --count HEAD"
20
+ sh "git status"
21
+ end
22
+
23
+ say "Finished testing vendor"
24
+ end
25
+
26
+ file Vendor::REPO => Vendor::DIR do
27
+ sh "git clone", Vendor::GITHUB, Vendor::REPO
28
+
29
+ cd Vendor::REPO do
30
+ sh "git reset --hard", Vendor::START
31
+ end
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.1.0.pre.147
5
5
  platform: ruby
6
6
  authors:
7
7
  - Linus Oleander
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-21 00:00:00.000000000 Z
11
+ date: 2020-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.15.10
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.15.10
27
+ - !ruby/object:Gem::Dependency
28
+ name: listen
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: rainbow
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +80,20 @@ dependencies:
52
80
  - - ">="
53
81
  - !ruby/object:Gem::Version
54
82
  version: '0.80'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rugged
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.0.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.0.0
55
97
  - !ruby/object:Gem::Dependency
56
98
  name: rspec
57
99
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +122,34 @@ dependencies:
80
122
  - - "~>"
81
123
  - !ruby/object:Gem::Version
82
124
  version: '1.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: colorize
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.8.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.8.1
139
+ - !ruby/object:Gem::Dependency
140
+ name: git
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 1.7.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 1.7.0
83
153
  - !ruby/object:Gem::Dependency
84
154
  name: rake
85
155
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +164,20 @@ dependencies:
94
164
  - - "~>"
95
165
  - !ruby/object:Gem::Version
96
166
  version: '12.3'
167
+ - !ruby/object:Gem::Dependency
168
+ name: pry
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.13.1
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.13.1
97
181
  description: |
98
182
  RuboCop CLI that only lints and auto-fixes code you committed by utilizing `git-log` and `git-diff`. Rfix CLI makes it possible to lint (`rfix lint`) and auto-fix (`rfix local|origin|branch`) code changes since a certain point in history. You can auto-fix code committed since creating the current branch (`rfix origin`) or since pushing to upstream (`rfix local`).
99
183
 
@@ -113,6 +197,7 @@ files:
113
197
  - ".travis.yml"
114
198
  - Gemfile
115
199
  - Gemfile.base
200
+ - Gemfile.base.lock
116
201
  - Gemfile.lock
117
202
  - Guardfile
118
203
  - LICENSE.txt
@@ -141,23 +226,61 @@ files:
141
226
  - ci/Gemfile.rubocop-0.85.1.lock
142
227
  - ci/Gemfile.rubocop-0.85.lock
143
228
  - exe/rfix
144
- - file.rb
145
229
  - lib/rfix.rb
230
+ - lib/rfix/box.rb
231
+ - lib/rfix/branch.rb
232
+ - lib/rfix/branches/base.rb
233
+ - lib/rfix/branches/head.rb
234
+ - lib/rfix/branches/main.rb
235
+ - lib/rfix/branches/name.rb
236
+ - lib/rfix/branches/reference.rb
237
+ - lib/rfix/branches/upstream.rb
146
238
  - lib/rfix/cmd.rb
239
+ - lib/rfix/commands/all.rb
240
+ - lib/rfix/commands/branch.rb
241
+ - lib/rfix/commands/extensions/options.rb
242
+ - lib/rfix/commands/help.rb
243
+ - lib/rfix/commands/helper/args.rb
244
+ - lib/rfix/commands/helper/help.rb
245
+ - lib/rfix/commands/helper/loader.rb
246
+ - lib/rfix/commands/helper/option.rb
247
+ - lib/rfix/commands/helper/params.rb
248
+ - lib/rfix/commands/helper/rubocop.rb
249
+ - lib/rfix/commands/info.rb
250
+ - lib/rfix/commands/lint.rb
251
+ - lib/rfix/commands/local.rb
252
+ - lib/rfix/commands/origin.rb
253
+ - lib/rfix/commands/setup.rb
254
+ - lib/rfix/commands/welcome.rb
255
+ - lib/rfix/deleted.rb
256
+ - lib/rfix/error.rb
147
257
  - lib/rfix/extensions/extensions.rb
148
258
  - lib/rfix/extensions/offense.rb
259
+ - lib/rfix/extensions/string.rb
260
+ - lib/rfix/file.rb
261
+ - lib/rfix/file_cache.rb
149
262
  - lib/rfix/formatter.rb
150
- - lib/rfix/gem_helper.rb
151
- - lib/rfix/git_file.rb
152
263
  - lib/rfix/git_helper.rb
153
264
  - lib/rfix/log.rb
154
- - lib/rfix/rake_helper.rb
265
+ - lib/rfix/no_file.rb
266
+ - lib/rfix/rake/paths.rb
267
+ - lib/rfix/rake/support.rb
268
+ - lib/rfix/repository.rb
155
269
  - lib/rfix/rfix.rb
270
+ - lib/rfix/tracked.rb
156
271
  - lib/rfix/tracked_file.rb
157
- - lib/rfix/untracked_file.rb
272
+ - lib/rfix/untracked.rb
158
273
  - lib/rfix/version.rb
274
+ - path.rb
159
275
  - resources/ps.png
160
276
  - rfix.gemspec
277
+ - rugged.rb
278
+ - tasks/bump.rake
279
+ - tasks/bundle.rake
280
+ - tasks/complex.rake
281
+ - tasks/simple.rake
282
+ - tasks/travis.rake
283
+ - tasks/vendor.rake
161
284
  - vendor/shopify/cli-ui/lib/cli/ui.rb
162
285
  - vendor/shopify/cli-ui/lib/cli/ui/ansi.rb
163
286
  - vendor/shopify/cli-ui/lib/cli/ui/color.rb
@@ -188,7 +311,7 @@ licenses:
188
311
  - MIT
189
312
  metadata:
190
313
  homepage_uri: https://github.com/oleander/rfix-rb
191
- post_install_message:
314
+ post_install_message:
192
315
  rdoc_options: []
193
316
  require_paths:
194
317
  - lib
@@ -200,13 +323,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
323
  version: 2.5.0
201
324
  required_rubygems_version: !ruby/object:Gem::Requirement
202
325
  requirements:
203
- - - ">="
326
+ - - ">"
204
327
  - !ruby/object:Gem::Version
205
- version: '0'
328
+ version: 1.3.1
206
329
  requirements:
207
330
  - git, v2.0+
208
- rubygems_version: 3.1.4
209
- signing_key:
331
+ rubygems_version: 3.0.3
332
+ signing_key:
210
333
  specification_version: 4
211
334
  summary: RuboCop CLI that only lints and auto-fixes code you committed by utilizing
212
335
  `git-log` and `git-diff`
data/file.rb DELETED
@@ -1 +0,0 @@
1
- "hello"
@@ -1,12 +0,0 @@
1
- require "bundler"
2
-
3
- module GemHelper
4
- def source_for(name:, &block)
5
- bundle_root = Bundler.bundle_path.join('bundler/gems')
6
- path = Dir.glob(bundle_root.join("#{name}-*").to_s).first
7
- path or raise "Could not find source for #{name}, run bundle install first"
8
- block(path)
9
- rescue StandardError => e
10
- puts "[Bundler] #{e}"
11
- end
12
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pathname"
4
- require "rfix/git_helper"
5
-
6
- class Rfix::GitFile
7
- include Rfix::GitHelper
8
- attr_reader :path, :ref
9
-
10
- def initialize(path, ref, root_dir)
11
- @path = File.join(root_dir, path)
12
- @root_dir = Pathname.new(root_dir)
13
- @ref = ref
14
- @ranges = []
15
- end
16
-
17
- def file?
18
- File.file?(path)
19
- end
20
-
21
- def ==(other)
22
- path == other.path
23
- end
24
-
25
- def eql?(other)
26
- path == other.path
27
- end
28
-
29
- def hash
30
- path.hash
31
- end
32
-
33
- def relative_path
34
- Pathname.new(path).relative_path_from(@root_dir).to_s
35
- end
36
- end
@@ -1,56 +0,0 @@
1
- require "tmpdir"
2
-
3
- module RakeHelper
4
- include Rfix::Log
5
- include Rfix::Cmd
6
- include Rfix::GitHelper
7
-
8
- def dirty?
9
- !cmd_succeeded?("git diff --quiet")
10
- end
11
-
12
- def clone(github:, ref:)
13
- Dir.mktmpdir(github.split("/")) do |src|
14
- say "Clone {{info:#{github}}}, hold on ..."
15
- git("clone", "https://github.com/#{github}", src)
16
- Dir.chdir(src) do
17
- say "Check out {{info:#{ref}}}"
18
- git("reset", "--hard", ref)
19
- git("clean", "-f", "-d")
20
- end
21
-
22
- dest = File.join("vendor", github)
23
- say "Copy files to {{info:#{dest}}}"
24
- FileUtils.mkdir_p(dest)
25
- FileUtils.copy_entry(src, dest, true, true, true)
26
- end
27
- end
28
-
29
- def gemfiles
30
- Dir.glob("ci/Gemfile*").unshift("Gemfile").reject do |path|
31
- [".lock", ".base"].include?(File.extname(path))
32
- end
33
- end
34
-
35
- def gemlocks
36
- Dir.glob("ci/Gemfile*.lock").unshift("Gemfile.lock")
37
- end
38
-
39
- def source_for(name:)
40
- bundle_root = Bundler.bundle_path.join('bundler/gems')
41
- path = Dir.glob(bundle_root.join("#{name}-*").to_s).first
42
- path or raise "Could not find source for #{name}, run bundle install first"
43
- end
44
-
45
- def dest_for(name:)
46
- File.join(__dir__, 'vendor', name)
47
- end
48
-
49
- def osx?
50
- ENV.fetch("TRAVIS_OS_NAME") == "osx"
51
- end
52
-
53
- def brew_url(ref:)
54
- "https://raw.githubusercontent.com/Homebrew/homebrew-core/#{ref}/Formula/git.rb"
55
- end
56
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rfix/git_file"
4
-
5
- class Rfix::UntrackedFile < Rfix::GitFile
6
- def refresh!
7
- # nothing
8
- end
9
-
10
- def include?(_line)
11
- true
12
- end
13
- end