forked from sj26/mailcatcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
63 lines (48 loc) · 1.64 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
# frozen_string_literal: true
require "fileutils"
require "rubygems"
require "mail_catcher/version"
# 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|
if asset = sprockets.find_asset(logical_path)
target = File.join(compiled_path, logical_path)
asset.write_to target
end
end
end
desc "Package as Gem"
task "package" => ["assets"] do
require "rubygems/package"
require "rubygems/specification"
spec_file = File.expand_path("../mailcatcher.gemspec", __FILE__)
spec = Gem::Specification.load(spec_file)
Gem::Package.build spec
end
desc "Release Gem to RubyGems"
task "release" => ["package"] do
%x[gem push mailcatcher-#{MailCatcher::VERSION}.gem]
end
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 "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:test) do |rspec|
rspec.rspec_opts = "--format doc"
end
task :test => :assets
task :default => :test