blue_print 0.0.1 → 1.0.0
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.
- checksums.yaml +4 -4
- data/blue_print.gemspec +2 -0
- data/lib/blue_print.rb +1 -0
- data/lib/blue_print/integration.rb +12 -0
- data/lib/blue_print/integration/action_controller.rb +4 -11
- data/lib/blue_print/integration/draper.rb +8 -0
- data/lib/blue_print/integration/grape.rb +7 -0
- data/lib/blue_print/integration/grape/api.rb +13 -0
- data/lib/blue_print/integration/grape/helper.rb +6 -0
- data/lib/blue_print/integration/grape/middleware.rb +12 -0
- data/lib/blue_print/version.rb +1 -1
- data/spec/apis/application_api_spec.rb +10 -0
- data/spec/dummy/app/apis/application_api.rb +5 -0
- data/spec/dummy/app/controllers/echo_controller.rb +5 -0
- data/spec/dummy/config/application.rb +2 -0
- data/spec/dummy/config/routes.rb +2 -55
- data/spec/requests/echo_spec.rb +10 -0
- data/spec/support/api_testing.rb +5 -0
- metadata +44 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: dbd7694883cacae9801cfc6fa826746829542562
         | 
| 4 | 
            +
              data.tar.gz: 51575e4325de406fbf93d4b089c043e18b0ce74b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 93b04df1d153d2af18d1853a2b3e0d7e21676caa36df2492647a0cfb44cbc9990da410645d42452e0bf949b6234ba169e8e4ae3b45ae747b08a9e08b2bd5f809
         | 
| 7 | 
            +
              data.tar.gz: 83c97daa1ed5eff9dc535255f347a8c3f5bf8f517b945e85f53e4a9dbced1f2e87a049bd80bc9e3c819316a5d42b07d4796bbd419a69caad1d38ca7ec5d08ee7
         | 
    
        data/blue_print.gemspec
    CHANGED
    
    | @@ -28,6 +28,8 @@ Gem::Specification.new do |spec| | |
| 28 28 | 
             
              spec.add_development_dependency 'database_cleaner'
         | 
| 29 29 | 
             
              spec.add_development_dependency 'generator_spec'
         | 
| 30 30 | 
             
              spec.add_development_dependency 'coveralls'
         | 
| 31 | 
            +
              spec.add_development_dependency 'draper'
         | 
| 32 | 
            +
              spec.add_development_dependency 'grape'
         | 
| 31 33 |  | 
| 32 34 | 
             
              spec.add_dependency 'activesupport'
         | 
| 33 35 | 
             
              spec.add_dependency 'hashie'
         | 
    
        data/lib/blue_print.rb
    CHANGED
    
    
| @@ -2,3 +2,15 @@ require 'blue_print' | |
| 2 2 |  | 
| 3 3 | 
             
            module BluePrint::Integration
         | 
| 4 4 | 
             
            end
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            begin
         | 
| 7 | 
            +
              require 'draper'
         | 
| 8 | 
            +
              require 'blue_print/integration/draper'
         | 
| 9 | 
            +
            rescue LoadError
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            begin
         | 
| 13 | 
            +
              require 'grape'
         | 
| 14 | 
            +
              require 'blue_print/integration/grape'
         | 
| 15 | 
            +
            rescue LoadError
         | 
| 16 | 
            +
            end
         | 
| @@ -8,17 +8,10 @@ module BluePrint::Integration::ActionController | |
| 8 8 | 
             
              include BluePrint::Helper
         | 
| 9 9 |  | 
| 10 10 | 
             
              included do
         | 
| 11 | 
            -
                 | 
| 12 | 
            -
             | 
| 13 | 
            -
                 | 
| 14 | 
            -
             | 
| 15 | 
            -
                end
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                if respond_to?(:after_action)
         | 
| 18 | 
            -
                  after_action(:clear_blue_print_environment)
         | 
| 19 | 
            -
                else
         | 
| 20 | 
            -
                  after_filter(:clear_blue_print_environment)
         | 
| 21 | 
            -
                end
         | 
| 11 | 
            +
                action_or_filter = respond_to?(:before_action) ? :action : :filter
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                send("before_#{action_or_filter}", :build_blue_print_environment)
         | 
| 14 | 
            +
                send("after_#{action_or_filter}", :clear_blue_print_environment)
         | 
| 22 15 | 
             
              end
         | 
| 23 16 |  | 
| 24 17 | 
             
              private
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            require 'grape/api'
         | 
| 2 | 
            +
            require 'blue_print/integration/grape'
         | 
| 3 | 
            +
            require 'blue_print/integration/grape/middleware'
         | 
| 4 | 
            +
            require 'blue_print/integration/grape/helper'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            class << Grape::API
         | 
| 7 | 
            +
              def inherited_with_blue_print(klass)
         | 
| 8 | 
            +
                inherited_without_blue_print(klass)
         | 
| 9 | 
            +
                klass.use BluePrint::Integration::Grape::Middleware
         | 
| 10 | 
            +
                klass.helpers BluePrint::Integration::Grape::Helper
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
              alias_method_chain :inherited, :blue_print
         | 
| 13 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            require 'grape/middleware/base'
         | 
| 2 | 
            +
            require 'blue_print/integration/grape'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            class BluePrint::Integration::Grape::Middleware < ::Grape::Middleware::Base
         | 
| 5 | 
            +
              def before
         | 
| 6 | 
            +
                BluePrint.env = BluePrint::Environment.new(env['api.endpoint'])
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              def after
         | 
| 10 | 
            +
                BluePrint.clear!
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            end
         | 
    
        data/lib/blue_print/version.rb
    CHANGED
    
    
    
        data/spec/dummy/config/routes.rb
    CHANGED
    
    | @@ -1,58 +1,5 @@ | |
| 1 1 | 
             
            Dummy::Application.routes.draw do
         | 
| 2 | 
            -
               | 
| 3 | 
            -
              # first created -> highest priority.
         | 
| 2 | 
            +
              mount ApplicationApi => '/api'
         | 
| 4 3 |  | 
| 5 | 
            -
               | 
| 6 | 
            -
              #   match 'products/:id' => 'catalog#view'
         | 
| 7 | 
            -
              # Keep in mind you can assign values other than :controller and :action
         | 
| 8 | 
            -
             | 
| 9 | 
            -
              # Sample of named route:
         | 
| 10 | 
            -
              #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
         | 
| 11 | 
            -
              # This route can be invoked with purchase_url(:id => product.id)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              # Sample resource route (maps HTTP verbs to controller actions automatically):
         | 
| 14 | 
            -
              #   resources :products
         | 
| 15 | 
            -
             | 
| 16 | 
            -
              # Sample resource route with options:
         | 
| 17 | 
            -
              #   resources :products do
         | 
| 18 | 
            -
              #     member do
         | 
| 19 | 
            -
              #       get 'short'
         | 
| 20 | 
            -
              #       post 'toggle'
         | 
| 21 | 
            -
              #     end
         | 
| 22 | 
            -
              #
         | 
| 23 | 
            -
              #     collection do
         | 
| 24 | 
            -
              #       get 'sold'
         | 
| 25 | 
            -
              #     end
         | 
| 26 | 
            -
              #   end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
              # Sample resource route with sub-resources:
         | 
| 29 | 
            -
              #   resources :products do
         | 
| 30 | 
            -
              #     resources :comments, :sales
         | 
| 31 | 
            -
              #     resource :seller
         | 
| 32 | 
            -
              #   end
         | 
| 33 | 
            -
             | 
| 34 | 
            -
              # Sample resource route with more complex sub-resources
         | 
| 35 | 
            -
              #   resources :products do
         | 
| 36 | 
            -
              #     resources :comments
         | 
| 37 | 
            -
              #     resources :sales do
         | 
| 38 | 
            -
              #       get 'recent', :on => :collection
         | 
| 39 | 
            -
              #     end
         | 
| 40 | 
            -
              #   end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
              # Sample resource route within a namespace:
         | 
| 43 | 
            -
              #   namespace :admin do
         | 
| 44 | 
            -
              #     # Directs /admin/products/* to Admin::ProductsController
         | 
| 45 | 
            -
              #     # (app/controllers/admin/products_controller.rb)
         | 
| 46 | 
            -
              #     resources :products
         | 
| 47 | 
            -
              #   end
         | 
| 48 | 
            -
             | 
| 49 | 
            -
              # You can have the root of your site routed with "root"
         | 
| 50 | 
            -
              # just remember to delete public/index.html.
         | 
| 51 | 
            -
              # root :to => 'welcome#index'
         | 
| 52 | 
            -
             | 
| 53 | 
            -
              # See how all your routes lay out with "rake routes"
         | 
| 54 | 
            -
             | 
| 55 | 
            -
              # This is a legacy wild controller route that's not recommended for RESTful applications.
         | 
| 56 | 
            -
              # Note: This route will make all actions in every controller accessible via GET requests.
         | 
| 57 | 
            -
              # match ':controller(/:action(/:id))(.:format)'
         | 
| 4 | 
            +
              get 'echo/:text' => 'echo#show'
         | 
| 58 5 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: blue_print
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0 | 
| 4 | 
            +
              version: 1.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sho Kusano
         | 
| @@ -164,6 +164,34 @@ dependencies: | |
| 164 164 | 
             
                - - ">="
         | 
| 165 165 | 
             
                  - !ruby/object:Gem::Version
         | 
| 166 166 | 
             
                    version: '0'
         | 
| 167 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 168 | 
            +
              name: draper
         | 
| 169 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 170 | 
            +
                requirements:
         | 
| 171 | 
            +
                - - ">="
         | 
| 172 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 173 | 
            +
                    version: '0'
         | 
| 174 | 
            +
              type: :development
         | 
| 175 | 
            +
              prerelease: false
         | 
| 176 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 177 | 
            +
                requirements:
         | 
| 178 | 
            +
                - - ">="
         | 
| 179 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 180 | 
            +
                    version: '0'
         | 
| 181 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 182 | 
            +
              name: grape
         | 
| 183 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 184 | 
            +
                requirements:
         | 
| 185 | 
            +
                - - ">="
         | 
| 186 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 187 | 
            +
                    version: '0'
         | 
| 188 | 
            +
              type: :development
         | 
| 189 | 
            +
              prerelease: false
         | 
| 190 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 191 | 
            +
                requirements:
         | 
| 192 | 
            +
                - - ">="
         | 
| 193 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 194 | 
            +
                    version: '0'
         | 
| 167 195 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 168 196 | 
             
              name: activesupport
         | 
| 169 197 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -232,6 +260,11 @@ files: | |
| 232 260 | 
             
            - lib/blue_print/helper.rb
         | 
| 233 261 | 
             
            - lib/blue_print/integration.rb
         | 
| 234 262 | 
             
            - lib/blue_print/integration/action_controller.rb
         | 
| 263 | 
            +
            - lib/blue_print/integration/draper.rb
         | 
| 264 | 
            +
            - lib/blue_print/integration/grape.rb
         | 
| 265 | 
            +
            - lib/blue_print/integration/grape/api.rb
         | 
| 266 | 
            +
            - lib/blue_print/integration/grape/helper.rb
         | 
| 267 | 
            +
            - lib/blue_print/integration/grape/middleware.rb
         | 
| 235 268 | 
             
            - lib/blue_print/railtie.rb
         | 
| 236 269 | 
             
            - lib/blue_print/railtie/action_controller.rb
         | 
| 237 270 | 
             
            - lib/blue_print/railtie/action_view.rb
         | 
| @@ -244,14 +277,17 @@ files: | |
| 244 277 | 
             
            - lib/generators/rspec/blue_print_generator.rb
         | 
| 245 278 | 
             
            - lib/generators/rspec/templates/context_spec.rb
         | 
| 246 279 | 
             
            - lib/generators/rspec/templates/role_spec.rb
         | 
| 280 | 
            +
            - spec/apis/application_api_spec.rb
         | 
| 247 281 | 
             
            - spec/dummy/.gitignore
         | 
| 248 282 | 
             
            - spec/dummy/Gemfile
         | 
| 249 283 | 
             
            - spec/dummy/README.rdoc
         | 
| 250 284 | 
             
            - spec/dummy/Rakefile
         | 
| 285 | 
            +
            - spec/dummy/app/apis/application_api.rb
         | 
| 251 286 | 
             
            - spec/dummy/app/assets/images/rails.png
         | 
| 252 287 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| 253 288 | 
             
            - spec/dummy/app/assets/stylesheets/application.css
         | 
| 254 289 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| 290 | 
            +
            - spec/dummy/app/controllers/echo_controller.rb
         | 
| 255 291 | 
             
            - spec/dummy/app/helpers/application_helper.rb
         | 
| 256 292 | 
             
            - spec/dummy/app/mailers/.gitkeep
         | 
| 257 293 | 
             
            - spec/dummy/app/models/.gitkeep
         | 
| @@ -294,7 +330,9 @@ files: | |
| 294 330 | 
             
            - spec/lib/blue_print_spec.rb
         | 
| 295 331 | 
             
            - spec/lib/generators/rails/blue_print_generator_spec.rb
         | 
| 296 332 | 
             
            - spec/lib/generators/rspec/blue_print_generator_spec.rb
         | 
| 333 | 
            +
            - spec/requests/echo_spec.rb
         | 
| 297 334 | 
             
            - spec/spec_helper.rb
         | 
| 335 | 
            +
            - spec/support/api_testing.rb
         | 
| 298 336 | 
             
            - spec/support/database_cleaner.rb
         | 
| 299 337 | 
             
            - spec/support/generator_spec.rb
         | 
| 300 338 | 
             
            homepage: http://magnet-inc.github.io/blue_print
         | 
| @@ -322,14 +360,17 @@ signing_key: | |
| 322 360 | 
             
            specification_version: 4
         | 
| 323 361 | 
             
            summary: The behavior switching framework for Rails
         | 
| 324 362 | 
             
            test_files:
         | 
| 363 | 
            +
            - spec/apis/application_api_spec.rb
         | 
| 325 364 | 
             
            - spec/dummy/.gitignore
         | 
| 326 365 | 
             
            - spec/dummy/Gemfile
         | 
| 327 366 | 
             
            - spec/dummy/README.rdoc
         | 
| 328 367 | 
             
            - spec/dummy/Rakefile
         | 
| 368 | 
            +
            - spec/dummy/app/apis/application_api.rb
         | 
| 329 369 | 
             
            - spec/dummy/app/assets/images/rails.png
         | 
| 330 370 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| 331 371 | 
             
            - spec/dummy/app/assets/stylesheets/application.css
         | 
| 332 372 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| 373 | 
            +
            - spec/dummy/app/controllers/echo_controller.rb
         | 
| 333 374 | 
             
            - spec/dummy/app/helpers/application_helper.rb
         | 
| 334 375 | 
             
            - spec/dummy/app/mailers/.gitkeep
         | 
| 335 376 | 
             
            - spec/dummy/app/models/.gitkeep
         | 
| @@ -372,6 +413,8 @@ test_files: | |
| 372 413 | 
             
            - spec/lib/blue_print_spec.rb
         | 
| 373 414 | 
             
            - spec/lib/generators/rails/blue_print_generator_spec.rb
         | 
| 374 415 | 
             
            - spec/lib/generators/rspec/blue_print_generator_spec.rb
         | 
| 416 | 
            +
            - spec/requests/echo_spec.rb
         | 
| 375 417 | 
             
            - spec/spec_helper.rb
         | 
| 418 | 
            +
            - spec/support/api_testing.rb
         | 
| 376 419 | 
             
            - spec/support/database_cleaner.rb
         | 
| 377 420 | 
             
            - spec/support/generator_spec.rb
         |