-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathRakefile
35 lines (28 loc) · 856 Bytes
/
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
require "bundler/gem_tasks"
require "rake/testtask"
require 'yaml'
require 'erubi'
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
task default: :test
def camelize(str)
str.sub(/^[a-z\d]*/) { $&.capitalize }.sub(/\-[a-z]*/) { $&.slice(1..-1).capitalize }
end
task default: :test
task :generate do
data = YAML.load(File.read('misc/html.yaml'), symbolize_names: true)
@tags = data.each_value.inject(:+).uniq
table = eval(Erubi::Engine.new(File.read('misc/table.erubi')).src, binding)
File.write('lib/gammo/tags/table.rb', table)
end
namespace :racc do
task :xpath do
`bundle exec racc lib/gammo/xpath/parser.y -o lib/gammo/xpath/parser.rb`
end
task :css do
`bundle exec racc lib/gammo/css_selector/parser.y -o lib/gammo/css_selector/parser.rb`
end
end