diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..0a3786f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,11 @@ +ARG VARIANT="3" + +FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT} + +USER vscode +WORKDIR /home/vscode + +RUN mkdir -p .config/git \ + && echo ".vscode/*" >> .config/git/ignore \ + && echo "*.code-workspace" >> .config/git/ignore \ + && echo ".history/" >> .config/git/ignore diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c67bfc2 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json", + "name": "Ruby", + "build": { + "dockerfile": "Dockerfile", + "args": { + "VARIANT": "3" + } + }, + "extensions": [ + "rebornix.Ruby", + "ms-vsliveshare.vsliveshare", + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode" + ], + "postCreateCommand": "bundle install", + "remoteUser": "vscode" +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..79621be --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..38ceb6d --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,34 @@ +--- +name: Setup +description: Setup Ruby and install dependencies. + +inputs: + ruby_version: + description: The Ruby version. + required: false + default: '3.3.0' + install_dependencies: + description: Install dependencies. + required: false + default: 'true' + gem_credentials: + description: Gem credentials. + required: false + +runs: + using: composite + steps: + - name: Setup credentials + if: inputs.gem_credentials + shell: bash + run: | + mkdir -p ~/.gem + echo "$GEM_CREDENTIALS" > ~/.gem/credentials + chmod 600 ~/.gem/credentials + env: + GEM_CREDENTIALS: ${{ inputs.gem_credentials }} + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: ${{ inputs.install_dependencies == 'true' }} + ruby-version: ${{ inputs.ruby_version }} diff --git a/.github/workflows/_build.yml b/.github/workflows/_build.yml new file mode 100644 index 0000000..cd9899d --- /dev/null +++ b/.github/workflows/_build.yml @@ -0,0 +1,36 @@ +--- +name: _build + +on: + workflow_call: + inputs: + ruby_version: + description: The Ruby version. + type: string + required: false + default: '3.3.0' + outputs: + artifact_name: + description: The artifact name. + value: build-${{ github.sha }} + +jobs: + build: + name: Gem + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup + with: + ruby_version: ${{ inputs.ruby_version }} + - name: Build + run: bundle exec rake build + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: build-${{ github.sha }} + if-no-files-found: error + path: pkg/ diff --git a/.github/workflows/_publish.yml b/.github/workflows/_publish.yml new file mode 100644 index 0000000..a3372d6 --- /dev/null +++ b/.github/workflows/_publish.yml @@ -0,0 +1,47 @@ +--- +name: _publish + +on: + workflow_call: + inputs: + artifact_name: + description: The artifact name. + type: string + required: true + registry_key: + description: The gem registry credentials key. + type: string + required: true + registry_host: + description: The gem registry host. + type: string + required: true + secrets: + registry_credentials: + description: The gem registry credentials. + required: true + +jobs: + publish: + name: Publish gem + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup + with: + install_dependencies: 'false' + gem_credentials: ':${{ inputs.registry_key }}: ${{ secrets.registry_credentials }}' + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact_name }} + path: pkg/ + - name: Publish + run: gem push --key $REGISTRY_KEY --host $REGISTRY_HOST $GEM_ARTIFACTS/* + env: + REGISTRY_KEY: ${{ inputs.registry_key }} + REGISTRY_HOST: ${{ inputs.registry_host }} + GEM_ARTIFACTS: pkg diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..6008e29 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,115 @@ +--- +name: Check + +on: + push: + branches: + - main + pull_request: + branches: + - '**' + +jobs: + test: + name: Test (Ruby ${{ matrix.ruby }} on ${{ matrix.os_name }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + ruby: + - '3.1' + - '3.2' + - '3.3' + include: + - os: ubuntu-latest + os_name: Linux + - os: macos-latest + os_name: macOS + - os: windows-latest + os_name: Windows + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup + with: + ruby_version: ${{ matrix.ruby }} + - name: Test + run: bundle exec rake test + lint: + name: Lint (Ruby ${{ matrix.ruby }}) + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + ruby: + - '3.1' + - '3.2' + - '3.3' + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup + with: + ruby_version: ${{ matrix.ruby }} + - name: Lint + run: bundle exec rake lint + build: + name: Build + uses: ./.github/workflows/_build.yml + install: + name: Install (Ruby ${{ matrix.ruby }} on ${{ matrix.os_name }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 30 + needs: build + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + ruby: + - '3.1' + - '3.2' + - '3.3' + include: + - os: ubuntu-latest + os_name: Linux + - os: macos-latest + os_name: macOS + - os: windows-latest + os_name: Windows + steps: + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build.outputs.artifact_name }} + path: . + - name: Find gems + uses: tj-actions/glob@v21 + id: gems + with: + files: '*.gem' + - name: Create main.rb + uses: DamianReeves/write-file-action@v1.3 + with: + write-mode: overwrite + path: main.rb + contents: | + require 'seam' + - name: Install + run: gem install ${{ steps.gems.outputs.paths }} + - name: Run + run: ruby main.rb diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..d0bd0b7 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,41 @@ +--- +name: Format + +on: + push: + branches-ignore: + - main + workflow_dispatch: {} + +jobs: + commit: + name: Format code + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GH_TOKEN }} + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + git_user_signingkey: true + git_commit_gpgsign: true + git_committer_name: ${{ secrets.GIT_USER_NAME }} + git_committer_email: ${{ secrets.GIT_USER_EMAIL }} + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Setup + uses: ./.github/actions/setup + - name: Format + run: bundle exec rake format + - name: Commit + uses: stefanzweifel/git-auto-commit-action@v5 + if: always() + with: + commit_message: 'ci: Format code' + commit_user_name: ${{ secrets.GIT_USER_NAME }} + commit_user_email: ${{ secrets.GIT_USER_EMAIL }} + commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}> diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml new file mode 100644 index 0000000..b38c9d0 --- /dev/null +++ b/.github/workflows/generate.yml @@ -0,0 +1,42 @@ +--- +name: Generate + +on: + push: + branches-ignore: + - main + workflow_dispatch: {} + +jobs: + commit: + name: Generate code + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GH_TOKEN }} + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + git_user_signingkey: true + git_commit_gpgsign: true + git_committer_name: ${{ secrets.GIT_USER_NAME }} + git_committer_email: ${{ secrets.GIT_USER_EMAIL }} + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Setup + uses: ./.github/actions/setup + with: + install_dependencies: 'false' + - name: Normalize Gemfile.lock + run: bundle install + - name: Commit + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: 'ci: Generate code' + commit_user_name: ${{ secrets.GIT_USER_NAME }} + commit_user_email: ${{ secrets.GIT_USER_EMAIL }} + commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}> diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..1895d00 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,67 @@ +--- +name: Publish + +run-name: Publish ${{ github.ref_name }} + +on: + push: + tags: + - v* + +jobs: + build: + name: Build + uses: ./.github/workflows/_build.yml + release: + name: GitHub Releases + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: build + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build.outputs.artifact_name }} + path: pkg/ + - name: Generate release notes + id: changelog + run: | + mkdir tmp + outfile=tmp/changelog.txt + echo "outfile=${outfile}" >> $GITHUB_OUTPUT + npx standard-changelog@^5.0.0 --release-count 2 --infile $outfile.tmp --outfile $outfile.tmp + sed '1,3d' $outfile.tmp > $outfile + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + token: ${{ secrets.GH_TOKEN }} + fail_on_unmatched_files: true + prerelease: ${{ contains(github.ref_name, 'pre') }} + files: pkg/* + body_path: ${{ github.workspace }}/${{ steps.changelog.outputs.outfile }} + rubygems: + name: RubyGems.org + uses: ./.github/workflows/_publish.yml + needs: build + with: + artifact_name: ${{ needs.build.outputs.artifact_name }} + registry_key: rubygems + registry_host: https://rubygems.org + secrets: + registry_credentials: ${{ secrets.RUBYGEMS_API_KEY }} + github: + name: GitHub Packages + uses: ./.github/workflows/_publish.yml + permissions: + packages: write + needs: build + with: + artifact_name: ${{ needs.build.outputs.artifact_name }} + registry_key: github + registry_host: https://rubygems.pkg.github.com/${{ github.repository_owner }} + secrets: + registry_credentials: Bearer ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml new file mode 100644 index 0000000..20a1f4f --- /dev/null +++ b/.github/workflows/semantic-release.yml @@ -0,0 +1,49 @@ +--- +name: Semantic Release + +run-name: Semantic Release from ${{ github.ref_name }} + +on: + push: + branches: + - '**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + semantic: + name: Determine version + runs-on: ubuntu-latest + timeout-minutes: 30 + outputs: + new_release_published: ${{ steps.release.outputs.new_release_published }} + new_release_version: ${{ steps.release.outputs.new_release_version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Semantic release + id: release + uses: cycjimmy/semantic-release-action@v4 + with: + dry_run: true + release: + name: Release version + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: semantic + if: needs.semantic.outputs.new_release_published == 'true' && needs.semantic.outputs.new_release_version != '1.0.0' + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: Release version ${{ needs.semantic.outputs.new_release_version }} on ${{ github.ref_name }} + run: gh workflow run version.yml --raw-field version=$VERSION --ref $BRANCH + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + VERSION: ${{ needs.semantic.outputs.new_release_version }} + BRANCH: ${{ github.ref_name }} diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 0000000..e620178 --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,52 @@ +--- +name: Version + +run-name: Cut ${{ github.event.inputs.version }} + +on: + workflow_dispatch: + inputs: + version: + description: Version to cut + required: true + +jobs: + tag: + name: Tag + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + git_user_signingkey: true + git_commit_gpgsign: true + git_committer_name: ${{ secrets.GIT_USER_NAME }} + git_committer_email: ${{ secrets.GIT_USER_EMAIL }} + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Setup + uses: ./.github/actions/setup + - name: Cut ${{ github.event.inputs.version }} version + run: bundle exec gem bump --no-commit --version ${{ github.event.inputs.version }} + - name: Update Gemfile.lock + run: | + bundle config set --local deployment 'false' + bundle install + - name: Get meta + id: meta + run: | + version=$(bundle exec parse-gemspec-cli parse *.gemspec | jq -r .version) + echo "version=${version}" >> $GITHUB_OUTPUT + - name: Tag ${{ github.event.inputs.version }} version + run: | + git add . + git commit --sign -m "${VERSION}" + git tag --sign "v${VERSION}" -m "${VERSION}" + git push --follow-tags + env: + VERSION: ${{ steps.meta.outputs.version }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e13c32d --- /dev/null +++ b/.gitignore @@ -0,0 +1,66 @@ +# Parts of this file were adapted from +# GitHub’s collection of .gitignore file templates +# which are Copyright (c) 2024 GitHub, Inc. +# and released under the MIT License. +# For more details, visit the project page: +# https://github.com/github/gitignore + +# rspec failure tracking +.rspec_status + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +# Used by dotenv library to load environment variables. +# .env + +# Ignore Byebug command history file. +.byebug_history + +## Specific to RubyMotion: +.dat* +.repl_history +build/ +*.bridgesupport +build-iPhoneOS/ +build-iPhoneSimulator/ + +## Specific to RubyMotion (use of CocoaPods): +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# vendor/Pods/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc + +# Used by RuboCop. Remote config files pulled in from inherit_from directive. +# .rubocop-https?--* diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..bd9c6e5 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,11 @@ +{ + "branches": [ + "+([0-9])?(.{+([0-9]),x}).x", + "main", + "next", + "next-major", + { "name": "beta", "prerelease": true }, + { "name": "alpha", "prerelease": true } + ], + "plugins": ["@semantic-release/commit-analyzer"] +} diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..d895d29 --- /dev/null +++ b/.rspec @@ -0,0 +1,4 @@ +--format documentation +--color +--require spec_helper +--pattern "{spec,lib}/**/*_spec.rb" diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..15a2799 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.3.0 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..afc4302 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/) +and this project adheres to [Semantic Versioning](https://semver.org/). + +## Unreleased diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..8bc9d09 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in seam.gemspec. +gemspec diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..0810047 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,105 @@ +PATH + remote: . + specs: + seam (3.1.1) + +GEM + remote: https://rubygems.org/ + specs: + ansi (1.5.0) + ast (2.4.2) + diff-lcs (1.5.1) + docile (1.4.0) + gem-release (2.2.2) + json (2.7.2) + language_server-protocol (3.17.0.3) + lint_roller (1.1.0) + multi_json (1.15.0) + parallel (1.24.0) + parse_gemspec (1.0.0) + parse_gemspec-cli (1.0.0) + multi_json + parse_gemspec + thor + parser (3.3.0.5) + ast (~> 2.4.1) + racc + racc (1.7.3) + rainbow (3.1.1) + rake (13.2.1) + regexp_parser (2.9.0) + rexml (3.2.6) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + rubocop (1.62.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.31.2) + parser (>= 3.3.0.4) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + ruby-progressbar (1.13.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-console (0.9.1) + ansi + simplecov + terminal-table + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + standard (1.35.1) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.62.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.3) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.3.1) + lint_roller (~> 1.1) + rubocop-performance (~> 1.20.2) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + thor (1.3.1) + unicode-display_width (2.5.0) + +PLATFORMS + ruby + x86_64-linux + +DEPENDENCIES + bundler (~> 2.0) + gem-release (~> 2.2) + seam! + parse_gemspec-cli (~> 1.0) + rake (~> 13.0) + rspec (~> 3.0) + simplecov (~> 0.21) + simplecov-console (~> 0.9) + standard (~> 1.3) + +BUNDLED WITH + 2.5.7 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..620ba99 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2024 Seam Labs, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2c7ae6d --- /dev/null +++ b/README.md @@ -0,0 +1,166 @@ +# Seam Ruby SDK + +[![RubyGems.org](https://img.shields.io/gem/v/seam)](https://rubygems.org/gems/seam) +[![GitHub Actions](https://github.com/seamapi/ruby-next/actions/workflows/check.yml/badge.svg)](https://github.com/seamapi/ruby-next/actions/workflows/check.yml) + +SDK for the Seam API written in Ruby. + +## Description + +TODO + +## Installation + +Add this as a dependency to your project using [Bundler] with + +``` +$ bundle add seam +``` + +[bundler]: https://bundler.io/ + +## Development and Testing + +### Quickstart + +``` +$ git clone https://github.com/seamapi/ruby-next.git +$ cd ruby-next +$ bundle install +``` + +Run the command below + +``` +$ bundle exec rake +``` + +Open an interactive ruby console with + +``` +$ bundle exec rake +``` + +Primary development tasks are defined as [rake] tasks in the `Rakefile` +and available via `rake`. +View them with + +``` +$ bundle exec rake -T +``` + +[rake]: https://ruby.github.io/rake/ + +### Source code + +The [source code] is hosted on GitHub. +Clone the project with + +``` +$ git clone git@github.com:seamapi/ruby-next.git +``` + +[source code]: https://github.com/seamapi/ruby-next + +### Requirements + +You will need [Ruby] with [Bundler]. + +Be sure that all commands run under the correct Ruby version, e.g., +if using [rbenv], install the correct version with + +``` +$ rbenv install +``` + +Install the development dependencies with + +``` +$ bundle install +``` + +[bundler]: https://bundler.io/ +[ruby]: https://www.ruby-lang.org/ +[rbenv]: https://github.com/rbenv/rbenv + +### Publishing + +New versions are created with [gem release]. + +#### Automatic + +New versions are released automatically with [semantic-release] +as long as commits follow the [Angular Commit Message Conventions]. + +[Angular Commit Message Conventions]: https://semantic-release.gitbook.io/semantic-release/#commit-message-format +[semantic-release]: https://semantic-release.gitbook.io/ + +#### Manual + +Publish a new version by triggering a [version workflow_dispatch on GitHub Actions]. +The `version` input will be passed to the `--version` option of `gem bump`. + +This may be done on the web or using the [GitHub CLI] with + +``` +$ gh workflow run version.yml --raw-field version= +``` + +[gem release]: https://github.com/svenfuchs/gem-release +[GitHub CLI]: https://cli.github.com/ +[version workflow_dispatch on GitHub Actions]: https://github.com/seamapi/ruby-next/actions?query=workflow%3Aversion + +## GitHub Actions + +_GitHub Actions should already be configured: this section is for reference only._ + +The following repository secrets must be set on [GitHub Actions]: + +- `RUBYGEMS_API_KEY`: RubyGems.org token for publishing gems. + +These must be set manually. + +### Secrets for Optional GitHub Actions + +The version, format, generate, and semantic-release GitHub actions +require a user with write access to the repository. +Set these additional secrets to enable the action: + +- `GH_TOKEN`: A personal access token for the user. +- `GIT_USER_NAME`: The GitHub user's real name. +- `GIT_USER_EMAIL`: The GitHub user's email. +- `GPG_PRIVATE_KEY`: The GitHub user's [GPG private key]. +- `GPG_PASSPHRASE`: The GitHub user's GPG passphrase. + +[github actions]: https://github.com/features/actions +[gpg private key]: https://github.com/marketplace/actions/import-gpg#prerequisites + +## Contributing + +Please submit and comment on bug reports and feature requests. + +To submit a patch: + +1. Fork it (https://github.com/seamapi/ruby-next/fork). +2. Create your feature branch (`git checkout -b my-new-feature`). +3. Make changes. +4. Commit your changes (`git commit -am 'Add some feature'`). +5. Push to the branch (`git push origin my-new-feature`). +6. Create a new Pull Request. + +## License + +This Ruby gem is licensed under the MIT license. + +## Warranty + +This software is provided by the copyright holders and contributors "as is" and +any express or implied warranties, including, but not limited to, the implied +warranties of merchantability and fitness for a particular purpose are +disclaimed. In no event shall the copyright holder or contributors be liable for +any direct, indirect, incidental, special, exemplary, or consequential damages +(including, but not limited to, procurement of substitute goods or services; +loss of use, data, or profits; or business interruption) however caused and on +any theory of liability, whether in contract, strict liability, or tort +(including negligence or otherwise) arising in any way out of the use of this +software, even if advised of the possibility of such damage. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..193f713 --- /dev/null +++ b/Rakefile @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rspec/core/rake_task" +require "standard/rake" + +RSpec::Core::RakeTask.new(:spec) do |t| + t.rspec_opts = "--pattern {spec,lib}/**/*_spec.rb" +end + +task default: %i[lint test] + +task test: "spec" +task lint: "standard" +task format: "standard:fix" + +desc "Open an interactive ruby console" +task :console do + require "irb" + require "bundler/setup" + require "seam" + ARGV.clear + IRB.start +end diff --git a/lib/seam.rb b/lib/seam.rb new file mode 100644 index 0000000..7cf8749 --- /dev/null +++ b/lib/seam.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require_relative "seam/version" +require_relative "seam/todo" + +module Seam + # TODO +end diff --git a/lib/seam/todo.rb b/lib/seam/todo.rb new file mode 100644 index 0000000..570801b --- /dev/null +++ b/lib/seam/todo.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Seam + class Todo + def todo + "TODO" + end + end +end diff --git a/lib/seam/todo_spec.rb b/lib/seam/todo_spec.rb new file mode 100644 index 0000000..bd7553c --- /dev/null +++ b/lib/seam/todo_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe Seam::Todo do + subject(:todo) { Seam::Todo.new } + + describe ".todo" do + it "returns todo" do + expect(todo.todo).to be "TODO" + end + end +end diff --git a/lib/seam/version.rb b/lib/seam/version.rb new file mode 100644 index 0000000..25bae0e --- /dev/null +++ b/lib/seam/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Seam + VERSION = "3.1.1" +end diff --git a/seam.gemspec b/seam.gemspec new file mode 100644 index 0000000..983751c --- /dev/null +++ b/seam.gemspec @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require_relative "lib/seam/version" + +Gem::Specification.new do |spec| + spec.name = "seam" + spec.version = Seam::VERSION + spec.author = "Seam Labs, Inc." + spec.email = "engineering@getseam.com" + + spec.summary = "Seam Ruby SDK" + spec.description = "SDK for the Seam API written in Ruby." + spec.homepage = "https://github.com/seamapi/ruby-next" + spec.license = "MIT" + spec.required_ruby_version = ">= 3.1.0" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = spec.homepage + spec.metadata["bug_tracker_uri"] = "#{spec.metadata["source_code_uri"]}/issues" + spec.metadata["changelog_uri"] = "#{spec.metadata["source_code_uri"]}/blob/main/CHANGELOG.md" + spec.metadata["github_repo"] = "git@github.com:seamapi/ruby-next.git" + + spec.bindir = "bin" + spec.executables = spec.files.grep(%r{\A#{spec.bindir}/}) { |f| File.basename(f) } + + spec.files = Dir["lib/**/*.rb"].reject { |f| f.end_with?("_spec.rb") } + spec.files += Dir["[A-Z]*"] + + spec.add_development_dependency "bundler", "~> 2.0" + spec.add_development_dependency "gem-release", "~> 2.2" + spec.add_development_dependency "parse_gemspec-cli", "~> 1.0" + spec.add_development_dependency "rake", "~> 13.0" + spec.add_development_dependency "rspec", "~> 3.0" + spec.add_development_dependency "simplecov", "~> 0.21" + spec.add_development_dependency "simplecov-console", "~> 0.9" + spec.add_development_dependency "standard", "~> 1.3" +end diff --git a/spec/module_spec.rb b/spec/module_spec.rb new file mode 100644 index 0000000..3fbf657 --- /dev/null +++ b/spec/module_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +RSpec.describe Seam do + it "has a version number" do + expect(Seam::VERSION).not_to be nil + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..d5044dc --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require "simplecov" +require "simplecov-console" + +SimpleCov.start + +require "seam" + +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::Console +]) + +RSpec.configure do |config| + config.example_status_persistence_file_path = ".rspec_status" + + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end