rfix 1.0.7.pre.67 → 1.0.15

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.
@@ -1,2 +1,2 @@
1
- eval_gemfile("../Gemfile")
1
+ eval_gemfile(File.join(__dir__, "../Gemfile.base"))
2
2
  gem "rubocop", "0.85.0"
@@ -1,2 +1,2 @@
1
- eval_gemfile("../Gemfile")
1
+ eval_gemfile(File.join(__dir__, "../Gemfile.base"))
2
2
  gem "rubocop", "0.85.1"
@@ -1,42 +1,22 @@
1
- GIT
2
- remote: https://github.com/Shopify/cli-ui.git
3
- revision: ef976df676f43a80b47249ac2390d5f12b2293d1
4
- ref: ef976df676f4
5
- specs:
6
- cli-ui (1.3.0)
7
-
8
- GIT
9
- remote: https://github.com/oleander/git-fame-rb.git
10
- revision: a9b9c25bbab197feaee00f9a5c970998e76f636c
11
- ref: a9b9c25bbab1
12
- specs:
13
- git_fame (2.5.3)
14
- hirb (~> 0.7.3)
15
- memoist (~> 0.14.0)
16
- method_profiler (~> 2.0.1)
17
- progressbar (~> 0.21.0)
18
- scrub_rb (~> 1.0.1)
19
- trollop (~> 2.1.2)
20
-
21
1
  PATH
22
- remote: ..
2
+ remote: .
23
3
  specs:
24
- rfix (0.2.0)
4
+ rfix (1.0.8)
25
5
  rainbow (~> 3.0)
26
6
  rouge (~> 3.20)
27
- rubocop (~> 0.80)
7
+ rubocop (>= 0.80)
28
8
 
29
9
  GEM
30
10
  remote: https://rubygems.org/
31
11
  specs:
32
- activesupport (6.0.3.1)
12
+ activesupport (6.0.3.2)
33
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
34
14
  i18n (>= 0.7, < 2)
35
15
  minitest (~> 5.1)
36
16
  tzinfo (~> 1.1)
37
17
  zeitwerk (~> 2.2, >= 2.2.2)
38
- aruba (1.0.1)
39
- childprocess (~> 3.0)
18
+ aruba (1.0.2)
19
+ childprocess (>= 2.0, < 5.0)
40
20
  contracts (~> 0.16.0)
41
21
  cucumber (>= 2.4, < 5.0)
42
22
  ffi (~> 1.9)
@@ -44,7 +24,7 @@ GEM
44
24
  thor (~> 1.0)
45
25
  ast (2.4.1)
46
26
  builder (3.2.4)
47
- childprocess (3.0.0)
27
+ childprocess (4.0.0)
48
28
  coderay (1.1.3)
49
29
  concurrent-ruby (1.1.6)
50
30
  contracts (0.16.0)
@@ -78,6 +58,7 @@ GEM
78
58
  diff-lcs (1.3)
79
59
  ffi (1.13.1)
80
60
  formatador (0.2.5)
61
+ gem-release (2.1.1)
81
62
  guard (2.16.2)
82
63
  formatador (>= 0.2.4)
83
64
  listen (>= 2.7, < 4.0)
@@ -92,16 +73,12 @@ GEM
92
73
  guard (~> 2.1)
93
74
  guard-compat (~> 1.1)
94
75
  rspec (>= 2.99.0, < 4.0)
95
- hirb (0.7.3)
96
76
  i18n (1.8.3)
97
77
  concurrent-ruby (~> 1.0)
98
78
  listen (3.2.1)
99
79
  rb-fsevent (~> 0.10, >= 0.10.3)
100
80
  rb-inotify (~> 0.9, >= 0.9.10)
101
- lumberjack (1.2.5)
102
- memoist (0.14.0)
103
- method_profiler (2.0.1)
104
- hirb (>= 0.6.0)
81
+ lumberjack (1.2.6)
105
82
  method_source (1.0.0)
106
83
  middleware (0.1.0)
107
84
  minitest (5.14.1)
@@ -110,10 +87,9 @@ GEM
110
87
  notiffany (0.1.3)
111
88
  nenv (~> 0.1)
112
89
  shellany (~> 0.0)
113
- parallel (1.19.1)
114
- parser (2.7.1.3)
115
- ast (~> 2.4.0)
116
- progressbar (0.21.0)
90
+ parallel (1.19.2)
91
+ parser (2.7.1.4)
92
+ ast (~> 2.4.1)
117
93
  protobuf-cucumber (3.10.8)
118
94
  activesupport (>= 3.2)
119
95
  middleware
@@ -155,13 +131,11 @@ GEM
155
131
  rubocop-ast (0.0.3)
156
132
  parser (>= 2.7.0.1)
157
133
  ruby-progressbar (1.10.1)
158
- scrub_rb (1.0.1)
159
134
  shellany (0.0.1)
160
135
  sys-uname (1.2.1)
161
136
  ffi (>= 1.0.0)
162
137
  thor (1.0.1)
163
138
  thread_safe (0.3.6)
164
- trollop (2.1.3)
165
139
  tzinfo (1.2.7)
166
140
  thread_safe (~> 0.1)
167
141
  unicode-display_width (1.7.0)
@@ -171,19 +145,14 @@ PLATFORMS
171
145
  ruby
172
146
 
173
147
  DEPENDENCIES
174
- aruba
175
- cli-ui!
176
- git_fame!
148
+ aruba (~> 1.0)
149
+ gem-release
177
150
  guard
178
151
  guard-rspec
179
- pry
180
- rake (~> 12.0)
152
+ rake (~> 12.3)
181
153
  rfix!
182
154
  rspec (~> 3.0)
183
155
  rubocop (= 0.85.1)
184
156
 
185
- RUBY VERSION
186
- ruby 2.5.0p0
187
-
188
157
  BUNDLED WITH
189
158
  2.1.4
@@ -1,42 +1,22 @@
1
- GIT
2
- remote: https://github.com/Shopify/cli-ui.git
3
- revision: ef976df676f43a80b47249ac2390d5f12b2293d1
4
- ref: ef976df676f4
5
- specs:
6
- cli-ui (1.3.0)
7
-
8
- GIT
9
- remote: https://github.com/oleander/git-fame-rb.git
10
- revision: a9b9c25bbab197feaee00f9a5c970998e76f636c
11
- ref: a9b9c25bbab1
12
- specs:
13
- git_fame (2.5.3)
14
- hirb (~> 0.7.3)
15
- memoist (~> 0.14.0)
16
- method_profiler (~> 2.0.1)
17
- progressbar (~> 0.21.0)
18
- scrub_rb (~> 1.0.1)
19
- trollop (~> 2.1.2)
20
-
21
1
  PATH
22
- remote: ..
2
+ remote: .
23
3
  specs:
24
- rfix (0.2.0)
4
+ rfix (1.0.8)
25
5
  rainbow (~> 3.0)
26
6
  rouge (~> 3.20)
27
- rubocop (~> 0.80)
7
+ rubocop (>= 0.80)
28
8
 
29
9
  GEM
30
10
  remote: https://rubygems.org/
31
11
  specs:
32
- activesupport (6.0.3.1)
12
+ activesupport (6.0.3.2)
33
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
34
14
  i18n (>= 0.7, < 2)
35
15
  minitest (~> 5.1)
36
16
  tzinfo (~> 1.1)
37
17
  zeitwerk (~> 2.2, >= 2.2.2)
38
- aruba (1.0.1)
39
- childprocess (~> 3.0)
18
+ aruba (1.0.2)
19
+ childprocess (>= 2.0, < 5.0)
40
20
  contracts (~> 0.16.0)
41
21
  cucumber (>= 2.4, < 5.0)
42
22
  ffi (~> 1.9)
@@ -44,7 +24,7 @@ GEM
44
24
  thor (~> 1.0)
45
25
  ast (2.4.1)
46
26
  builder (3.2.4)
47
- childprocess (3.0.0)
27
+ childprocess (4.0.0)
48
28
  coderay (1.1.3)
49
29
  concurrent-ruby (1.1.6)
50
30
  contracts (0.16.0)
@@ -78,6 +58,7 @@ GEM
78
58
  diff-lcs (1.3)
79
59
  ffi (1.13.1)
80
60
  formatador (0.2.5)
61
+ gem-release (2.1.1)
81
62
  guard (2.16.2)
82
63
  formatador (>= 0.2.4)
83
64
  listen (>= 2.7, < 4.0)
@@ -92,16 +73,12 @@ GEM
92
73
  guard (~> 2.1)
93
74
  guard-compat (~> 1.1)
94
75
  rspec (>= 2.99.0, < 4.0)
95
- hirb (0.7.3)
96
76
  i18n (1.8.3)
97
77
  concurrent-ruby (~> 1.0)
98
78
  listen (3.2.1)
99
79
  rb-fsevent (~> 0.10, >= 0.10.3)
100
80
  rb-inotify (~> 0.9, >= 0.9.10)
101
- lumberjack (1.2.5)
102
- memoist (0.14.0)
103
- method_profiler (2.0.1)
104
- hirb (>= 0.6.0)
81
+ lumberjack (1.2.6)
105
82
  method_source (1.0.0)
106
83
  middleware (0.1.0)
107
84
  minitest (5.14.1)
@@ -110,10 +87,9 @@ GEM
110
87
  notiffany (0.1.3)
111
88
  nenv (~> 0.1)
112
89
  shellany (~> 0.0)
113
- parallel (1.19.1)
114
- parser (2.7.1.3)
115
- ast (~> 2.4.0)
116
- progressbar (0.21.0)
90
+ parallel (1.19.2)
91
+ parser (2.7.1.4)
92
+ ast (~> 2.4.1)
117
93
  protobuf-cucumber (3.10.8)
118
94
  activesupport (>= 3.2)
119
95
  middleware
@@ -155,13 +131,11 @@ GEM
155
131
  rubocop-ast (0.0.3)
156
132
  parser (>= 2.7.0.1)
157
133
  ruby-progressbar (1.10.1)
158
- scrub_rb (1.0.1)
159
134
  shellany (0.0.1)
160
135
  sys-uname (1.2.1)
161
136
  ffi (>= 1.0.0)
162
137
  thor (1.0.1)
163
138
  thread_safe (0.3.6)
164
- trollop (2.1.3)
165
139
  tzinfo (1.2.7)
166
140
  thread_safe (~> 0.1)
167
141
  unicode-display_width (1.7.0)
@@ -171,19 +145,14 @@ PLATFORMS
171
145
  ruby
172
146
 
173
147
  DEPENDENCIES
174
- aruba
175
- cli-ui!
176
- git_fame!
148
+ aruba (~> 1.0)
149
+ gem-release
177
150
  guard
178
151
  guard-rspec
179
- pry
180
- rake (~> 12.0)
152
+ rake (~> 12.3)
181
153
  rfix!
182
154
  rspec (~> 3.0)
183
155
  rubocop (= 0.85.0)
184
156
 
185
- RUBY VERSION
186
- ruby 2.5.0p0
187
-
188
157
  BUNDLED WITH
189
158
  2.1.4
data/exe/rfix CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  # frozen_string_literal: true
3
4
 
4
5
  require "rfix"
@@ -9,16 +10,19 @@ require "cli/ui"
9
10
  should_list_files = false
10
11
  limit_files = false
11
12
  options = RuboCop::Options.new
12
- config = RuboCop::ConfigStore.new
13
+
13
14
  display_help = ARGV.include?("--help")
14
15
  is_dry = ARGV.include?("--dry")
15
16
  config_path = false
17
+ clear_cache = false
16
18
 
17
19
  extend Rfix::Log
18
20
  Rfix.init!
19
21
  CLI::UI::StdoutRouter.enable
20
22
 
21
- say "Using RuboCop {{yellow:#{RuboCop::Version.version}}}"
23
+ if ARGV.include?("--debug")
24
+ Rfix.debug!
25
+ end
22
26
 
23
27
  options.on("--untracked", "Include untracked files") do
24
28
  Rfix.load_untracked!
@@ -33,6 +37,10 @@ options.on("--list-files", "List files found by git") do
33
37
  should_list_files = true
34
38
  end
35
39
 
40
+ options.on("--clear-cache", "Clear RuboCop cache") do
41
+ clear_cache = true
42
+ end
43
+
36
44
  options.on("--limit-files NUM", Integer, "Limit number of files") do |limit|
37
45
  limit_files = limit
38
46
  end
@@ -43,10 +51,15 @@ end
43
51
 
44
52
  case cmd = ARGV.shift
45
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}}}"
46
57
  say "Using Rfix {{yellow:#{Rfix::VERSION}}}"
47
58
  say "Using OS {{yellow:#{Rfix.current_os}}}"
48
59
  say "Using Git {{yellow:#{Rfix.git_version}}}"
49
60
  say "Using Ruby {{yellow:#{Rfix.ruby_version}}}"
61
+ say_debug "Current Git branch {{yellow:#{Rfix.current_branch}}}"
62
+ say_debug "Number of commits {{yellow:#{Rfix.number_of_commits_since}}}"
50
63
  exit 0
51
64
  when "lint"
52
65
  Rfix.lint_mode!
@@ -55,6 +68,8 @@ when "local"
55
68
  reference = Rfix.ref_since_push
56
69
  when "origin"
57
70
  reference = Rfix.ref_since_origin
71
+ when "welcome"
72
+ abort Rfix.thanks
58
73
  when "all"
59
74
  reference = false
60
75
  Rfix.global_enable!
@@ -74,15 +89,7 @@ when "branch"
74
89
  else
75
90
  unless display_help
76
91
  say_error "Valid rfix commands are:"
77
- say_error_sub "\n"
78
- say_error_sub "\t{{bold:rfix branch <branch>}} -- {{italic:Fix changes made between HEAD and <branch>}}"
79
- say_error_sub "\t{{bold:rfix origin}} -- {{italic:Fix changes made between HEAD and origin branch}}"
80
- say_error_sub "\t{{bold:rfix local}} -- {{italic:Fix changes not yet pushed to upstream branch}}"
81
- say_error_sub "\t{{bold:rfix info}} -- {{italic:Display runtime dependencies and their versions}}"
82
- say_error_sub "\t{{bold:rfix all}} -- {{italic:Fix all files in this repository}} {{warning:(not recommended)}}"
83
- say_error_sub "\t{{bold:rfix lint}} -- {{italic:Shortcut for 'local --dry --untracked'}}"
84
- say_error_sub "\n"
85
- say_error_sub "\t{{italic:Optional args: --dry --help --list-files --limit-files --config --untracked}}"
92
+ say_error_sub Rfix.help
86
93
  exit 1
87
94
  end
88
95
 
@@ -96,15 +103,22 @@ rescue OptionParser::MissingArgument => e
96
103
  end
97
104
 
98
105
  if path = config_path
99
- Rfix.load_config do
106
+ Rfix.load_config do |config|
107
+ say_debug "[Config:Option] Load from #{path}"
100
108
  config.options_config = path
101
109
  end
102
110
  else
103
- Rfix.load_config do
111
+ Rfix.load_config do |config|
112
+ say_debug "[Config:PWD] Load from #{Dir.pwd}"
104
113
  config.for(Dir.pwd)
105
114
  end
106
115
  end
107
116
 
117
+ if clear_cache
118
+ say "Clearing cache"
119
+ Rfix.clear_cache!
120
+ end
121
+
108
122
  if ref = reference
109
123
  say "Compare against {{yellow:#{ref}}}"
110
124
 
@@ -127,9 +141,11 @@ if should_list_files
127
141
  end
128
142
  end
129
143
 
144
+ say_debug "[Config:Dump] #{Rfix.store}"
145
+
130
146
  env = RuboCop::CLI::Environment.new(
131
147
  Rfix.config.merge(options),
132
- config,
148
+ Rfix.store,
133
149
  paths
134
150
  )
135
151
 
data/file.rb ADDED
@@ -0,0 +1 @@
1
+ "hello"
@@ -4,7 +4,7 @@
4
4
  # https://gist.github.com/skanev/9d4bec97d5a6825eaaf6
5
5
 
6
6
  require "rfix/version"
7
- require "rfix/log"
7
+ require "cli/ui"
8
8
  require "rfix/extensions/extensions"
9
9
  require "rfix/extensions/offense"
10
10
  require "rfix/rfix"
@@ -7,13 +7,15 @@ 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
+ say_debug "[Cmd] {{command:#{args.join(' ')}}}"
13
+
13
14
  unless status.success?
14
15
  return yield if block_given?
16
+ return if quiet
15
17
 
16
- say_error "[Cmd] {{italic:#{args.join(" ")}}}"
18
+ say_error "[Cmd] {{italic:#{args.join(' ')}}}"
17
19
  say_error "[Pwd] {{italic:#{Dir.pwd}}}"
18
20
  say_error "[Err] {{error:#{err.strip}}}"
19
21
 
@@ -23,6 +25,10 @@ module Rfix::Cmd
23
25
  out.lines.map(&:chomp)
24
26
  end
25
27
 
28
+ def cmd_succeeded?(*cmd)
29
+ Open3.capture2e(*cmd).last.success?
30
+ end
31
+
26
32
  def params
27
33
  [
28
34
  "--word-diff-regex=[^[:space:]]",
@@ -0,0 +1,12 @@
1
+ require "bundler"
2
+
3
+ module GemHelper
4
+ def source_for(name:, &block)
5
+ bundle_root = Bundler.bundle_path.join('bundler/gems')
6
+ path = Dir.glob(bundle_root.join("#{name}-*").to_s).first
7
+ path or raise "Could not find source for #{name}, run bundle install first"
8
+ block(path)
9
+ rescue StandardError => e
10
+ puts "[Bundler] #{e}"
11
+ end
12
+ end
@@ -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
- cmd("git", *args, &block)
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