jugglite 0.1.0 → 0.2.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/.travis.yml +2 -2
- data/CHANGELOG +8 -0
- data/lib/jugglite/app.rb +13 -1
- data/lib/jugglite/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 82002ee49bbedda3d7b82861ba2ba736948e3ff9
         | 
| 4 | 
            +
              data.tar.gz: e38c074d4e77ada440ddf98c0d481ccde469d9c9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d741e66346520c6039c3bd25ef07d01fb47f15e108a7c507ef5ea06df30ada7fb7d65f739f1fbccd8c5b50ef1dd18ad51c2f3544ab7ebec826c332bf5885f2e5
         | 
| 7 | 
            +
              data.tar.gz: 2d54a2d640965daaeef872d02557c67095fb6c1f5235a62d26adff418185513b072b14f77781b35a42c2619701cf7db854a30d8a0c91a8cc46a2c69eb8639c1e
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG
    CHANGED
    
    | @@ -1,3 +1,11 @@ | |
| 1 | 
            +
            = 0.2.0 / 2014-02-25
         | 
| 2 | 
            +
             | 
| 3 | 
            +
             * If message is JSON, extract 'event' and 'id' from the message
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            = 0.1.0 / 2014-02-21
         | 
| 6 | 
            +
             | 
| 7 | 
            +
             * Compatible with newer em-hiredis
         | 
| 8 | 
            +
             | 
| 1 9 | 
             
            = 0.0.4 / 2012-12-13
         | 
| 2 10 |  | 
| 3 11 | 
             
             * support for listening to a unix socket using the --socket commandline option
         | 
    
        data/lib/jugglite/app.rb
    CHANGED
    
    | @@ -101,10 +101,11 @@ module Jugglite | |
| 101 101 |  | 
| 102 102 | 
             
                def expedite_incoming_message(channel, message)
         | 
| 103 103 | 
             
                  no_connection_listening = true
         | 
| 104 | 
            +
                  options = extract_options_from_message(message)
         | 
| 104 105 | 
             
                  # Select upfront and use EM::Iterator
         | 
| 105 106 | 
             
                  @subscription_map.each do |connection, channels|
         | 
| 106 107 | 
             
                    if channels.include?(channel)
         | 
| 107 | 
            -
                      connection.write message
         | 
| 108 | 
            +
                      connection.write message, options
         | 
| 108 109 | 
             
                      no_connection_listening = false
         | 
| 109 110 | 
             
                    end
         | 
| 110 111 | 
             
                  end
         | 
| @@ -118,5 +119,16 @@ module Jugglite | |
| 118 119 | 
             
                    @redis_channels.delete(channel)
         | 
| 119 120 | 
             
                  end
         | 
| 120 121 | 
             
                end
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                def extract_options_from_message(message)
         | 
| 124 | 
            +
                  data = JSON.parse(message)
         | 
| 125 | 
            +
                  options = {}
         | 
| 126 | 
            +
                  options['event'] = data.delete('event') if data['event']
         | 
| 127 | 
            +
                  options['id'] = data.delete('id') if data['id']
         | 
| 128 | 
            +
                  options
         | 
| 129 | 
            +
                rescue JSON::ParserError
         | 
| 130 | 
            +
                  # The message is not valid json, so we are not able to extract options
         | 
| 131 | 
            +
                  {}
         | 
| 132 | 
            +
                end
         | 
| 121 133 | 
             
              end
         | 
| 122 134 | 
             
            end
         | 
    
        data/lib/jugglite/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jugglite
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - andruby
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014-02- | 
| 11 | 
            +
            date: 2014-02-25 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: thin
         |