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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 979604266b50448ef2a189a633eda6a6057e179ef67962a850718c07f8e2c726
4
- data.tar.gz: 60b0a5b249baf32b738bde9ae350af154b3bf7862af836b42b960d5c91347b0f
3
+ metadata.gz: 4963fcdeb152d9e132794d42982797eadf9848ecfcfed8e94f51885003b0ddbb
4
+ data.tar.gz: 8cb32d9c8e17a881eec724678f0e69bc138ca360f24ea6318c733429e09e45f3
5
5
  SHA512:
6
- metadata.gz: 7efcea3b4f4419c05fca0467bfa1748d2cf1eb2c7771aeaa7f8bb83826016ece746635eb1303b6e881a1e108d4d06f9d6c0730db447314500ff1f30f5259b3b1
7
- data.tar.gz: 3aba1e9526e140517131811ec818edcc437274cf36746b5253bffd86fcf301ffde93d40370264157a7099b30e7fd906f198b765dfb523725e6a752a8cbdb9c1d
6
+ metadata.gz: 064c76697d6e5cad1b1e35c52f4ee9b7f52df2697fdf8680f18289130aa8b6f634ed3cf2bcba41cc8d0a27fd95e61e79d2c3a5638620baf61440935471ed784f
7
+ data.tar.gz: 4936c5ca44319492caf7a8556ff5913ca527541b5d7a3453d04db77785bfcb535929153a7a7e11881283dc7e1910c7f4164d4293eae9c4b405de12fc032ccc88
@@ -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
- setup:
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}}"
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rfix (1.2.5)
4
+ rfix (1.2.6)
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 (>= 0.80)
10
+ rubocop (~> 0.80)
11
11
  rugged (~> 1.0.0)
12
12
 
13
13
  GEM
@@ -1,15 +1,15 @@
1
1
  class Rfix::Branch::Base
2
2
  def resolve(with:)
3
- raise Rfix::NotYetImplementedError.new("#resolved")
3
+ raise Rfix::NotYetImplementedError, "#resolved"
4
4
  end
5
5
 
6
6
  def to_s
7
- raise Rfix::NotYetImplementedError.new("#to_s")
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.new("Could not find reference {{error:#{ref}}}")
13
+ raise Rfix::Branch::UnknownBranchError, "Could not find reference {{error:#{ref}}}"
14
14
  end
15
15
  end
@@ -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.new("Please run {{command:rfix setup}} first")
10
+ raise Error, "Please run {{command:rfix setup}} first"
11
11
  end
12
12
 
13
13
  Branch::Name.new(name).resolve(with: with)
@@ -10,12 +10,12 @@ module Rfix
10
10
 
11
11
  def resolve(with:)
12
12
  unless branch = with.branches[name]
13
- raise Branch::UnknownBranchError.new("Could not find branch {{error:#{name}}}")
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.new("Could not find branch {{error:#{name}}}")
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.new("Branch with reference {{error:#{reference}}} not found")
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"
@@ -8,7 +8,6 @@ summary "Lints commits and untracked files not yet pushed to upstream"
8
8
  usage "rfix lint [opts] [path ..]"
9
9
  description "Lint (read-only) files"
10
10
 
11
-
12
11
  run do |opts, args, _cmd|
13
12
  opts[:dry] = true
14
13
  opts[:untracked] = true
@@ -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.new("#include? not implemented")
21
+ raise Rfix::Error, "#include? not implemented"
22
22
  end
23
23
 
24
24
  def refresh!
25
- raise Rfix::Error.new("#refresh! not implemented")
25
+ raise Rfix::Error, "#refresh! not implemented"
26
26
  end
27
27
 
28
28
  def inspect
29
- raise Rfix::Error.new("#inspect not implemented")
29
+ raise Rfix::Error, "#inspect not implemented"
30
30
  end
31
31
 
32
32
  def git_path
@@ -31,7 +31,7 @@ module Rfix::Log
31
31
  end
32
32
 
33
33
  def say_debug(message)
34
- if debug? or test?
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
 
@@ -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.new("Need Branch::Base, got {{error:#{reference.class}}}")
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
- !! @reference
38
+ !!@reference
39
39
  end
40
40
 
41
- def reference
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
@@ -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{ |l| l.new_lineno }.reject { |l| l == -1 }.to_set
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
- include_untracked_content: true,
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
- }).tap do |diff|
64
+ }).tap do |diff|
65
65
  diff.find_similar!(
66
66
  renames_from_rewrites: true,
67
67
  renames: true,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rfix
4
- VERSION = "1.2.5"
4
+ VERSION = "1.2.6"
5
5
  end
@@ -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", ">= 0.80"
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
@@ -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
 
@@ -45,7 +45,7 @@ namespace :bundle do
45
45
 
46
46
  sh "git config user.email 'you@example.com'"
47
47
  sh "git config user.name 'Your Name'"
48
-
48
+
49
49
  sh "git commit -m 'A Commit Message'"
50
50
 
51
51
  sh "git config push.default current"
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.5
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-29 00:00:00.000000000 Z
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: rouge
56
+ name: require_all
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.20'
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: '3.20'
68
+ version: 3.0.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: rubocop
70
+ name: rouge
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.80'
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: '0.80'
82
+ version: '3.20'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rugged
84
+ name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.0.0
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: 1.0.0
96
+ version: '0.80'
97
97
  - !ruby/object:Gem::Dependency
98
- name: require_all
98
+ name: rugged
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 3.0.0
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: 3.0.0
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: rake
168
+ name: pry
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '12.3'
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: '12.3'
180
+ version: 0.13.1
181
181
  - !ruby/object:Gem::Dependency
182
- name: pry
182
+ name: rake
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 0.13.1
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: 0.13.1
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