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 +4 -4
- data/.travis.yml +1 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +3 -0
- data/exe/rfix +8 -7
- data/lib/rfix/cmd.rb +2 -2
- data/lib/rfix/log.rb +1 -1
- data/lib/rfix/rfix.rb +18 -14
- data/lib/rfix/tracked_file.rb +1 -1
- data/lib/rfix/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 809c73bd0063eb6e08514f282623524fdd9a0dc1b6b39c38dac2b55207e3f3c2
|
4
|
+
data.tar.gz: afd4053dc8c7dbf7602ed459f3b4f87d7b0a25a1c399c5eaf851e4775efe4683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f93e07417ac0e001888df20f758ce766ff3590ac2de191bd746065de962e506584c8e1c6a4455886b9dd34b43de166d251f0fdf6cd21c70a92e5ac2bec3c06d8
|
7
|
+
data.tar.gz: d87aa4d413f4074db0a2e59b9748478727b554f54a3fa0baba748acd7d59c132771f63d16856c5eb8ebe21b73f6c417a194f3442d966f2d10419591bd0f2dd43
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
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
|
-
|
63
|
-
|
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
|
-
|
92
|
+
say_error_sub Rfix.help
|
92
93
|
exit 1
|
93
94
|
end
|
94
95
|
|
data/lib/rfix/cmd.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/rfix/log.rb
CHANGED
data/lib/rfix/rfix.rb
CHANGED
@@ -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
|
-
|
25
|
-
tx << "#{indent}{{command
|
26
|
-
tx << "#{indent}{{command
|
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 << "
|
42
|
-
cmds << "
|
43
|
-
cmds << "
|
44
|
-
cmds << "
|
45
|
-
cmds << "
|
46
|
-
cmds << "
|
47
|
-
cmds << "
|
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}
|
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
|
data/lib/rfix/tracked_file.rb
CHANGED
@@ -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
|
data/lib/rfix/version.rb
CHANGED