Skip to content

Commit c26fa75

Browse files
committed
Changed the way elasticsearch/elasticsearch repository is embedded
Instead of using a submodule, do a regular Git clone in the `tmp` directory. Changed the `rake setup` task to do a clone, if the repository doesn't exist yet. Updated all the other tasks.
1 parent ba93cef commit c26fa75

File tree

5 files changed

+16
-21
lines changed

5 files changed

+16
-21
lines changed

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

Rakefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ end
2323

2424
desc "Setup the project"
2525
task :setup do
26-
sh "git submodule update --init --recursive"
26+
unless File.exists?('./tmp/elasticsearch')
27+
sh "git clone [email protected]:elasticsearch/elasticsearch.git tmp/elasticsearch"
28+
end
2729
end
2830

2931
desc "Alias for `bundle:install`"
@@ -54,21 +56,19 @@ end
5456
namespace :elasticsearch do
5557
desc "Update the submodule with Elasticsearch core repository"
5658
task :update do
57-
sh "git submodule foreach git reset --hard"
58-
puts
59-
sh "git --git-dir=#{__current__.join('support/elasticsearch/.git')} --work-tree=#{__current__.join('support/elasticsearch')} fetch origin --verbose"
59+
sh "git --git-dir=#{__current__.join('tmp/elasticsearch/.git')} --work-tree=#{__current__.join('tmp/elasticsearch')} fetch origin --verbose"
6060
begin
61-
puts %x[git --git-dir=#{__current__.join('support/elasticsearch/.git')} --work-tree=#{__current__.join('support/elasticsearch')} pull --verbose]
61+
puts %x[git --git-dir=#{__current__.join('tmp/elasticsearch/.git')} --work-tree=#{__current__.join('tmp/elasticsearch')} pull --verbose]
6262
rescue Exception => @exception
6363
@failed = true
6464
end
6565

6666
if @failed || !$?.success?
67-
STDERR.puts "", "[!] Error while pulling. #{@exception}"
67+
STDERR.puts "", "[!] Error while pulling -- #{@exception}"
6868
end
6969

7070
puts "\n", "CHANGES:", '-'*80
71-
sh "git --git-dir=#{__current__.join('support/elasticsearch/.git')} --work-tree=#{__current__.join('support/elasticsearch')} log --oneline ORIG_HEAD..HEAD | cat", :verbose => false
71+
sh "git --git-dir=#{__current__.join('tmp/elasticsearch/.git')} --work-tree=#{__current__.join('tmp/elasticsearch')} log --oneline ORIG_HEAD..HEAD | cat", :verbose => false
7272
end
7373

7474
desc <<-DESC
@@ -85,11 +85,11 @@ namespace :elasticsearch do
8585
puts '-'*80
8686

8787
branch = args[:branch] || 'origin/master'
88-
current_branch = `git --git-dir=#{__current__.join('support/elasticsearch/.git')} --work-tree=#{__current__.join('support/elasticsearch')} branch --no-color`.split("\n").select { |b| b =~ /^\*/ }.first.gsub(/^\*\s*/, '')
88+
current_branch = `git --git-dir=#{__current__.join('tmp/elasticsearch/.git')} --work-tree=#{__current__.join('tmp/elasticsearch')} branch --no-color`.split("\n").select { |b| b =~ /^\*/ }.first.gsub(/^\*\s*/, '')
8989
begin
9090
sh <<-CODE
9191
mkdir -p #{__current__.join('tmp/builds')} && \
92-
cd #{__current__.join('support/elasticsearch')} && \
92+
cd #{__current__.join('tmp/elasticsearch')} && \
9393
git fetch origin --quiet && \
9494
git checkout #{branch} && \
9595
mvn clean && \
@@ -106,7 +106,7 @@ namespace :elasticsearch do
106106

107107
desc "Display the info for all branches in the Elasticsearch submodule"
108108
task :status do
109-
sh "git --git-dir=#{__current__.join('support/elasticsearch/.git')} --work-tree=#{__current__.join('support/elasticsearch')} branch -v -v", :verbose => false
109+
sh "git --git-dir=#{__current__.join('tmp/elasticsearch/.git')} --work-tree=#{__current__.join('tmp/elasticsearch')} branch -v -v", :verbose => false
110110
end
111111

112112
desc "Display the list of builds"
@@ -119,8 +119,8 @@ namespace :elasticsearch do
119119

120120
desc "Display the history of the 'rest-api-spec' repo"
121121
task :changes do
122-
STDERR.puts "Log: #{__current__.join('support/elasticsearch')}/rest-api-spec", ""
123-
sh "git --git-dir=#{__current__.join('support/elasticsearch/.git')} --work-tree=#{__current__.join('support/elasticsearch')} log --pretty=format:'%C(yellow)%h%Creset %s \e[2m[%ar by %an]\e[0m' -- rest-api-spec", :verbose => false
122+
STDERR.puts "Log: #{__current__.join('tmp/elasticsearch')}/rest-api-spec", ""
123+
sh "git --git-dir=#{__current__.join('tmp/elasticsearch/.git')} --work-tree=#{__current__.join('tmp/elasticsearch')} log --pretty=format:'%C(yellow)%h%Creset %s \e[2m[%ar by %an]\e[0m' -- rest-api-spec", :verbose => false
124124
end
125125
end
126126

elasticsearch-api/Rakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def __current__
55
end
66

77
def git_specs(command, options={})
8-
sh "git --git-dir=#{__current__.join('../support/elasticsearch/.git')} --work-tree=#{__current__.join('../support/elasticsearch')} #{command}", options
8+
sh "git --git-dir=#{__current__.join('../tmp/elasticsearch/.git')} --work-tree=#{__current__.join('../tmp/elasticsearch')} #{command}", options
99
end
1010

1111
task(:default) { system "rake --tasks" }
@@ -44,7 +44,7 @@ namespace :test do
4444
task :integration do
4545
require 'elasticsearch'
4646

47-
branches = `git --git-dir=#{__current__.join('../support/elasticsearch/.git')} --work-tree=#{__current__.join('../support/elasticsearch')} branch --no-color`
47+
branches = `git --git-dir=#{__current__.join('../tmp/elasticsearch/.git')} --work-tree=#{__current__.join('../tmp/elasticsearch')} branch --no-color`
4848

4949
current_branch = branches.
5050
split("\n").
@@ -98,7 +98,7 @@ namespace :test do
9898
end
9999

100100
# Path to the API specs
101-
ENV['TEST_REST_API_SPEC'] = __current__.join('../support/elasticsearch/rest-api-spec/test/').to_s
101+
ENV['TEST_REST_API_SPEC'] = __current__.join('../tmp/elasticsearch/rest-api-spec/test/').to_s
102102

103103
# Run the task
104104
args = [t.ruby_opts_string, t.run_code, t.file_list_string, t.option_list].join(' ')

elasticsearch-api/test/integration/yaml_test_runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class YamlTestCase < ::Test::Unit::TestCase; end
261261
include Elasticsearch::YamlTestSuite
262262

263263
PATH = Pathname(ENV['TEST_REST_API_SPEC'] || \
264-
File.expand_path('../../../../support/elasticsearch/rest-api-spec/test', __FILE__))
264+
File.expand_path('../../../../tmp/elasticsearch/rest-api-spec/test', __FILE__))
265265
suites = Dir.glob(PATH.join('*')).map { |d| Pathname(d) }
266266
suites = suites.select { |s| s.to_s =~ Regexp.new(ENV['FILTER']) } if ENV['FILTER']
267267

support/elasticsearch

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)