marquise 0.1.0 → 0.1.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/lib/marquise.rb +18 -3
- data/spec/marquise_tell_spec.rb +14 -0
- metadata +4 -4
    
        data/lib/marquise.rb
    CHANGED
    
    | @@ -47,7 +47,8 @@ class Marquise | |
| 47 47 | 
             
            			raise RuntimeError,
         | 
| 48 48 | 
             
            			      "libmarquise failed; check syslog (no, seriously)"
         | 
| 49 49 | 
             
            		end
         | 
| 50 | 
            -
             | 
| 50 | 
            +
             | 
| 51 | 
            +
            		$stderr.puts "Consumer is #{@consumer.inspect}" if $DEBUG
         | 
| 51 52 | 
             
            		@connections = {}
         | 
| 52 53 |  | 
| 53 54 | 
             
            		@janitor = Janitor.new(@consumer, @connections)
         | 
| @@ -55,6 +56,11 @@ class Marquise | |
| 55 56 | 
             
            	end
         | 
| 56 57 |  | 
| 57 58 | 
             
            	def tell(*args)
         | 
| 59 | 
            +
            		if @consumer.nil?
         | 
| 60 | 
            +
            			raise IOError,
         | 
| 61 | 
            +
            			      "Connection has been closed"
         | 
| 62 | 
            +
            		end
         | 
| 63 | 
            +
             | 
| 58 64 | 
             
            		val, ts, opts = parse_tell_opts(args)
         | 
| 59 65 |  | 
| 60 66 | 
             
            		k, v, len = if opts.length == 0
         | 
| @@ -152,7 +158,9 @@ class Marquise | |
| 152 158 | 
             
            		if @connections[th].nil?
         | 
| 153 159 | 
             
            			raise RuntimeError.new("marquise_connect() failed... consult syslog (no, seriously)")
         | 
| 154 160 | 
             
            		end
         | 
| 155 | 
            -
             | 
| 161 | 
            +
             | 
| 162 | 
            +
            		$stderr.puts "Created new connection #{@connections[th].inspect} for #{th.inspect}" if $DEBUG
         | 
| 163 | 
            +
             | 
| 156 164 | 
             
            		nil
         | 
| 157 165 | 
             
            	end
         | 
| 158 166 |  | 
| @@ -175,8 +183,15 @@ class Marquise | |
| 175 183 | 
             
            		end
         | 
| 176 184 |  | 
| 177 185 | 
             
            		def call(*args)
         | 
| 178 | 
            -
            			 | 
| 186 | 
            +
            			$stderr.puts "Janitor is running for #{@ptr.inspect}/#{@conns.inspect}" if $DEBUG
         | 
| 187 | 
            +
            			@conns.values.each do |c|
         | 
| 188 | 
            +
            				$stderr.puts "Pre-clean #{c.inspect}" if $DEBUG
         | 
| 189 | 
            +
            				Marquise::FFI.marquise_close(c)
         | 
| 190 | 
            +
            				$stderr.puts "Post-clean #{c.inspect}" if $DEBUG
         | 
| 191 | 
            +
            			end
         | 
| 192 | 
            +
            			$stderr.puts "Pre-clean #{@ptr.inspect}" if $DEBUG
         | 
| 179 193 | 
             
            			Marquise::FFI.marquise_consumer_shutdown(@ptr)
         | 
| 194 | 
            +
            			$stderr.puts "Cleaned up #{@ptr.inspect} and #{@conns.inspect}" if $DEBUG
         | 
| 180 195 | 
             
            		end
         | 
| 181 196 | 
             
            	end
         | 
| 182 197 |  | 
    
        data/spec/marquise_tell_spec.rb
    CHANGED
    
    | @@ -23,5 +23,19 @@ describe Marquise do | |
| 23 23 | 
             
            			       /Invalid call to Marquise#tell/
         | 
| 24 24 | 
             
            			     )
         | 
| 25 25 | 
             
            		end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            		it "assplodes if #close has previously been called" do
         | 
| 28 | 
            +
            			Marquise::FFI.
         | 
| 29 | 
            +
            			  should_receive(:marquise_consumer_shutdown).
         | 
| 30 | 
            +
            			  with('#tell')
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            			marquise.close
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            			expect { marquise.tell }.
         | 
| 35 | 
            +
            			  to raise_error(
         | 
| 36 | 
            +
            			       IOError,
         | 
| 37 | 
            +
            			       /Connection has been closed/
         | 
| 38 | 
            +
            			     )
         | 
| 39 | 
            +
            		end
         | 
| 26 40 | 
             
            	end
         | 
| 27 41 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: marquise
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2014-03- | 
| 12 | 
            +
            date: 2014-03-24 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: ffi
         | 
| @@ -240,7 +240,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 240 240 | 
             
                  version: '0'
         | 
| 241 241 | 
             
                  segments:
         | 
| 242 242 | 
             
                  - 0
         | 
| 243 | 
            -
                  hash:  | 
| 243 | 
            +
                  hash: 4388250139847967772
         | 
| 244 244 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 245 245 | 
             
              none: false
         | 
| 246 246 | 
             
              requirements:
         | 
| @@ -249,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 249 249 | 
             
                  version: '0'
         | 
| 250 250 | 
             
                  segments:
         | 
| 251 251 | 
             
                  - 0
         | 
| 252 | 
            -
                  hash:  | 
| 252 | 
            +
                  hash: 4388250139847967772
         | 
| 253 253 | 
             
            requirements: []
         | 
| 254 254 | 
             
            rubyforge_project: 
         | 
| 255 255 | 
             
            rubygems_version: 1.8.23
         |