Sha256: 8910c32e34eb2a513fd0697305cf4543ba560b8baf7c4034cf53756dc6952ba8

Contents?: true

Size: 1.66 KB

Versions: 7

Compression:

Stored size: 1.66 KB

Contents

require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'rails/version'
require 'bundler/gem_tasks'

desc 'Default: run unit tests.'
task :default => %i[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
  require 'rubocop/rake_task'
  RuboCop::RakeTask.new
end

desc 'Setup and run all tests'
task :setup_and_run_tests do
  Rake::Task[:dummy_generate].invoke unless File.exist?('test/dummy/config/environment.rb')
  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'
  system('rails new test/dummy --database=sqlite3')
  system('touch test/dummy/db/schema.rb')
  FileUtils.cp 'test/fixtures/database.yml', 'test/dummy/config/'
  FileUtils.rm_r Dir.glob('test/dummy/test/*')

  # rails 6 needs this to be present before start:
  FileUtils.mkdir_p('test/dummy/app/assets/config')
  FileUtils.mkdir_p('test/dummy/app/assets/javascripts')
  FileUtils.cp 'test/fixtures/manifest.js', 'test/dummy/app/assets/config/'
  FileUtils.cp 'test/fixtures/wicked.js', 'test/dummy/app/assets/javascripts/'
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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wicked_pdf-2.8.2 Rakefile
wicked_pdf-2.8.1 Rakefile
wicked_pdf-2.8.0 Rakefile
wicked_pdf-2.7.0 Rakefile
wicked_pdf-2.6.3 Rakefile
wicked_pdf-2.6.2 Rakefile
wicked_pdf-2.6.0 Rakefile