This repository has been archived by the owner on May 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
120 lines (105 loc) · 3 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
require 'rake/clean'
require 'bundler'
require 'rdoc/task'
require 'cucumber'
require 'cucumber/rake/task'
Bundler::GemHelper.install_tasks
CLEAN << "test/slideshow/index.html"
Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
rd.title = 'Your application title'
end
CUKE_RESULTS = 'results.html'
CLEAN << CUKE_RESULTS
CLOBBER << 'tmp/aruba'
desc 'Run features'
Cucumber::Rake::Task.new(:features) do |t|
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
t.cucumber_opts = opts
t.fork = false
end
desc 'Run features tagged as work-in-progress (@wip)'
Cucumber::Rake::Task.new('features:wip') do |t|
tag_opts = ' --tags ~@pending'
tag_opts = ' --tags @wip'
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
t.fork = false
end
task :cucumber => :features
task 'cucumber:wip' => 'features:wip'
task :wip => 'features:wip'
task :jasmine do |t|
unless system("jasmine-headless-webkit -j test/jasmine.yml")
exit -1
end
end
CLOBBER << ".jhw-cache"
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/*_test.rb']
end
desc 'Add CSS markup to the theme files for callouts'
task 'patch_css' do
Dir["css/themes-orig/*.css"].each do |original_css_file|
new_css_file = "css/themes/" + File.basename(original_css_file)
background = nil
opacity = nil
look_for_background = false
File.open(new_css_file,'w') do |new_file|
File.open(original_css_file).readlines.each do |line|
new_file.puts line
if look_for_background
if line =~ /background-color: (.*);/
background = $1;
look_for_background = false
elsif line =~ /background: (.*);/
background = $1;
look_for_background = false
elsif line =~ /opacity: (.*);/
opacity = $1;
look_for_background = false
end
end
if line =~ /^pre .tex .formula {/
look_for_background = true
end
end
string = <<EOS
pre {
counter-reset: lines;
}
pre .line {
counter-increment: lines;
}
pre .line::before {
content: counter(lines); text-align: right;
display: inline-block; width: 2em;
padding-right: 0.5em; margin-right: 0.5em;
color: #eee8d5;
}
pre .line-callout::before {
content: '\\2192'; text-align: right;
display: inline-block; width: 2em;
padding-right: 0.5em; margin-right: 0.5em;
color: #002b36;
}
.lines-callout {
border-radius: 0.25em;
padding-top: 0.15em;
padding-bottom: 0.15em;
}
.lines-callout {
padding-top: 0.1em;
padding-bottom: 0.1em;
#{background.nil? ? opacity.nil? ? '/* Could not determine background for callouts */' : ("opacity: " + opacity + ";") : ("background: " + background + ";")}
}
EOS
new_file.puts string
end
puts "Migrated #{original_css_file}"
end
end
task :default => [:test,:jasmine,:features]