Skip to content

Instantly share code, notes, and snippets.

@dtrce
Created March 27, 2014 03:43
Show Gist options
  • Save dtrce/9799692 to your computer and use it in GitHub Desktop.
Save dtrce/9799692 to your computer and use it in GitHub Desktop.
code climate script
#!/usr/bin/env ruby
require 'fileutils'
if Dir.exists?(ENV['CODECLIMATE_PATH']) == false
abort "CODECLIMATE_PATH variable not set or invalid path"
end
@cc_path = ENV['CODECLIMATE_PATH']
@repo_name = Dir.pwd.split('/').last
@cc_repo_path = "#{@cc_path}/#{@repo_name}"
if Dir.exists?("#{@cc_repo_path}") == false
Dir.mkdir("#{@cc_repo_path}")
end
pipe = IO.popen("git ls-files -om --exclude-standard")
while (line = pipe.gets)
@file = line.strip()
if File.exist?(@file) == true
FileUtils.cp(@file, @cc_repo_path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment