diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ac2a58..8b3d115 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,82 +1,123 @@ -version: 2 +version: 2.1 -workflows: - version: 2 - main: - jobs: - - build_2_4 - - build_2_5 - - build_2_6 -jobs: - build_2_4: +orbs: + gem: doximity/gem-publisher@0 + +executors: + ruby-latest: resource_class: small docker: - - image: ruby:2.4 - - image: elastic/elasticsearch:6.8.2 + - image: circleci/ruby:latest environment: - - xpack.security.enabled=false - steps: - - restore_cache: - keys: - - gem-cache-2_4-v2-{{ checksum "Gemfile.lock" }} - - gem-cache-2_4-v2- - - checkout - - run: - name: Install Ruby Dependencies - command: bundle install - - run: - name: Run Tests - command: bundle exec rspec - - save_cache: - key: gem-cache-2_4-v2-{{ checksum "Gemfile.lock" }} - paths: - - ./vendor/bundle - - ./vendor/cache - build_2_5: + BUNDLE_VERSION: "~> 1.17" + ruby_2_5: resource_class: small docker: - - image: ruby:2.5 + - image: circleci/ruby:2.5 + environment: + BUNDLE_VERSION: "~> 1.17" - image: elastic/elasticsearch:6.8.2 environment: - xpack.security.enabled=false + +# yaml anchor filters +master_only: &master_only + filters: + branches: + only: master + tags: + ignore: /.*/ +pr_only: &pr_only + filters: + branches: + ignore: master + tags: + ignore: /.*/ +version_tags_only: &version_tags_only + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ + +jobs: + build_2_5: + executor: ruby_2_5 steps: + - checkout + - run: + name: Install Bundler specific version + command: bundle check --path=vendor/bundle || bundle install --local --frozen --path=vendor/bundle --jobs=4 --retry=3 - restore_cache: keys: - gem-cache-2_5-v2-{{ checksum "Gemfile.lock" }} - gem-cache-2_5-v2- - - checkout - run: name: Install Ruby Dependencies - command: bundle install - - run: - name: Run Tests - command: bundle exec rspec + command: bundle install --path=vendor/bundle --jobs=4 --retry=3 - save_cache: key: gem-cache-2_5-v2-{{ checksum "Gemfile.lock" }} paths: - ./vendor/bundle - - ./vendor/cache - build_2_6: - resource_class: small - docker: - - image: ruby:2.5 - - image: elastic/elasticsearch:6.8.2 - environment: - - xpack.security.enabled=false - steps: - - restore_cache: - keys: - - gem-cache-2_6-v2-{{ checksum "Gemfile.lock" }} - - gem-cache-2_6-v2- - - checkout - - run: - name: Install Ruby Dependencies - command: bundle install - run: name: Run Tests command: bundle exec rspec - - save_cache: - key: gem-cache-2_6-v2-{{ checksum "Gemfile.lock" }} + - persist_to_workspace: + root: . paths: - - ./vendor/bundle - - ./vendor/cache + - vendor/bundle +workflows: + version: 2 + trunk: + jobs: + - build_2_5: + <<: *master_only + - gem/build: + <<: *master_only + executor: ruby-latest + name: gem-build + requires: + - build_2_5 + + pull-requests: + jobs: + - build_2_5: + <<: *pr_only + - gem/build: + <<: *pr_only + executor: ruby-latest + name: gem-build + requires: + - build_2_5 + - pre-release-approval: + <<: *pr_only + type: approval + requires: + - gem-build + - gem/publish: + <<: *pr_only + name: gem-publish + to_nexus: true + pre_release: true + requires: + - pre-release-approval + context: artifact_publishing + + final-release: + jobs: + - build_2_5: + <<: *version_tags_only + - gem/build: + <<: *version_tags_only + executor: ruby-latest + name: gem-build + requires: + - build_2_5 + - gem/publish: + <<: *version_tags_only + name: gem-publish + to_nexus: true + pre_release: false + requires: + - gem-build + context: artifact_publishing diff --git a/.gitignore b/.gitignore index c02ab48..882ecb3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,19 @@ +*.a +*.bundle +*.log +*.o +*.so +.DS_Store +.rspec_status +/*.gem /.bundle/ +/.ruby-version /.yardoc -/Gemfile.lock /_yardoc/ /coverage/ /doc/ /pkg/ /spec/reports/ /tmp/ -*.bundle -*.so -*.o -*.a +/vendor/bundle/ mkmf.log -*.log -.DS_Store diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..0803663 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,23 @@ +--- +inherit_gem: + dox-style: + - ".rubocop.yml" + +Env/UseFetch: + Exclude: + - "./bin/*" + +Metrics/BlockLength: + Exclude: + - "./**/*_spec*.rb" + - "./*.gemspec" + - "./spec/*_helper*.rb" + - "Gemfile" + +Metrics/ModuleLength: + Exclude: + - "./**/*_spec*.rb" + +Metrics/MethodLength: + Exclude: + - "./**/*_spec*.rb" diff --git a/CHANGELOG b/CHANGELOG.md similarity index 96% rename from CHANGELOG rename to CHANGELOG.md index b4c797b..e1692ee 100644 --- a/CHANGELOG +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Changelog +========= +## 0.13.2 + * Release on Nexus using gem-publisher CircleCI Orb + * Packing gems + * bump the version for testing the Nexus repo v0.13.1 - remove superfluous 'to_ary' delegation that was causing issues downstream v0.13.0 diff --git a/Gemfile b/Gemfile index 9241e72..84367ef 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ -source 'https://rubygems.org' +# frozen_string_literal: true +# +# BEFORE changing this file, read https://wiki.doximity.com/articles/gemfile-maintenance +source "https://artifacts.dox.support/repository/gems" -# Specify your gem's dependencies in elasticity.gemspec gemspec - -gem "elasticsearch", "7.2.0" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..d70ceaa --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,94 @@ +PATH + remote: . + specs: + es-elasticity (0.13.2) + activemodel (>= 4.0.0, < 6) + activerecord (>= 4.0.0, < 6) + activesupport (>= 4.0.0, < 6) + elasticsearch (>= 1.0) + +GEM + remote: https://artifacts.dox.support/repository/gems/ + specs: + activemodel (5.2.4) + activesupport (= 5.2.4) + activerecord (5.2.4) + activemodel (= 5.2.4) + activesupport (= 5.2.4) + arel (>= 9.0) + activesupport (5.2.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (9.0.0) + byebug (11.0.1) + codeclimate-test-reporter (1.0.9) + simplecov (<= 0.13) + coderay (1.1.2) + concurrent-ruby (1.1.5) + diff-lcs (1.3) + elasticsearch (7.2.0) + elasticsearch-api (= 7.2.0) + elasticsearch-transport (= 7.2.0) + elasticsearch-api (7.2.0) + multi_json + elasticsearch-transport (7.2.0) + faraday + multi_json + faraday (0.17.1) + multipart-post (>= 1.2, < 3) + i18n (1.7.0) + concurrent-ruby (~> 1.0) + method_source (0.9.2) + minitest (5.13.0) + multi_json (1.14.1) + multipart-post (2.1.1) + oj (3.10.0) + pry (0.12.2) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + rake (10.5.0) + redis (4.1.3) + rspec (3.1.0) + rspec-core (~> 3.1.0) + rspec-expectations (~> 3.1.0) + rspec-mocks (~> 3.1.0) + rspec-core (3.1.7) + rspec-support (~> 3.1.0) + rspec-expectations (3.1.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.1.0) + rspec-mocks (3.1.3) + rspec-support (~> 3.1.0) + rspec-support (3.1.2) + rspec_junit_formatter (0.4.1) + rspec-core (>= 2, < 4, != 2.12.0) + simplecov (0.7.1) + multi_json (~> 1.0) + simplecov-html (~> 0.7.1) + simplecov-html (0.7.1) + thread_safe (0.3.6) + timecop (0.9.1) + tzinfo (1.2.5) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + bundler (~> 1.7) + byebug + codeclimate-test-reporter + es-elasticity! + oj + pry + rake (~> 10.0) + redis + rspec (~> 3.1.0) + rspec_junit_formatter + simplecov (~> 0.7.1) + timecop + +BUNDLED WITH + 1.17.3 diff --git a/README.md b/README.md index 66a803b..f74c5cd 100644 --- a/README.md +++ b/README.md @@ -443,6 +443,20 @@ The default persistence strategy changed from SingleIndex to AliasIndex in versi 5. Create a new Pull Request 6. Sign the CLA if you haven't yet. See CONTRIBUTING.md +## Gem documentation + +You can find the documentation by going to CircleCI, looking for the `build` job, going to Artifacts and clicking on `index.html`. A visual guide on this can be found in our wiki at [Gems Development: Where to find documentation for our gems](https://wiki.doximity.com/articles/gems-development-where-to-find-documentation-for-our-gems). + +## Gem development + +After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests. +You can also run `bundle console` for an interactive prompt that will allow you to experiment. + +This repository uses a gem publishing mechanism on the CI configuration, meaning most work related with cutting a new +version is done automatically. + +To release a new version, follow the [wiki instructions](https://wiki.doximity.com/articles/gems-development-releasing-new-versions). + ## License MPN is licensed under an Apache 2 license. Contributors are required to sign an contributor license agreement. See LICENSE.txt and CONTRIBUTING.md for more information. diff --git a/Rakefile b/Rakefile index 8b1b45e..8d2114e 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,10 @@ +# frozen_string_literal: true + require "bundler/gem_tasks" require "rspec/core/rake_task" -RSpec::Core::RakeTask.new +FileList["tasks/*.rake"].each { |task| load task } + +RSpec::Core::RakeTask.new(:spec) task default: :spec diff --git a/elasticity.gemspec b/es-elasticity.gemspec similarity index 89% rename from elasticity.gemspec rename to es-elasticity.gemspec index 89edd80..b9d6771 100644 --- a/elasticity.gemspec +++ b/es-elasticity.gemspec @@ -14,6 +14,9 @@ Gem::Specification.new do |spec| spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") + spec.files = `git ls-files -z`.split("\x0").reject do |f| + f.match(%r{^(bin|test|spec|vendor|tmp|coverage)/}) + end # spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.executables = [] spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) @@ -29,6 +32,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "codeclimate-test-reporter" spec.add_development_dependency "redis" spec.add_development_dependency "timecop" + spec.add_development_dependency "rspec_junit_formatter" spec.add_dependency "activesupport", ">= 4.0.0", "< 6" spec.add_dependency "activemodel", ">= 4.0.0", "< 6" diff --git a/lib/elasticity/version.rb b/lib/elasticity/version.rb index 4d5c181..2985066 100644 --- a/lib/elasticity/version.rb +++ b/lib/elasticity/version.rb @@ -1,3 +1,3 @@ module Elasticity - VERSION = "0.13.1" + VERSION = "0.13.2" end diff --git a/tasks/ci.rake b/tasks/ci.rake new file mode 100644 index 0000000..3a582db --- /dev/null +++ b/tasks/ci.rake @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +namespace :ci do + desc "Run specs" + task :specs do + reports = "tmp/test-results/rspec" + sh "mkdir -p #{reports}" + sh "bundle exec rspec ./spec " \ + "--format progress "\ + "-o #{reports}/results.xml" + end +end diff --git a/tasks/rdoc.rake b/tasks/rdoc.rake new file mode 100644 index 0000000..16fa86d --- /dev/null +++ b/tasks/rdoc.rake @@ -0,0 +1,14 @@ +# frozeon_string_literal: true + +require "rdoc/task" + +RDoc::Task.new do |rdoc| + rdoc.main = "README.md" + rdoc.markup = "tomdoc" + rdoc.options << "--github --encoding=UTF-8" + rdoc.rdoc_dir = "doc" + rdoc.rdoc_files.exclude("vendor", "tmp") + rdoc.rdoc_files.include("README.md", "lib", "*.rb") + rdoc.template = "rails" + rdoc.title = "Documentation" +end diff --git a/vendor/cache/activemodel-5.2.4.gem b/vendor/cache/activemodel-5.2.4.gem new file mode 100644 index 0000000..5650735 Binary files /dev/null and b/vendor/cache/activemodel-5.2.4.gem differ diff --git a/vendor/cache/activerecord-5.2.4.gem b/vendor/cache/activerecord-5.2.4.gem new file mode 100644 index 0000000..d6c5194 Binary files /dev/null and b/vendor/cache/activerecord-5.2.4.gem differ diff --git a/vendor/cache/activesupport-5.2.4.gem b/vendor/cache/activesupport-5.2.4.gem new file mode 100644 index 0000000..465c6c6 Binary files /dev/null and b/vendor/cache/activesupport-5.2.4.gem differ diff --git a/vendor/cache/arel-9.0.0.gem b/vendor/cache/arel-9.0.0.gem new file mode 100755 index 0000000..a2c51af Binary files /dev/null and b/vendor/cache/arel-9.0.0.gem differ diff --git a/vendor/cache/byebug-11.0.1.gem b/vendor/cache/byebug-11.0.1.gem new file mode 100755 index 0000000..c4dae2b Binary files /dev/null and b/vendor/cache/byebug-11.0.1.gem differ diff --git a/vendor/cache/codeclimate-test-reporter-1.0.9.gem b/vendor/cache/codeclimate-test-reporter-1.0.9.gem new file mode 100755 index 0000000..39c5147 Binary files /dev/null and b/vendor/cache/codeclimate-test-reporter-1.0.9.gem differ diff --git a/vendor/cache/coderay-1.1.2.gem b/vendor/cache/coderay-1.1.2.gem new file mode 100755 index 0000000..5d698f1 Binary files /dev/null and b/vendor/cache/coderay-1.1.2.gem differ diff --git a/vendor/cache/concurrent-ruby-1.1.5.gem b/vendor/cache/concurrent-ruby-1.1.5.gem new file mode 100755 index 0000000..ce1284a Binary files /dev/null and b/vendor/cache/concurrent-ruby-1.1.5.gem differ diff --git a/vendor/cache/diff-lcs-1.3.gem b/vendor/cache/diff-lcs-1.3.gem new file mode 100755 index 0000000..ae5a5f9 Binary files /dev/null and b/vendor/cache/diff-lcs-1.3.gem differ diff --git a/vendor/cache/elasticsearch-7.2.0.gem b/vendor/cache/elasticsearch-7.2.0.gem new file mode 100755 index 0000000..ca60f7c Binary files /dev/null and b/vendor/cache/elasticsearch-7.2.0.gem differ diff --git a/vendor/cache/elasticsearch-api-7.2.0.gem b/vendor/cache/elasticsearch-api-7.2.0.gem new file mode 100755 index 0000000..d3f04a0 Binary files /dev/null and b/vendor/cache/elasticsearch-api-7.2.0.gem differ diff --git a/vendor/cache/elasticsearch-transport-7.2.0.gem b/vendor/cache/elasticsearch-transport-7.2.0.gem new file mode 100755 index 0000000..42e1404 Binary files /dev/null and b/vendor/cache/elasticsearch-transport-7.2.0.gem differ diff --git a/vendor/cache/faraday-0.17.1.gem b/vendor/cache/faraday-0.17.1.gem new file mode 100644 index 0000000..2097f41 Binary files /dev/null and b/vendor/cache/faraday-0.17.1.gem differ diff --git a/vendor/cache/i18n-1.7.0.gem b/vendor/cache/i18n-1.7.0.gem new file mode 100755 index 0000000..de92a6f Binary files /dev/null and b/vendor/cache/i18n-1.7.0.gem differ diff --git a/vendor/cache/method_source-0.9.2.gem b/vendor/cache/method_source-0.9.2.gem new file mode 100755 index 0000000..c12e342 Binary files /dev/null and b/vendor/cache/method_source-0.9.2.gem differ diff --git a/vendor/cache/minitest-5.13.0.gem b/vendor/cache/minitest-5.13.0.gem new file mode 100644 index 0000000..eaf1c8b Binary files /dev/null and b/vendor/cache/minitest-5.13.0.gem differ diff --git a/vendor/cache/multi_json-1.14.1.gem b/vendor/cache/multi_json-1.14.1.gem new file mode 100755 index 0000000..65dea1d Binary files /dev/null and b/vendor/cache/multi_json-1.14.1.gem differ diff --git a/vendor/cache/multipart-post-2.1.1.gem b/vendor/cache/multipart-post-2.1.1.gem new file mode 100755 index 0000000..027956d Binary files /dev/null and b/vendor/cache/multipart-post-2.1.1.gem differ diff --git a/vendor/cache/oj-3.10.0.gem b/vendor/cache/oj-3.10.0.gem new file mode 100644 index 0000000..3723b9f Binary files /dev/null and b/vendor/cache/oj-3.10.0.gem differ diff --git a/vendor/cache/pry-0.12.2.gem b/vendor/cache/pry-0.12.2.gem new file mode 100755 index 0000000..e7c4ee1 Binary files /dev/null and b/vendor/cache/pry-0.12.2.gem differ diff --git a/vendor/cache/rake-10.5.0.gem b/vendor/cache/rake-10.5.0.gem new file mode 100755 index 0000000..0fe2757 Binary files /dev/null and b/vendor/cache/rake-10.5.0.gem differ diff --git a/vendor/cache/redis-4.1.3.gem b/vendor/cache/redis-4.1.3.gem new file mode 100755 index 0000000..7e4dd4e Binary files /dev/null and b/vendor/cache/redis-4.1.3.gem differ diff --git a/vendor/cache/rspec-3.1.0.gem b/vendor/cache/rspec-3.1.0.gem new file mode 100755 index 0000000..9f909ad Binary files /dev/null and b/vendor/cache/rspec-3.1.0.gem differ diff --git a/vendor/cache/rspec-core-3.1.7.gem b/vendor/cache/rspec-core-3.1.7.gem new file mode 100755 index 0000000..2b20659 Binary files /dev/null and b/vendor/cache/rspec-core-3.1.7.gem differ diff --git a/vendor/cache/rspec-expectations-3.1.2.gem b/vendor/cache/rspec-expectations-3.1.2.gem new file mode 100755 index 0000000..1b0f225 Binary files /dev/null and b/vendor/cache/rspec-expectations-3.1.2.gem differ diff --git a/vendor/cache/rspec-mocks-3.1.3.gem b/vendor/cache/rspec-mocks-3.1.3.gem new file mode 100755 index 0000000..1625553 Binary files /dev/null and b/vendor/cache/rspec-mocks-3.1.3.gem differ diff --git a/vendor/cache/rspec-support-3.1.2.gem b/vendor/cache/rspec-support-3.1.2.gem new file mode 100755 index 0000000..0a230d6 Binary files /dev/null and b/vendor/cache/rspec-support-3.1.2.gem differ diff --git a/vendor/cache/rspec_junit_formatter-0.4.1.gem b/vendor/cache/rspec_junit_formatter-0.4.1.gem new file mode 100644 index 0000000..c456b43 Binary files /dev/null and b/vendor/cache/rspec_junit_formatter-0.4.1.gem differ diff --git a/vendor/cache/simplecov-0.7.1.gem b/vendor/cache/simplecov-0.7.1.gem new file mode 100755 index 0000000..9571c50 Binary files /dev/null and b/vendor/cache/simplecov-0.7.1.gem differ diff --git a/vendor/cache/simplecov-html-0.7.1.gem b/vendor/cache/simplecov-html-0.7.1.gem new file mode 100755 index 0000000..87b65c5 Binary files /dev/null and b/vendor/cache/simplecov-html-0.7.1.gem differ diff --git a/vendor/cache/thread_safe-0.3.6.gem b/vendor/cache/thread_safe-0.3.6.gem new file mode 100755 index 0000000..7ee950f Binary files /dev/null and b/vendor/cache/thread_safe-0.3.6.gem differ diff --git a/vendor/cache/timecop-0.9.1.gem b/vendor/cache/timecop-0.9.1.gem new file mode 100755 index 0000000..7c3eb5e Binary files /dev/null and b/vendor/cache/timecop-0.9.1.gem differ diff --git a/vendor/cache/tzinfo-1.2.5.gem b/vendor/cache/tzinfo-1.2.5.gem new file mode 100755 index 0000000..fd75e90 Binary files /dev/null and b/vendor/cache/tzinfo-1.2.5.gem differ