forked from thoughtbot/paperclip
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
103 lines (92 loc) · 3.22 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
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
require 'paperclip'
desc 'Default: run unit tests.'
task :default => [:clean, :test]
desc 'Test the paperclip plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib' << 'profile'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Start an IRB session with all necessary files required.'
task :shell do |t|
chdir File.dirname(__FILE__)
exec 'irb -I lib/ -I lib/paperclip -r rubygems -r active_record -r tempfile -r init'
end
desc 'Generate documentation for the paperclip plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = 'Paperclip'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
desc 'Update documentation on website'
task :sync_docs => 'rdoc' do
`rsync -ave ssh doc/ [email protected]:/home/dev/www/dev.thoughtbot.com/paperclip`
end
desc 'Clean up files.'
task :clean do |t|
FileUtils.rm_rf "doc"
FileUtils.rm_rf "tmp"
FileUtils.rm_rf "pkg"
FileUtils.rm "test/debug.log" rescue nil
FileUtils.rm "test/paperclip.db" rescue nil
Dir.glob("paperclip-*.gem").each{|f| FileUtils.rm f }
end
include_file_globs = ["README*",
"LICENSE",
"Rakefile",
"init.rb",
"{generators,lib,tasks,test,shoulda_macros}/**/*"]
exclude_file_globs = ["test/s3.yml",
"test/debug.log",
"test/paperclip.db",
"test/doc",
"test/doc/*",
"test/pkg",
"test/pkg/*",
"test/tmp",
"test/tmp/*"]
spec = Gem::Specification.new do |s|
s.name = "paperclip"
s.version = Paperclip::VERSION
s.author = "Jon Yurek"
s.email = "[email protected]"
s.homepage = "http://www.thoughtbot.com/projects/paperclip"
s.platform = Gem::Platform::RUBY
s.summary = "File attachments as attributes for ActiveRecord"
s.files = FileList[include_file_globs].to_a - FileList[exclude_file_globs].to_a
s.require_path = "lib"
s.test_files = FileList["test/**/test_*.rb"].to_a
s.rubyforge_project = "paperclip"
s.has_rdoc = true
s.extra_rdoc_files = FileList["README*"].to_a
s.rdoc_options << '--line-numbers' << '--inline-source'
s.requirements << "ImageMagick"
s.add_development_dependency 'shoulda'
s.add_development_dependency 'jferris-mocha', '>= 0.9.5.0.1241126838'
s.add_development_dependency 'aws-s3'
s.add_development_dependency 'sqlite3-ruby'
s.add_development_dependency 'activerecord'
s.add_development_dependency 'activesupport'
end
desc "Print a list of the files to be put into the gem"
task :manifest => :clean do
spec.files.each do |file|
puts file
end
end
desc "Generate a gemspec file for GitHub"
task :gemspec => :clean do
File.open("#{spec.name}.gemspec", 'w') do |f|
f.write spec.to_ruby
end
end
desc "Build the gem into the current directory"
task :gem => :gemspec do
`gem build #{spec.name}.gemspec`
end