-
Notifications
You must be signed in to change notification settings - Fork 590
/
Copy pathRakefile
111 lines (88 loc) · 2.01 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# frozen_string_literal: true
require 'rubygems'
require 'date'
require 'open3'
task :build do
sh('cargo build --release')
end
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
require 'rake/testtask'
Rake::TestTask.new(minitests: :build) do |t|
t.test_files = FileList['minitests/**/test_*.rb']
t.verbose = true
end
task test: %i[build spec minitests]
task rspec: %i[build spec]
task minitest: %i[build without_rspec] do
begin
Rake::Task['minitests'].execute
ensure
Rake::Task['with_rspec'].execute
end
end
rescue LoadError
end
task :without_rspec do
sh('bundle config set without rspec')
end
task :with_rspec do
sh('bundle config unset without')
end
def rubocop(fix:)
sh "bundle exec rubocop #{'-a' if fix} lib spec minitests " \
'Rakefile hypothesis-specs.gemspec'
end
task :checkformat do
rubocop(fix: false)
end
task :format do
rubocop(fix: true)
end
begin
require 'yard'
YARD::Rake::YardocTask.new(:runyard) do |t|
t.files = [
'lib/hypothesis.rb', 'lib/hypothesis/errors.rb',
'lib/hypothesis/possible.rb'
]
t.options = ['--markup=markdown', '--no-private']
end
task doc: :runyard do
YARD::Registry.load
objs = YARD::Registry.select do |o|
is_private = false
t = o
until t.root?
if t.visibility != :public
is_private = true
break
end
t = t.parent
end
!is_private && o.docstring.blank?
end
objs.sort_by! { |o| o.name.to_s }
unless objs.empty?
abort "Undocumented objects: #{objs.map(&:name).join(', ')}"
end
end
rescue LoadError
end
GEMSPEC = 'hypothesis-specs.gemspec'
RELEASE_FILE = 'RELEASE.md'
CHANGELOG = 'CHANGELOG.md'
def run_for_output(*args)
out, result = Open3.capture2(*args)
abort if result.exitstatus != 0
out.strip
end
task :clean do
sh 'git clean -fdx lib'
sh 'rm -rf hypothesis-specs*.gem'
sh 'rm -rf ../target'
end
task gem: :clean do
sh 'gem build hypothesis-specs.gemspec'
end