Rakefile 1.93 KB
Newer Older
jyurek committed
1 2 3 4
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

5 6 7
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
require 'paperclip'

jyurek committed
8
desc 'Default: run unit tests.'
jyurek committed
9
task :default => [:clean, :test]
jyurek committed
10

11
desc 'Test the paperclip plugin under all supported Rails versions.'
12
task :all do |t|
13 14 15
  exec('rake RAILS_VERSION=2.1 && rake RAILS_VERSION=2.3 && rake RAILS_VERSION=3.0')
end

jyurek committed
16 17
desc 'Test the paperclip plugin.'
Rake::TestTask.new(:test) do |t|
18
  t.libs << 'lib' << 'profile'
19
  t.pattern = 'test/**/*_test.rb'
jyurek committed
20 21 22
  t.verbose = true
end

23 24 25 26 27 28
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

jyurek committed
29 30
desc 'Generate documentation for the paperclip plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
31
  rdoc.rdoc_dir = 'doc'
jyurek committed
32 33
  rdoc.title    = 'Paperclip'
  rdoc.options << '--line-numbers' << '--inline-source'
34
  rdoc.rdoc_files.include('README*')
jyurek committed
35 36
  rdoc.rdoc_files.include('lib/**/*.rb')
end
37

jyurek committed
38 39 40 41 42
desc 'Update documentation on website'
task :sync_docs => 'rdoc' do
  `rsync -ave ssh doc/ dev@dev.thoughtbot.com:/home/dev/www/dev.thoughtbot.com/paperclip`
end

43 44 45 46
desc 'Clean up files.'
task :clean do |t|
  FileUtils.rm_rf "doc"
  FileUtils.rm_rf "tmp"
47
  FileUtils.rm_rf "pkg"
48
  FileUtils.rm_rf "public"
49 50
  FileUtils.rm "test/debug.log" rescue nil
  FileUtils.rm "test/paperclip.db" rescue nil
51
  Dir.glob("paperclip-*.gem").each{|f| FileUtils.rm f }
52
end
53

54 55 56
desc 'Build the gemspec.'
task :gemspec do |t|
  exec 'gem build paperclip.gemspec'
57
end
58 59 60 61 62 63 64

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
65
 
66
desc "Generate a gemspec file for GitHub"
67
task :gemspec => :clean do
68 69 70
  File.open("#{spec.name}.gemspec", 'w') do |f|
    f.write spec.to_ruby
  end
71 72 73 74 75
end 

desc "Build the gem into the current directory"
task :gem => :gemspec do
  `gem build #{spec.name}.gemspec`
76
end