rfix 1.0.7 → 1.0.8.pre.108

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: 62646c9f16e2ab955a7a9991bdb352f746abc64fe40935748d1f46102a377a71
4
- data.tar.gz: 4887ecd7aa14ca41aa06905d3eb2213ee91a58b9e7578e7bb0a87d30331598f3
3
+ metadata.gz: 537cb3de2248f7c030873f1435b0e4b0a8b7568e9bebfc6055a3efca5e126f06
4
+ data.tar.gz: 104a7dbbe3bbbc108a79629cc81de2d341ddea2a74fc68716e07a38e3d3cf2c3
5
5
  SHA512:
6
- metadata.gz: acac0bbc26cda8e39742b91abde14386c0d6cb8f252aa7de3de65c69421f93c3db4ffb3026c6763f3328f901ba148451c7c3ee1fb71ca7548d09922f0e5c9b41
7
- data.tar.gz: b65b8dde72ab2ad7796a402d60ac2e351009adab266509797e71654129bcd7577edf821ef15bd5b6b065defaf6284a8cf7b827e975f9314146cf68772ff68a5b
6
+ metadata.gz: 72d111d79b2bc9a7420d78f0efa388730b7adf66545280a91af5f3fc3f69d0a234c6ccbab984cd01d800233aa7a6de3e5b7a8f7639e7df067b3bb528fd4885a4
7
+ data.tar.gz: dfef4fb22d0757f4bf1259d96309358111fd7eeacc08d621c52175d9e39cc4a395e3225a7420293bea7f870c5016918f0da80d852eb066d7c91e265f5c6ef509
data/.gitignore CHANGED
@@ -16,3 +16,23 @@ vendor/*
16
16
  tmp/*
17
17
  .rspec_status
18
18
  pkg/*.gem
19
+ bin/_guard-core
20
+ bin/aruba
21
+ bin/coderay
22
+ bin/cucumber
23
+ bin/cucumber-html-formatter
24
+ bin/gherkin
25
+ bin/gherkin-ruby
26
+ bin/git-fame
27
+ bin/htmldiff
28
+ bin/ldiff
29
+ bin/listen
30
+ bin/protoc-gen-ruby
31
+ bin/pry
32
+ bin/rougify
33
+ bin/rpc_server
34
+ bin/rubocop
35
+ bin/ruby-parse
36
+ bin/ruby-rewrite
37
+ bin/thor
38
+ ci/vendor/
@@ -66,3 +66,7 @@ Style/AsciiComments:
66
66
  Enabled: false
67
67
  Style/ConditionalAssignment:
68
68
  EnforcedStyle: assign_inside_condition
69
+ Lint/AmbiguousBlockAssociation:
70
+ Enabled: false
71
+ Style/Semicolon:
72
+ Enabled: false
@@ -1,4 +1,11 @@
1
1
  language: ruby
2
+ # cache:
3
+ # bundler: true
4
+ # directories:
5
+ # - $HOME/.rvm
6
+ # - $HOME/Library/Caches/Homebrew
7
+ before_cache:
8
+ - brew cleanup
2
9
  rvm:
3
10
  - 2.5.0
4
11
  - 2.6.2
@@ -7,7 +14,6 @@ os:
7
14
  - osx
8
15
  - linux
9
16
  gemfile:
10
- - Gemfile
11
17
  - ci/Gemfile.rubocop-0.80
12
18
  - ci/Gemfile.rubocop-0.81
13
19
  - ci/Gemfile.rubocop-0.82
@@ -17,13 +23,9 @@ gemfile:
17
23
  - ci/Gemfile.rubocop-0.85.1
18
24
  before_install:
19
25
  - yes | gem update --system --force
20
- - gem uninstall bundler
21
- - gem install bundler -v 2.1.4
22
- - bundle config git.allow_insecure true
26
+ - make dir fetch
23
27
  install:
24
28
  - bundle install
25
- - bundle exec rake setup
26
- - bundle exec rake git:config
27
29
  script:
28
30
  - bundle exec rake spec
29
31
  - bundle exec rake install
data/Gemfile CHANGED
@@ -1,16 +1,2 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
- ruby '>= 2.5.0'
5
-
6
- gemspec
7
-
8
- gem 'aruba'
9
- gem 'pry'
10
- gem 'rake', '~> 12.0'
11
- gem 'rspec', '~> 3.0'
12
- gem 'guard', require: false
13
- gem 'guard-rspec', require: false
14
-
15
- gem 'cli-ui', github: 'Shopify/cli-ui', ref: 'ef976df676f4', require: false
16
- gem 'git_fame', github: 'oleander/git-fame-rb', ref: 'a9b9c25bbab1', require: false
1
+ eval_gemfile(File.join(__dir__, "Gemfile.base"))
2
+ gem "rubocop", "~> 0.85"
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "guard", require: false
4
+ gem "guard-rspec", require: false
5
+ gem "gem-release", require: false
6
+
7
+ gemspec path: __dir__
@@ -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
2
  remote: .
23
3
  specs:
24
- rfix (1.0.7)
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)
@@ -111,9 +88,8 @@ GEM
111
88
  nenv (~> 0.1)
112
89
  shellany (~> 0.0)
113
90
  parallel (1.19.2)
114
- parser (2.7.1.3)
115
- ast (~> 2.4.0)
116
- progressbar (0.21.0)
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,18 +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
-
184
- RUBY VERSION
185
- ruby 2.5.0p0
155
+ rubocop (~> 0.85)
186
156
 
187
157
  BUNDLED WITH
188
158
  2.1.4
@@ -0,0 +1,13 @@
1
+ FAME=vendor/oleander/git-fame-rb
2
+ CLI=vendor/shopify/cli-ui
3
+ dir:
4
+ mkdir -p vendor
5
+ rm -rf vendor/shopify
6
+ rm -rf vendor/oleander
7
+ mkdir -p vendor/shopify
8
+ mkdir -p vendor/oleander
9
+ fetch:
10
+ git clone https://github.com/shopify/cli-ui $(CLI)
11
+ git --git-dir $(CLI)/.git --work-tree $(CLI) reset --hard ef976df676f4
12
+ git clone https://github.com/oleander/git-fame-rb $(FAME)
13
+ git --git-dir $(FAME)/.git --work-tree $(FAME) reset --hard a9b9c25bbab1
data/README.md CHANGED
@@ -1,39 +1,92 @@
1
- # Rfix [![Build Status](https://travis-ci.org/oleander/rfix-rb.svg?branch=master)](https://travis-ci.org/oleander/rfix-rb) ![Gem](https://img.shields.io/gem/dt/rfix)
1
+ # :bug: Rfix [![Build Status](https://travis-ci.org/oleander/rfix-rb.svg?branch=master)](https://travis-ci.org/oleander/rfix-rb) [![Gem](https://img.shields.io/gem/dt/rfix)](https://rubygems.org/gems/rfix)
2
2
 
3
- RuboCop CLI that only complains about your latest changes
3
+ 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`).
4
+
5
+ Includes a RuboCop formatter with syntax highlighting and build in hyperlinks for offense documentation.
6
+
7
+ Holds the same CLI arguments as RuboCop. Run `rfix --help` for a complete list or `rfix` for supported commands. Here are a few examples to get you started:
8
+
9
+ - `rfix local` Auto-fixes commits not yet pushed to upstream
10
+ - `rfix origin` Auto-fixes commits between `HEAD` and origin branch
11
+ - `rfix lint` Lints commits and untracked files not yet pushed to upstream
12
+
13
+ ![Printscreen](resources/ps.png)
4
14
 
5
15
  ## Installation
6
16
 
7
17
  ``` shell
8
- $ gem install rfix
9
- $ rfix <local|branch|origin|info|all> [--dry] [--help]
18
+ $ gem install rfix [--pre]
19
+ ```
20
+
21
+ ## Help
22
+
23
+ ``` shell
24
+ $ rfix branch "branch" # Fix changes made between HEAD and <branch>
25
+ $ rfix origin # Fix changes made between HEAD and origin branch
26
+ $ rfix local # Fix changes not yet pushed to upstream branch
27
+ $ rfix info # Display runtime dependencies and their versions
28
+ $ rfix all # Fix all files in this repository (not recommended)
29
+ $ rfix lint # Shortcut for 'rfix local --dry --untracked'
30
+ $ rfix # Displays this list of supported commands
10
31
  ```
11
32
 
33
+ ### Arguments
34
+
35
+ - `--dry` Turns off RuboCops autofix feature (read-only mode)
36
+ - `--help` Displays RubyCops and Rfix supported arguments
37
+ - `--list-files` List all files being passed to RubyCop
38
+ - `--untracked` Include files not tracked by git
39
+ - `--config` Configuration file, defaults to `.rubocop.yml`
40
+
12
41
  ## Development
13
42
 
14
- - `git clone https://github.com/oleander/rfix-rb`
15
- - `cd rfix-rb`
16
- - `bundle install`
17
- - `bundle exec rake setup`
18
- - `bundle exec rake local`
19
- - `bundle exec rake spec`
43
+ ### Setup
44
+
45
+ 1. Download repository
46
+ - `$ git clone https://github.com/oleander/rfix-rb`
47
+ - `$ cd rfix-rb`
48
+ 2. Downloads fixtures and run time dependencies
49
+ - `$ make dir fetch`
50
+ - `$ bundle install`
51
+
52
+ ### Install from repository
53
+
54
+ ``` shell
55
+ $ bundle exec rake install
56
+ ```
57
+
58
+ ### Run tests
59
+
60
+ ``` shell
61
+ $ bundle exec rake spec
62
+ ```
20
63
 
21
64
  ## Overcommit
22
65
 
66
+ Add the following to your `.overcommit.yml`, then run `overcommit --install` and `overcommit --sign pre-commit`. Lints commits not yet pushed to your upstream branch whenever `git commit` is ran.
67
+
23
68
  ``` yaml
24
69
  PreCommit:
25
70
  RFix:
26
71
  enabled: true
27
- command: ["rfix", "local", "--untracked", "--dry"]
28
- description: "Lint changes since last push using RuboCop"
72
+ command: ["rfix", "lint"]
73
+ description: "Lint unchanged commits using RuboCop"
29
74
  parallelize: true
30
75
  ```
31
76
 
77
+ ### From scratch
78
+
79
+ 1. `gem install overcommit rfix`
80
+ 2. `curl https://raw.githubusercontent.com/oleander/rfix-rb/master/resouces/overcommit.yml > .overcommit.yml`
81
+ 3. `overcommit --install`
82
+ 4. `overcommit --sign pre-commit`
83
+
84
+ Run `overcommit --run` to test the new hook.
85
+
32
86
  ## Contributing
33
87
 
34
88
  Bug reports and pull requests are welcome on GitHub at https://github.com/oleander/rfix.
35
89
 
36
-
37
90
  ## License
38
91
 
39
92
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -3,58 +3,39 @@
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
5
  require 'fileutils'
6
- require 'rfix'
7
-
8
- include Rfix::Log
9
- include Rfix::Cmd
6
+ require "rfix"
7
+ require_relative "lib/rfix/rake_helper"
10
8
 
11
9
  RSpec::Core::RakeTask.new(:spec)
12
-
13
- def source_for(name:)
14
- bundle_root = Bundler.bundle_path.join('bundler/gems')
15
- path = Dir.glob(bundle_root.join("#{name}-*").to_s).first
16
- path or raise "Could not find source for #{name}, run bundle install first"
17
- end
18
-
19
- def dest_for(name:)
20
- File.join(__dir__, 'vendor', name)
21
- end
22
-
23
- def setup(gem:)
24
- say "Setup gem {{yellow:#{gem}}}"
25
- Bundler.setup(gem)
26
-
27
- source = source_for(name: gem)
28
- say "Load source {{yellow:#{source}}}"
29
-
30
- dest = dest_for(name: gem)
31
- say "Load dest {{yellow:#{dest}}}"
32
-
33
- FileUtils.mkdir_p(dest)
34
- say "Copy files"
35
- FileUtils.copy_entry source, dest, true, true, true
36
- end
10
+ extend RakeHelper
37
11
 
38
12
  task default: :spec
39
13
 
40
- task :bundle_install do
41
- say "Running bundle install"
42
- cmd "bundle install"
43
- end
14
+ desc "Install gems not in the gemspec or gemfile"
15
+ namespace :vendor do
16
+ task :download do
17
+ say "Download external gems, hold on ..."
18
+ clone(github: "shopify/cli-ui", ref: "ef976df676f4")
19
+ clone(github: "oleander/git-fame-rb", ref: "a9b9c25bbab1")
20
+ end
44
21
 
45
- task setup: [:bundle_install] do
46
- setup(gem: "cli-ui")
47
- setup(gem: "git-fame-rb")
22
+ task :clear do
23
+ say "Remove and create vendor folder"
24
+ FileUtils.remove_dir("vendor/shopify")
25
+ FileUtils.remove_dir("vendor/oleander")
26
+ end
48
27
  end
49
28
 
50
- def osx?
51
- ENV.fetch("TRAVIS_OS_NAME") == "osx"
29
+ desc "Install dependencies in the correct order"
30
+ namespace :bundle do
31
+ task :install do
32
+ say "Running {{command:bundle install}} with gemspec"
33
+ cmd "bundle install"
34
+ end
52
35
  end
53
36
 
54
- def brew_url(ref:)
55
- "https://raw.githubusercontent.com/Homebrew/homebrew-core/#{ref}/Formula/git.rb"
56
- end
57
37
 
38
+ desc "Set user.* for global git user"
58
39
  namespace :git do
59
40
  task :config do
60
41
  cmd("git config --global user.email hello@world.com")
@@ -79,15 +60,44 @@ namespace :git do
79
60
  end
80
61
  end
81
62
 
82
- namespace :update do
83
- task :gemfiles do
84
- Dir.glob("ci/Gemfile*").unshift("Gemfile").reject do |path|
85
- File.extname(path) == ".lock"
86
- end.each do |gemfile|
63
+ namespace :gemfile do
64
+ task :update do
65
+ gemfiles.each do |gemfile|
87
66
  say "Update #{gemfile}"
88
67
  cmd("bundle", "update", "--gemfile", gemfile)
89
68
  end
90
69
  end
70
+
71
+ namespace :locks do
72
+ task :clear do
73
+ gemlocks.each do |lock|
74
+ say "Remove #{lock}"
75
+ FileUtils.remove_file(lock, true)
76
+ end
77
+ end
78
+ end
79
+
80
+ task :install do
81
+ gemfiles.each do |gemfile|
82
+ say "Bundle install #{gemfile}"
83
+ cmd("bundle", "install", "--gemfile", gemfile)
84
+ end
85
+ end
86
+
87
+ task commit: :update do
88
+ cmd("git", "commit", "-a", "-m", "Ran bundle install")
89
+ end
90
+ end
91
+
92
+ task :rehash do
93
+ cmd("rbenv", "rehash")
94
+ end
95
+
96
+ task :bump do
97
+ cmd("gem", "bump", "-c", "-m", "Bump version to %{version}")
91
98
  end
92
99
 
100
+ task clear: ["vendor:clear", "gemfile:locks:clear"]
101
+ task setup: ["vendor:download", "gemfile:install", "gemfile:update"]
93
102
  task local: [:setup, :install]
103
+ task reset: [:clear, :setup]