-
Notifications
You must be signed in to change notification settings - Fork 126
/
Rakefile
46 lines (35 loc) · 1.19 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
begin
require "bundler/setup"
rescue LoadError
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
end
# setup the dummy app
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
load "rails/tasks/engine.rake"
# useful bundler gem tasks
require "bundler/gem_tasks"
# load in rspec tasks
load "rspec/rails/tasks/rspec.rake"
# apitome build tasks
namespace :apitome do
desc "Combine and bundle javascripts and stylesheets"
task build: ["build:javascripts", "build:stylesheets"]
task javascripts: :environment do
env = Rails.application.assets
root = Apitome::Engine.root.join("app/assets")
puts "Building javascripts..."
asset = env.find_asset("apitome/application.js")
asset.write_to(root.join("javascripts/apitome", "bundle.js"))
end
task stylesheets: :environment do
env = Rails.application.assets
root = Apitome::Engine.root.join("app/assets")
puts "Building stylesheets..."
asset = env.find_asset("apitome/application.css")
asset.write_to(root.join("stylesheets/apitome", "bundle.css"))
end
end
# setup the default task
Rake::Task["default"].prerequisites.clear
Rake::Task["default"].clear
task default: [:spec]