rfix 1.0.8.pre.108 → 1.0.8.pre.109
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/exe/rfix +6 -0
- data/file.rb +1 -0
- data/lib/rfix/cmd.rb +3 -1
- data/lib/rfix/git_helper.rb +19 -2
- data/lib/rfix/log.rb +3 -1
- data/lib/rfix/rfix.rb +17 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4097e2bfdc301c182d0b04d369576a35ffa391f1afa4b7e8643daa52e1dc1aeb
|
4
|
+
data.tar.gz: c324d50979ea839dae4d3738971e23c69e601f05c049d72bc5ebe6cb9dc5cb53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d7ffdf2ef3d46b6a7e5c9eb19e5942331c0dcf010524c49a8a0ff59c25290998d5196c2199f76cd80dbd5a151d5f0fe9d20d8b7d2de1527824eaeea7e0576e
|
7
|
+
data.tar.gz: 7efe96eef04ec0dc1cf3344db5b5d68a2a88cd56cc2aea8211566d1350053e2a209a19e586a6559274a8853ae34cd8478109bc3d85a01ac2afdec75acaa01395
|
data/exe/rfix
CHANGED
@@ -20,6 +20,10 @@ extend Rfix::Log
|
|
20
20
|
Rfix.init!
|
21
21
|
CLI::UI::StdoutRouter.enable
|
22
22
|
|
23
|
+
if ARGV.include?("--debug")
|
24
|
+
Rfix.debug!
|
25
|
+
end
|
26
|
+
|
23
27
|
say "Using RuboCop {{yellow:#{RuboCop::Version.version}}}"
|
24
28
|
say_debug "Current directory {{italic:#{Dir.pwd}}}"
|
25
29
|
say_debug "[Ruby] {{italic:#{RbConfig.ruby}}}"
|
@@ -55,6 +59,8 @@ when "info"
|
|
55
59
|
say "Using OS {{yellow:#{Rfix.current_os}}}"
|
56
60
|
say "Using Git {{yellow:#{Rfix.git_version}}}"
|
57
61
|
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}}}"
|
58
64
|
exit 0
|
59
65
|
when "lint"
|
60
66
|
Rfix.lint_mode!
|
data/file.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"hello"
|
data/lib/rfix/cmd.rb
CHANGED
@@ -7,11 +7,13 @@ require "rfix/log"
|
|
7
7
|
module Rfix::Cmd
|
8
8
|
include Rfix::Log
|
9
9
|
|
10
|
-
def cmd(*args)
|
10
|
+
def cmd(*args, quiet: false)
|
11
11
|
out, err, status = Open3.capture3(*args)
|
12
12
|
|
13
|
+
# say "[Cmd] {{italic:#{args.join(' ')}}}"
|
13
14
|
unless status.success?
|
14
15
|
return yield if block_given?
|
16
|
+
return if quiet
|
15
17
|
|
16
18
|
say_error "[Cmd] {{italic:#{args.join(' ')}}}"
|
17
19
|
say_error "[Pwd] {{italic:#{Dir.pwd}}}"
|
data/lib/rfix/git_helper.rb
CHANGED
@@ -9,8 +9,20 @@ module Rfix::GitHelper
|
|
9
9
|
include Rfix::Log
|
10
10
|
include Rfix::Cmd
|
11
11
|
|
12
|
-
def git(*args, &block)
|
13
|
-
|
12
|
+
def git(*args, root: Dir.pwd, quiet: false, &block)
|
13
|
+
args.unshift *["--git-dir", File.join(root, ".git")]
|
14
|
+
args.unshift *["--work-tree", root]
|
15
|
+
cmd("git", *args, quiet: quiet, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def has_branch?(branch)
|
19
|
+
cmd_succeeded?("git", "cat-file", "-t", branch)
|
20
|
+
end
|
21
|
+
|
22
|
+
def dirty?(path)
|
23
|
+
Dir.chdir(path) do
|
24
|
+
!cmd_succeeded?("git diff --quiet")
|
25
|
+
end
|
14
26
|
end
|
15
27
|
|
16
28
|
def params
|
@@ -28,3 +40,8 @@ module Rfix::GitHelper
|
|
28
40
|
]
|
29
41
|
end
|
30
42
|
end
|
43
|
+
|
44
|
+
# TODO: Rename above to just ::Git
|
45
|
+
module Rfix::Git
|
46
|
+
extend Rfix::GitHelper
|
47
|
+
end
|
data/lib/rfix/log.rb
CHANGED
data/lib/rfix/rfix.rb
CHANGED
@@ -48,6 +48,22 @@ module Rfix
|
|
48
48
|
CLI::UI.fmt(cmds.join("\n"), enable_color: true)
|
49
49
|
end
|
50
50
|
|
51
|
+
def current_branch
|
52
|
+
git("rev-parse", "--abbrev-ref", "HEAD").first
|
53
|
+
end
|
54
|
+
|
55
|
+
def debug?
|
56
|
+
@debug
|
57
|
+
end
|
58
|
+
|
59
|
+
def debug!
|
60
|
+
@debug = true
|
61
|
+
end
|
62
|
+
|
63
|
+
def number_of_commits_since
|
64
|
+
cmd("git rev-list master..HEAD | wc -l").first
|
65
|
+
end
|
66
|
+
|
51
67
|
def config
|
52
68
|
@config
|
53
69
|
end
|
@@ -112,6 +128,7 @@ module Rfix
|
|
112
128
|
}
|
113
129
|
|
114
130
|
@store = RuboCop::ConfigStore.new
|
131
|
+
@debug = false
|
115
132
|
auto_correct!
|
116
133
|
end
|
117
134
|
|
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.
|
4
|
+
version: 1.0.8.pre.109
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linus Oleander
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- ci/Gemfile.rubocop-0.85.1.lock
|
142
142
|
- ci/Gemfile.rubocop-0.85.lock
|
143
143
|
- exe/rfix
|
144
|
+
- file.rb
|
144
145
|
- lib/rfix.rb
|
145
146
|
- lib/rfix/cmd.rb
|
146
147
|
- lib/rfix/extensions/extensions.rb
|