-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
82 lines (71 loc) · 3.29 KB
/
Rakefile
File metadata and controls
82 lines (71 loc) · 3.29 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# vim: set ft=ruby :
require 'corundum/tasklibs'
# This Rakefile makes use of the Corundum tasklibs to parameterize lots and
# lots of tasks to build your gem. Most of this is (minimal) boilerplate, but
# there are some places where you can configure exactly how the tasks should
# work.
#
# If you haven't seen the pattern before, simply instantiating the tasklib
# class (i.e. SomeTasklib.new) is enough to create all the tasks it's
# responsible for. If you do need to configure a tasklib, you can give ::new a
# block which will receive the tasklib to configure. c.f. QuestionableContent
# for an example.
#
# (Further docs for all the Corundum tasklibs will be coming to an Internet
# near you real soon now.)
module Corundum
Corundum::register_project(__FILE__)
# The Core tasklib coordinates the other tasks. Generally it doesn't need any
# configuration.
core = Core.new
core.in_namespace do
# The GemspecFiles tasklib is responsible for checking that all the files
# necessary for your gem are listed in the Gemfile. Usually you don't need
# to add any configuration. Of note is the "extra_files" configuration - a
# list of files that need to be included but that Corundum might not be
# able to detect on its own.
GemspecFiles.new(core)
# QuestionableContent searches codefiles for words (especially in comments)
# that you might not want going out into the world. Note that QC is added 4
# times by default with different types of text.
#
# If QC is wrong about something (e.g. there's a completely legitimate
# reason that 'p' appears on a line) You can tag the line with an '#ok'
# comment to have QC ignore it.
# This default checks for unacceptable language (of both the profanity
# and -ism varieties) before release, as well as debugging statements
# like debugger, byebug, puts, p, etc. accidentally left in the code.
#
# Also available: 'unfinished': TODO and XXX
["debug", "profanity", "ableism", "racism"].each do |type|
QuestionableContent.new(core) do |content|
content.type = type
end
end
# Corundum won't let you release a gem where any tests fail. By default, it
# assumes RSpec is used to test the project (alternative implementations
# are anxiously encouraged!)
rspec = RSpec.new(core)
# To make sure that tests don't just pass because they're incomplete,
# Corundum also requires a coverage threshold, which we measure with
# Simplecov. Coverage also figures into how we determine that files should
# be in the gemspec (covered files should be included, and included files
# should be covered)
SimpleCov.new(core, rspec) do |cov|
cov.threshold = 85
end
# The tasks to actually take code + gemspec and package into a gem. All its
# configuration should be determined by the gemspec itself.
gem = GemBuilding.new(core)
# Tasks for uploading gems to rubygems.com - called GemCutter for
# historical reasons.
GemCutter.new(core,gem)
# We require that the code for a gem be pushed before releasing, and tag
# the branch with the version of the gem automatically. Corundum assumes
# Git for version control - alternatives encouraged.
Git.new(core) do |vc|
vc.branch = "master"
end
end
end
task :default => [:release]