diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c3f10e1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,14 @@ +{ + "name": "microcms-ruby-sdk", + "image": "ghcr.io/rails/devcontainer/images/ruby:4.0.5", + "postCreateCommand": "bin/setup", + "customizations": { + "vscode": { + "extensions": [ + "Shopify.ruby-lsp", + "rebornix.Ruby" + ] + } + }, + "remoteUser": "vscode" +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19f96af..a2426e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false - name: Setup Ruby and install gems - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@0dafeac902942906541bc140009cdbf32665b601 # v1.315.0 with: - ruby-version: 2.7 bundler-cache: true - name: Run linters @@ -26,13 +27,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: [2.6, 2.7, 3.0] + ruby-version: [2.6, 2.7, 3.4, 4.0] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@0dafeac902942906541bc140009cdbf32665b601 # v1.315.0 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 176561a..fbd653d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,11 +14,11 @@ jobs: packages: write steps: - - uses: actions/checkout@v2 - - name: Set up Ruby 2.6 - uses: actions/setup-ruby@v1 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: - ruby-version: 2.6.x + persist-credentials: false + - name: Set up Ruby + uses: ruby/setup-ruby@0dafeac902942906541bc140009cdbf32665b601 # v1.315.0 - name: Publish to RubyGems run: | diff --git a/.rubocop.yml b/.rubocop.yml index 2fbb3c9..6c669e2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,3 +9,13 @@ Metrics/BlockLength: Style/OpenStructUse: Exclude: - 'spec/**/*' + +Style/RedundantConstantBase: + Exclude: + - 'spec/**/*' + +Style/ZeroLengthPredicate: + Enabled: false + +Style/SafeNavigation: + Enabled: false diff --git a/.ruby-version b/.ruby-version index 37c2961..7636e75 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.2 +4.0.5 diff --git a/lib/microcms.rb b/lib/microcms.rb index a603d59..9d4afb8 100644 --- a/lib/microcms.rb +++ b/lib/microcms.rb @@ -5,6 +5,7 @@ require 'uri' require 'json' require 'forwardable' +require 'ostruct' # MicroCMS module MicroCMS diff --git a/microcms.gemspec b/microcms.gemspec index 9fc6652..67b0ad2 100644 --- a/microcms.gemspec +++ b/microcms.gemspec @@ -26,4 +26,6 @@ Gem::Specification.new do |spec| spec.bindir = 'exe' spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] + + spec.add_dependency 'ostruct' end