forked from mileszs/wicked_pdf
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
59 lines (52 loc) · 1.48 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
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'rails/version'
require 'bundler/gem_tasks'
desc 'Default: run unit tests.'
task :default => [:setup_and_run_tests, :rubocop]
desc 'Test the wicked_pdf plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Run RuboCop'
task :rubocop do
next unless RUBY_VERSION >= '2.0.0'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end
desc 'Setup and run all tests'
task :setup_and_run_tests do
unless File.exist?('test/dummy/config/environment.rb')
Rake::Task[:dummy_generate].invoke
end
Rake::Task[:test].invoke
end
desc 'Generate dummy application for test cases'
task :dummy_generate do
Rake::Task[:dummy_remove].invoke
puts 'Creating dummy application to run tests'
if Rails::VERSION::MAJOR > 2
system('rails new test/dummy --database=sqlite3')
else
system('rails test/dummy')
end
system('touch test/dummy/db/schema.rb')
FileUtils.cp 'test/fixtures/database.yml', 'test/dummy/config/'
FileUtils.rm_r Dir.glob('test/dummy/test/*')
end
desc 'Remove dummy application'
task :dummy_remove do
FileUtils.rm_r Dir.glob('test/dummy/*')
end
desc 'Generate documentation for the wicked_pdf gem.'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'WickedPdf'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/**/*.rb')
end