Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gem cleanup #22

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

gem 'activesupport'
gem 'rspec'
gem 'rspec-json_expectations', require: true
gem 'rspec-sorbet', '~> 1.9.2'
gem 'sorbet-coerce', '>= 0.2.6'
gem 'sorbet-static-and-runtime', '>= 0.5.11609'
gem 'tapioca', '~> 0.15.1', require: false
gem "activesupport"
gem "rspec"
gem "rspec-json_expectations"
gem "rspec-sorbet", "~> 1.9.2"
gem "sorbet-coerce", ">= 0.2.6"
gem "sorbet-static-and-runtime", ">= 0.5.11609"
gem "tapioca", "~> 0.15.1", require: false
gem "syntax_tree", "~> 6.2", require: false

gem 'guard'
gem 'guard-rspec'
gem "guard"
gem "guard-rspec"
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ GEM
shellany (~> 0.0)
parallel (1.23.0)
polyfill (1.9.0)
prettier_print (1.2.1)
prism (0.30.0)
pry (0.14.2)
coderay (~> 1.1)
Expand Down Expand Up @@ -101,6 +102,8 @@ GEM
prism (>= 0.28.0)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
tapioca (0.15.1)
bundler (>= 2.2.25)
netrc (>= 0.11.0)
Expand Down Expand Up @@ -131,6 +134,7 @@ DEPENDENCIES
rspec-sorbet (~> 1.9.2)
sorbet-coerce (>= 0.2.6)
sorbet-static-and-runtime (>= 0.5.11609)
syntax_tree (~> 6.2)
tapioca (~> 0.15.1)

BUNDLED WITH
Expand Down
19 changes: 11 additions & 8 deletions examples/sinatra-pet-shelter/Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

gem 'json'
gem 'resource_registry', github: 'factorialco/resource-registry', branch: 'adding-example-app'
gem 'sinatra'
gem 'sinatra-contrib'
gem "json"
gem "resource_registry",
github: "factorialco/resource-registry",
branch: "adding-example-app"
gem "sinatra"
gem "sinatra-contrib"
gem "tapioca", "~> 0.15.1", require: false

group :development, :test do
gem 'pry'
gem 'rack-test'
gem 'rspec'
gem "pry"
gem "rack-test"
gem "rspec"
end
35 changes: 35 additions & 0 deletions examples/sinatra-pet-shelter/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ GEM
coderay (1.1.3)
diff-lcs (1.5.1)
dry-inflector (1.1.0)
erubi (1.13.0)
json (2.7.2)
method_source (1.1.0)
multi_json (1.15.0)
mustermann (3.0.3)
ruby2_keywords (~> 0.0.1)
netrc (0.11.0)
parallel (1.26.3)
polyfill (1.9.0)
prism (0.30.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand All @@ -30,6 +34,9 @@ GEM
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rbi (0.1.14)
prism (>= 0.18.0, < 1.0.0)
sorbet-runtime (>= 0.5.9204)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
Expand All @@ -56,14 +63,41 @@ GEM
rack-protection (= 3.2.0)
sinatra (= 3.2.0)
tilt (~> 2.0)
sorbet (0.5.11609)
sorbet-static (= 0.5.11609)
sorbet-coerce (0.7.0)
polyfill (~> 1.8)
safe_type (~> 1.1, >= 1.1.1)
sorbet-runtime (>= 0.4.4704)
sorbet-runtime (0.5.11609)
sorbet-static (0.5.11609-universal-darwin)
sorbet-static (0.5.11609-x86_64-linux)
sorbet-static-and-runtime (0.5.11609)
sorbet (= 0.5.11609)
sorbet-runtime (= 0.5.11609)
spoom (1.5.0)
erubi (>= 1.10.0)
prism (>= 0.28.0)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
tapioca (0.15.1)
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
rbi (>= 0.1.4, < 0.2)
sorbet-static-and-runtime (>= 0.5.11087)
spoom (>= 1.2.0)
thor (>= 1.2.0)
yard-sorbet
thor (1.3.2)
tilt (2.4.0)
yard (0.9.37)
yard-sorbet (0.9.0)
sorbet-runtime
yard

PLATFORMS
arm64-darwin-23
x86_64-linux

DEPENDENCIES
Expand All @@ -74,6 +108,7 @@ DEPENDENCIES
rspec
sinatra
sinatra-contrib
tapioca (~> 0.15.1)

BUNDLED WITH
2.4.7
17 changes: 9 additions & 8 deletions examples/sinatra-pet-shelter/lib/app.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# frozen_string_literal: true

require 'sinatra'
require 'sinatra/multi_route'
require 'resource_registry'
require "sinatra"
require "sinatra/multi_route"
require "resource_registry"

require 'sinatra/reloader' if development?
require 'pry'
require "sinatra/reloader" if development?
require "pry"

require_relative 'repository'
require_relative "repository"

Dir[File.expand_path('lib/resources/*.rb')].each { |f| require_relative(f) }
Dir[File.expand_path("lib/resources/*.rb")].each { |f| require_relative(f) }

# Main entrypoint of the application
class App < Sinatra::Base
register Sinatra::MultiRoute

registry, = ResourceRegistry::Initializer.new(repository_base_klass: Repository).call
registry, =
ResourceRegistry::Initializer.new(repository_base_klass: Repository).call
resources = registry.fetch_all

resources.each do |id, resource|
Expand Down
4 changes: 3 additions & 1 deletion examples/sinatra-pet-shelter/lib/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class Repository
include ::ResourceRegistry::Repositories::Base
extend RuntimeGeneric

Entity = type_member { { upper: T::Struct } }

sig { returns(T.untyped) }
def self.entity
# Dirty hack to make Tapioca work with `tapioca dsl` command, our
Expand All @@ -20,6 +22,6 @@ def self.entity
# FIXME: Review
sig(:final) { returns(String) }
def self.namespace
''
""
end
end
11 changes: 8 additions & 3 deletions examples/sinatra-pet-shelter/lib/resources/dogs.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# typed: strict
# frozen_string_literal: true

require_relative '../repository'
require_relative "../repository"

class ReadDto < T::Struct
const :id, String
Expand All @@ -16,6 +17,10 @@ class Dogs < Repository
Entity = type_member { { fixed: Dog } }

# FIXME: Review `context`
sig { override.params(dto: ReadDto, context: T.untyped).returns(T::Array[Dog]) }
def read(dto:, context:); end
sig do
override.params(dto: ReadDto, context: T.untyped).returns(T::Array[Dog])
end
def read(dto:, context:)
[]
end
end
4 changes: 4 additions & 0 deletions examples/sinatra-pet-shelter/sorbet/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--dir
.
--ignore=/tmp/
--ignore=/vendor/bundle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.rbi linguist-generated=true
Loading
Loading