-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
67 lines (61 loc) · 2.17 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
# frozen_string_literal: true
require 'bundler/gem_tasks'
# rubocop:disable Metrics/BlockLength
namespace :test do
desc 'Push template to organization (set ENV[GITHUB_ACCESS_TOKEN] and ENV[GITHUB_ORG_NAME])'
task :push_template do
require 'huborg'
client = Huborg::Client.new(
github_access_token: ENV.fetch('GITHUB_ACCESS_TOKEN'),
org_names: ENV.fetch('GITHUB_ORG_NAME')
)
client.push_template!(
template: __FILE__,
filename: "disposable-#{Time.now.utc.to_s.gsub(/\D+/, '')}.rake"
)
end
task :clone_and_rebase do
require 'huborg'
client = Huborg::Client.new(
github_access_token: ENV.fetch('GITHUB_ACCESS_TOKEN'),
org_names: ENV.fetch('GITHUB_ORG_NAME')
)
directory = ENV.fetch('DIRECTORY') { File.join(ENV.fetch('HOME'), 'git') }
client.clone_and_rebase!(directory: directory)
end
task :audit_license do
require 'huborg'
client = Huborg::Client.new(
github_access_token: ENV.fetch('GITHUB_ACCESS_TOKEN'),
org_names: ENV.fetch('GITHUB_ORG_NAME')
)
client.audit_license
end
task :mailmap do
require 'huborg'
client = Huborg::Client.new(
github_access_token: ENV.fetch('GITHUB_ACCESS_TOKEN'),
org_names: ENV.fetch('GITHUB_ORG_NAME')
)
client.synchronize_mailmap!(template: ENV.fetch('MAILMAP_TEMPLATE_FILENAME'))
end
end
require 'github_changelog_generator/task'
# rubocop:disable Metrics/LineLength
desc 'Generate CHANGELOG.md based on lib/huborg/version.md (change that to the new version before you run rake changelog)'
# rubocop:enable Metrics/LineLength
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
begin
ENV.fetch('CHANGELOG_GITHUB_TOKEN')
rescue KeyError
warn %(To run `rake changelog` you need to have a CHANGELOG_GITHUB_TOKEN)
warn %(set in ENV. (`export CHANGELOG_GITHUB_TOKEN="«your-40-digit-github-token»"`))
exit!(1)
end
config.user = 'samvera-labs'
config.project = 'huborg'
config.since_tag = 'v0.1.0' # The changes before v0.1.0 were not as helpful
config.future_release = %(v#{ENV.fetch('FUTURE_RELEASE', Huborg::VERSION)})
config.base = 'CHANGELOG.md'
end
# rubocop:enable Metrics/BlockLength