Skip to content

Commit

Permalink
Introducing a Sinatra app example
Browse files Browse the repository at this point in the history
The purpose of this example is to demonstrate the potential of Resource
Registry declarative approach with a simple enough Sinatra application.

This exercise helps to make sure Resource Registry is abstract enough to
be used from a generic project.
  • Loading branch information
gtrias committed Sep 23, 2024
1 parent 2a75d30 commit 4c1f970
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/sinatra-pet-shelter/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'json'
gem 'sinatra'
gem 'sinatra-contrib'

group :development, :test do
gem 'pry'
gem 'rspec'
end
57 changes: 57 additions & 0 deletions examples/sinatra-pet-shelter/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
GEM
remote: https://rubygems.org/
specs:
base64 (0.2.0)
coderay (1.1.3)
diff-lcs (1.5.1)
json (2.7.2)
method_source (1.1.0)
multi_json (1.15.0)
mustermann (3.0.3)
ruby2_keywords (~> 0.0.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
rack (2.2.9)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
ruby2_keywords (0.0.5)
sinatra (3.2.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.2.0)
tilt (~> 2.0)
sinatra-contrib (3.2.0)
multi_json (>= 0.0.2)
mustermann (~> 3.0)
rack-protection (= 3.2.0)
sinatra (= 3.2.0)
tilt (~> 2.0)
tilt (2.4.0)

PLATFORMS
x86_64-linux

DEPENDENCIES
json
pry
rspec
sinatra
sinatra-contrib

BUNDLED WITH
2.4.7
11 changes: 11 additions & 0 deletions examples/sinatra-pet-shelter/app.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

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

# Main entrypoint of the application
class App < Sinatra::Base
get '/' do
'Hello world!'
end
end
10 changes: 10 additions & 0 deletions examples/sinatra-pet-shelter/app_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

require 'spec_helper'
require_relative 'app'

describe App do
it 'works' do
# ...
end
end
4 changes: 4 additions & 0 deletions examples/sinatra-pet-shelter/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

RSpec.configure do |config|
end

0 comments on commit 4c1f970

Please sign in to comment.