neuron 0.0.13 → 0.1.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.
- data/app/views/{defaults → application}/_form.html.haml +0 -0
- data/app/views/{defaults → application}/edit.html.haml +0 -0
- data/app/views/{defaults → application}/index.atom.builder +0 -0
- data/app/views/{defaults → application}/index.html.haml +0 -0
- data/app/views/{defaults → application}/new.html.haml +0 -0
- data/app/views/{defaults → application}/update.js.erb +0 -0
- data/lib/neuron.rb +6 -11
- data/lib/neuron/controller.rb +0 -6
- data/lib/neuron/railtie.rb +2 -0
- data/lib/neuron/resources.rb +4 -5
- data/lib/neuron/version.rb +1 -1
- data/lib/neuron/view.rb +4 -6
- data/neuron.gemspec +1 -1
- metadata +58 -51
- data/lib/neuron/resolver.rb +0 -14
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        data/lib/neuron.rb
    CHANGED
    
    | @@ -3,23 +3,18 @@ require 'neuron/version' | |
| 3 3 | 
             
            module Neuron
         | 
| 4 4 | 
             
              autoload :Application,    'neuron/application'
         | 
| 5 5 | 
             
              autoload :Authorization,  'neuron/authorization'
         | 
| 6 | 
            -
              autoload :Controller,     'neuron/controller'
         | 
| 7 6 | 
             
              autoload :Navigation,     'neuron/navigation'
         | 
| 8 7 | 
             
              autoload :Railtie,        'neuron/railtie'
         | 
| 9 | 
            -
              autoload :Resolver,       'neuron/resolver'
         | 
| 10 8 | 
             
              autoload :Resources,      'neuron/resources'
         | 
| 11 9 | 
             
              autoload :ShowFor,        'neuron/show_for'
         | 
| 12 | 
            -
              autoload :View,           'neuron/view'
         | 
| 13 10 |  | 
| 14 | 
            -
               | 
| 15 | 
            -
                 | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
                end
         | 
| 11 | 
            +
              def self.setup!
         | 
| 12 | 
            +
                Neuron::Controller.setup!
         | 
| 13 | 
            +
                Neuron::View.setup!
         | 
| 14 | 
            +
              end
         | 
| 19 15 |  | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
                end
         | 
| 16 | 
            +
              def self.path
         | 
| 17 | 
            +
                File.expand_path('../..', __FILE__)
         | 
| 23 18 | 
             
              end
         | 
| 24 19 | 
             
            end
         | 
| 25 20 |  | 
    
        data/lib/neuron/controller.rb
    CHANGED
    
    | @@ -12,11 +12,5 @@ module Neuron | |
| 12 12 | 
             
                    ActionController::Base.send(:include, Neuron::Authorization::Controller)  if defined?(::CanCan)
         | 
| 13 13 | 
             
                  end
         | 
| 14 14 | 
             
                end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                module ClassMethods
         | 
| 17 | 
            -
                  def append_neuron_view_path_resolver
         | 
| 18 | 
            -
                    append_view_path Neuron::Resolver.new
         | 
| 19 | 
            -
                  end
         | 
| 20 | 
            -
                end
         | 
| 21 15 | 
             
              end
         | 
| 22 16 | 
             
            end
         | 
    
        data/lib/neuron/railtie.rb
    CHANGED
    
    
    
        data/lib/neuron/resources.rb
    CHANGED
    
    | @@ -30,7 +30,6 @@ module Neuron | |
| 30 30 | 
             
                      prepend_before_filter :set_default_collection_scopes, only: [:index]
         | 
| 31 31 |  | 
| 32 32 | 
             
                      inherit_resources
         | 
| 33 | 
            -
                      append_neuron_view_path_resolver
         | 
| 34 33 |  | 
| 35 34 | 
             
                      if options[:order]
         | 
| 36 35 | 
             
                        order_scopes(options[:order])
         | 
| @@ -61,11 +60,11 @@ module Neuron | |
| 61 60 | 
             
                        get_collection_ivar || begin
         | 
| 62 61 | 
             
                          results = end_of_association_chain
         | 
| 63 62 | 
             
                          if (params[:paginate] != "false") && applicable?(options[:if], true) && applicable?(options[:unless], false)
         | 
| 64 | 
            -
                            results = results. | 
| 63 | 
            +
                            results = results.page(params[:page]).per(params[:per_page])
         | 
| 65 64 | 
             
                            headers['X-Pagination-TotalEntries']  = results.total_entries.to_s
         | 
| 66 65 | 
             
                            headers['X-Pagination-TotalPages']    = results.total_pages.to_s
         | 
| 67 66 | 
             
                            headers['X-Pagination-CurrentPage']   = results.current_page.to_s
         | 
| 68 | 
            -
                            headers['X-Pagination-PerPage']       = results. | 
| 67 | 
            +
                            headers['X-Pagination-PerPage']       = results.limit_value.to_s
         | 
| 69 68 | 
             
                          end
         | 
| 70 69 | 
             
                          set_collection_ivar(results)
         | 
| 71 70 | 
             
                        end
         | 
| @@ -148,8 +147,8 @@ module Neuron | |
| 148 147 | 
             
                    collection      ||= self.collection
         | 
| 149 148 | 
             
                    collection_name ||= self.resource_collection_name
         | 
| 150 149 | 
             
                    if collection.respond_to?(:total_pages)
         | 
| 151 | 
            -
                      start = 1 + (collection.current_page - 1) * collection. | 
| 152 | 
            -
                      pagination =  | 
| 150 | 
            +
                      start = 1 + (collection.current_page - 1) * collection.limit_value
         | 
| 151 | 
            +
                      pagination = paginate(collection)
         | 
| 153 152 | 
             
                    else
         | 
| 154 153 | 
             
                      start = 1
         | 
| 155 154 | 
             
                      pagination = ''
         | 
    
        data/lib/neuron/version.rb
    CHANGED
    
    
    
        data/lib/neuron/view.rb
    CHANGED
    
    | @@ -2,8 +2,6 @@ require 'neuron' | |
| 2 2 |  | 
| 3 3 | 
             
            module Neuron
         | 
| 4 4 | 
             
              module View
         | 
| 5 | 
            -
                extend ActiveSupport::Memoizable
         | 
| 6 | 
            -
             | 
| 7 5 | 
             
                def self.setup!
         | 
| 8 6 | 
             
                  if defined?(::ActionView)
         | 
| 9 7 | 
             
                    ActionView::Base.send(:include, Neuron::View)
         | 
| @@ -38,9 +36,10 @@ module Neuron | |
| 38 36 | 
             
                end
         | 
| 39 37 |  | 
| 40 38 | 
             
                def human(klass, attribute = nil)
         | 
| 41 | 
            -
                   | 
| 39 | 
            +
                  @human ||= {}
         | 
| 40 | 
            +
                  @human[klass] ||= {}
         | 
| 41 | 
            +
                  @human[klass][attribute] ||= attribute ? klass.human_attribute_name(attribute) : klass.name.human
         | 
| 42 42 | 
             
                end
         | 
| 43 | 
            -
                memoize :human
         | 
| 44 43 |  | 
| 45 44 | 
             
                # Build canonical url for given resource
         | 
| 46 45 | 
             
                def canonical_url(resource, options = {})
         | 
| @@ -70,9 +69,8 @@ module Neuron | |
| 70 69 | 
             
                end
         | 
| 71 70 |  | 
| 72 71 | 
             
                def controller_i18n_scope
         | 
| 73 | 
            -
                  controller.controller_path.gsub(%r{/}, '.')
         | 
| 72 | 
            +
                  @controller_i18n_scope ||= controller.controller_path.gsub(%r{/}, '.')
         | 
| 74 73 | 
             
                end
         | 
| 75 | 
            -
                memoize :controller_i18n_scope
         | 
| 76 74 |  | 
| 77 75 | 
             
                def time(time, options = {})
         | 
| 78 76 | 
             
                  format        = options.delete(:format) { :short }
         | 
    
        data/neuron.gemspec
    CHANGED
    
    | @@ -19,6 +19,6 @@ Gem::Specification.new do |s| | |
| 19 19 | 
             
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         | 
| 20 20 | 
             
              s.require_paths = ["lib"]
         | 
| 21 21 |  | 
| 22 | 
            -
              s.add_dependency 'railties', '~> 3. | 
| 22 | 
            +
              s.add_dependency 'railties', '~> 3.2'
         | 
| 23 23 | 
             
              s.add_development_dependency 'rake'
         | 
| 24 24 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,58 +1,64 @@ | |
| 1 | 
            -
            --- !ruby/object:Gem::Specification | 
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: neuron
         | 
| 3 | 
            -
            version: !ruby/object:Gem::Version | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.1.0
         | 
| 4 5 | 
             
              prerelease: 
         | 
| 5 | 
            -
              version: 0.0.13
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 | 
            -
            authors: | 
| 7 | 
            +
            authors:
         | 
| 8 8 | 
             
            - Alexander Semyonov
         | 
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 12 | 
            +
            date: 2012-10-21 00:00:00.000000000 Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 16 15 | 
             
              name: railties
         | 
| 17 | 
            -
               | 
| 18 | 
            -
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 16 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 19 17 | 
             
                none: false
         | 
| 20 | 
            -
                requirements: | 
| 18 | 
            +
                requirements:
         | 
| 21 19 | 
             
                - - ~>
         | 
| 22 | 
            -
                  - !ruby/object:Gem::Version | 
| 23 | 
            -
                    version:  | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: '3.2'
         | 
| 24 22 | 
             
              type: :runtime
         | 
| 25 | 
            -
              version_requirements: *id001
         | 
| 26 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 27 | 
            -
              name: rake
         | 
| 28 23 | 
             
              prerelease: false
         | 
| 29 | 
            -
               | 
| 24 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 30 25 | 
             
                none: false
         | 
| 31 | 
            -
                requirements: | 
| 32 | 
            -
                - -  | 
| 33 | 
            -
                  - !ruby/object:Gem::Version | 
| 34 | 
            -
                    version:  | 
| 26 | 
            +
                requirements:
         | 
| 27 | 
            +
                - - ~>
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            +
                    version: '3.2'
         | 
| 30 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 31 | 
            +
              name: rake
         | 
| 32 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            +
                none: false
         | 
| 34 | 
            +
                requirements:
         | 
| 35 | 
            +
                - - ! '>='
         | 
| 36 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            +
                    version: '0'
         | 
| 35 38 | 
             
              type: :development
         | 
| 36 | 
            -
               | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            +
                none: false
         | 
| 42 | 
            +
                requirements:
         | 
| 43 | 
            +
                - - ! '>='
         | 
| 44 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            +
                    version: '0'
         | 
| 37 46 | 
             
            description: Code reused in many applications
         | 
| 38 | 
            -
            email: | 
| 47 | 
            +
            email:
         | 
| 39 48 | 
             
            - al@semyonov.us
         | 
| 40 49 | 
             
            executables: []
         | 
| 41 | 
            -
             | 
| 42 50 | 
             
            extensions: []
         | 
| 43 | 
            -
             | 
| 44 51 | 
             
            extra_rdoc_files: []
         | 
| 45 | 
            -
             | 
| 46 | 
            -
            files: 
         | 
| 52 | 
            +
            files:
         | 
| 47 53 | 
             
            - .gitignore
         | 
| 48 54 | 
             
            - Gemfile
         | 
| 49 55 | 
             
            - Rakefile
         | 
| 50 | 
            -
            - app/views/ | 
| 51 | 
            -
            - app/views/ | 
| 52 | 
            -
            - app/views/ | 
| 53 | 
            -
            - app/views/ | 
| 54 | 
            -
            - app/views/ | 
| 55 | 
            -
            - app/views/ | 
| 56 | 
            +
            - app/views/application/_form.html.haml
         | 
| 57 | 
            +
            - app/views/application/edit.html.haml
         | 
| 58 | 
            +
            - app/views/application/index.atom.builder
         | 
| 59 | 
            +
            - app/views/application/index.html.haml
         | 
| 60 | 
            +
            - app/views/application/new.html.haml
         | 
| 61 | 
            +
            - app/views/application/update.js.erb
         | 
| 56 62 | 
             
            - app/views/shared/_flash_messages.html.haml
         | 
| 57 63 | 
             
            - config/locales/neuron.en.yml
         | 
| 58 64 | 
             
            - config/locales/neuron.ru.yml
         | 
| @@ -62,39 +68,40 @@ files: | |
| 62 68 | 
             
            - lib/neuron/controller.rb
         | 
| 63 69 | 
             
            - lib/neuron/navigation.rb
         | 
| 64 70 | 
             
            - lib/neuron/railtie.rb
         | 
| 65 | 
            -
            - lib/neuron/resolver.rb
         | 
| 66 71 | 
             
            - lib/neuron/resources.rb
         | 
| 67 72 | 
             
            - lib/neuron/show_for.rb
         | 
| 68 73 | 
             
            - lib/neuron/show_for/helper.rb
         | 
| 69 74 | 
             
            - lib/neuron/version.rb
         | 
| 70 75 | 
             
            - lib/neuron/view.rb
         | 
| 71 76 | 
             
            - neuron.gemspec
         | 
| 72 | 
            -
            homepage:  | 
| 77 | 
            +
            homepage: ''
         | 
| 73 78 | 
             
            licenses: []
         | 
| 74 | 
            -
             | 
| 75 79 | 
             
            post_install_message: 
         | 
| 76 80 | 
             
            rdoc_options: []
         | 
| 77 | 
            -
             | 
| 78 | 
            -
            require_paths: 
         | 
| 81 | 
            +
            require_paths:
         | 
| 79 82 | 
             
            - lib
         | 
| 80 | 
            -
            required_ruby_version: !ruby/object:Gem::Requirement | 
| 83 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 81 84 | 
             
              none: false
         | 
| 82 | 
            -
              requirements: | 
| 83 | 
            -
              - -  | 
| 84 | 
            -
                - !ruby/object:Gem::Version | 
| 85 | 
            -
                  version:  | 
| 86 | 
            -
             | 
| 85 | 
            +
              requirements:
         | 
| 86 | 
            +
              - - ! '>='
         | 
| 87 | 
            +
                - !ruby/object:Gem::Version
         | 
| 88 | 
            +
                  version: '0'
         | 
| 89 | 
            +
                  segments:
         | 
| 90 | 
            +
                  - 0
         | 
| 91 | 
            +
                  hash: 4151533389982554336
         | 
| 92 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 87 93 | 
             
              none: false
         | 
| 88 | 
            -
              requirements: | 
| 89 | 
            -
              - -  | 
| 90 | 
            -
                - !ruby/object:Gem::Version | 
| 91 | 
            -
                  version:  | 
| 94 | 
            +
              requirements:
         | 
| 95 | 
            +
              - - ! '>='
         | 
| 96 | 
            +
                - !ruby/object:Gem::Version
         | 
| 97 | 
            +
                  version: '0'
         | 
| 98 | 
            +
                  segments:
         | 
| 99 | 
            +
                  - 0
         | 
| 100 | 
            +
                  hash: 4151533389982554336
         | 
| 92 101 | 
             
            requirements: []
         | 
| 93 | 
            -
             | 
| 94 102 | 
             
            rubyforge_project: neuron
         | 
| 95 | 
            -
            rubygems_version: 1.8. | 
| 103 | 
            +
            rubygems_version: 1.8.24
         | 
| 96 104 | 
             
            signing_key: 
         | 
| 97 105 | 
             
            specification_version: 3
         | 
| 98 106 | 
             
            summary: Tools for decrease code duplication in rails applications
         | 
| 99 107 | 
             
            test_files: []
         | 
| 100 | 
            -
             | 
    
        data/lib/neuron/resolver.rb
    DELETED
    
    | @@ -1,14 +0,0 @@ | |
| 1 | 
            -
            require 'neuron'
         | 
| 2 | 
            -
            require 'action_view/template/resolver'
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            module Neuron
         | 
| 5 | 
            -
              class Resolver < ::ActionView::FileSystemResolver
         | 
| 6 | 
            -
                def initialize
         | 
| 7 | 
            -
                  super(File.join(Neuron.path, 'app', 'views'))
         | 
| 8 | 
            -
                end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                def find_templates(name, prefix, partial, details)
         | 
| 11 | 
            -
                  super(name, 'defaults', partial, details)
         | 
| 12 | 
            -
                end
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
            end
         |