forked from cucumber-attic/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
46 lines (37 loc) · 1.13 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
$: << File.dirname(__FILE__) + '/lib'
ENV["RACK_ENV"] ||= "development"
task default: [:spec, :cucumber, :backup_events]
task :spec do
sh 'bundle exec rspec'
end
task :cucumber do
sh 'bundle exec cucumber'
end
task :backup_events do
require 'open-uri'
require_relative 'lib/cucumber/website/config'
config = Cucumber::Website::Config.new('development')
config['calendars'].each do |url|
file_name = "event-backup/#{Time.now.strftime('%Y%m%d')}-#{url.gsub(/[:\/]/, '-')}"
file_name += '.ics' unless file_name =~ /\.ics/
begin
File.open(file_name, 'w') { |io| io.write(open(url).read) }
rescue OpenURI::HTTPError => e
STDERR.puts "\e[31m****** #{url}: #{e.message} ******\e[0m\n"
end
end
end
namespace :assets do
require_relative 'apps/static/app'
App = Cucumber::Website::Static::App
desc 'Precompile assets'
task :precompile do
environment = App.assets
manifest = Sprockets::Manifest.new(environment.index, File.join(App.assets_path, "manifest.json"))
manifest.compile(App.assets_precompile)
end
desc "Clean assets"
task :clean do
FileUtils.rm_rf(App.assets_path)
end
end