-
Notifications
You must be signed in to change notification settings - Fork 6
/
Rakefile
84 lines (68 loc) · 2.68 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
$deploy_dir="/opt/web-editor"
task :default => 'test:spec'
namespace :assets do
desc 'compile assets'
task :compile => [:compile_js, :compile_css] {}
desc 'Clean compiled assets'
task :clean do
# TODO implement
end
desc "Compile css assets"
task :compile_css do
require 'compass'
%w(configuration frameworks app_integration actions compiler commands).each do |lib|
require "compass/#{lib}"
end
require 'zurb-foundation'
require 'zurb-foundation'
Compass::Commands::UpdateProject.new(File.dirname(__FILE__), {
:framework => 'zurb-foundation',
:project_type => :stand_alone,
:css_dir => 'public/stylesheets',
:http_path => '/',
:sass_dir => 'assets/sass',
:images_dir => 'assets/images',
:fonts_dir => 'assets/fonts',
:javascripts_dir => 'assets/javascripts',
:output_style => :compressed
}).perform
end
desc 'Compile JavaScript Assets'
task :compile_js do
require 'sprockets'
require 'uglifier'
sprockets = Sprockets::Environment.new
sprockets.append_path File.join('assets', 'javascripts')
#sprockets.js_compressor = :uglifier
asset = sprockets['package.js']
outpath = File.join('public', 'javascripts')
outfile = Pathname.new(outpath).join('package.js') # may want to use the digest in the future?
FileUtils.mkdir_p outfile.dirname
asset.write_to(outfile)
puts "successfully compiled js assets"
end
desc 'Deploy web-editor to #{$deploy_dir} for usage by provided init script'
task :deploy do
`rsync -a --exclude-from=\.deploy-excludes ./** #{$deploy_dir}`
end
end
namespace :test do
require 'rspec/core/rake_task'
if !defined?(RSpec)
puts "spec targets require RSpec"
else
desc "Run all specifications"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/**/*_spec.rb'
end
end
desc "Start Guard to listen for changes and run specs"
task :guard do
require 'guard'
Guard.start(:guardfile => 'Guardfile')
Guard.run_all
while ::Guard.running do
sleep 0.5
end
end
end