forked from lstejskal/adapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
65 lines (53 loc) · 1.53 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
require 'bundler/gem_tasks'
require 'rake'
task :default do
# run examples using current gem environment
# example: rake example=find_campaigns
#
if ENV.keys.include?("example")
ENV["example"] += ".rb" unless ENV["example"] =~ /\.rb$/
exec "ruby -Ilib examples/%s" % ENV["example"]
# load example into irb using current gem environment
# example: rake irb=find_campaigns
#
elsif ENV.keys.include?("irb")
exec "irb -Ilib -Iexamples -r%s" % ENV["irb"].gsub(/\.rb$/, '')
# run default task: test
#
else
Rake::Task['test'].invoke
end
end
### Tests ###
# run all tests except integrations tests
#
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << %w{ lib test }
test.pattern = 'test/unit/*_test.rb'
test.verbose = true
end
require 'rake/testtask'
Rake::TestTask.new(:"test:integration") do |test|
test.libs << %w{ lib test }
test.pattern = 'test/integration/*_test.rb'
test.verbose = true
end
### Documentation ###
require 'yard'
require 'yard/rake/yardoc_task'
desc "Generate documentation"
task :doc => 'doc:generate'
namespace :doc do
GEM_ROOT = File.dirname(__FILE__)
RDOC_ROOT = File.join(GEM_ROOT, 'doc')
YARD::Rake::YardocTask.new(:generate) do |rdoc|
rdoc.files = Dir.glob(File.join(GEM_ROOT, 'lib', '**', '*.rb')) +
[ File.join(GEM_ROOT, 'README.md') ]
rdoc.options = ['--output-dir', RDOC_ROOT, '--readme', 'README.md']
end
desc "Remove generated documentation"
task :clobber do
FileUtils.rm_rf(RDOC_ROOT) if File.exists?(RDOC_ROOT)
end
end