Skip to content

Commit 374ced5

Browse files
committedSep 23, 2020
[DOCS] Updates README, adds missing license headers, minor styling updates
1 parent c318932 commit 374ced5

File tree

6 files changed

+55
-13
lines changed

6 files changed

+55
-13
lines changed
 

‎README.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,22 @@ bundle exec rake setup
102102
bundle exec rake bundle
103103
```
104104

105-
This will clone the Elasticsearch repository into the project, and run `bundle install` in all subprojects.
105+
This will clone the Elasticsearch repository into the project, and run `bundle install` in all subprojects. There are a few tasks to work with Elasticsearch. Use `rake -T` and look for the tasks in the `elasticsearch` namespace. You can build elasticsearch with `rake elasticsearch:build` after having ran setup.
106106

107107
To run tests, you need to start a testing cluster on port 9250, or provide a different one in the `TEST_CLUSTER_PORT` environment variable.
108108

109-
There's a Rake task to start the testing cluster:
109+
There's a Rake task to start the testing cluster. By default this is going to try and use the `elasticsearch` command on your system:
110110

111111
```
112112
rake test:cluster:start
113113
```
114114

115-
You can configure the port, path to the startup script, number of nodes, and other settings with environment variables:
115+
You can also configure where the elasticsearch startup script is found with the `TEST_CLUSTER_COMMAND` environment variable, e.g.:
116+
```
117+
TEST_CLUSTER_COMMAND=~/elasticsearch/bin/elasticsearch rake test:cluster:stop
118+
```
119+
120+
You also can configure the port, number of nodes, and other settings with environment variables:
116121

117122
```
118123
TEST_CLUSTER_COMMAND=./tmp/builds/elasticsearch-7.10.0-SNAPSHOT/bin/elasticsearch \
@@ -131,6 +136,9 @@ TEST_CLUSTER_COMMAND=./tmp/builds/elasticsearch-7.10.0-SNAPSHOT/bin/elasticsearc
131136
rake test:cluster:stop
132137
```
133138

139+
There's also a rake task for starting up Elasticsearch in a Docker container:
140+
`rake docker:start[version]` - E.g.: `rake docker:start[7.x-SNAPSHOT]`. To start the container with X-Pack, pass it in as a parameter: `rake docker:start[7.x-SNAPSHOT,xpack]`.
141+
134142
To run tests against unreleased Elasticsearch versions, you can use the `rake elasticsearch:build` Rake task to build Elasticsearch from the cloned source (use `rake elasticsearch:update` to update the repository):
135143

136144
**Note:** If you have gems from the `elasticsearch` family installed system-wide, and want to use development ones, prepend the command with `bundle exec`.
@@ -139,6 +147,8 @@ To run tests against unreleased Elasticsearch versions, you can use the `rake el
139147
rake elasticsearch:build
140148
```
141149

150+
This is going to create the build in `./tmp/builds/`.
151+
142152
You can pass a branch name (tag, commit, ...) as the Rake task variable:
143153

144154
```

‎Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def admin_client
6565
user = ENV['ELASTIC_USER'] || 'elastic'
6666
url = "https://#{user}:#{password}@#{uri.host}:#{uri.port}"
6767
else
68-
url = "http://#{uri.host || 'localhost'}:#{uri.port || 9200}"
68+
url = "http://#{uri&.host || 'localhost'}:#{uri&.port || 9200}"
6969
end
7070
puts "Elasticsearch Client url: #{url}"
7171
Elasticsearch::Client.new(host: url, transport_options: transport_options)

‎elasticsearch-extensions/Rakefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
require "bundler/gem_tasks"
18+
require 'bundler/gem_tasks'
1919

20-
desc "Run unit tests"
21-
task :default => 'test:unit'
22-
task :test => 'test:unit'
20+
desc 'Run unit tests'
21+
task default: 'test:unit'
22+
task test: 'test:unit'
2323

2424
# ----- Test tasks ------------------------------------------------------------
2525

‎elasticsearch-extensions/test/test_helper.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
19-
ELASTICSEARCH_HOSTS = if hosts = ENV['TEST_ES_SERVER'] || ENV['ELASTICSEARCH_HOSTS']
18+
ELASTICSEARCH_HOSTS = if (hosts = ENV['TEST_ES_SERVER'] || ENV['ELASTICSEARCH_HOSTS'])
2019
hosts.split(',').map do |host|
2120
/(http\:\/\/)?(\S+)/.match(host)[2]
2221
end
2322
end.freeze
2423

2524
TEST_HOST, TEST_PORT = ELASTICSEARCH_HOSTS.first.split(':') if ELASTICSEARCH_HOSTS
2625

27-
JRUBY = defined?(JRUBY_VERSION)
26+
JRUBY = defined?(JRUBY_VERSION)
2827

2928
if ENV['COVERAGE'] && ENV['CI'].nil? && !RUBY_1_8
3029
require 'simplecov'

‎rake_tasks/elasticsearch_tasks.rake

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
118
ELASTICSEARCH_PATH = "#{CURRENT_PATH}/tmp/elasticsearch".freeze
219

320
desc 'Clone elasticsearch into the ./tmp directory'
@@ -49,7 +66,7 @@ namespace :elasticsearch do
4966
end
5067

5168
desc <<-DESC
52-
Build Elasticsearch for the specified branch ('origin/master' by default)"
69+
Build Elasticsearch for the specified branch ('origin/master' by default)
5370
5471
Build a specific branch:
5572
@@ -70,7 +87,6 @@ namespace :elasticsearch do
7087

7188
case es_version
7289
when 0.0, 7.0, 8.0
73-
# /home/fernando/workspace/ruby/tmp/elasticsearch/distribution/docker/build/docker
7490
path_to_build = CURRENT_PATH.join('tmp/elasticsearch/distribution/docker/build/docker/elasticsearch-*.tar.gz')
7591
build_command = "cd #{CURRENT_PATH.join('tmp/elasticsearch')} && ./gradlew assemble;"
7692

‎rake_tasks/test_tasks.rake

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
118
UNIT_TESTED_PROJECTS = [
219
'elasticsearch',
320
'elasticsearch-transport',

0 commit comments

Comments
 (0)
Please sign in to comment.