forked from soffes/hue
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
67 lines (57 loc) · 1.46 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "bundler/gem_tasks"
FileList["tasks/**/*.rake"]
.map { |fname| File.expand_path(fname) }
.sort
.each do |fname|
load fname
end
# Define a task named `name` that runs all tasks under an identically
# named `namespace`.
def parent_task(name)
task name do
::Rake::Task
.tasks
.select { |t| t.name =~ /^#{name}:/ }
.sort { |a, b| a.name <=> b.name }
.each(&:execute)
end
end
desc "Open a Ruby console to Pry."
task :console do
# rubocop:disable Lint/Debugger
require "pry"
binding.pry
# rubocop:enable Lint/Debugger
end
namespace :lint do
desc "Run Rubocop against the codebase."
task :rubocop do
require "yaml"
sh "rubocop --display-cop-names"
end
desc "Run bundler-audit against the Gemfile."
task :'bundler-audit' do
require "bundler/audit/cli"
%w(update check).each do |command|
Bundler::Audit::CLI.start [command]
end
end
have_cloc = `which cloc`.strip != ""
if have_cloc
desc "Show LOC metrics for project using cloc."
task :cloc do
sh "cloc . --exclude-dir=etc,reference,.bundle,tmp"
end
end
desc "Check for outdated gems."
task :bundler do
# Don't error-out if this fails, since we may not be able to update some
# deps.
sh "bundle outdated || true"
end
end
desc "Run all lint checks against the code."
parent_task :lint
task default: [:lint]