Skip to content

Commit 1b574aa

Browse files
committed
Minor whitespace and styling fixes
1 parent 527f850 commit 1b574aa

File tree

4 files changed

+38
-40
lines changed

4 files changed

+38
-40
lines changed

Rakefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ end
7575
# subprojects.each { |project| $LOAD_PATH.unshift CURRENT_PATH.join(project, "lib").to_s }
7676

7777
task :default do
78-
system "rake --tasks"
78+
system 'rake --tasks'
7979
end
8080

8181
desc 'Display information about subprojects'
8282
task :subprojects do
83-
puts '-'*80
83+
puts '-' * 80
8484
SUBPROJECTS.each do |project|
8585
commit = `git log --pretty=format:'%h %ar: %s' -1 #{project}`
8686
version = Gem::Specification::load(CURRENT_PATH.join(project, "#{project}.gemspec").to_s).version.to_s
@@ -96,7 +96,7 @@ namespace :bundle do
9696
desc 'Run `bundle install` in all subprojects'
9797
task :install do
9898
SUBPROJECTS.each do |project|
99-
puts '-'*80
99+
puts '-' * 80
100100
sh "cd #{CURRENT_PATH.join(project)} && unset BUNDLE_GEMFILE && bundle install"
101101
puts
102102
end

elasticsearch/Rakefile

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ task :test => 'test:unit'
1111

1212
require 'rake/testtask'
1313
namespace :test do
14-
1514
desc "Wait for Elasticsearch to be in a green state"
1615
task :wait_for_green do
1716
sh '../scripts/wait-cluster.sh'

rake_tasks/elasticsearch_tasks.rake

+14-17
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
ELASTICSEARCH_PATH = "#{CURRENT_PATH}/tmp/elasticsearch"
1+
ELASTICSEARCH_PATH = "#{CURRENT_PATH}/tmp/elasticsearch".freeze
22

3-
desc "Clone elasticsearch into the ./tmp directory"
3+
desc 'Clone elasticsearch into the ./tmp directory'
44
task :setup do
55
unless File.exist?('./tmp/elasticsearch')
6-
sh "git clone https://github.com/elasticsearch/elasticsearch.git tmp/elasticsearch"
6+
sh 'git clone https://github.com/elasticsearch/elasticsearch.git tmp/elasticsearch'
77
end
88
end
99

1010
namespace :elasticsearch do
11-
12-
desc "Wait for elasticsearch cluster to be in green state"
11+
desc 'Wait for elasticsearch cluster to be in green state'
1312
task :wait_for_green do
1413
require 'elasticsearch'
1514

@@ -21,10 +20,10 @@ namespace :elasticsearch do
2120
ready = true
2221
break
2322
end
24-
rescue Elasticsearch::Transport::Transport::Errors::RequestTimeout => ex
25-
puts "Couldn't confirm green status.\n#{ex.inspect}."
26-
rescue Faraday::ConnectionFailed => ex
27-
puts "Couldn't connect to Elasticsearch.\n#{ex.inspect}."
23+
rescue Elasticsearch::Transport::Transport::Errors::RequestTimeout => e
24+
puts "Couldn't confirm green status.\n#{e.inspect}."
25+
rescue Faraday::ConnectionFailed => e
26+
puts "Couldn't connect to Elasticsearch.\n#{e.inspect}."
2827
sleep(30)
2928
end
3029
end
@@ -34,20 +33,18 @@ namespace :elasticsearch do
3433
end
3534
end
3635

37-
desc "Update the submodule with Elasticsearch core repository"
38-
task :update => :setup do
36+
desc 'Update the submodule with Elasticsearch core repository'
37+
task update: :setup do
3938
sh "git --git-dir=#{CURRENT_PATH.join('tmp/elasticsearch/.git')} --work-tree=#{CURRENT_PATH.join('tmp/elasticsearch')} fetch origin --quiet"
4039
begin
4140
%x[git --git-dir=#{CURRENT_PATH.join('tmp/elasticsearch/.git')} --work-tree=#{CURRENT_PATH.join('tmp/elasticsearch')} pull]
42-
rescue Exception => @exception
41+
rescue Exception => @e
4342
@failed = true
4443
end
4544

46-
if @failed || !$?.success?
47-
STDERR.puts "", "[!] Error while pulling -- #{@exception}"
48-
end
45+
STDERR.puts '', "[!] Error while pulling -- #{@e}" if @failed || !$?.success?
4946

50-
puts "\n", "CHANGES:", '-'*80
47+
puts "\n", "CHANGES:", '-' * 80
5148
sh "git --git-dir=#{CURRENT_PATH.join('tmp/elasticsearch/.git')} --work-tree=#{CURRENT_PATH.join('tmp/elasticsearch')} log --oneline ORIG_HEAD..HEAD | cat", :verbose => false
5249
end
5350

@@ -62,7 +59,7 @@ namespace :elasticsearch do
6259
DESC
6360
task :build, :branch do |task, args|
6461
Rake::Task['elasticsearch:status'].invoke
65-
puts '-'*80
62+
puts '-' * 80
6663

6764
gitref = args[:branch] || 'origin/master'
6865
es_version = gitref.gsub(/^v|origin\/(\d\.+)/, '\1').to_f

rake_tasks/test_tasks.rake

+21-19
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,49 @@
1-
UNIT_TESTED_PROJECTS = [ 'elasticsearch',
2-
'elasticsearch-transport',
3-
'elasticsearch-dsl',
4-
'elasticsearch-api',
5-
'elasticsearch-xpack',
6-
'elasticsearch-extensions' ].freeze
1+
UNIT_TESTED_PROJECTS = [
2+
'elasticsearch',
3+
'elasticsearch-transport',
4+
'elasticsearch-dsl',
5+
'elasticsearch-api',
6+
'elasticsearch-xpack',
7+
'elasticsearch-extensions'
8+
].freeze
79

810
INTEGRATION_TESTED_PROJECTS = (UNIT_TESTED_PROJECTS - ['elasticsearch-api']).freeze
911

1012
namespace :test do
11-
task :bundle => 'bundle:install'
13+
task bundle: 'bundle:install'
1214

13-
desc "Run all tests in all subprojects"
14-
task :client => [ :unit, :integration ]
15+
desc 'Run all tests in all subprojects'
16+
task client: [:unit, :integration]
1517

16-
desc "Run unit tests in all subprojects"
18+
desc 'Run unit tests in all subprojects'
1719
task :unit do
1820
UNIT_TESTED_PROJECTS.each do |project|
19-
puts '-'*80
21+
puts '-' * 80
2022
sh "cd #{CURRENT_PATH.join(project)} && unset BUNDLE_GEMFILE && unset BUNDLE_PATH && unset BUNDLE_BIN && bundle exec rake test:unit"
2123
puts "\n"
2224
end
2325
end
2426

25-
desc "Run integration tests in all subprojects"
27+
desc 'Run integration tests in all subprojects'
2628
task :integration do
2729
INTEGRATION_TESTED_PROJECTS.each do |project|
28-
puts '-'*80
30+
puts '-' * 80
2931
sh "cd #{CURRENT_PATH.join(project)} && unset BUNDLE_GEMFILE && bundle exec rake test:integration"
3032
puts "\n"
3133
end
3234
end
3335

3436
# Note: Start Elasticsearch with the following command if Docker is not used.
3537
# bin/elasticsearch -Erepositories.url.allowed_urls=http://* -Epath.repo=/tmp -Enode.attr.testattr=test
36-
desc "Run rest api tests"
37-
task :rest_api => ['elasticsearch:update', 'elasticsearch:wait_for_green'] do
38+
desc 'Run rest api tests'
39+
task rest_api: ['elasticsearch:update', 'elasticsearch:wait_for_green'] do
3840
puts '-' * 80
3941
sh "cd #{CURRENT_PATH.join('elasticsearch-api')} && unset BUNDLE_GEMFILE && bundle exec rake test:integration"
4042
puts "\n"
4143
end
4244

43-
desc "Run security (Platinum) rest api yaml tests"
44-
task :security => 'elasticsearch:update' do
45+
desc 'Run security (Platinum) rest api yaml tests'
46+
task security: 'elasticsearch:update' do
4547
Rake::Task['elasticsearch:wait_for_green'].invoke
4648
Rake::Task['elasticsearch:checkout_build'].invoke
4749
puts '-' * 80
@@ -50,13 +52,13 @@ namespace :test do
5052
end
5153

5254
namespace :cluster do
53-
desc "Start Elasticsearch nodes for tests"
55+
desc 'Start Elasticsearch nodes for tests'
5456
task :start do
5557
require 'elasticsearch/extensions/test/cluster'
5658
Elasticsearch::Extensions::Test::Cluster.start
5759
end
5860

59-
desc "Stop Elasticsearch nodes for tests"
61+
desc 'Stop Elasticsearch nodes for tests'
6062
task :stop do
6163
require 'elasticsearch/extensions/test/cluster'
6264
Elasticsearch::Extensions::Test::Cluster.stop

0 commit comments

Comments
 (0)