mailcatcher/Rakefile

58 lines
1.5 KiB
Ruby
Raw Normal View History

2014-03-17 01:53:13 -04:00
require "fileutils"
require "rubygems"
2011-05-28 02:21:11 -04:00
2014-03-17 01:53:13 -04:00
require "mail_catcher/version"
2014-03-17 01:53:13 -04:00
# XXX: Would prefer to use Rake::SprocketsTask but can't populate
# non-digest assets, and we don't want sprockets at runtime so
# can't use manifest directly. Perhaps index.html should be
# precompiled with digest assets paths?
desc "Compile assets"
task "assets" do
compiled_path = File.expand_path("../public/assets", __FILE__)
FileUtils.mkdir_p(compiled_path)
require "mail_catcher/web/assets"
sprockets = MailCatcher::Web::Assets
sprockets.css_compressor = :sass
sprockets.js_compressor = :uglifier
sprockets.each_logical_path(/(\Amailcatcher\.(js|css)|\.(xsl|png)\Z)/) do |logical_path|
2014-03-17 01:53:13 -04:00
if asset = sprockets.find_asset(logical_path)
target = File.join(compiled_path, logical_path)
asset.write_to target
end
2011-05-29 00:41:02 -04:00
end
end
2011-05-28 02:21:11 -04:00
desc "Package as Gem"
2014-03-17 01:53:13 -04:00
task "package" => ["assets"] do
2014-03-20 20:58:44 -04:00
require "rubygems/package"
require "rubygems/specification"
spec_file = File.expand_path("../mailcatcher.gemspec", __FILE__)
spec = Gem::Specification.load(spec_file)
2013-03-11 19:19:40 -04:00
Gem::Package.build spec
2011-05-28 02:21:11 -04:00
end
desc "Release Gem to RubyGems"
2014-03-17 01:53:13 -04:00
task "release" => ["package"] do
%x[gem push mailcatcher-#{MailCatcher::VERSION}.gem]
2011-05-28 02:21:11 -04:00
end
2014-03-20 20:58:44 -04:00
require "rdoc/task"
RDoc::Task.new(:rdoc => "doc",:clobber_rdoc => "doc:clean", :rerdoc => "doc:force") do |rdoc|
rdoc.title = "MailCatcher #{MailCatcher::VERSION}"
rdoc.rdoc_dir = "doc"
rdoc.main = "README.md"
rdoc.rdoc_files.include "lib/**/*.rb"
end
require "rake/testtask"
Rake::TestTask.new do |task|
task.pattern = "spec/*_spec.rb"
end