cramp 0.6 → 0.7
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/MIT-LICENSE +1 -1
- data/lib/cramp/controller/abstract.rb +2 -0
- data/lib/cramp/controller/body.rb +2 -2
- data/lib/cramp/controller/callbacks.rb +0 -8
- data/lib/cramp.rb +1 -1
- metadata +4 -5
- data/README +0 -30
    
        data/MIT-LICENSE
    CHANGED
    
    
| @@ -30,7 +30,7 @@ module Cramp | |
| 30 30 | 
             
                    return unless @body_callback
         | 
| 31 31 |  | 
| 32 32 | 
             
                    until @queue.empty?
         | 
| 33 | 
            -
                      @queue.shift.each {|chunk| @body_callback.call(chunk) }
         | 
| 33 | 
            +
                      Array(@queue.shift).each {|chunk| @body_callback.call(chunk) }
         | 
| 34 34 | 
             
                    end
         | 
| 35 35 | 
             
                  end
         | 
| 36 36 |  | 
| @@ -40,7 +40,7 @@ module Cramp | |
| 40 40 | 
             
                    EventMachine.next_tick do
         | 
| 41 41 | 
             
                      next unless body = @queue.shift
         | 
| 42 42 |  | 
| 43 | 
            -
                      body.each {|chunk| @body_callback.call(chunk) }
         | 
| 43 | 
            +
                      Array(body).each {|chunk| @body_callback.call(chunk) }
         | 
| 44 44 | 
             
                      schedule_dequeue unless @queue.empty?
         | 
| 45 45 | 
             
                    end
         | 
| 46 46 | 
             
                  end
         | 
| @@ -4,15 +4,7 @@ module Cramp | |
| 4 4 |  | 
| 5 5 | 
             
                  extend ActiveSupport::Concern
         | 
| 6 6 |  | 
| 7 | 
            -
                  ASYNC_RESPONSE = [-1, {}, []].freeze
         | 
| 8 | 
            -
                  DEFAULT_STATUS = 200
         | 
| 9 | 
            -
                  DEFAULT_HEADERS =  { 'Content-Type' => 'text/html' }.freeze
         | 
| 10 | 
            -
             | 
| 11 7 | 
             
                  included do
         | 
| 12 | 
            -
                    class_inheritable_accessor :default_status, :default_headers, :instance_reader => false
         | 
| 13 | 
            -
                    self.default_status = DEFAULT_STATUS
         | 
| 14 | 
            -
                    self.default_headers = DEFAULT_HEADERS
         | 
| 15 | 
            -
             | 
| 16 8 | 
             
                    class_inheritable_accessor :before_start_callbacks, :on_finish_callbacks, :on_start_callback, :instance_reader => false
         | 
| 17 9 | 
             
                    self.before_start_callbacks = []
         | 
| 18 10 | 
             
                    self.on_finish_callbacks = []
         | 
    
        data/lib/cramp.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: cramp
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: "0. | 
| 4 | 
            +
              version: "0.7"
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Pratik Naik
         | 
| @@ -9,7 +9,7 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2010-01- | 
| 12 | 
            +
            date: 2010-01-09 00:00:00 +05:30
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -38,9 +38,9 @@ dependencies: | |
| 38 38 | 
             
              version_requirement: 
         | 
| 39 39 | 
             
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 40 40 | 
             
                requirements: 
         | 
| 41 | 
            -
                - -  | 
| 41 | 
            +
                - - "="
         | 
| 42 42 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 43 | 
            -
                    version: 0. | 
| 43 | 
            +
                    version: 0.2.pre
         | 
| 44 44 | 
             
                version: 
         | 
| 45 45 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 46 46 | 
             
              name: rack
         | 
| @@ -91,7 +91,6 @@ extensions: [] | |
| 91 91 | 
             
            extra_rdoc_files: []
         | 
| 92 92 |  | 
| 93 93 | 
             
            files: 
         | 
| 94 | 
            -
            - README
         | 
| 95 94 | 
             
            - MIT-LICENSE
         | 
| 96 95 | 
             
            - lib/cramp/controller/abstract.rb
         | 
| 97 96 | 
             
            - lib/cramp/controller/action.rb
         | 
    
        data/README
    DELETED
    
    | @@ -1,30 +0,0 @@ | |
| 1 | 
            -
            require 'rubygems'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            $: << File.join(File.dirname(__FILE__), "lib")
         | 
| 4 | 
            -
            require 'cramp/model'
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            Cramp::Model.init(:username => 'root', :database => 'arel_development')
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            class User < Cramp::Model::Base
         | 
| 9 | 
            -
              attribute :id, :type => Integer, :primary_key => true
         | 
| 10 | 
            -
              attribute :name
         | 
| 11 | 
            -
             | 
| 12 | 
            -
              validates_presence_of :name
         | 
| 13 | 
            -
            end
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            EM.run do
         | 
| 16 | 
            -
              user = User.new
         | 
| 17 | 
            -
             | 
| 18 | 
            -
              user.save do |status|
         | 
| 19 | 
            -
                if status.success?
         | 
| 20 | 
            -
                  puts "WTF!"
         | 
| 21 | 
            -
                else
         | 
| 22 | 
            -
                  puts "Oops. Found errors : #{user.errors.inspect}"
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                  user.name = 'Lush'
         | 
| 25 | 
            -
                  user.save do
         | 
| 26 | 
            -
                    User.where(User[:name].eq('Lush')).all {|users| puts users.inspect; EM.stop }
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
                end
         | 
| 29 | 
            -
              end
         | 
| 30 | 
            -
            end
         |