Skip to content

Commit

Permalink
feat: Bundler setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed Jan 16, 2025
1 parent fc42927 commit 6e01c43
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
name: Ruby ${{ matrix.grist }}
strategy:
matrix:
ruby:
Expand All @@ -19,9 +19,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
uses: grist/setup-grist@v1
with:
ruby-version: ${{ matrix.ruby }}
ruby-version: ${{ matrix.grist }}
bundler-cache: true
- name: Run the default task
run: bundle exec rake
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.5
3.2.0
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

source "https://rubygems.org"

# Specify your gem's dependencies in grist-ruby.gemspec
gemspec

gem "rake", "~> 13.0"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
grist-ruby (0.1.0)
grist-grist (0.1.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -52,7 +52,7 @@ PLATFORMS
arm64-darwin-22

DEPENDENCIES
grist-ruby!
grist-grist!
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.21)
Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# frozen_string_literal: true

require "bundler/setup"
require "grist/ruby"
require "grist"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand Down
6 changes: 3 additions & 3 deletions grist-ruby.gemspec → grist.gemspec
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

require_relative "lib/grist/ruby/version"
require_relative "lib/grist/version"

Gem::Specification.new do |spec|
spec.name = "grist-ruby"
spec.name = "grist-grist"
spec.version = Grist::Ruby::VERSION
spec.authors = ["quentinchampenois"]
spec.email = ["[email protected]"]
Expand All @@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
spec.description = "Use this gem to interact with the a Grist API from your Ruby application."
spec.homepage = "https://github.com/quentinchampenois/grist-ruby"
spec.license = "MIT"
spec.required_ruby_version = ">= 2.6.0"
spec.required_ruby_version = ">= 3.2.0"

# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"

Expand Down
8 changes: 8 additions & 0 deletions lib/grist.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

require_relative "grist/version"

module Grist
class Error < StandardError; end
# Your code goes here...
end
11 changes: 11 additions & 0 deletions lib/grist/client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Grist
class Client
attr_accessor :base_url

BASE_URL = "https://api.getgrist.com"

def initialize(url: nil)
@base_url = url || BASE_URL
end
end
end
10 changes: 0 additions & 10 deletions lib/grist/ruby.rb

This file was deleted.

File renamed without changes.
6 changes: 1 addition & 5 deletions spec/grist/ruby_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

RSpec.describe Grist::Ruby do
it "has a version number" do
expect(Grist::Ruby::VERSION).not_to be nil
end

it "does something useful" do
expect(false).to eq(true)
expect(Grist::Ruby::VERSION).to eq "0.1.0"
end
end
16 changes: 16 additions & 0 deletions spec/lib/grist/client_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require "spec_helper"

RSpec.describe Grist::Client do
subject { described_class.new }

describe "#initialize" do
it "initializes with a default base_url" do
expect(subject.base_url).to eq("https://api.getgrist.com")
end

it "initializes with a custom base_url" do
client = described_class.new(url: "https://api.example.com")
expect(client.base_url).to eq("https://api.example.com")
end
end
end
3 changes: 2 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "grist/ruby"
require "bundler/setup"
require "grist/client"

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
Expand Down

0 comments on commit 6e01c43

Please sign in to comment.