diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..3e16eafe --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "daily" +- package-ecosystem: bundler + directory: "/" + schedule: + interval: daily + time: "11:00" + open-pull-requests-limit: 10 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..93077e3a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +--- + +name: CI + +on: [push, pull_request] + +jobs: + test: + name: "Testing" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + # Recent Rubies and Rails + - ruby-version: '3.2' + - ruby-version: '3.1' + - ruby-version: '3.0' + - ruby-version: '2.7' + - ruby-version: '2.6' + - ruby-version: '2.6' + - ruby-version: '2.7' + - ruby-version: '2.6' + # Old Rubies and Rails + - ruby-version: '2.5' + bundler: '1' + - ruby-version: '2.4' + bundler: '1' + - ruby-version: '2.4' + bundler: '1' + # Failing with a stack trace in active support + # - ruby-version: '2.4' + # rails-version: '4.1' + # bundler: '1' + + continue-on-error: "${{ endsWith(matrix.ruby-version, 'head') }}" + + env: + CI: "1" + + steps: + - name: "Checkout Code" + uses: "actions/checkout@v4" + timeout-minutes: 5 + with: + fetch-depth: 0 + + # - name: Install required libs + # run: | + # sudo apt-get -yqq install libsqlite3-dev + + - name: "Build Ruby" + uses: ruby/setup-ruby@v1 + with: + ruby-version: "${{ matrix.ruby-version }}" + bundler: "${{ matrix.bundler || 2 }}" + bundler-cache: true + # env: + # RAILS_VERSION: ${{ matrix.rails-version }} + + - name: "Run tests" + run: | + bundle exec rake + # env: + # RAILS_VERSION: ${{ matrix.rails-version }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f219b701..00000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: ruby -rvm: - - 2.1.8 - - 2.2.4 - - 2.3.0 - - 2.4.9 - - 2.5.8 - - 2.6.6 -gemfile: - - Gemfile -script: - - bundle exec rake -branches: - only: - - master diff --git a/README.md b/README.md index 3a02de80..3c413732 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![Build Status](https://travis-ci.org/zipmark/rspec_api_documentation.svg?branch=master)](https://travis-ci.org/zipmark/rspec_api_documentation) [![Code Climate](https://codeclimate.com/github/zipmark/rspec_api_documentation/badges/gpa.svg)](https://codeclimate.com/github/zipmark/rspec_api_documentation) [![Inline docs](https://inch-ci.org/github/zipmark/rspec_api_documentation.svg?branch=master)](https://inch-ci.org/github/zipmark/rspec_api_documentation) [![Gem Version](https://badge.fury.io/rb/rspec_api_documentation.svg)](https://badge.fury.io/rb/rspec_api_documentation) diff --git a/features/readme.md b/features/readme.md index 8b424a20..365510ec 100644 --- a/features/readme.md +++ b/features/readme.md @@ -1,5 +1,3 @@ -[![Travis status](https://secure.travis-ci.org/zipmark/rspec_api_documentation.png)](https://secure.travis-ci.org/zipmark/rspec_api_documentation) - http://github.com/zipmark/rspec_api_documentation # RSpec API Doc Generator diff --git a/lib/rspec_api_documentation.rb b/lib/rspec_api_documentation.rb index 5986aadb..a15e6018 100644 --- a/lib/rspec_api_documentation.rb +++ b/lib/rspec_api_documentation.rb @@ -1,7 +1,9 @@ require 'active_support' require 'active_support/inflector' +require 'active_support/core_ext/array/extract_options' require 'active_support/core_ext/hash/conversions' require 'active_support/core_ext/hash/deep_merge' +require 'active_support/core_ext/hash/keys' require 'cgi' require 'json' diff --git a/lib/rspec_api_documentation/writers/append_json_writer.rb b/lib/rspec_api_documentation/writers/append_json_writer.rb index 5eae1f7b..69f943e7 100644 --- a/lib/rspec_api_documentation/writers/append_json_writer.rb +++ b/lib/rspec_api_documentation/writers/append_json_writer.rb @@ -5,7 +5,7 @@ module Writers class AppendJsonWriter < JsonWriter def write index_file = docs_dir.join("index.json") - if File.exists?(index_file) && (output = File.read(index_file)).length >= 2 + if File.exist?(index_file) && (output = File.read(index_file)).length >= 2 existing_index_hash = JSON.parse(output) end File.open(index_file, "w+") do |f| diff --git a/lib/rspec_api_documentation/writers/writer.rb b/lib/rspec_api_documentation/writers/writer.rb index d70b1f2a..a00c1715 100644 --- a/lib/rspec_api_documentation/writers/writer.rb +++ b/lib/rspec_api_documentation/writers/writer.rb @@ -14,7 +14,7 @@ def self.write(index, configuration) end def self.clear_docs(docs_dir) - if File.exists?(docs_dir) + if File.exist?(docs_dir) FileUtils.rm_rf(docs_dir, :secure => true) end FileUtils.mkdir_p(docs_dir) diff --git a/rspec_api_documentation.gemspec b/rspec_api_documentation.gemspec index 20e1258d..978b3bf0 100644 --- a/rspec_api_documentation.gemspec +++ b/rspec_api_documentation.gemspec @@ -20,23 +20,23 @@ Gem::Specification.new do |s| s.add_development_dependency "bundler", ">= 1.16" s.add_development_dependency "fakefs", "~> 0.6.0" - s.add_development_dependency "sinatra", "~> 1.4.7" - s.add_development_dependency "aruba", "~> 0.13.0" - s.add_development_dependency "capybara", "~> 2.6.2" - s.add_development_dependency "rake", "~> 10.5.0" + s.add_development_dependency "sinatra", "~> 2.0.8" + s.add_development_dependency "aruba", "~> 0.14.14" + s.add_development_dependency "capybara", "~> 3.39.2" + s.add_development_dependency "rake", "~> 13.2.1" s.add_development_dependency "rack-test", "~> 0.6.3" - s.add_development_dependency "rack-oauth2", "~> 1.2.2" - s.add_development_dependency "webmock", "~> 3.8.3" - s.add_development_dependency "rspec-its", "~> 1.2.0" - s.add_development_dependency "faraday", "~> 0.9.2" + s.add_development_dependency "rack-oauth2", "~> 1.12.0" + s.add_development_dependency "webmock", "~> 3.23.0" + s.add_development_dependency "rspec-its", "~> 1.3.0" + s.add_development_dependency "faraday", "~> 1.0.0" s.add_development_dependency "nokogiri", "~> 1.8.4" s.add_development_dependency "yard", "~> 0.9.15" s.add_development_dependency "inch", "~> 0.8.0" s.add_development_dependency "minitest", "~> 5.8.4" - s.add_development_dependency "contracts", "~> 0.13.0" - s.add_development_dependency "gherkin", "~> 3.2.0" - s.add_development_dependency "multi_json", "~> 1.11.2" - s.add_development_dependency "rspec", "~> 3.4.0" + s.add_development_dependency "contracts", "~> 0.17" + s.add_development_dependency "gherkin", "~> 9.0.0" + s.add_development_dependency "multi_json", "~> 1.15.0" + s.add_development_dependency "rspec", "~> 3.0" s.files = Dir.glob("lib/**/*") + Dir.glob("templates/**/*") s.require_path = "lib" diff --git a/spec/api_documentation_spec.rb b/spec/api_documentation_spec.rb index 39930cc4..dc295567 100644 --- a/spec/api_documentation_spec.rb +++ b/spec/api_documentation_spec.rb @@ -19,7 +19,7 @@ subject.clear_docs expect(File.directory?(configuration.docs_dir)).to be_truthy - expect(File.exists?(test_file)).to be_falsey + expect(File.exist?(test_file)).to be_falsey end end diff --git a/spec/views/api_blueprint_index_spec.rb b/spec/views/api_blueprint_index_spec.rb index 1d526597..e923abf2 100644 --- a/spec/views/api_blueprint_index_spec.rb +++ b/spec/views/api_blueprint_index_spec.rb @@ -142,7 +142,7 @@ properties_description: "required, string" }, { name: "option", - description: nil, + description: 'Option', properties_description: 'optional' }] expect(post_route_with_optionals[:has_attributes?]).to eq false @@ -158,7 +158,7 @@ expect(posts_route[:attributes]).to eq [{ required: false, name: "description", - description: nil, + description: 'Description', properties_description: "optional" }] end diff --git a/spec/writers/html_writer_spec.rb b/spec/writers/html_writer_spec.rb index 72dc5615..76db414e 100644 --- a/spec/writers/html_writer_spec.rb +++ b/spec/writers/html_writer_spec.rb @@ -27,7 +27,7 @@ writer.write index_file = File.join(configuration.docs_dir, "index.html") - expect(File.exists?(index_file)).to be_truthy + expect(File.exist?(index_file)).to be_truthy end end end diff --git a/spec/writers/json_iodocs_writer_spec.rb b/spec/writers/json_iodocs_writer_spec.rb index bfee639c..116ccab1 100644 --- a/spec/writers/json_iodocs_writer_spec.rb +++ b/spec/writers/json_iodocs_writer_spec.rb @@ -25,7 +25,7 @@ it "should write the index" do writer.write index_file = File.join(configuration.docs_dir, "apiconfig.json") - expect(File.exists?(index_file)).to be_truthy + expect(File.exist?(index_file)).to be_truthy end end end diff --git a/spec/writers/json_writer_spec.rb b/spec/writers/json_writer_spec.rb index 9e5e6b8d..973b52b1 100644 --- a/spec/writers/json_writer_spec.rb +++ b/spec/writers/json_writer_spec.rb @@ -24,7 +24,7 @@ it "should write the index" do writer.write index_file = File.join(configuration.docs_dir, "index.json") - expect(File.exists?(index_file)).to be_truthy + expect(File.exist?(index_file)).to be_truthy end end end diff --git a/spec/writers/markdown_writer_spec.rb b/spec/writers/markdown_writer_spec.rb index 799336ee..313a51d9 100644 --- a/spec/writers/markdown_writer_spec.rb +++ b/spec/writers/markdown_writer_spec.rb @@ -27,7 +27,7 @@ writer.write index_file = File.join(configuration.docs_dir, "index.md") - expect(File.exists?(index_file)).to be_truthy + expect(File.exist?(index_file)).to be_truthy end end end diff --git a/spec/writers/slate_writer_spec.rb b/spec/writers/slate_writer_spec.rb index 9c1398da..acd91047 100644 --- a/spec/writers/slate_writer_spec.rb +++ b/spec/writers/slate_writer_spec.rb @@ -27,7 +27,7 @@ writer.write index_file = File.join(configuration.docs_dir, "index.html.md") - expect(File.exists?(index_file)).to be_truthy + expect(File.exist?(index_file)).to be_truthy end end end diff --git a/spec/writers/textile_writer_spec.rb b/spec/writers/textile_writer_spec.rb index 1531f7ad..2e10cb7d 100644 --- a/spec/writers/textile_writer_spec.rb +++ b/spec/writers/textile_writer_spec.rb @@ -27,7 +27,7 @@ writer.write index_file = File.join(configuration.docs_dir, "index.textile") - expect(File.exists?(index_file)).to be_truthy + expect(File.exist?(index_file)).to be_truthy end end end