diff --git a/.circleci/config.yml b/.circleci/config.yml index cc29bcf..589406d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,87 +1,38 @@ -version: 2.0 +version: 2.1 -jobs: - ruby2.2: - docker: - - image: circleci/ruby:2.2 - steps: - - checkout - - restore_cache: - key: gemfile-2-2-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }} - - run: bundle install -j3 --path vendor/bundle - - save_cache: - key: gemfile-2-2-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }} - paths: - - vendor/bundle - - run: bundle check --path vendor/bundle - - run: bundle exec rubocop - - run: | - bundle exec rspec --profile 10 \ - --format RspecJunitFormatter \ - --out tmp/results/rspec.xml \ - --format progress \ - $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) - - store_test_results: - path: tmp/results +docker-auth: &docker-auth + auth: + username: $DOCKERHUB_USERNAME + password: $DOCKERHUB_ACCESS_TOKEN - ruby2.3: - docker: - - image: circleci/ruby:2.3 - steps: - - checkout - - restore_cache: - key: gemfile-2-3-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }} - - run: bundle install -j3 --path vendor/bundle - - save_cache: - key: gemfile-2-3-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }} - paths: - - vendor/bundle - - run: bundle check --path vendor/bundle - - run: bundle exec rubocop - - run: | - bundle exec rspec --profile 10 \ - --format RspecJunitFormatter \ - --out tmp/results/rspec.xml \ - --format progress \ - $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) - - store_test_results: - path: tmp/results - - ruby2.4: +jobs: + bundle: + parameters: + ruby_version: { type: string } docker: - - image: circleci/ruby:2.4 + - image: cimg/ruby:<< parameters.ruby_version >> + <<: *docker-auth steps: - checkout - restore_cache: - key: gemfile-2-4-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }} - - run: bundle install -j3 --path vendor/bundle + key: gemfile-<< parameters.ruby_version >>-{{ checksum "Gemfile" }} + - run: bundle install -j3 - save_cache: - key: gemfile-2-4-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }} + key: gemfile-<< parameters.ruby_version >>-{{ checksum "Gemfile" }} paths: - vendor/bundle - - run: bundle check --path vendor/bundle - - run: bundle exec rubocop - - run: | - bundle exec rspec --profile 10 \ - --format RspecJunitFormatter \ - --out tmp/results/rspec.xml \ - --format progress \ - $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) - - store_test_results: - path: tmp/results - ruby2.5: + ruby: + parameters: + ruby_version: { type: string } docker: - - image: circleci/ruby:2.5 + - image: cimg/ruby:<< parameters.ruby_version >> + <<: *docker-auth steps: - checkout - restore_cache: - key: gemfile-2-5-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }} - - run: bundle install -j3 --path vendor/bundle - - save_cache: - key: gemfile-2-5-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }} - paths: - - vendor/bundle + key: gemfile-<< parameters.ruby_version >>-{{ checksum "Gemfile" }} + - run: gem install bundler:2.3.26 - run: bundle check --path vendor/bundle - run: bundle exec rubocop - run: | @@ -93,12 +44,19 @@ jobs: - store_test_results: path: tmp/results - workflows: version: 2 build: jobs: - - ruby2.2 - - ruby2.3 - - ruby2.4 - - ruby2.5 + - bundle: + context: org-global + matrix: + parameters: + ruby_version: ['2.7', '3.0'] + - ruby: + context: org-global + matrix: + parameters: + ruby_version: ['2.7', '3.0'] + requires: + - bundle diff --git a/.rubocop.yml b/.rubocop.yml index 0414e19..a7e2b20 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,6 @@ +AllCops: + TargetRubyVersion: 2.7 + Metrics/BlockLength: Exclude: - 'spec/**/*' diff --git a/Gemfile b/Gemfile index 6c1e57e..8d62d5b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' group :development do diff --git a/lib/selligent/middlewares/authorization.rb b/lib/selligent/middlewares/authorization.rb index 2499d57..a0f0a0d 100644 --- a/lib/selligent/middlewares/authorization.rb +++ b/lib/selligent/middlewares/authorization.rb @@ -8,7 +8,7 @@ module Selligent module Middlewares # Auth is a Faraday middleware class Authorization < ::Faraday::Middleware - AUTH_HEADER = 'X-ApiKey'.freeze + AUTH_HEADER = 'X-ApiKey' def call(env) env[:request_headers][AUTH_HEADER] = auth_header diff --git a/lib/selligent/version.rb b/lib/selligent/version.rb index cc33de8..11d81f3 100644 --- a/lib/selligent/version.rb +++ b/lib/selligent/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Selligent - VERSION = '0.1.3'.freeze + VERSION = '0.1.3' end diff --git a/selligent.gemspec b/selligent.gemspec index 0abdfbc..415b4b3 100644 --- a/selligent.gemspec +++ b/selligent.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'selligent/version' @@ -12,14 +14,15 @@ Gem::Specification.new do |s| s.summary = 'Selligent Ruby API client' s.description = 'Provides access to the Selligent REST API' s.license = 'MIT' + s.required_ruby_version = '>= 2.7' - s.files = `git ls-files -z`.split("\x0").reject do |f| + s.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{^(test|spec|features)/}) end s.require_paths = ['lib'] - s.add_development_dependency 'bundler', '~> 1.16' + s.add_development_dependency 'bundler', '~> 2.3' s.add_dependency 'faraday' s.add_dependency 'faraday_middleware' end diff --git a/spec/selligent/client/content_spec.rb b/spec/selligent/client/content_spec.rb index 740ae95..9327333 100644 --- a/spec/selligent/client/content_spec.rb +++ b/spec/selligent/client/content_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::Content do diff --git a/spec/selligent/client/cumulio_spec.rb b/spec/selligent/client/cumulio_spec.rb index a4b5e73..2e992ae 100644 --- a/spec/selligent/client/cumulio_spec.rb +++ b/spec/selligent/client/cumulio_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::Cumulio do diff --git a/spec/selligent/client/data_spec.rb b/spec/selligent/client/data_spec.rb index 6ad8a71..013e6b8 100644 --- a/spec/selligent/client/data_spec.rb +++ b/spec/selligent/client/data_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::Data do diff --git a/spec/selligent/client/journeys_spec.rb b/spec/selligent/client/journeys_spec.rb index 59cd66c..cb7f1fd 100644 --- a/spec/selligent/client/journeys_spec.rb +++ b/spec/selligent/client/journeys_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::Status do diff --git a/spec/selligent/client/lists_spec.rb b/spec/selligent/client/lists_spec.rb index 4d40a1c..f360d04 100644 --- a/spec/selligent/client/lists_spec.rb +++ b/spec/selligent/client/lists_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::Lists do diff --git a/spec/selligent/client/organizations_spec.rb b/spec/selligent/client/organizations_spec.rb index b40f03e..5b44022 100644 --- a/spec/selligent/client/organizations_spec.rb +++ b/spec/selligent/client/organizations_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::Organizations do diff --git a/spec/selligent/client/single_batch_spec.rb b/spec/selligent/client/single_batch_spec.rb index b4b63e8..a53d6c7 100644 --- a/spec/selligent/client/single_batch_spec.rb +++ b/spec/selligent/client/single_batch_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::SingleBatch do diff --git a/spec/selligent/client/status_spec.rb b/spec/selligent/client/status_spec.rb index 6e2038e..c9f332d 100644 --- a/spec/selligent/client/status_spec.rb +++ b/spec/selligent/client/status_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::Journeys do diff --git a/spec/selligent/client/stored_procedures_spec.rb b/spec/selligent/client/stored_procedures_spec.rb index cbab010..6e9ddda 100644 --- a/spec/selligent/client/stored_procedures_spec.rb +++ b/spec/selligent/client/stored_procedures_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::StoredProcedures do diff --git a/spec/selligent/client/tasks_spec.rb b/spec/selligent/client/tasks_spec.rb index 7473c8c..6984ef9 100644 --- a/spec/selligent/client/tasks_spec.rb +++ b/spec/selligent/client/tasks_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::Tasks do diff --git a/spec/selligent/client/transactional_bulk_spec.rb b/spec/selligent/client/transactional_bulk_spec.rb index 82826b7..02cdb0b 100644 --- a/spec/selligent/client/transactional_bulk_spec.rb +++ b/spec/selligent/client/transactional_bulk_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::TransactionalBulk do diff --git a/spec/selligent/client/transactionals_spec.rb b/spec/selligent/client/transactionals_spec.rb index 81afb23..dcb8a86 100644 --- a/spec/selligent/client/transactionals_spec.rb +++ b/spec/selligent/client/transactionals_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client::Transactionals do diff --git a/spec/selligent/client_spec.rb b/spec/selligent/client_spec.rb index d3b2b81..e4580bf 100644 --- a/spec/selligent/client_spec.rb +++ b/spec/selligent/client_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Client do diff --git a/spec/selligent/configuration_spec.rb b/spec/selligent/configuration_spec.rb index c4953a8..b3e6592 100644 --- a/spec/selligent/configuration_spec.rb +++ b/spec/selligent/configuration_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe Selligent::Configuration do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6400d62..7ddc12a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'selligent' require 'timecop' require 'webmock/rspec'