rfix 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -15
- data/Gemfile.lock +2 -2
- data/lib/rfix/branches/base.rb +3 -3
- data/lib/rfix/branches/main.rb +2 -2
- data/lib/rfix/branches/name.rb +2 -2
- data/lib/rfix/branches/reference.rb +1 -1
- data/lib/rfix/commands/helper/args.rb +1 -1
- data/lib/rfix/commands/lint.rb +0 -1
- data/lib/rfix/file.rb +3 -3
- data/lib/rfix/log.rb +2 -1
- data/lib/rfix/repository.rb +4 -6
- data/lib/rfix/tracked.rb +3 -3
- data/lib/rfix/version.rb +1 -1
- data/rfix.gemspec +3 -3
- data/tasks/execute.rake +3 -3
- data/tasks/simple.rake +1 -1
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4963fcdeb152d9e132794d42982797eadf9848ecfcfed8e94f51885003b0ddbb
|
4
|
+
data.tar.gz: 8cb32d9c8e17a881eec724678f0e69bc138ca360f24ea6318c733429e09e45f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 064c76697d6e5cad1b1e35c52f4ee9b7f52df2697fdf8680f18289130aa8b6f634ed3cf2bcba41cc8d0a27fd95e61e79d2c3a5638620baf61440935471ed784f
|
7
|
+
data.tar.gz: 4936c5ca44319492caf7a8556ff5913ca527541b5d7a3453d04db77785bfcb535929153a7a7e11881283dc7e1910c7f4164d4293eae9c4b405de12fc032ccc88
|
data/.github/workflows/main.yml
CHANGED
@@ -5,7 +5,7 @@ env:
|
|
5
5
|
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
6
6
|
GITHUB_API_TOKEN: ${{secrets.API_KEY}}
|
7
7
|
jobs:
|
8
|
-
|
8
|
+
build:
|
9
9
|
container: ruby:2.7
|
10
10
|
runs-on: ubuntu-latest
|
11
11
|
steps:
|
@@ -22,17 +22,3 @@ jobs:
|
|
22
22
|
|
23
23
|
- run: bundle install --path vendor/bundle
|
24
24
|
- run: rake execute:local execute:origin execute:lint execute:branch
|
25
|
-
|
26
|
-
- run: git config user.email "linus@oleander.io"
|
27
|
-
- run: git config user.name "Linus Oleander"
|
28
|
-
|
29
|
-
- name: Publish to RubyGems
|
30
|
-
run: |
|
31
|
-
mkdir -p $HOME/.gem
|
32
|
-
touch $HOME/.gem/credentials
|
33
|
-
chmod 0600 $HOME/.gem/credentials
|
34
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
35
|
-
gem build *.gemspec
|
36
|
-
gem push *.gem
|
37
|
-
env:
|
38
|
-
GEM_HOST_API_KEY: "Bearer ${{secrets.RUBYGEMS_API_KEY}}"
|
data/Gemfile.lock
CHANGED
data/lib/rfix/branches/base.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
class Rfix::Branch::Base
|
2
2
|
def resolve(with:)
|
3
|
-
raise Rfix::NotYetImplementedError
|
3
|
+
raise Rfix::NotYetImplementedError, "#resolved"
|
4
4
|
end
|
5
5
|
|
6
6
|
def to_s
|
7
|
-
raise Rfix::NotYetImplementedError
|
7
|
+
raise Rfix::NotYetImplementedError, "#to_s"
|
8
8
|
end
|
9
9
|
|
10
10
|
def revparse(using:, ref:)
|
11
11
|
using.rev_parse(ref)
|
12
12
|
rescue Rugged::InvalidError
|
13
|
-
raise Rfix::Branch::UnknownBranchError
|
13
|
+
raise Rfix::Branch::UnknownBranchError, "Could not find reference {{error:#{ref}}}"
|
14
14
|
end
|
15
15
|
end
|
data/lib/rfix/branches/main.rb
CHANGED
@@ -3,11 +3,11 @@ require_relative "base"
|
|
3
3
|
|
4
4
|
module Rfix
|
5
5
|
class Branch::Main < Branch::Base
|
6
|
-
KEY = "rfix.main.branch"
|
6
|
+
KEY = "rfix.main.branch".freeze
|
7
7
|
|
8
8
|
def resolve(with:)
|
9
9
|
unless name = with.config[KEY]
|
10
|
-
raise Error
|
10
|
+
raise Error, "Please run {{command:rfix setup}} first"
|
11
11
|
end
|
12
12
|
|
13
13
|
Branch::Name.new(name).resolve(with: with)
|
data/lib/rfix/branches/name.rb
CHANGED
@@ -10,12 +10,12 @@ module Rfix
|
|
10
10
|
|
11
11
|
def resolve(with:)
|
12
12
|
unless branch = with.branches[name]
|
13
|
-
raise Branch::UnknownBranchError
|
13
|
+
raise Branch::UnknownBranchError, "Could not find branch {{error:#{name}}}"
|
14
14
|
end
|
15
15
|
|
16
16
|
with.lookup(with.merge_base(branch.target_id, with.head.target_id))
|
17
17
|
rescue Rugged::ReferenceError
|
18
|
-
raise Branch::UnknownBranchError
|
18
|
+
raise Branch::UnknownBranchError, "Could not find branch {{error:#{name}}}"
|
19
19
|
end
|
20
20
|
|
21
21
|
alias to_s name
|
@@ -13,7 +13,7 @@ module Rfix
|
|
13
13
|
rescue Branch::UnknownBranchError
|
14
14
|
revparse(using: with, ref: reference)
|
15
15
|
rescue Rugged::InvalidError
|
16
|
-
raise Branch::UnknownBranchError
|
16
|
+
raise Branch::UnknownBranchError, "Branch with reference {{error:#{reference}}} not found"
|
17
17
|
end
|
18
18
|
|
19
19
|
alias to_s reference
|
@@ -116,7 +116,7 @@ def setup(r_args = [], opts, _args, files: [], reference:)
|
|
116
116
|
paths = files
|
117
117
|
elsif paths.empty? && repo.paths.empty?
|
118
118
|
if opts[:format] == "json"
|
119
|
-
prt JSON.pretty_generate({"files": []})
|
119
|
+
prt JSON.pretty_generate({ "files": [] })
|
120
120
|
exit 0
|
121
121
|
else
|
122
122
|
say_exit "Everything looks good, nothing to lint"
|
data/lib/rfix/commands/lint.rb
CHANGED
data/lib/rfix/file.rb
CHANGED
@@ -18,15 +18,15 @@ class Rfix::File < Struct.new(:path, :repo, :ref)
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def include?(_)
|
21
|
-
raise Rfix::Error
|
21
|
+
raise Rfix::Error, "#include? not implemented"
|
22
22
|
end
|
23
23
|
|
24
24
|
def refresh!
|
25
|
-
raise Rfix::Error
|
25
|
+
raise Rfix::Error, "#refresh! not implemented"
|
26
26
|
end
|
27
27
|
|
28
28
|
def inspect
|
29
|
-
raise Rfix::Error
|
29
|
+
raise Rfix::Error, "#inspect not implemented"
|
30
30
|
end
|
31
31
|
|
32
32
|
def git_path
|
data/lib/rfix/log.rb
CHANGED
@@ -31,7 +31,7 @@ module Rfix::Log
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def say_debug(message)
|
34
|
-
if debug?
|
34
|
+
if debug? || test?
|
35
35
|
prt("{{i}} #{strip(message)}", to: $stderr)
|
36
36
|
end
|
37
37
|
end
|
@@ -43,6 +43,7 @@ module Rfix::Log
|
|
43
43
|
|
44
44
|
def debug?
|
45
45
|
return false unless defined?(RSpec)
|
46
|
+
|
46
47
|
return RSpec.configuration.debug?
|
47
48
|
end
|
48
49
|
|
data/lib/rfix/repository.rb
CHANGED
@@ -18,7 +18,7 @@ class Rfix::Repository
|
|
18
18
|
end
|
19
19
|
|
20
20
|
unless reference.is_a?(Rfix::Branch::Base)
|
21
|
-
raise Rfix::Error
|
21
|
+
raise Rfix::Error, "Need Branch::Base, got {{error:#{reference.class}}}"
|
22
22
|
end
|
23
23
|
|
24
24
|
@files = FileCache.new(root_path)
|
@@ -35,12 +35,10 @@ class Rfix::Repository
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def load_tracked?
|
38
|
-
|
38
|
+
!!@reference
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
@reference
|
43
|
-
end
|
41
|
+
attr_reader :reference
|
44
42
|
|
45
43
|
def refresh!(path)
|
46
44
|
@files.get(path).refresh!
|
@@ -108,7 +106,7 @@ class Rfix::Repository
|
|
108
106
|
}
|
109
107
|
|
110
108
|
unless @paths.empty?
|
111
|
-
say_debug("Use @paths #{@paths.join(
|
109
|
+
say_debug("Use @paths #{@paths.join(', ')}")
|
112
110
|
params[:disable_pathspec_match] = false
|
113
111
|
params[:paths] = @paths
|
114
112
|
end
|
data/lib/rfix/tracked.rb
CHANGED
@@ -4,7 +4,7 @@ class Rfix::Tracked < Rfix::File
|
|
4
4
|
include Rfix::Log
|
5
5
|
|
6
6
|
def include?(line)
|
7
|
-
set = diff.each_line.to_a.map
|
7
|
+
set = diff.each_line.to_a.map(&:new_lineno).reject { |l| l == -1 }.to_set
|
8
8
|
say_debug "Does {{yellow:#{set}}} contain {{red:#{line}}}"
|
9
9
|
set.include?(line)
|
10
10
|
end
|
@@ -54,14 +54,14 @@ class Rfix::Tracked < Rfix::File
|
|
54
54
|
|
55
55
|
def diff
|
56
56
|
upstream.diff_workdir({
|
57
|
-
|
57
|
+
include_untracked_content: true,
|
58
58
|
recurse_untracked_dirs: true,
|
59
59
|
include_untracked: true,
|
60
60
|
ignore_submodules: true,
|
61
61
|
include_ignored: false,
|
62
62
|
context_lines: 0,
|
63
63
|
paths: [path]
|
64
|
-
|
64
|
+
}).tap do |diff|
|
65
65
|
diff.find_similar!(
|
66
66
|
renames_from_rewrites: true,
|
67
67
|
renames: true,
|
data/lib/rfix/version.rb
CHANGED
data/rfix.gemspec
CHANGED
@@ -54,15 +54,15 @@ Gem::Specification.new do |spec|
|
|
54
54
|
spec.add_runtime_dependency "cri", "~> 2.15.10"
|
55
55
|
spec.add_runtime_dependency "listen", "~> 3.0"
|
56
56
|
spec.add_runtime_dependency "rainbow", "~> 3.0"
|
57
|
+
spec.add_runtime_dependency "require_all", "~> 3.0.0"
|
57
58
|
spec.add_runtime_dependency "rouge", "~> 3.20"
|
58
|
-
spec.add_runtime_dependency "rubocop", "
|
59
|
+
spec.add_runtime_dependency "rubocop", "~> 0.80"
|
59
60
|
spec.add_runtime_dependency "rugged", "~> 1.0.0"
|
60
|
-
spec.add_runtime_dependency "require_all", "~> 3.0.0"
|
61
61
|
|
62
62
|
spec.add_development_dependency "rspec", "~> 3.0"
|
63
63
|
spec.add_development_dependency "aruba", "~> 1.0"
|
64
64
|
spec.add_development_dependency "colorize", "~> 0.8.1"
|
65
65
|
spec.add_development_dependency "git", "~> 1.7.0"
|
66
|
-
spec.add_development_dependency "rake", "~> 12.3"
|
67
66
|
spec.add_development_dependency "pry", "~> 0.13.1"
|
67
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
68
68
|
end
|
data/tasks/execute.rake
CHANGED
@@ -9,7 +9,7 @@ CLEAN.include(repo_path)
|
|
9
9
|
namespace :execute do
|
10
10
|
task local: [repo_path, :install] do
|
11
11
|
chdir(repo_path) do
|
12
|
-
sh "rfix local"
|
12
|
+
sh "rfix local --main-branch master"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -21,13 +21,13 @@ namespace :execute do
|
|
21
21
|
|
22
22
|
task origin: [repo_path, :install] do
|
23
23
|
chdir(repo_path) do
|
24
|
-
sh "rfix origin"
|
24
|
+
sh "rfix origin --main-branch master"
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
task lint: [repo_path, :install] do
|
29
29
|
chdir(repo_path) do
|
30
|
-
sh "rfix lint"
|
30
|
+
sh "rfix lint --main-branch master"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
data/tasks/simple.rake
CHANGED
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.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linus Oleander
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07
|
11
|
+
date: 2020-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -53,61 +53,61 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: require_all
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.0.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 3.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rouge
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.20'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.20'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0.80'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0.80'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rugged
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 1.0.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 1.0.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,33 +165,33 @@ dependencies:
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 1.7.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: pry
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 0.13.1
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 0.13.1
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
182
|
+
name: rake
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
187
|
+
version: '12.3'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: '12.3'
|
195
195
|
description: |
|
196
196
|
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`).
|
197
197
|
|