-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
57 lines (47 loc) · 1.5 KB
/
Rakefile
File metadata and controls
57 lines (47 loc) · 1.5 KB
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
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
desc 'Run specs'
RSpec::Core::RakeTask.new(:spec) do |t|
t.verbose = false
t.rspec_opts = ['--format documentation',
'-t ~@skip-ci',
'--failure-exit-code 1']
end
desc 'Run rubocop'
RuboCop::RakeTask.new(:rubocop) do |t|
t.fail_on_error = true
t.verbose = false
t.formatters = ['RuboCop::Formatter::SimpleTextFormatter']
t.options = ['-D']
end
desc 'Run things for ci'
task :ci do
puts "\033[34mRunning rubocop:\033[0m"
Rake::Task['rubocop'].invoke
puts
puts "\033[34mRunning rspec:\033[0m"
Rake::Task['spec'].invoke
end
# simple rake task to output a changelog between two commits, tags ...
# output is formatted simply, commits are grouped under each author name
#
desc 'generate changelog with nice clean output'
task :changelog, :since_c, :until_c do |_, args|
since_c = args[:since_c] || `git tag | head -1`.chomp
until_c = args[:until_c]
cmd = `git log --pretty='format:%ci::%an <%ae>::%s::%H' #{since_c}..#{until_c}`
entries = {}
changelog_content = ''
cmd.split("\n").each do |entry|
_, author, subject, hash = entry.chomp.split('::')
entries[author] ||= []
entries[author] << "#{subject} (#{hash})" unless subject =~ /Merge/
end
# generate clean output
entries.keys.each do |author|
changelog_content += "#{author}\n"
entries[author].reverse.each { |entry| changelog_content += " * #{entry}\n" }
end
puts changelog_content
end