blinkbox-rubocop 0.0.0
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 +15 -0
- data/.gitignore +22 -0
- data/.travis.yml +13 -0
- data/CHANGELOG.md +54 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +54 -0
- data/Rakefile +11 -0
- data/VERSION +1 -0
- data/bin/bbrubocop +40 -0
- data/blinkbox-rubocop.gemspec +25 -0
- data/lib/blinkbox/rubocop.rb +41 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YTQyYzQwMGNkZDAyOTcwMDE4NTMyMzg4NGIyMWQzMmVhOTI3MGI5MQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZWJhMzhmMjZiZWI5MGJlNzBiMDM1ODhmYzE3YzBjYmUzNGNlNWU3MQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZGZkZjJlZDZjMzBjMjEyNDhhNWQ4NWRhNzJmMzA2Mjg4ZGU1ZTA1YzA3OTJi
|
10
|
+
NDUwMjJjOTU4NzA1M2QwYjI4MjRkYTMxMDUyOTk0ZDg2NWIxODNlMDVjMzI4
|
11
|
+
MTUwNzU4ZjU4ZDQzMjFiNmEyZTI0MDhhOGQ0MDQyMGRmNDRjNjQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MWY4YmY3ZjYzOGRiNzY3MDVkNTFhMTRmNTM1NzRjNjZlMjliMjUxMDliOGQ2
|
14
|
+
NjhhMjg0MTc3NzlmOWZkNzMzMjZhMWFlNjRmMDAzNzk3MDJiMDMxMmIyN2Zm
|
15
|
+
YzMyZmI4YTRlNTZkNzgxYmNlMDdlOWU5Y2FkNzcxNWNjZDFjMGE=
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.travis.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.0.0
|
4
|
+
- 2.1.2
|
5
|
+
deploy:
|
6
|
+
provider: rubygems
|
7
|
+
api_key:
|
8
|
+
secure: ZSY3ckX44CNSYLWdB3T/RK6iOThMQ6dia/arXt4Lb2+F2PnLYmWzTap0+VfgywZW3PcBzPlkyJ/W6KAKqcXwoX932SzG1UCJvUR70ipidQYQKPxc1UC2QriA9hMCjrC/dDtV/T/UVq1VBPykBspSljbJ87RV8DJBgHrrv66k5Xk=
|
9
|
+
gem: blinkbox-rubocop
|
10
|
+
on:
|
11
|
+
repo: blinkboxbooks/blinkbox-rubocop.rb
|
12
|
+
rvm: 2.1.2
|
13
|
+
branch: master
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Change log
|
2
|
+
|
3
|
+
## 0.1.1 ([#9](https://git.mobcastdev.com/TEST/blinkbox-rubocop/pull/9) 2015-01-26 18:53:53)
|
4
|
+
|
5
|
+
Add support for running on Grisham (CI)
|
6
|
+
|
7
|
+
Patch to add support for running on CI and checking out with OAuth tokens.
|
8
|
+
|
9
|
+
## 0.1.0 ([#8](https://git.mobcastdev.com/TEST/blinkbox-rubocop/pull/8) 2014-11-17 10:55:17)
|
10
|
+
|
11
|
+
Minor feature: Added --git-diff option, which will run rubocop on locally changed files
|
12
|
+
|
13
|
+
new feature
|
14
|
+
|
15
|
+
## 0.0.6 ([#6](https://git.mobcastdev.com/TEST/blinkbox-rubocop/pull/6) 2014-11-14 17:36:01)
|
16
|
+
|
17
|
+
added tip on how to run bbrubocop only on files with changes against HEAD
|
18
|
+
|
19
|
+
patch
|
20
|
+
|
21
|
+
## 0.0.5 ([#5](https://git.mobcastdev.com/TEST/blinkbox-rubocop/pull/5) 2014-10-13 15:48:04)
|
22
|
+
|
23
|
+
improvement: added support for arguments
|
24
|
+
|
25
|
+
Patch
|
26
|
+
|
27
|
+
## 0.0.4 ([#4](https://git.mobcastdev.com/TEST/blinkbox-rubocop/pull/4) 2014-10-13 14:54:42)
|
28
|
+
|
29
|
+
Yo dawg, I heard you like rubocop, so I ran rubocop against your rubocop...
|
30
|
+
|
31
|
+
... wrapper so you can lint whilst you lint
|
32
|
+
|
33
|
+
Patch
|
34
|
+
|
35
|
+
## 0.0.3 ([#3](https://git.mobcastdev.com/TEST/blinkbox-rubocop/pull/3) 2014-09-08 09:43:38)
|
36
|
+
|
37
|
+
Read VERSION from correct folder
|
38
|
+
|
39
|
+
Improvement
|
40
|
+
|
41
|
+
## 0.0.2 ([#2](https://git.mobcastdev.com/TEST/blinkbox-rubocop/pull/2) 2014-08-29 15:12:37)
|
42
|
+
|
43
|
+
Use the version from the root file
|
44
|
+
|
45
|
+
### Bug fix
|
46
|
+
|
47
|
+
- Use the `VERSION` file so the gems are correctly version numbered.
|
48
|
+
|
49
|
+
## 0.0.1 ([#1](https://git.mobcastdev.com/TEST/blinkbox-rubocop/pull/1) 2014-08-27 17:08:46)
|
50
|
+
|
51
|
+
Documentation
|
52
|
+
|
53
|
+
Patch
|
54
|
+
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 blinkbox Books Ltd.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Blinkbox::Rubocop
|
2
|
+
|
3
|
+
An easy to use wrapper for Rubocop, and Blinkbox code styles. Rather than faff about with
|
4
|
+
storing config files, and passing commandline switches to Rubocop; just install this.
|
5
|
+
|
6
|
+
Under the hood, it'll automagically check out the latest code styles, and instruct Rubocop
|
7
|
+
to run with them.
|
8
|
+
|
9
|
+
Future scoping of this could include the auto deployment of custom in-house Rubocop Cop files.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'blinkbox-rubocop'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install blinkbox-rubocop --source "http://artifactory.blinkbox.local/artifactory/api/gems/bbb-gems/"
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
From within the code project you wish to evaluate
|
28
|
+
|
29
|
+
```
|
30
|
+
$ bbrubocop
|
31
|
+
```
|
32
|
+
|
33
|
+
Alternatively you can pass rubocop a list of files and directories to check:
|
34
|
+
|
35
|
+
```
|
36
|
+
$ bbrubocop lib/blinkbox/rubocop.rb bin
|
37
|
+
```
|
38
|
+
|
39
|
+
To run only on files with local changes - [tracked, staged and unstaged, changes against current HEAD](http://stackoverflow.com/questions/5096268/git-reports-get-changed-files)
|
40
|
+
```
|
41
|
+
$ bbrubocop --git-diff
|
42
|
+
# or
|
43
|
+
$ bbrubocop -g
|
44
|
+
```
|
45
|
+
|
46
|
+
For more details check the available command-line options:
|
47
|
+
|
48
|
+
```
|
49
|
+
$ bbrubocop -h
|
50
|
+
```
|
51
|
+
|
52
|
+
## TODOs
|
53
|
+
|
54
|
+
Add in a Rake task handler
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.1
|
data/bin/bbrubocop
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH << File.join(__dir__, "../lib")
|
3
|
+
require 'blinkbox/rubocop'
|
4
|
+
|
5
|
+
puts "Blinkbox-Rubocop v#{Blinkbox::Rubocop::VERSION}"
|
6
|
+
|
7
|
+
CONFIG_DIR = File.expand_path(File.join("~", ".bbrubocop"))
|
8
|
+
|
9
|
+
if Dir.exist?(CONFIG_DIR)
|
10
|
+
Blinkbox::Rubocop.update_config(CONFIG_DIR)
|
11
|
+
else
|
12
|
+
Blinkbox::Rubocop.checkout_config(CONFIG_DIR)
|
13
|
+
end
|
14
|
+
|
15
|
+
# TODO: Handle alternative config files once we have them
|
16
|
+
@config_file = File.join(CONFIG_DIR, "blinkbox_platform.yml")
|
17
|
+
|
18
|
+
# adding --git-diff option to run on locally changed files compared to git remote HEAD
|
19
|
+
require 'optparse'
|
20
|
+
files = ''
|
21
|
+
opt_parser = OptionParser.new do |opts|
|
22
|
+
opts.banner = 'Usage: bbrubocop [-g|--git-diff] [file1, file2, folder1, ...]'
|
23
|
+
opts.separator ''
|
24
|
+
|
25
|
+
opts.on('-g', '--git-diff',
|
26
|
+
'run on locally changed files compared to git remote HEAD') do
|
27
|
+
files = %x[ git diff --name-only HEAD | tr "\\n", " " ]
|
28
|
+
puts "Git detected changes in: #{files}"
|
29
|
+
if files.empty? && ARGV.empty?
|
30
|
+
puts 'No files to check, quiting...'
|
31
|
+
exit 0
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
opt_parser.parse!(ARGV)
|
36
|
+
file_list = files + ARGV.join(' ')
|
37
|
+
|
38
|
+
rubocop_command = "rubocop -D -c #{@config_file} #{file_list}"
|
39
|
+
puts "Running rubocop with arguments: #{rubocop_command}"
|
40
|
+
Kernel.exec(rubocop_command)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "blinkbox/rubocop"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "blinkbox-rubocop"
|
8
|
+
spec.version = Blinkbox::Rubocop::VERSION
|
9
|
+
spec.authors = ["Muz"]
|
10
|
+
spec.email = ["muz@blinkbox.com"]
|
11
|
+
spec.summary = %q{Blinkbox wrappers and guff for Rubocop}
|
12
|
+
spec.description = %q{Automagic management of Rubocop config, custom cops, and execution}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "rubocop", "0.24.1"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# General namespace. See the Rubocop module.
|
2
|
+
module Blinkbox
|
3
|
+
# Helper methods for setting up, configuring and running Rubocop.
|
4
|
+
module Rubocop
|
5
|
+
begin
|
6
|
+
# Set the Gem Version
|
7
|
+
VERSION = File.read(File.join(__dir__, '../../VERSION')).strip
|
8
|
+
rescue
|
9
|
+
VERSION = "0.0.0"
|
10
|
+
end
|
11
|
+
|
12
|
+
# Configures the URL that git clones the config from
|
13
|
+
def self.config_repo_url
|
14
|
+
if ENV['GITHUB_TOKEN'] # For CI jobs
|
15
|
+
"https://#{ENV['GITHUB_TOKEN']}@git.mobcastdev.com/TEST/rubocop_config.git"
|
16
|
+
else # Assumes that you're previously authenticated for this HTTP host. TODO: SSH support.
|
17
|
+
"https://git.mobcastdev.com/TEST/rubocop_config.git"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Attempts to update an existing checkout of the config files via git.
|
22
|
+
def self.update_config(config_dir)
|
23
|
+
puts "Updating checked out Rubocop config..."
|
24
|
+
current_dir = Dir.pwd
|
25
|
+
|
26
|
+
begin
|
27
|
+
Dir.chdir(config_dir)
|
28
|
+
`git pull -q origin master`
|
29
|
+
Dir.chdir(current_dir)
|
30
|
+
rescue
|
31
|
+
puts "Failed to update config in #{config_dir}. Try removing it and re-running?"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attempts to checkout a clean copy of the config files via git.
|
36
|
+
def self.checkout_config(config_dir)
|
37
|
+
puts "Checking out Rubocop config..."
|
38
|
+
`git clone -q #{Blinkbox::Rubocop.config_repo_url} #{config_dir}`
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blinkbox-rubocop
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Muz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.24.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.24.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Automagic management of Rubocop config, custom cops, and execution
|
56
|
+
email:
|
57
|
+
- muz@blinkbox.com
|
58
|
+
executables:
|
59
|
+
- bbrubocop
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- .travis.yml
|
65
|
+
- CHANGELOG.md
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- VERSION
|
71
|
+
- bin/bbrubocop
|
72
|
+
- blinkbox-rubocop.gemspec
|
73
|
+
- lib/blinkbox/rubocop.rb
|
74
|
+
homepage: ''
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.4.5
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Blinkbox wrappers and guff for Rubocop
|
98
|
+
test_files: []
|