Skip to content

Commit 6e199e4

Browse files
committed
[STORE] Added the blank skeleton of the "elasticsearch-persistence" gem
1 parent 304615e commit 6e199e4

File tree

9 files changed

+205
-0
lines changed

9 files changed

+205
-0
lines changed

elasticsearch-persistence/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.gem
2+
*.rbc
3+
.bundle
4+
.config
5+
.yardoc
6+
Gemfile.lock
7+
InstalledFiles
8+
_yardoc
9+
coverage
10+
doc/
11+
lib/bundler/man
12+
pkg
13+
rdoc
14+
spec/reports
15+
test/tmp
16+
test/version_tmp
17+
tmp

elasticsearch-persistence/Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in elasticsearch-persistence.gemspec
4+
gemspec

elasticsearch-persistence/LICENSE.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (c) 2014 Elasticsearch <http://www.elasticsearch.org>
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

elasticsearch-persistence/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Elasticsearch::Persistence
2+
3+
WIP> Persistence layer for Ruby domain objects using the Repository and ActiveRecord patterns
4+
5+
## License
6+
7+
This software is licensed under the Apache 2 license, quoted below.
8+
9+
Copyright (c) 2014 Elasticsearch <http://www.elasticsearch.org>
10+
11+
Licensed under the Apache License, Version 2.0 (the "License");
12+
you may not use this file except in compliance with the License.
13+
You may obtain a copy of the License at
14+
15+
http://www.apache.org/licenses/LICENSE-2.0
16+
17+
Unless required by applicable law or agreed to in writing, software
18+
distributed under the License is distributed on an "AS IS" BASIS,
19+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20+
See the License for the specific language governing permissions and
21+
limitations under the License.

elasticsearch-persistence/Rakefile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
require "bundler/gem_tasks"
2+
3+
desc "Run unit tests"
4+
task :default => 'test:unit'
5+
task :test => 'test:unit'
6+
7+
# ----- Test tasks ------------------------------------------------------------
8+
9+
require 'rake/testtask'
10+
namespace :test do
11+
task :ci_reporter do
12+
ENV['CI_REPORTS'] ||= 'tmp/reports'
13+
require 'ci/reporter/rake/minitest'
14+
Rake::Task['ci:setup:minitest'].invoke
15+
end
16+
17+
Rake::TestTask.new(:unit) do |test|
18+
Rake::Task['test:ci_reporter'].invoke if ENV['CI']
19+
test.libs << 'lib' << 'test'
20+
test.test_files = FileList["test/unit/**/*_test.rb"]
21+
# test.verbose = true
22+
# test.warning = true
23+
end
24+
25+
Rake::TestTask.new(:integration) do |test|
26+
Rake::Task['test:ci_reporter'].invoke if ENV['CI']
27+
test.libs << 'lib' << 'test'
28+
test.test_files = FileList["test/integration/**/*_test.rb"]
29+
end
30+
31+
Rake::TestTask.new(:all) do |test|
32+
Rake::Task['test:ci_reporter'].invoke if ENV['CI']
33+
test.libs << 'lib' << 'test'
34+
test.test_files = FileList["test/unit/**/*_test.rb", "test/integration/**/*_test.rb"]
35+
end
36+
end
37+
38+
# ----- Documentation tasks ---------------------------------------------------
39+
40+
require 'yard'
41+
YARD::Rake::YardocTask.new(:doc) do |t|
42+
t.options = %w| --embed-mixins --markup=markdown |
43+
end
44+
45+
# ----- Code analysis tasks ---------------------------------------------------
46+
47+
if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
48+
begin
49+
require 'cane/rake_task'
50+
Cane::RakeTask.new(:quality) do |cane|
51+
cane.abc_max = 15
52+
cane.style_measure = 120
53+
end
54+
rescue LoadError
55+
warn "cane not available, quality task not provided."
56+
end
57+
end
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# coding: utf-8
2+
lib = File.expand_path('../lib', __FILE__)
3+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4+
require 'elasticsearch/persistence/version'
5+
6+
Gem::Specification.new do |s|
7+
s.name = "elasticsearch-persistence"
8+
s.version = Elasticsearch::Persistence::VERSION
9+
s.authors = ["Karel Minarik"]
10+
s.email = ["karel.minarik@elasticsearch.org"]
11+
s.description = "Persistence layer for Ruby models and Elasticsearch."
12+
s.summary = "Persistence layer for Ruby models and Elasticsearch."
13+
s.homepage = "https://github.com/elasticsearch/elasticsearch-rails/"
14+
s.license = "Apache 2"
15+
16+
s.files = `git ls-files -z`.split("\x0")
17+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
18+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
19+
s.require_paths = ["lib"]
20+
21+
s.extra_rdoc_files = [ "README.md", "LICENSE.txt" ]
22+
s.rdoc_options = [ "--charset=UTF-8" ]
23+
24+
s.add_development_dependency "bundler", "~> 1.5"
25+
s.add_development_dependency "rake"
26+
27+
s.add_development_dependency "shoulda-context"
28+
s.add_development_dependency "mocha"
29+
s.add_development_dependency "turn"
30+
s.add_development_dependency "yard"
31+
s.add_development_dependency "ruby-prof"
32+
s.add_development_dependency "pry"
33+
s.add_development_dependency "ci_reporter"
34+
35+
if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
36+
s.add_development_dependency "simplecov"
37+
s.add_development_dependency "cane"
38+
end
39+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require "elasticsearch/persistence/version"
2+
3+
module Elasticsearch
4+
module Persistence
5+
# Your code goes here...
6+
end
7+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Elasticsearch
2+
module Persistence
3+
VERSION = "0.0.1"
4+
end
5+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
RUBY_1_8 = defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
2+
3+
exit(0) if RUBY_1_8
4+
5+
require 'simplecov' and SimpleCov.start { add_filter "/test|test_/" } if ENV["COVERAGE"]
6+
7+
# Register `at_exit` handler for integration tests shutdown.
8+
# MUST be called before requiring `test/unit`.
9+
at_exit { Elasticsearch::Test::IntegrationTestCase.__run_at_exit_hooks } if ENV['SERVER']
10+
11+
require 'test/unit'
12+
require 'shoulda-context'
13+
require 'mocha/setup'
14+
require 'turn' unless ENV["TM_FILEPATH"] || ENV["NOTURN"] || RUBY_1_8
15+
16+
require 'ansi'
17+
require 'oj'
18+
19+
require 'elasticsearch/extensions/test/cluster'
20+
require 'elasticsearch/extensions/test/startup_shutdown'
21+
22+
require 'elasticsearch/persistence'
23+
24+
module Elasticsearch
25+
module Test
26+
class IntegrationTestCase < ::Test::Unit::TestCase
27+
extend Elasticsearch::Extensions::Test::StartupShutdown
28+
29+
startup { Elasticsearch::Extensions::Test::Cluster.start(nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running? }
30+
shutdown { Elasticsearch::Extensions::Test::Cluster.stop if ENV['SERVER'] && started? }
31+
context "IntegrationTest" do; should "noop on Ruby 1.8" do; end; end if RUBY_1_8
32+
33+
def setup
34+
tracer = ::Logger.new(STDERR)
35+
tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" }
36+
Elasticsearch::Persistence.client = Elasticsearch::Client.new \
37+
host: "localhost:#{(ENV['TEST_CLUSTER_PORT'] || 9250)}",
38+
tracer: (ENV['QUIET'] ? nil : tracer)
39+
end
40+
end
41+
end
42+
end

0 commit comments

Comments
 (0)