rfix 1.0.8.pre.109 → 1.0.15.pre.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4097e2bfdc301c182d0b04d369576a35ffa391f1afa4b7e8643daa52e1dc1aeb
4
- data.tar.gz: c324d50979ea839dae4d3738971e23c69e601f05c049d72bc5ebe6cb9dc5cb53
3
+ metadata.gz: 809c73bd0063eb6e08514f282623524fdd9a0dc1b6b39c38dac2b55207e3f3c2
4
+ data.tar.gz: afd4053dc8c7dbf7602ed459f3b4f87d7b0a25a1c399c5eaf851e4775efe4683
5
5
  SHA512:
6
- metadata.gz: 39d7ffdf2ef3d46b6a7e5c9eb19e5942331c0dcf010524c49a8a0ff59c25290998d5196c2199f76cd80dbd5a151d5f0fe9d20d8b7d2de1527824eaeea7e0576e
7
- data.tar.gz: 7efe96eef04ec0dc1cf3344db5b5d68a2a88cd56cc2aea8211566d1350053e2a209a19e586a6559274a8853ae34cd8478109bc3d85a01ac2afdec75acaa01395
6
+ metadata.gz: f93e07417ac0e001888df20f758ce766ff3590ac2de191bd746065de962e506584c8e1c6a4455886b9dd34b43de166d251f0fdf6cd21c70a92e5ac2bec3c06d8
7
+ data.tar.gz: d87aa4d413f4074db0a2e59b9748478727b554f54a3fa0baba748acd7d59c132771f63d16856c5eb8ebe21b73f6c417a194f3442d966f2d10419591bd0f2dd43
@@ -27,6 +27,7 @@ before_install:
27
27
  install:
28
28
  - bundle install
29
29
  script:
30
+ - bundle exec rake git:config
30
31
  - bundle exec rake spec
31
32
  - bundle exec rake install
32
33
  - rfix info
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rfix (1.0.8)
4
+ rfix (1.0.15)
5
5
  rainbow (~> 3.0)
6
6
  rouge (~> 3.20)
7
7
  rubocop (>= 0.80)
data/Rakefile CHANGED
@@ -95,6 +95,9 @@ end
95
95
 
96
96
  task :bump do
97
97
  cmd("gem", "bump", "-c", "-m", "Bump version to %{version}")
98
+ cmd("bundle", "install")
99
+ cmd("git add Gemfile.lock")
100
+ cmd("git commit --amend --no-edit")
98
101
  end
99
102
 
100
103
  task clear: ["vendor:clear", "gemfile:locks:clear"]
data/exe/rfix CHANGED
@@ -24,10 +24,6 @@ if ARGV.include?("--debug")
24
24
  Rfix.debug!
25
25
  end
26
26
 
27
- say "Using RuboCop {{yellow:#{RuboCop::Version.version}}}"
28
- say_debug "Current directory {{italic:#{Dir.pwd}}}"
29
- say_debug "[Ruby] {{italic:#{RbConfig.ruby}}}"
30
-
31
27
  options.on("--untracked", "Include untracked files") do
32
28
  Rfix.load_untracked!
33
29
  end
@@ -55,12 +51,15 @@ end
55
51
 
56
52
  case cmd = ARGV.shift
57
53
  when "info"
54
+ say "Using RuboCop {{yellow:#{RuboCop::Version.version}}}"
55
+ say_debug "Current directory {{italic:#{Dir.pwd}}}"
56
+ say_debug "[Ruby] {{italic:#{RbConfig.ruby}}}"
58
57
  say "Using Rfix {{yellow:#{Rfix::VERSION}}}"
59
58
  say "Using OS {{yellow:#{Rfix.current_os}}}"
60
59
  say "Using Git {{yellow:#{Rfix.git_version}}}"
61
60
  say "Using Ruby {{yellow:#{Rfix.ruby_version}}}"
62
- say "Current Git branch {{yellow:#{Rfix.current_branch}}}"
63
- say "Number of commits {{yellow:#{Rfix.number_of_commits_since}}}"
61
+ say_debug "Current Git branch {{yellow:#{Rfix.current_branch}}}"
62
+ say_debug "Number of commits {{yellow:#{Rfix.number_of_commits_since}}}"
64
63
  exit 0
65
64
  when "lint"
66
65
  Rfix.lint_mode!
@@ -69,6 +68,8 @@ when "local"
69
68
  reference = Rfix.ref_since_push
70
69
  when "origin"
71
70
  reference = Rfix.ref_since_origin
71
+ when "welcome"
72
+ abort Rfix.thanks
72
73
  when "all"
73
74
  reference = false
74
75
  Rfix.global_enable!
@@ -88,7 +89,7 @@ when "branch"
88
89
  else
89
90
  unless display_help
90
91
  say_error "Valid rfix commands are:"
91
- say_error Rfix.help
92
+ say_error_sub Rfix.help
92
93
  exit 1
93
94
  end
94
95
 
@@ -9,8 +9,8 @@ module Rfix::Cmd
9
9
 
10
10
  def cmd(*args, quiet: false)
11
11
  out, err, status = Open3.capture3(*args)
12
-
13
- # say "[Cmd] {{italic:#{args.join(' ')}}}"
12
+ say_debug "[Cmd] {{command:#{args.join(' ')}}}"
13
+
14
14
  unless status.success?
15
15
  return yield if block_given?
16
16
  return if quiet
@@ -17,7 +17,7 @@ module Rfix::Log
17
17
  end
18
18
 
19
19
  def say_debug(message)
20
- unless Rfix.debug?
20
+ if Rfix.debug?
21
21
  CLI::UI.puts("{{*}} [{{info:Debug}}] #{message}")
22
22
  end
23
23
  end
@@ -15,16 +15,19 @@ module Rfix
15
15
  include GitHelper
16
16
  include Log
17
17
 
18
+ def indent
19
+ " " * 2
20
+ end
21
+
18
22
  def thanks
19
23
  tx = []
20
24
  tx << "\n{{v}} Thank you for installing {{green:rfix v#{Rfix::VERSION}}}!\n"
21
25
  tx << "{{i}} Run {{command:rfix}} for avalible commands or any of the following to get started:"
22
26
  tx << ""
23
27
  # tx << "Here are a few examples that might be useful:"
24
- indent = " " * 3
25
- tx << "#{indent}{{command:rfix local}} {{italic:# Auto-fixes commits not yet pushed to upstream}}"
26
- tx << "#{indent}{{command:rfix origin}} {{italic:# Auto-fixes commits between HEAD and origin branch}}"
27
- tx << "#{indent}{{command:rfix lint}} {{italic:# Lints commits and untracked files not yet pushed to upstream}}"
28
+ tx << "#{indent}{{command:$ rfix local}} {{italic:# Auto-fixes commits not yet pushed to upstream}}"
29
+ tx << "#{indent}{{command:$ rfix origin}} {{italic:# Auto-fixes commits between HEAD and origin branch}}"
30
+ tx << "#{indent}{{command:$ rfix lint}} {{italic:# Lints commits and untracked files not yet pushed to upstream}}"
28
31
  tx << ""
29
32
  tx << "{{*}} {{bold:ProTip:}} Append {{command:--dry}} to run {{command:rfix}} in read-only mode"
30
33
  tx << ""
@@ -37,14 +40,14 @@ module Rfix
37
40
  end
38
41
 
39
42
  def help
40
- cmds = []
41
- cmds << "\t{{bold:rfix [cmd] [options]}} -- {{italic:--dry --help --list-files --limit-files --config --untracked}}"
42
- cmds << "\t{{bold:rfix branch <branch>}} -- {{italic:Fix changes made between HEAD and <branch>}}"
43
- cmds << "\t{{bold:rfix origin}} -- {{italic:Fix changes made between HEAD and origin branch}}"
44
- cmds << "\t{{bold:rfix local}} -- {{italic:Fix changes not yet pushed to upstream branch}}"
45
- cmds << "\t{{bold:rfix info}} -- {{italic:Display runtime dependencies and their versions}}"
46
- cmds << "\t{{bold:rfix all}} -- {{italic:Fix all files in this repository}} {{warning:(not recommended)}}"
47
- cmds << "\t{{bold:rfix lint}} -- {{italic:Shortcut for 'local --dry --untracked'}}"
43
+ cmds = [""]
44
+ cmds << "#{indent}{{command:$ rfix [cmd] [options]}} # {{italic:--dry --help --list-files --limit-files --config --untracked}}"
45
+ cmds << "#{indent}{{command:$ rfix branch <branch>}} # {{italic:Fix changes made between HEAD and <branch>}}"
46
+ cmds << "#{indent}{{command:$ rfix origin}} # {{italic:Fix changes made between HEAD and origin branch}}"
47
+ cmds << "#{indent}{{command:$ rfix local}} # {{italic:Fix changes not yet pushed to upstream branch}}"
48
+ cmds << "#{indent}{{command:$ rfix info}} # {{italic:Display runtime dependencies and their versions}}"
49
+ cmds << "#{indent}{{command:$ rfix all}} # {{italic:Fix all files in this repository}} {{warning:(not recommended)}}"
50
+ cmds << "#{indent}{{command:$ rfix lint}} # {{italic:Shortcut for 'local --dry --untracked'}}"
48
51
  CLI::UI.fmt(cmds.join("\n"), enable_color: true)
49
52
  end
50
53
 
@@ -58,6 +61,7 @@ module Rfix
58
61
 
59
62
  def debug!
60
63
  @debug = true
64
+ @config[:debug] = true
61
65
  end
62
66
 
63
67
  def number_of_commits_since
@@ -122,13 +126,13 @@ module Rfix
122
126
  def init!
123
127
  @files ||= {}
124
128
  @global_enable = false
129
+ @debug = false
125
130
  @config = {
126
131
  force_exclusion: true,
127
132
  formatters: ["Rfix::Formatter"]
128
133
  }
129
134
 
130
135
  @store = RuboCop::ConfigStore.new
131
- @debug = false
132
136
  auto_correct!
133
137
  end
134
138
 
@@ -171,7 +175,7 @@ module Rfix
171
175
  end
172
176
 
173
177
  def load_tracked!(reference)
174
- cached(git("log", "--name-only", "--pretty=format:", *params, "#{reference}..HEAD").map do |path|
178
+ cached(git("log", "--name-only", "--pretty=format:", *params, "#{reference}...HEAD").map do |path|
175
179
  TrackedFile.new(path, reference, root_dir)
176
180
  end.select(&:file?).to_set)
177
181
  end
@@ -4,7 +4,7 @@ require "rfix/git_file"
4
4
 
5
5
  class Rfix::TrackedFile < Rfix::GitFile
6
6
  def refresh!
7
- @ranges = git("--no-pager", "diff", *params, ref, path)
7
+ @ranges = git("--no-pager", "diff", *params, "#{ref}...HEAD", path)
8
8
  .grep(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/) do
9
9
  Regexp.last_match(1).to_i...(Regexp.last_match(1).to_i + (Regexp.last_match(2) || 1).to_i)
10
10
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rfix
4
- VERSION = "1.0.8"
4
+ VERSION = "1.0.15"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8.pre.109
4
+ version: 1.0.15.pre.116
5
5
  platform: ruby
6
6
  authors:
7
7
  - Linus Oleander