module Blinkbox::Rubocop

 Helper methods for setting up, configuring and running Rubocop.

Constants

VERSION

 Set the Gem Version

Public Class Methods

checkout_config(config_dir) click to toggle source

Attempts to checkout a clean copy of the config files via git.

# File lib/blinkbox/rubocop.rb, line 36
def self.checkout_config(config_dir)
  puts "Checking out Rubocop config..."
  `git clone -q #{Blinkbox::Rubocop.config_repo_url} #{config_dir}`
end
config_repo_url() click to toggle source

 Configures the URL that git clones the config from

# File lib/blinkbox/rubocop.rb, line 13
def self.config_repo_url
  if ENV['GITHUB_TOKEN'] # For CI jobs
    "https://#{ENV['GITHUB_TOKEN']}@git.mobcastdev.com/TEST/rubocop_config.git"
  else # Assumes that you're previously authenticated for this HTTP host. TODO: SSH support.
    "https://git.mobcastdev.com/TEST/rubocop_config.git"
  end
end
update_config(config_dir) click to toggle source

 Attempts to update an existing checkout of the config files via git.

# File lib/blinkbox/rubocop.rb, line 22
def self.update_config(config_dir)
  puts "Updating checked out Rubocop config..."
  current_dir = Dir.pwd

  begin
    Dir.chdir(config_dir)
    `git pull -q origin master`
    Dir.chdir(current_dir)
  rescue
    puts "Failed to update config in #{config_dir}. Try removing it and re-running?"
  end
end