forked from twitter/twitter-cldr-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
61 lines (45 loc) · 1.4 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
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
$:.unshift File.join(File.dirname(__FILE__), 'lib')
require 'rubygems' unless ENV['NO_RUBYGEMS']
require 'bundler'
require 'digest'
require 'fileutils'
require 'rexml/document'
require 'rspec/core/rake_task'
require 'rubygems/package_task'
require './lib/twitter_cldr/js'
Bundler::GemHelper.install_tasks
task :default => :spec
desc 'Run specs'
task :spec => ["spec:ruby", "spec:js"]
desc 'Run Ruby specs'
RSpec::Core::RakeTask.new("spec:ruby") do |t|
t.pattern = './spec/**/*_spec.rb'
end
desc 'Run JavaScript specs'
task "spec:js" do
ENV["LOCALES"] = "en,ar,ko,ru"
Rake::Task["twitter_cldr:js:update_for_test"].invoke
puts "\nJasmine Specs"
if `which jasmine-node`.strip.empty?
puts "ERROR: You need to install jasmine-node to run JavaScript tests:"
puts " `npm install jasmine-node -g`"
exit 1
else
puts `jasmine-node #{File.dirname(__FILE__)} --junitreport`
doc_files = Dir.glob(File.join(File.dirname(__FILE__), "reports/**"))
failures = 0
doc_files.each do |doc_file|
doc = REXML::Document.new(File.read(doc_file))
failures = doc.elements.to_a("testsuites/testsuite").inject(0) do |sum, element|
sum + element.attributes["failures"].to_i
end
end
if failures > 0
exit 1
end
end
end
load "./lib/twitter_cldr/js/tasks/tasks.rake"