rfix 1.2.6 → 1.3.0.pre.199
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/Makefile +12 -4
- data/exe/rfix +20 -1
- data/lib/rfix/loader/bundler.rb +37 -0
- data/lib/rfix/loader/env.rb +33 -0
- data/lib/rfix/loader/spec.rb +41 -0
- data/lib/rfix/version.rb +1 -1
- data/rfix.gemspec +1 -1
- metadata +18 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4329b03ddb1e83fbb9a00904e2f12ddd747bef384cea815b3fff933adffdc1c0
|
4
|
+
data.tar.gz: c9dbf63cbaaadefe458c560cf88535d2aef4d57e2dd7c0ff6554dcf560da51be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc086f736a7bf0341b9bd2c05dc936b2f5a08a3443f235e914a52b05b4ea27ce385802fcba6275c9baae9d0f078493dc280d08a084acee177c4c26c4f5f0de9f
|
7
|
+
data.tar.gz: 9f157905bad41d869dbb3759533b1b7774b06dee8e3033e8f96259a83b8d376ddc23a9013f7014f56b1266ae035f94c9318a65d63099829aba18dde5162891c9
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rfix (1.
|
4
|
+
rfix (1.3.0)
|
5
5
|
cri (~> 2.15.10)
|
6
6
|
listen (~> 3.0)
|
7
7
|
rainbow (~> 3.0)
|
8
8
|
require_all (~> 3.0.0)
|
9
9
|
rouge (~> 3.20)
|
10
|
-
rubocop (
|
10
|
+
rubocop (>= 0.80, < 0.90)
|
11
11
|
rugged (~> 1.0.0)
|
12
12
|
|
13
13
|
GEM
|
@@ -121,7 +121,7 @@ GEM
|
|
121
121
|
regexp_parser (1.7.1)
|
122
122
|
require_all (3.0.0)
|
123
123
|
rexml (3.2.4)
|
124
|
-
rouge (3.
|
124
|
+
rouge (3.24.0)
|
125
125
|
rspec (3.9.0)
|
126
126
|
rspec-core (~> 3.9.0)
|
127
127
|
rspec-expectations (~> 3.9.0)
|
data/Makefile
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
rake
|
1
|
+
bundle:
|
2
|
+
cd tmp && bundle install
|
3
|
+
install: bundle
|
4
|
+
bundle exec rake install:local
|
5
|
+
# brew install cmake pkg-config libgit2 safe-rm
|
6
|
+
# gem install colorize rake
|
7
|
+
# rake build
|
8
|
+
|
9
|
+
test: install
|
10
|
+
cd tmp && rfix info || true
|
11
|
+
# cd tmp && bundle exec rfix --help || true
|
12
|
+
# cd tmp && bundle exec ./exe/rfix --debug --help || true
|
data/exe/rfix
CHANGED
@@ -1,4 +1,23 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
1
|
+
# #!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler"
|
4
|
+
|
5
|
+
require_relative "../lib/rfix/loader/spec.rb"
|
6
|
+
require_relative "../lib/rfix/loader/bundler.rb"
|
7
|
+
require_relative "../lib/rfix/loader/env.rb"
|
8
|
+
|
9
|
+
if spec = Bundler.find_locked("rubocop")
|
10
|
+
Gem::Specification.deactivate(spec.name)
|
11
|
+
unless spec.__materialize__&.activation
|
12
|
+
abort "Could not load rubocop spec file"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
if spec = Gem.loaded_specs.fetch("rubocop")
|
17
|
+
unless Env.requirement === spec.version
|
18
|
+
abort "RuboCop version #{Env.pretty_req} required by rfix but #{spec.version} was found in Gemfile"
|
19
|
+
end
|
20
|
+
end
|
2
21
|
|
3
22
|
require "cri"
|
4
23
|
require "rfix"
|
@@ -0,0 +1,37 @@
|
|
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
|
@@ -0,0 +1,33 @@
|
|
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
|
@@ -0,0 +1,41 @@
|
|
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/version.rb
CHANGED
data/rfix.gemspec
CHANGED
@@ -56,7 +56,7 @@ Gem::Specification.new do |spec|
|
|
56
56
|
spec.add_runtime_dependency "rainbow", "~> 3.0"
|
57
57
|
spec.add_runtime_dependency "require_all", "~> 3.0.0"
|
58
58
|
spec.add_runtime_dependency "rouge", "~> 3.20"
|
59
|
-
spec.add_runtime_dependency "rubocop", "
|
59
|
+
spec.add_runtime_dependency "rubocop", ">= 0.80", "< 0.90"
|
60
60
|
spec.add_runtime_dependency "rugged", "~> 1.0.0"
|
61
61
|
|
62
62
|
spec.add_development_dependency "rspec", "~> 3.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0.pre.199
|
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-
|
11
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -84,16 +84,22 @@ dependencies:
|
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.80'
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0.90'
|
90
93
|
type: :runtime
|
91
94
|
prerelease: false
|
92
95
|
version_requirements: !ruby/object:Gem::Requirement
|
93
96
|
requirements:
|
94
|
-
- - "
|
97
|
+
- - ">="
|
95
98
|
- !ruby/object:Gem::Version
|
96
99
|
version: '0.80'
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.90'
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: rugged
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -275,6 +281,9 @@ files:
|
|
275
281
|
- lib/rfix/file_cache.rb
|
276
282
|
- lib/rfix/formatter.rb
|
277
283
|
- lib/rfix/git_helper.rb
|
284
|
+
- lib/rfix/loader/bundler.rb
|
285
|
+
- lib/rfix/loader/env.rb
|
286
|
+
- lib/rfix/loader/spec.rb
|
278
287
|
- lib/rfix/log.rb
|
279
288
|
- lib/rfix/no_file.rb
|
280
289
|
- lib/rfix/rake/paths.rb
|
@@ -325,7 +334,7 @@ licenses:
|
|
325
334
|
- MIT
|
326
335
|
metadata:
|
327
336
|
homepage_uri: https://github.com/oleander/rfix-rb
|
328
|
-
post_install_message:
|
337
|
+
post_install_message:
|
329
338
|
rdoc_options: []
|
330
339
|
require_paths:
|
331
340
|
- lib
|
@@ -337,13 +346,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
337
346
|
version: 2.5.0
|
338
347
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
339
348
|
requirements:
|
340
|
-
- - "
|
349
|
+
- - ">"
|
341
350
|
- !ruby/object:Gem::Version
|
342
|
-
version:
|
351
|
+
version: 1.3.1
|
343
352
|
requirements:
|
344
353
|
- git, v2.0+
|
345
354
|
rubygems_version: 3.0.3
|
346
|
-
signing_key:
|
355
|
+
signing_key:
|
347
356
|
specification_version: 4
|
348
357
|
summary: RuboCop CLI that only lints and auto-fixes code you committed by utilizing
|
349
358
|
`git-log` and `git-diff`
|