-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
81 lines (66 loc) · 2.05 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
# -*- mode: ruby; -*-
require "rubygems"
require "rake/testtask"
task :test do
Rake::Task["test:all"].invoke
end
namespace :test do
desc "Run all tests"
task :all => [:js, :unit, :integration, :slow]
desc "Run the tests for the js Mongo Shell plugin"
task :js do
orig_dir = Dir.pwd
Dir.chdir("test/js")
output = system("ruby js_test.rb")
puts output
Dir.chdir orig_dir
end
desc "Run the unit tests"
Rake::TestTask.new(:unit) do |t|
t.test_files = FileList["test/unit/*_test.rb"]
t.verbose = true
end
desc "Run the integration tests"
Rake::TestTask.new(:integration) do |t|
t.test_files = FileList["test/integration/*_test.rb"]
t.verbose = true
end
desc "Run the very slow tests"
Rake::TestTask.new(:slow) do |t|
t.test_files = FileList["test/slow_tests/*_test.rb"]
t.verbose = true
end
end
task :default do
system("rake -T")
end
file "solr.js" do
# Note: sequence is relevant. Dependent files should be placed before files it depend.
js_files = %w[msolr_const util msolr_server msolr]
js_opt_arr = js_files.map { |file| "--js=lib/js/#{file}.js" }
js_opt_str = js_opt_arr.join(" ")
system("java -jar compiler.jar #{js_opt_str} --js_output_file=solr.js")
end
file "solr-plugin.js" => "solr.js" do |task|
# Note: sequence is relevant. Dependent files should be placed before files it depend.
js_files = task.prerequisites
js_files << "lib/js/msolr_plugin.js"
js_opt_arr = js_files.map { |file| "--js=#{file}" }
js_opt_str = js_opt_arr.join(" ")
system("java -jar compiler.jar #{js_opt_str} --js_output_file=solr-plugin.js")
end
desc "Build the Mongo Shell plugin js file. Needs the Google Closure compiler jar file to be at the root directory."
task :build => "solr-plugin.js"
desc "Build the Mongo Shell plugin js file from scratch."
task :rebuild do
rm FileList["*.js"]
Rake::Task[:build].invoke
end
namespace :gem do
desc "Install the gem locally"
task :install do
`gem build msolr.gemspec`
`gem install --no-rdoc --no-ri msolr-*.gem`
`rm msolr-*.gem`
end
end