Skip to content

Commit

Permalink
🔥 Config Elasticsearch with ElasticsearchReader
Browse files Browse the repository at this point in the history
  • Loading branch information
adham90 committed Jun 16, 2017
1 parent 54ab797 commit e9cf750
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
/spec/reports/
/tmp/

.byebug_history

# rspec failure tracking
.rspec_status
10 changes: 0 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,4 @@

source 'https://rubygems.org'

# Specify your gem's dependencies in elasticsearch_reader.gemspec
gemspec

gem 'activesupport'

gem 'guard'
gem 'guard-bundler', require: false
gem 'guard-rspec'

gem 'redcarpet'
gem 'yard'
9 changes: 8 additions & 1 deletion elasticsearch_reader.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']
spec.metadata['yard.run'] = 'yri'

spec.add_development_dependency 'bundler', '~> 1.14'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'byebug'
spec.add_development_dependency 'guard'
spec.add_development_dependency 'guard-rspec'
spec.add_development_dependency 'guard-bundler'
spec.add_development_dependency 'redcarpet'
spec.add_development_dependency 'yard'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rspec-its'
spec.add_development_dependency 'rubocop', '0.48.1'
spec.add_development_dependency 'rspec-collection_matchers'
spec.add_development_dependency 'appraisal'

spec.add_dependency 'activesupport'
spec.add_dependency 'elasticsearch', '>= 5.0.0'
spec.add_dependency 'elasticsearch-dsl'
end
27 changes: 12 additions & 15 deletions lib/elasticsearch_reader.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
# frozen_string_literal: true

require 'active_support/concern'
require 'active_support/deprecation'
require 'active_support/json'
require 'active_support/log_subscriber'
require 'singleton'
require 'elasticsearch'

require 'active_support/core_ext/array/access'
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/enumerable'
require 'active_support/core_ext/hash/reverse_merge'
require 'active_support/core_ext/numeric/time'
require 'active_support/core_ext/numeric/bytes'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/inclusion'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/module/delegation'

require 'singleton'
require 'elasticsearch_reader/version'
require 'elasticsearch_reader/config'

# You Know What It Is :D
module ElasticsearchReader
# Your code goes here...
# ElasticsearchReader Main Class
class << self
# Main elasticsearch-ruby client instance
#
def client
::Elasticsearch::Client.new(configuration)
end

def config
ElasticsearchReader::Config.instance
end
Expand Down
4 changes: 4 additions & 0 deletions spec/elasticsearch_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
it 'has a version number' do
expect(ElasticsearchReader::VERSION).not_to be nil
end

# TODO: write test cases for .client method
context '.client' do
end
end
6 changes: 6 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
require 'bundler/setup'
require 'elasticsearch_reader'
require 'rspec/its'
require 'byebug'

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'

config.mock_with :rspec
config.order = :random
config.filter_run focus: true
config.run_all_when_everything_filtered = true

config.expect_with :rspec do |c|
c.syntax = :expect
end
Expand Down

0 comments on commit e9cf750

Please sign in to comment.