1
1
require 'pathname'
2
2
3
3
subprojects = %w| elasticsearch-model elasticsearch-rails |
4
+
4
5
__current__ = Pathname ( File . expand_path ( '..' , __FILE__ ) )
5
6
6
7
task :default do
7
8
system "rake --tasks"
8
9
end
9
10
10
- desc "List all subprojects"
11
11
task :subprojects do
12
12
puts '-' *80
13
13
subprojects . each do |project |
@@ -17,31 +17,53 @@ task :subprojects do
17
17
end
18
18
end
19
19
20
- namespace :test do
20
+ desc "Alias for `bundle:install`"
21
+ task :bundle => 'bundle:install'
22
+
23
+ namespace :bundle do
21
24
desc "Run `bundle install` in all subprojects"
22
- task :bundle do
25
+ task :install do
26
+ puts '-' *80
27
+ sh "bundle install --gemfile #{ __current__ } /Gemfile"
28
+ puts
23
29
subprojects . each do |project |
24
- sh "bundle install --gemfile #{ __current__ . join ( project ) } /Gemfile"
25
30
puts '-' *80
31
+ sh "bundle install --gemfile #{ __current__ . join ( project ) } /Gemfile"
32
+ puts
26
33
end
27
34
end
28
35
36
+ desc "Remove Gemfile.lock in all subprojects"
37
+ task :clean do
38
+ sh "rm -f Gemfile.lock"
39
+ subprojects . each do |project |
40
+ sh "rm -f #{ __current__ . join ( project ) } /Gemfile.lock"
41
+ end
42
+ end
43
+ end
44
+
45
+ namespace :test do
46
+ task :bundle => 'bundle:install'
47
+
29
48
desc "Run unit tests in all subprojects"
30
49
task :unit do
31
50
Rake ::Task [ 'test:ci_reporter' ] . invoke if ENV [ 'CI' ]
32
51
subprojects . each do |project |
33
- sh "cd #{ __current__ . join ( project ) } && unset BUNDLE_GEMFILE && bundle exec rake test:unit"
34
52
puts '-' *80
53
+ sh "cd #{ __current__ . join ( project ) } && unset BUNDLE_GEMFILE && bundle exec rake test:unit"
54
+ puts "\n "
35
55
end
36
56
Rake ::Task [ 'test:coveralls' ] . invoke if ENV [ 'CI' ] && defined? ( RUBY_VERSION ) && RUBY_VERSION > '1.9'
37
57
end
38
58
39
59
desc "Run integration tests in all subprojects"
40
60
task :integration do
61
+ Rake ::Task [ 'elasticsearch:update' ] . invoke
41
62
Rake ::Task [ 'test:ci_reporter' ] . invoke if ENV [ 'CI' ]
42
63
subprojects . each do |project |
43
- sh "cd #{ __current__ . join ( project ) } && unset BUNDLE_GEMFILE && bundle exec rake test:integration"
44
64
puts '-' *80
65
+ sh "cd #{ __current__ . join ( project ) } && unset BUNDLE_GEMFILE && bundle exec rake test:integration"
66
+ puts "\n "
45
67
end
46
68
Rake ::Task [ 'test:coveralls' ] . invoke if ENV [ 'CI' ] && defined? ( RUBY_VERSION ) && RUBY_VERSION > '1.9'
47
69
end
@@ -50,8 +72,9 @@ namespace :test do
50
72
task :all do
51
73
Rake ::Task [ 'test:ci_reporter' ] . invoke if ENV [ 'CI' ]
52
74
subprojects . each do |project |
53
- sh "cd #{ __current__ . join ( project ) } && unset BUNDLE_GEMFILE && bundle exec rake test:all"
54
75
puts '-' *80
76
+ sh "cd #{ __current__ . join ( project ) } && unset BUNDLE_GEMFILE && bundle exec rake test:all"
77
+ puts "\n "
55
78
end
56
79
end
57
80
@@ -72,7 +95,7 @@ namespace :test do
72
95
end
73
96
end
74
97
75
- namespace :server do
98
+ namespace :cluster do
76
99
desc "Start Elasticsearch nodes for tests"
77
100
task :start do
78
101
require 'elasticsearch/extensions/test/cluster'
@@ -84,6 +107,12 @@ namespace :test do
84
107
require 'elasticsearch/extensions/test/cluster'
85
108
Elasticsearch ::Extensions ::Test ::Cluster . stop
86
109
end
110
+
111
+ task :status do
112
+ require 'elasticsearch/extensions/test/cluster'
113
+ ( puts "\e [31m[!] Test cluster not running\e [0m" ; exit ( 1 ) ) unless Elasticsearch ::Extensions ::Test ::Cluster . running?
114
+ Elasticsearch ::Extensions ::Test ::Cluster . __print_cluster_info ( ENV [ 'TEST_CLUSTER_PORT' ] || 9250 )
115
+ end
87
116
end
88
117
end
89
118
0 commit comments