fendhal 0.0.1
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/.gitignore +6 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +65 -0
- data/README.md +0 -0
- data/fendhal.gemspec +18 -0
- data/lib/fendhal.rb +8 -0
- data/lib/fendhal/action.rb +45 -0
- data/lib/fendhal/controller.rb +17 -0
- data/spec/lib/fendhal/action_spec.rb +44 -0
- data/spec/lib/fendhal/controller_spec.rb +31 -0
- data/spec/lib/fendhal_spec.rb +5 -0
- data/spec/spec_helper.rb +12 -0
- metadata +110 -0
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/Gemfile.lock
    ADDED
    
    | @@ -0,0 +1,65 @@ | |
| 1 | 
            +
            PATH
         | 
| 2 | 
            +
              remote: .
         | 
| 3 | 
            +
              specs:
         | 
| 4 | 
            +
                fendhal (0.0.1)
         | 
| 5 | 
            +
                  actionpack
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            GEM
         | 
| 8 | 
            +
              remote: https://rubygems.org/
         | 
| 9 | 
            +
              specs:
         | 
| 10 | 
            +
                actionpack (3.2.13)
         | 
| 11 | 
            +
                  activemodel (= 3.2.13)
         | 
| 12 | 
            +
                  activesupport (= 3.2.13)
         | 
| 13 | 
            +
                  builder (~> 3.0.0)
         | 
| 14 | 
            +
                  erubis (~> 2.7.0)
         | 
| 15 | 
            +
                  journey (~> 1.0.4)
         | 
| 16 | 
            +
                  rack (~> 1.4.5)
         | 
| 17 | 
            +
                  rack-cache (~> 1.2)
         | 
| 18 | 
            +
                  rack-test (~> 0.6.1)
         | 
| 19 | 
            +
                  sprockets (~> 2.2.1)
         | 
| 20 | 
            +
                activemodel (3.2.13)
         | 
| 21 | 
            +
                  activesupport (= 3.2.13)
         | 
| 22 | 
            +
                  builder (~> 3.0.0)
         | 
| 23 | 
            +
                activesupport (3.2.13)
         | 
| 24 | 
            +
                  i18n (= 0.6.1)
         | 
| 25 | 
            +
                  multi_json (~> 1.0)
         | 
| 26 | 
            +
                builder (3.0.4)
         | 
| 27 | 
            +
                diff-lcs (1.2.4)
         | 
| 28 | 
            +
                erubis (2.7.0)
         | 
| 29 | 
            +
                hike (1.2.2)
         | 
| 30 | 
            +
                i18n (0.6.1)
         | 
| 31 | 
            +
                journey (1.0.4)
         | 
| 32 | 
            +
                json (1.7.7)
         | 
| 33 | 
            +
                multi_json (1.7.3)
         | 
| 34 | 
            +
                rack (1.4.5)
         | 
| 35 | 
            +
                rack-cache (1.2)
         | 
| 36 | 
            +
                  rack (>= 0.4)
         | 
| 37 | 
            +
                rack-test (0.6.2)
         | 
| 38 | 
            +
                  rack (>= 1.0)
         | 
| 39 | 
            +
                rspec (2.13.0)
         | 
| 40 | 
            +
                  rspec-core (~> 2.13.0)
         | 
| 41 | 
            +
                  rspec-expectations (~> 2.13.0)
         | 
| 42 | 
            +
                  rspec-mocks (~> 2.13.0)
         | 
| 43 | 
            +
                rspec-core (2.13.1)
         | 
| 44 | 
            +
                rspec-expectations (2.13.0)
         | 
| 45 | 
            +
                  diff-lcs (>= 1.1.3, < 2.0)
         | 
| 46 | 
            +
                rspec-mocks (2.13.1)
         | 
| 47 | 
            +
                simplecov (0.7.1)
         | 
| 48 | 
            +
                  multi_json (~> 1.0)
         | 
| 49 | 
            +
                  simplecov-html (~> 0.7.1)
         | 
| 50 | 
            +
                simplecov-html (0.7.1)
         | 
| 51 | 
            +
                sprockets (2.2.2)
         | 
| 52 | 
            +
                  hike (~> 1.2)
         | 
| 53 | 
            +
                  multi_json (~> 1.0)
         | 
| 54 | 
            +
                  rack (~> 1.0)
         | 
| 55 | 
            +
                  tilt (~> 1.1, != 1.3.0)
         | 
| 56 | 
            +
                tilt (1.4.1)
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            PLATFORMS
         | 
| 59 | 
            +
              ruby
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            DEPENDENCIES
         | 
| 62 | 
            +
              fendhal!
         | 
| 63 | 
            +
              json (~> 1.7.7)
         | 
| 64 | 
            +
              rspec
         | 
| 65 | 
            +
              simplecov
         | 
    
        data/README.md
    ADDED
    
    | 
            File without changes
         | 
    
        data/fendhal.gemspec
    ADDED
    
    | @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            Gem::Specification.new do |s|
         | 
| 2 | 
            +
              s.name          = 'fendhal'
         | 
| 3 | 
            +
              s.version       = '0.0.1'
         | 
| 4 | 
            +
              s.date          = '2013-05-22'
         | 
| 5 | 
            +
              s.summary       = "Modular, class based controller actions for Rails"
         | 
| 6 | 
            +
              s.description   = "Modular, class based controller actions for Rails"
         | 
| 7 | 
            +
              s.authors       = ["Russell Dunphy"]
         | 
| 8 | 
            +
              s.email         = ['russell@russelldunphy.com']
         | 
| 9 | 
            +
              s.files         = `git ls-files`.split($\)
         | 
| 10 | 
            +
              s.test_files    = s.files.grep(%r{^(test|spec|features)/})
         | 
| 11 | 
            +
              s.require_paths = ["lib"]
         | 
| 12 | 
            +
              s.homepage      = 'http://github.com/rsslldnphy/fendhal'
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              s.add_dependency "actionpack"
         | 
| 15 | 
            +
              s.add_development_dependency "rspec"
         | 
| 16 | 
            +
              s.add_development_dependency "simplecov"
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            end
         | 
    
        data/lib/fendhal.rb
    ADDED
    
    
| @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            module Fendhal
         | 
| 2 | 
            +
              class Action < SimpleDelegator
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                def action
         | 
| 5 | 
            +
                end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def respond_to *formats
         | 
| 8 | 
            +
                  super() { |format| formats.each { |f| format.send(f) { send f } } }
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def all
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                def text
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def html
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                def js
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def ics
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                def csv
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                def xml
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                def yaml
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                def rss
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                def atom
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                def json
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
            end
         | 
| 45 | 
            +
             | 
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            module Fendhal
         | 
| 2 | 
            +
              class Controller < ActionController::Base
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                def self.defines *actions
         | 
| 5 | 
            +
                  actions.each do |action|
         | 
| 6 | 
            +
                    define_method(action) { class_for(action).new(self).action }
         | 
| 7 | 
            +
                  end
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                private
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                def class_for(action)
         | 
| 13 | 
            +
                  self.class.const_get(action.to_s.camelcase)
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
| @@ -0,0 +1,44 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Fendhal
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              class TestAction < Action
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def action
         | 
| 8 | 
            +
                  respond_to :html, :csv
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              class MockController
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def respond_to &block
         | 
| 16 | 
            +
                  block.call format
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                class Format
         | 
| 20 | 
            +
                  def method_missing name, *args, &block
         | 
| 21 | 
            +
                    self
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                def format
         | 
| 26 | 
            +
                  @format ||= Format.new
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              describe Action do
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                let (:action)     { Action.new(controller) }
         | 
| 34 | 
            +
                let (:controller) { MockController.new     }
         | 
| 35 | 
            +
                let (:format)     { controller.format      }
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                it 'responds to formats by calling the respective methods' do
         | 
| 38 | 
            +
                  format.should_receive(:html)
         | 
| 39 | 
            +
                  format.should_receive(:csv)
         | 
| 40 | 
            +
                  action.respond_to(:html, :csv)
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
            end
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Fendhal
         | 
| 4 | 
            +
              describe Controller do
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                class TestController < Controller
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  class Index < Action
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                    def action
         | 
| 11 | 
            +
                      "Here's the action!"
         | 
| 12 | 
            +
                    end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  defines :index
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                let (:controller) { TestController.new }
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                it 'defines the specified actions' do
         | 
| 23 | 
            +
                  controller.should respond_to :index
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                it 'delegates to the respective classes for each action' do
         | 
| 27 | 
            +
                  controller.index.should eq "Here's the action!"
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    ADDED
    
    
    
        metadata
    ADDED
    
    | @@ -0,0 +1,110 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: fendhal
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.0.1
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 | 
            +
            platform: ruby
         | 
| 7 | 
            +
            authors:
         | 
| 8 | 
            +
            - Russell Dunphy
         | 
| 9 | 
            +
            autorequire: 
         | 
| 10 | 
            +
            bindir: bin
         | 
| 11 | 
            +
            cert_chain: []
         | 
| 12 | 
            +
            date: 2013-05-22 00:00:00.000000000 Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: actionpack
         | 
| 16 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                none: false
         | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - ! '>='
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: '0'
         | 
| 22 | 
            +
              type: :runtime
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            +
                none: false
         | 
| 26 | 
            +
                requirements:
         | 
| 27 | 
            +
                - - ! '>='
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            +
                    version: '0'
         | 
| 30 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 31 | 
            +
              name: rspec
         | 
| 32 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            +
                none: false
         | 
| 34 | 
            +
                requirements:
         | 
| 35 | 
            +
                - - ! '>='
         | 
| 36 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            +
                    version: '0'
         | 
| 38 | 
            +
              type: :development
         | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            +
                none: false
         | 
| 42 | 
            +
                requirements:
         | 
| 43 | 
            +
                - - ! '>='
         | 
| 44 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            +
                    version: '0'
         | 
| 46 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 47 | 
            +
              name: simplecov
         | 
| 48 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            +
                none: false
         | 
| 50 | 
            +
                requirements:
         | 
| 51 | 
            +
                - - ! '>='
         | 
| 52 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            +
                    version: '0'
         | 
| 54 | 
            +
              type: :development
         | 
| 55 | 
            +
              prerelease: false
         | 
| 56 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            +
                none: false
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ! '>='
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
            description: Modular, class based controller actions for Rails
         | 
| 63 | 
            +
            email:
         | 
| 64 | 
            +
            - russell@russelldunphy.com
         | 
| 65 | 
            +
            executables: []
         | 
| 66 | 
            +
            extensions: []
         | 
| 67 | 
            +
            extra_rdoc_files: []
         | 
| 68 | 
            +
            files:
         | 
| 69 | 
            +
            - .gitignore
         | 
| 70 | 
            +
            - Gemfile
         | 
| 71 | 
            +
            - Gemfile.lock
         | 
| 72 | 
            +
            - README.md
         | 
| 73 | 
            +
            - fendhal.gemspec
         | 
| 74 | 
            +
            - lib/fendhal.rb
         | 
| 75 | 
            +
            - lib/fendhal/action.rb
         | 
| 76 | 
            +
            - lib/fendhal/controller.rb
         | 
| 77 | 
            +
            - spec/lib/fendhal/action_spec.rb
         | 
| 78 | 
            +
            - spec/lib/fendhal/controller_spec.rb
         | 
| 79 | 
            +
            - spec/lib/fendhal_spec.rb
         | 
| 80 | 
            +
            - spec/spec_helper.rb
         | 
| 81 | 
            +
            homepage: http://github.com/rsslldnphy/fendhal
         | 
| 82 | 
            +
            licenses: []
         | 
| 83 | 
            +
            post_install_message: 
         | 
| 84 | 
            +
            rdoc_options: []
         | 
| 85 | 
            +
            require_paths:
         | 
| 86 | 
            +
            - lib
         | 
| 87 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 88 | 
            +
              none: false
         | 
| 89 | 
            +
              requirements:
         | 
| 90 | 
            +
              - - ! '>='
         | 
| 91 | 
            +
                - !ruby/object:Gem::Version
         | 
| 92 | 
            +
                  version: '0'
         | 
| 93 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 94 | 
            +
              none: false
         | 
| 95 | 
            +
              requirements:
         | 
| 96 | 
            +
              - - ! '>='
         | 
| 97 | 
            +
                - !ruby/object:Gem::Version
         | 
| 98 | 
            +
                  version: '0'
         | 
| 99 | 
            +
            requirements: []
         | 
| 100 | 
            +
            rubyforge_project: 
         | 
| 101 | 
            +
            rubygems_version: 1.8.25
         | 
| 102 | 
            +
            signing_key: 
         | 
| 103 | 
            +
            specification_version: 3
         | 
| 104 | 
            +
            summary: Modular, class based controller actions for Rails
         | 
| 105 | 
            +
            test_files:
         | 
| 106 | 
            +
            - spec/lib/fendhal/action_spec.rb
         | 
| 107 | 
            +
            - spec/lib/fendhal/controller_spec.rb
         | 
| 108 | 
            +
            - spec/lib/fendhal_spec.rb
         | 
| 109 | 
            +
            - spec/spec_helper.rb
         | 
| 110 | 
            +
            has_rdoc: 
         |