This repository has been archived by the owner on Jul 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Rakefile
71 lines (60 loc) · 1.67 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
# encoding: utf-8
require 'rubygems'
require 'bundler'
require 'rake'
require 'rake/testtask'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
end
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "dm-paperclip"
gem.author = "Ken Robertson"
gem.email = "[email protected]"
gem.homepage = "http://invalidlogic.com/dm-paperclip/"
gem.platform = Gem::Platform::RUBY
gem.summary = "File attachments as attributes for DataMapper, based on the original Paperclip by Jon Yurek at Thoughtbot"
gem.requirements << "ImageMagick"
end
Jeweler::RubygemsDotOrgTasks.new
rescue LoadError
end
begin
require 'yard'
YARD::Rake::YardocTask.new
rescue LoadError
end
# Test tasks
desc 'Test the DM-Paperclip library.'
Rake::TestTask.new(:test) do |t|
t.libs << 'dm-paperclip'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Default: run unit tests.'
task :default => [:clean, :test]
# Console
desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -r dm-validations -r dm-migrations -r ./lib/dm-paperclip.rb"
end
# Code coverage
task :coverage do
system("rm -fr coverage")
system("rcov test/test_*.rb")
system("open coverage/index.html")
end
# Clean house
desc 'Clean up files.'
task :clean do |t|
FileUtils.rm_rf "doc"
FileUtils.rm_rf "coverage"
FileUtils.rm_rf "tmp"
FileUtils.rm_rf "pkg"
FileUtils.rm_rf "log"
end