Skip to content

Instantly share code, notes, and snippets.

@jodosha
Last active January 4, 2016 19:09

Revisions

  1. jodosha revised this gist Jan 28, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion lotus-sinatra.gemspec
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ Gem::Specification.new do |s|
    s.email = 'me@lucaguidi.com'
    s.summary = 'Building Sinatra with Lotus'
    s.description = 'A step by step guide about how use Lotus to build Sinatra'
    s.homepage = ''
    s.homepage = 'http://bit.ly/1e4e58T'
    s.license = 'MIT'

    s.files = ['lotus-sinatra.rb']
  2. jodosha revised this gist Jan 28, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions lotus-sinatra.gemspec
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,8 @@ Gem::Specification.new do |s|
    s.platform = Gem::Platform::RUBY
    s.author = 'Luca Guidi'
    s.email = 'me@lucaguidi.com'
    s.summary = 'Cloning Sinatra with Lotus'
    s.description = 'A step by step guide about how use Lotus to clone Sinatra'
    s.summary = 'Building Sinatra with Lotus'
    s.description = 'A step by step guide about how use Lotus to build Sinatra'
    s.homepage = ''
    s.license = 'MIT'

  3. jodosha revised this gist Jan 28, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion lotus-sinatra.gemspec
    Original file line number Diff line number Diff line change
    @@ -12,5 +12,5 @@ Gem::Specification.new do |s|
    s.files = ['lotus-sinatra.rb']
    s.require_path = '.'

    spec.add_dependency 'lotus-router', '~> 0.1.0'
    s.add_dependency 'lotus-router', '~> 0.1.0'
    end
  4. jodosha created this gist Jan 28, 2014.
    16 changes: 16 additions & 0 deletions lotus-sinatra.gemspec
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    Gem::Specification.new do |s|
    s.name = 'lotus-sinatra'
    s.version = '0.1.0'
    s.platform = Gem::Platform::RUBY
    s.author = 'Luca Guidi'
    s.email = 'me@lucaguidi.com'
    s.summary = 'Cloning Sinatra with Lotus'
    s.description = 'A step by step guide about how use Lotus to clone Sinatra'
    s.homepage = ''
    s.license = 'MIT'

    s.files = ['lotus-sinatra.rb']
    s.require_path = '.'

    spec.add_dependency 'lotus-router', '~> 0.1.0'
    end
    27 changes: 27 additions & 0 deletions lotus-sinatra.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    require 'rubygems'
    require 'lotus/router'

    class Endpoint < Lotus::Routing::Endpoint
    def call(env)
    [200, {}, [super(params(env))]]
    end

    private
    def params(env)
    env.fetch('router.params')
    end
    end

    resolver = Lotus::Routing::EndpointResolver.new(endpoint: Endpoint)

    Application = Rack::Builder.new do
    run Lotus::Router.new(resolver: resolver)
    end.to_app

    def method_missing(m, *args, &blk)
    if Application.respond_to?(m)
    Application.send m, *args, &blk
    else
    super
    end
    end