forked from danger/danger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
47 lines (41 loc) · 1.32 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
begin
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:specs)
require "rubocop/rake_task"
RuboCop::RakeTask.new
rescue LoadError
puts "Please use `bundle exec` to get all the rake commands"
end
task default: %w(rubocop spec)
desc "Danger's tests"
task :spec do
Rake::Task["specs"].invoke
Rake::Task["spec_docs"].invoke
end
desc "Tests that the core documentation is up to snuff"
task :spec_docs do
core_plugins = Dir.glob("lib/danger/danger_core/plugins/*.rb")
sh "danger plugins lint #{core_plugins.join ' '}"
sh "danger systems ci_docs"
end
desc "I do this so often now, better to just handle it here"
task :guard do |task|
sh "bundle exec guard"
end
desc "Runs chandler for current version"
task :chandler do
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "danger/version"
if ENV["CHANDLER_GITHUB_API_TOKEN"]
sh "bundle exec chandler push #{Danger::VERSION}"
elsif ENV["DANGER_GITHUB_API_TOKEN"]
sh "CHANDLER_GITHUB_API_TOKEN=#{ENV['DANGER_GITHUB_API_TOKEN']} bundle exec chandler push #{Danger::VERSION}"
else
puts "Skipping chandler due to no `CHANDLER_GITHUB_API_TOKEN` or `DANGER_GITHUB_API_TOKEN` in the ENV."
end
end
Rake::Task["release"].enhance do
Rake::Task["chandler"].invoke
end