diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4f09396 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + bundler-cache: true + - run: bundle install + - run: bundle exec rspec + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + bundler-cache: true + - run: bundle install + - run: bundle exec rubocop diff --git a/.ruby-version b/.ruby-version index 338a5b5..be94e6f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.6 +3.2.2 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 07e63ab..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: ruby -rvm: - - 2.6 -cache: bundler -before_install: - - gem install bundler -script: - - bundle exec rspec - - bundle exec rubocop \ No newline at end of file diff --git a/Gemfile b/Gemfile index 7c6149d..07e08ee 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "http://rubygems.org" gem 'activesupport', '>= 5.1.4' -gem 'faraday', '> 0.9.2' +gem 'faraday', '~> 1' gem 'faraday_middleware', '> 0.12.2' gem 'hashie', '> 3.5.7' @@ -9,9 +9,9 @@ gem 'hashie', '> 3.5.7' # Include everything needed to run rake, tests, features, etc. group :development do gem "rspec" + gem "rake" gem "bundler" gem "webmock" gem "rspec-its" - gem "juwelier", git: 'https://github.com/flajann2/juwelier.git' gem "rubocop" end diff --git a/README.md b/README.md new file mode 100644 index 0000000..9495850 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# vertebrae + +Some basic infrastructure for writing beautiful API clients. See tijuana\_client for a small example. + +[![CI Status](https://github.com/controlshift/vertebrae/actions/workflows/ci.yml/badge.svg)](https://github.com/controlshift/vertebrae/actions/workflows/ci.yml) + +## Development + +After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests. + +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Copyright + +Copyright (c) 2013 Nathan Woodhull. See LICENSE.txt for +further details. + diff --git a/README.rdoc b/README.rdoc deleted file mode 100644 index 8e56248..0000000 --- a/README.rdoc +++ /dev/null @@ -1,21 +0,0 @@ -= vertebrae - -Some basic infrastructure for writing beautiful API clients. See tijuana_client for a small example. - -[![Build Status](https://travis-ci.org/controlshift/vertebrae.svg)](https://travis-ci.org/controlshift/vertebrae) - -== Contributing to vertebrae - -* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet. -* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it. -* Fork the project. -* Start a feature/bugfix branch. -* Commit and push until you are happy with your contribution. -* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. -* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. - -== Copyright - -Copyright (c) 2013 Nathan Woodhull. See LICENSE.txt for -further details. - diff --git a/Rakefile b/Rakefile index a3e9437..17afcde 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,8 @@ require 'rubygems' require 'bundler' +require 'bundler/gem_tasks' + begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e @@ -11,21 +13,6 @@ rescue Bundler::BundlerError => e end require 'rake' -require 'juwelier' -Juwelier::Tasks.new do |gem| - # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options - gem.name = "vertebrae" - gem.homepage = "http://github.com/controlshift/vertebrae" - gem.license = "MIT" - gem.summary = %Q{API Client Infrastructure} - gem.description = %Q{A set of low level infrastructure and reusable code for building API clients} - gem.email = "nathan@controlshiftlabs.com" - gem.authors = ["Nathan Woodhull"] - - # dependencies defined in Gemfile -end -Juwelier::RubygemsDotOrgTasks.new - require 'rspec/core' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |spec| diff --git a/VERSION b/VERSION deleted file mode 100644 index b1d7abc..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.6.2 \ No newline at end of file diff --git a/lib/vertebrae.rb b/lib/vertebrae.rb index a4c98ca..51886c0 100644 --- a/lib/vertebrae.rb +++ b/lib/vertebrae.rb @@ -2,18 +2,19 @@ require 'active_support/all' -require 'constants' -require 'authorization' -require 'configuration' -require 'connection' -require 'request' -require 'response_error' -require 'api' -require 'base' -require 'model' +require 'vertebrae/constants' +require 'vertebrae/authorization' +require 'vertebrae/configuration' +require 'vertebrae/connection' +require 'vertebrae/request' +require 'vertebrae/response_error' +require 'vertebrae/api' +require 'vertebrae/base' +require 'vertebrae/model' +require 'vertebrae/version' -require 'railties' if defined? Rails +require 'vertebrae/railties' if defined? Rails module Vertebrae -end \ No newline at end of file +end diff --git a/lib/api.rb b/lib/vertebrae/api.rb similarity index 100% rename from lib/api.rb rename to lib/vertebrae/api.rb diff --git a/lib/authorization.rb b/lib/vertebrae/authorization.rb similarity index 100% rename from lib/authorization.rb rename to lib/vertebrae/authorization.rb diff --git a/lib/base.rb b/lib/vertebrae/base.rb similarity index 100% rename from lib/base.rb rename to lib/vertebrae/base.rb diff --git a/lib/configuration.rb b/lib/vertebrae/configuration.rb similarity index 100% rename from lib/configuration.rb rename to lib/vertebrae/configuration.rb diff --git a/lib/connection.rb b/lib/vertebrae/connection.rb similarity index 96% rename from lib/connection.rb rename to lib/vertebrae/connection.rb index a7adc76..a046ffa 100644 --- a/lib/connection.rb +++ b/lib/vertebrae/connection.rb @@ -2,8 +2,8 @@ require 'faraday' require 'faraday_middleware' -require 'response/raise_error' -require 'authorization' +require 'vertebrae/response/raise_error' +require 'vertebrae/authorization' module Vertebrae class Connection @@ -44,6 +44,7 @@ def default_middleware end builder.use Faraday::Response::Logger if ENV['DEBUG'] + unless options[:raw] builder.use FaradayMiddleware::Mashify builder.use FaradayMiddleware::ParseJson diff --git a/lib/constants.rb b/lib/vertebrae/constants.rb similarity index 100% rename from lib/constants.rb rename to lib/vertebrae/constants.rb diff --git a/lib/model.rb b/lib/vertebrae/model.rb similarity index 100% rename from lib/model.rb rename to lib/vertebrae/model.rb diff --git a/lib/railties.rb b/lib/vertebrae/railties.rb similarity index 100% rename from lib/railties.rb rename to lib/vertebrae/railties.rb diff --git a/lib/request.rb b/lib/vertebrae/request.rb similarity index 100% rename from lib/request.rb rename to lib/vertebrae/request.rb diff --git a/lib/response/raise_error.rb b/lib/vertebrae/response/raise_error.rb similarity index 100% rename from lib/response/raise_error.rb rename to lib/vertebrae/response/raise_error.rb diff --git a/lib/response_error.rb b/lib/vertebrae/response_error.rb similarity index 100% rename from lib/response_error.rb rename to lib/vertebrae/response_error.rb diff --git a/lib/vertebrae/version.rb b/lib/vertebrae/version.rb new file mode 100644 index 0000000..bb2c289 --- /dev/null +++ b/lib/vertebrae/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Vertebrae + VERSION = '0.8.0' +end diff --git a/vertebrae.gemspec b/vertebrae.gemspec index 542dcc3..9088696 100644 --- a/vertebrae.gemspec +++ b/vertebrae.gemspec @@ -1,98 +1,58 @@ -# Generated by juwelier -# DO NOT EDIT THIS FILE DIRECTLY -# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec' -# -*- encoding: utf-8 -*- -# stub: vertebrae 0.7.0 ruby lib +# frozen_string_literal: true + +lib = File.expand_path('lib', __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'vertebrae/version' Gem::Specification.new do |s| s.name = "vertebrae".freeze - s.version = "0.7.0" + s.version = Vertebrae::VERSION s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Nathan Woodhull".freeze] - s.date = "2021-03-22" + s.date = "2023-09-28" s.description = "A set of low level infrastructure and reusable code for building API clients".freeze s.email = "nathan@controlshiftlabs.com".freeze s.extra_rdoc_files = [ "LICENSE.txt", - "README.rdoc" - ] - s.files = [ - ".document", - ".rspec", - ".rubocop.yml", - ".ruby-gemset", - ".ruby-version", - ".travis.yml", - "Gemfile", - "LICENSE.txt", - "README.rdoc", - "Rakefile", - "VERSION", - "lib/api.rb", - "lib/authorization.rb", - "lib/base.rb", - "lib/configuration.rb", - "lib/connection.rb", - "lib/constants.rb", - "lib/core_ext/array.rb", - "lib/model.rb", - "lib/railties.rb", - "lib/request.rb", - "lib/response/raise_error.rb", - "lib/response_error.rb", - "lib/vertebrae.rb", - "spec/api_spec.rb", - "spec/configuration_spec.rb", - "spec/dummy/client.rb", - "spec/dummy/dummy.rb", - "spec/logger_spec.rb", - "spec/request_spec.rb", - "spec/spec_helper.rb", - "vertebrae.gemspec" + "README.md" ] + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + s.files = Dir.chdir(File.expand_path(__dir__)) do + `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + end + s.homepage = "http://github.com/controlshift/vertebrae".freeze s.licenses = ["MIT".freeze] - s.rubygems_version = "3.0.8".freeze s.summary = "API Client Infrastructure".freeze if s.respond_to? :specification_version then s.specification_version = 4 + end - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q.freeze, [">= 5.1.4"]) - s.add_runtime_dependency(%q.freeze, [">= 1.0"]) - s.add_runtime_dependency(%q.freeze, [">= 1.0"]) - s.add_runtime_dependency(%q.freeze, ["> 3.5.7"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - else - s.add_dependency(%q.freeze, [">= 5.1.4"]) - s.add_dependency(%q.freeze, [">= 1.0"]) - s.add_dependency(%q.freeze, [">= 1.0"]) - s.add_dependency(%q.freeze, ["> 3.5.7"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) - end + if s.respond_to? :add_runtime_dependency then + s.add_runtime_dependency(%q.freeze, [">= 5.1.4"]) + s.add_runtime_dependency(%q.freeze, ["~> 1"]) + s.add_runtime_dependency(%q.freeze, ["> 0.12.2"]) + s.add_runtime_dependency(%q.freeze, ["> 3.5.7"]) + s.add_development_dependency(%q.freeze, [">= 0"]) + s.add_development_dependency(%q.freeze, [">= 0"]) + s.add_development_dependency(%q.freeze, [">= 0"]) + s.add_development_dependency(%q.freeze, [">= 0"]) + s.add_development_dependency(%q.freeze, [">= 0"]) + s.add_development_dependency(%q.freeze, [">= 0"]) else s.add_dependency(%q.freeze, [">= 5.1.4"]) - s.add_dependency(%q.freeze, [">= 1.0"]) - s.add_dependency(%q.freeze, [">= 1.0"]) + s.add_dependency(%q.freeze, ["~> 1"]) + s.add_dependency(%q.freeze, ["> 0.12.2"]) s.add_dependency(%q.freeze, ["> 3.5.7"]) s.add_dependency(%q.freeze, [">= 0"]) + s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) end end