sinatra-rabbit 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/sinatra/rabbit/base.rb +6 -2
 - data/lib/sinatra/rabbit/base_collection.rb +10 -1
 - data/sinatra-rabbit.gemspec +1 -1
 - metadata +40 -60
 
    
        data/lib/sinatra/rabbit/base.rb
    CHANGED
    
    | 
         @@ -89,9 +89,13 @@ module Sinatra 
     | 
|
| 
       89 
89 
     | 
    
         
             
                #       include Sinatra::Rabbit
         
     | 
| 
       90 
90 
     | 
    
         
             
                #     end
         
     | 
| 
       91 
91 
     | 
    
         
             
                #
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
       92 
93 
     | 
    
         
             
                def self.included(base)
         
     | 
| 
       93 
94 
     | 
    
         
             
                  configuration[:root_path] ||= '/'
         
     | 
| 
       94 
     | 
    
         
            -
                  base.register(DSL) if base.respond_to? :register
         
     | 
| 
      
 95 
     | 
    
         
            +
                  base.register(Rabbit::DSL) if base.respond_to? :register
         
     | 
| 
      
 96 
     | 
    
         
            +
                  if configuration[:use_namespace]
         
     | 
| 
      
 97 
     | 
    
         
            +
                    configuration[:base_module] = const_get(base.name.split('::').first)
         
     | 
| 
      
 98 
     | 
    
         
            +
                  end
         
     | 
| 
       95 
99 
     | 
    
         
             
                  base.get '/docs' do
         
     | 
| 
       96 
100 
     | 
    
         
             
                    css_file = File.read(File.join(File.dirname(__FILE__), '..', 'docs', 'bootstrap.min.css'))
         
     | 
| 
       97 
101 
     | 
    
         
             
                    index_file = File.read(File.join(File.dirname(__FILE__), '..', 'docs', 'api.haml'))
         
     | 
| 
         @@ -101,7 +105,7 @@ module Sinatra 
     | 
|
| 
       101 
105 
     | 
    
         | 
| 
       102 
106 
     | 
    
         
             
                class Collection < BaseCollection
         
     | 
| 
       103 
107 
     | 
    
         | 
| 
       104 
     | 
    
         
            -
                  include DSL
         
     | 
| 
      
 108 
     | 
    
         
            +
                  include Rabbit::DSL
         
     | 
| 
       105 
109 
     | 
    
         | 
| 
       106 
110 
     | 
    
         
             
                  def self.generate(name, parent_collection=nil, &block)
         
     | 
| 
       107 
111 
     | 
    
         
             
                    @collection_name = name.to_sym
         
     | 
| 
         @@ -49,7 +49,16 @@ module Sinatra 
     | 
|
| 
       49 
49 
     | 
    
         
             
                  end
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
                  def self.collection_class(name, parent_class=nil)
         
     | 
| 
       52 
     | 
    
         
            -
                     
     | 
| 
      
 52 
     | 
    
         
            +
                    if base_module = Rabbit::configuration[:base_module]
         
     | 
| 
      
 53 
     | 
    
         
            +
                      if base_module.const_defined? 'Rabbit'
         
     | 
| 
      
 54 
     | 
    
         
            +
                        base_module = base_module::Rabbit
         
     | 
| 
      
 55 
     | 
    
         
            +
                      else
         
     | 
| 
      
 56 
     | 
    
         
            +
                        base_module = base_module.const_set('Rabbit', Module.new)
         
     | 
| 
      
 57 
     | 
    
         
            +
                      end
         
     | 
| 
      
 58 
     | 
    
         
            +
                    else
         
     | 
| 
      
 59 
     | 
    
         
            +
                      base_module = Sinatra::Rabbit
         
     | 
| 
      
 60 
     | 
    
         
            +
                    end
         
     | 
| 
      
 61 
     | 
    
         
            +
                    klass = parent_class || base_module
         
     | 
| 
       53 
62 
     | 
    
         
             
                    begin
         
     | 
| 
       54 
63 
     | 
    
         
             
                      yield k = klass.const_get(name.to_s.camelize + 'Collection')
         
     | 
| 
       55 
64 
     | 
    
         
             
                    rescue NameError
         
     | 
    
        data/sinatra-rabbit.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,102 +1,82 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            --- !ruby/object:Gem::Specification 
     | 
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: sinatra-rabbit
         
     | 
| 
       3 
     | 
    
         
            -
            version: !ruby/object:Gem::Version 
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.5
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
     | 
    
         
            -
              segments: 
         
     | 
| 
       7 
     | 
    
         
            -
              - 1
         
     | 
| 
       8 
     | 
    
         
            -
              - 1
         
     | 
| 
       9 
     | 
    
         
            -
              - 4
         
     | 
| 
       10 
     | 
    
         
            -
              version: 1.1.4
         
     | 
| 
       11 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
     | 
    
         
            -
            authors: 
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
       13 
8 
     | 
    
         
             
            - The Apache Software Foundation
         
     | 
| 
       14 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       15 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            dependencies: 
         
     | 
| 
       21 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-02-27 00:00:00.000000000 Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 14 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       22 
15 
     | 
    
         
             
              name: sinatra
         
     | 
| 
       23 
     | 
    
         
            -
               
     | 
| 
       24 
     | 
    
         
            -
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       25 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       26 
     | 
    
         
            -
                requirements: 
     | 
| 
       27 
     | 
    
         
            -
                - -  
     | 
| 
       28 
     | 
    
         
            -
                  - !ruby/object:Gem::Version 
     | 
| 
       29 
     | 
    
         
            -
                    hash: 27
         
     | 
| 
       30 
     | 
    
         
            -
                    segments: 
         
     | 
| 
       31 
     | 
    
         
            -
                    - 1
         
     | 
| 
       32 
     | 
    
         
            -
                    - 3
         
     | 
| 
       33 
     | 
    
         
            -
                    - 0
         
     | 
| 
      
 18 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 19 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
       34 
21 
     | 
    
         
             
                    version: 1.3.0
         
     | 
| 
       35 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       36 
     | 
    
         
            -
               
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
      
 23 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 25 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: 1.3.0
         
     | 
| 
      
 30 
     | 
    
         
            +
            description: ! "    Rabbit is a Sinatra extension which can help you writing\n    a
         
     | 
| 
      
 31 
     | 
    
         
            +
              simple REST API using easy to undestand DSL.\n"
         
     | 
| 
       38 
32 
     | 
    
         
             
            email: dev@deltacloud.apache.org
         
     | 
| 
       39 
33 
     | 
    
         
             
            executables: []
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
34 
     | 
    
         
             
            extensions: []
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
            extra_rdoc_files: 
         
     | 
| 
      
 35 
     | 
    
         
            +
            extra_rdoc_files:
         
     | 
| 
       44 
36 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       45 
     | 
    
         
            -
            files: 
     | 
| 
      
 37 
     | 
    
         
            +
            files:
         
     | 
| 
       46 
38 
     | 
    
         
             
            - lib/sinatra/rabbit.rb
         
     | 
| 
       47 
39 
     | 
    
         
             
            - lib/sinatra/docs/api.haml
         
     | 
| 
       48 
     | 
    
         
            -
            - lib/sinatra/docs/collection.haml
         
     | 
| 
       49 
40 
     | 
    
         
             
            - lib/sinatra/docs/operation.haml
         
     | 
| 
      
 41 
     | 
    
         
            +
            - lib/sinatra/docs/collection.haml
         
     | 
| 
       50 
42 
     | 
    
         
             
            - lib/sinatra/docs/bootstrap.min.css
         
     | 
| 
       51 
43 
     | 
    
         
             
            - lib/sinatra/rabbit/base.rb
         
     | 
| 
       52 
     | 
    
         
            -
            - lib/sinatra/rabbit/base_collection.rb
         
     | 
| 
       53 
     | 
    
         
            -
            - lib/sinatra/rabbit/dsl.rb
         
     | 
| 
       54 
44 
     | 
    
         
             
            - lib/sinatra/rabbit/features.rb
         
     | 
| 
       55 
     | 
    
         
            -
            - lib/sinatra/rabbit/param.rb
         
     | 
| 
       56 
45 
     | 
    
         
             
            - lib/sinatra/rabbit/validator.rb
         
     | 
| 
      
 46 
     | 
    
         
            +
            - lib/sinatra/rabbit/dsl.rb
         
     | 
| 
      
 47 
     | 
    
         
            +
            - lib/sinatra/rabbit/param.rb
         
     | 
| 
      
 48 
     | 
    
         
            +
            - lib/sinatra/rabbit/base_collection.rb
         
     | 
| 
       57 
49 
     | 
    
         
             
            - tests/app_test.rb
         
     | 
| 
      
 50 
     | 
    
         
            +
            - tests/params_test.rb
         
     | 
| 
      
 51 
     | 
    
         
            +
            - tests/fixtures.rb
         
     | 
| 
       58 
52 
     | 
    
         
             
            - tests/docs_test.rb
         
     | 
| 
       59 
53 
     | 
    
         
             
            - tests/dsl_test.rb
         
     | 
| 
       60 
     | 
    
         
            -
            - tests/fixtures.rb
         
     | 
| 
       61 
     | 
    
         
            -
            - tests/params_test.rb
         
     | 
| 
       62 
54 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       63 
55 
     | 
    
         
             
            - README.md
         
     | 
| 
       64 
56 
     | 
    
         
             
            - sinatra-rabbit.gemspec
         
     | 
| 
       65 
     | 
    
         
            -
            has_rdoc: true
         
     | 
| 
       66 
57 
     | 
    
         
             
            homepage: http://github.com/mifo/sinatra-rabbit
         
     | 
| 
       67 
58 
     | 
    
         
             
            licenses: []
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
59 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       70 
60 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
            require_paths: 
         
     | 
| 
      
 61 
     | 
    
         
            +
            require_paths:
         
     | 
| 
       73 
62 
     | 
    
         
             
            - lib
         
     | 
| 
       74 
     | 
    
         
            -
            required_ruby_version: !ruby/object:Gem::Requirement 
     | 
| 
      
 63 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       75 
64 
     | 
    
         
             
              none: false
         
     | 
| 
       76 
     | 
    
         
            -
              requirements: 
     | 
| 
       77 
     | 
    
         
            -
              - -  
     | 
| 
       78 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       79 
     | 
    
         
            -
                  hash: 53
         
     | 
| 
       80 
     | 
    
         
            -
                  segments: 
         
     | 
| 
       81 
     | 
    
         
            -
                  - 1
         
     | 
| 
       82 
     | 
    
         
            -
                  - 8
         
     | 
| 
       83 
     | 
    
         
            -
                  - 1
         
     | 
| 
      
 65 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 67 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
       84 
68 
     | 
    
         
             
                  version: 1.8.1
         
     | 
| 
       85 
     | 
    
         
            -
            required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
| 
      
 69 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       86 
70 
     | 
    
         
             
              none: false
         
     | 
| 
       87 
     | 
    
         
            -
              requirements: 
     | 
| 
       88 
     | 
    
         
            -
              - -  
     | 
| 
       89 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       90 
     | 
    
         
            -
                   
     | 
| 
       91 
     | 
    
         
            -
                  segments: 
         
     | 
| 
       92 
     | 
    
         
            -
                  - 0
         
     | 
| 
       93 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 72 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 73 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 74 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       94 
75 
     | 
    
         
             
            requirements: []
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
76 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       97 
     | 
    
         
            -
            rubygems_version: 1. 
     | 
| 
      
 77 
     | 
    
         
            +
            rubygems_version: 1.8.23
         
     | 
| 
       98 
78 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       99 
79 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       100 
80 
     | 
    
         
             
            summary: Sinatra REST API DSL
         
     | 
| 
       101 
81 
     | 
    
         
             
            test_files: []
         
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
      
 82 
     | 
    
         
            +
            has_rdoc: 
         
     |