familia 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85be10b89ba21af81625429bd874cb415ea83325c52811cbf73ccadb436e83ad
4
- data.tar.gz: 0c60a40a22069927164afc9c3426f294f7b7d4e5066f5197c206a0940fc8b16a
3
+ metadata.gz: 6094ea590e66afd51a244fc0bdb4eaa3252a26cd3c1a7da445b5a222a44b9cca
4
+ data.tar.gz: 235b5ffc47898796c08fdcaca31341ff236bca5ea6b70aa1a11e3dc14617bd5c
5
5
  SHA512:
6
- metadata.gz: 57d68342db867a3e472b6a1c27b3d9f1c728d7b8ca821caf79d80d44f03fca0546263532ea5e43659cd379331d421a666b0fb94dd707de248f5453bfb0c527be
7
- data.tar.gz: 1251c83b61231e5b392da125b88cc8312b65d6892df285f6fed3ef4a12d354304c5f3a21f5d6f5cc95f2479ad04b53a98783e0429868d469c224506f46a41f70
6
+ metadata.gz: ed2cce70440beb24a905a139b316d03db97df8e91e7651c75cec4616276f75db22576afde2c257ff7b92dc6eab2cb0e902d2743f28334ff5048f76dff5c7cb39
7
+ data.tar.gz: cd67c6ee621157797594186cf9487e2cf2fd24e756d1a21f3534556e0e3b9938dcb119346df3e96659cac072c1cc080b3394d59950fde264fe28230f92ba12fc
@@ -7,6 +7,8 @@ on:
7
7
 
8
8
  pull_request:
9
9
 
10
+ workflow_dispatch:
11
+
10
12
  jobs:
11
13
  build:
12
14
  runs-on: ubuntu-latest
@@ -49,7 +51,7 @@ jobs:
49
51
  - 6379:6379
50
52
 
51
53
  steps:
52
- - uses: actions/checkout@v3
54
+ - uses: actions/checkout@v4
53
55
  - name: Set up Ruby
54
56
  uses: ruby/setup-ruby@v1
55
57
  with:
@@ -66,4 +68,4 @@ jobs:
66
68
  run: bundle install
67
69
 
68
70
  - name: Run the tryouts
69
- run: bundle exec try -v
71
+ run: bundle exec try -v try/*_try.rb
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Familia - 0.10.0
1
+ # Familia - 0.10.1
2
2
 
3
3
  **Organize and store ruby objects in Redis. A Ruby ORM for Redis.**
4
4
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :MAJOR: 0
3
3
  :MINOR: 10
4
- :PATCH: 0
4
+ :PATCH: 1
data/familia.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "familia"
3
- s.version = "0.10.0"
3
+ s.version = "0.10.1"
4
4
  s.summary = "Organize and store ruby objects in Redis"
5
5
  s.description = "Familia: #{s.summary}"
6
6
  s.authors = ["Delano Mandelbaum"]
@@ -46,7 +46,7 @@ module Familia
46
46
  end
47
47
  end
48
48
 
49
- attr_reader :name, :parent, :opts
49
+ attr_reader :name, :parent
50
50
  attr_writer :redis
51
51
 
52
52
  # RedisObject instances are frozen. `cache` is a hash
@@ -818,6 +818,11 @@ module Familia
818
818
  ret = redis.hset rediskey, n, to_redis(v)
819
819
  update_expiration
820
820
  ret
821
+ rescue TypeError => e
822
+ echo :hset, caller[0] if Familia.debug
823
+ klass = v.class
824
+ msg = "Cannot store #{n} => #{v.inspect} (#{klass}) in #{rediskey}"
825
+ raise e.class, msg
821
826
  end
822
827
  alias_method :put, :[]=
823
828
  alias_method :store, :[]=
data/lib/familia.rb CHANGED
@@ -32,10 +32,13 @@ module Familia
32
32
  @debug = false
33
33
  @dump_method = :to_json
34
34
  @load_method = :from_json
35
+
35
36
  class << self
36
37
  attr_reader :clients, :uri, :logger
37
38
  attr_accessor :debug, :secret, :delim, :dump_method, :load_method
38
39
  attr_writer :apiversion
40
+
41
+ alias_method :url, :uri
39
42
  def debug?() @debug == true end
40
43
  def info *msg
41
44
  STDERR.puts *msg
@@ -48,7 +51,7 @@ module Familia
48
51
  end
49
52
  def trace label, redis_instance, ident, context=nil
50
53
  return unless Familia.debug?
51
- info "[%s] %s/%s" % [label, redis_instance.id, ident]
54
+ info "[%s] %s %s" % [label, redis_instance.id, ident]
52
55
  if context
53
56
  context = [context].flatten
54
57
  context.reject! { |line| line =~ /lib\/familia/ }
@@ -87,7 +90,7 @@ module Familia
87
90
  uri ||= Familia.uri
88
91
  conf = uri.conf
89
92
  redis = Redis.new conf
90
- Familia.trace :CONNECT, redis, conf.inspect, caller[0..3] if Familia.debug
93
+ Familia.trace(:CONNECT, redis, conf.inspect, caller[0..3])
91
94
  @clients[uri.serverid] = redis
92
95
  end
93
96
  def reconnect_all!
@@ -0,0 +1,21 @@
1
+ require 'familia'
2
+ require 'familia/test_helpers'
3
+
4
+ Familia.apiversion = 'v1'
5
+
6
+
7
+ ## Check for help class
8
+ Bone.redis_objects.keys # consistent b/c hashes are ordered
9
+ #=> [:owners, :tags, :metrics, :props, :value]
10
+
11
+ ## Familia has a uri
12
+ Familia.uri.class
13
+ #=> URI::Redis
14
+
15
+ ## Familia has a uri as a string
16
+ Familia.uri.to_s
17
+ #=> 'redis://127.0.0.1'
18
+
19
+ ## Familia has a url, an alias to uri
20
+ Familia.url.eql?(Familia.uri)
21
+ #=> true
@@ -7,14 +7,13 @@ Familia.apiversion = 'v1'
7
7
  ## Redis Objects are unique per instance of a Familia class
8
8
  @a = Bone.new 'atoken', :name1
9
9
  @b = Bone.new 'atoken', :name2
10
- @a.owners.rediskey == @b.owners.rediskey
10
+ @a.owners.rediskey.eql?(@b.owners.rediskey)
11
11
  #=> false
12
12
 
13
- ## Redis Objects are frozen
13
+ ## Redis Objects are frozen
14
14
  @a.owners.frozen?
15
15
  #=> true
16
16
 
17
-
18
17
  ## Limiter#qstamp
19
18
  @limiter = Limiter.new :requests
20
19
  @limiter.counter.qstamp 10.minutes, '%H:%M', 1302468980
@@ -42,4 +41,4 @@ Familia.apiversion = 'v1'
42
41
  ## Check realttl
43
42
  sleep 1
44
43
  @limiter.counter.realttl
45
- #=> 3600-1
44
+ #=> 3600-1
@@ -0,0 +1,39 @@
1
+ require 'familia'
2
+ require 'familia/test_helpers'
3
+
4
+ Familia.debug = true
5
+
6
+ @hashkey = Familia::HashKey.new 'key'
7
+
8
+
9
+ ## Boolean values are returned as strings, on assignment as string
10
+ @hashkey["test"] = "true"
11
+ #=> "true"
12
+
13
+ ## Boolean values are returned as strings
14
+ @hashkey["test"]
15
+ #=> "true"
16
+
17
+ ## Trying to store a boolean value to a hash key raises an exception
18
+ begin
19
+ @hashkey["test"] = true
20
+ rescue TypeError => e
21
+ e.message
22
+ end
23
+ #=> "Cannot store test => true (TrueClass) in key"
24
+
25
+ ## Boolean values are returned as strings
26
+ @hashkey["test"]
27
+ #=> "true"
28
+
29
+ ## Trying to store a nil value to a hash key raises an exception
30
+ begin
31
+ @hashkey["test"] = nil
32
+ rescue TypeError => e
33
+ e.message
34
+ end
35
+ #=> "Cannot store test => nil (NilClass) in key"
36
+
37
+ ## The exceptions prevented the hash from being updated
38
+ @hashkey["test"]
39
+ #=> "true"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: familia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-16 00:00:00.000000000 Z
11
+ date: 2024-06-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Familia: Organize and store ruby objects in Redis'
14
14
  email: gems@solutious.com
@@ -32,7 +32,7 @@ files:
32
32
  - lib/familia/redisobject.rb
33
33
  - lib/familia/test_helpers.rb
34
34
  - lib/familia/tools.rb
35
- - try/00_familia.rb
35
+ - try/00_familia_try.rb
36
36
  - try/10_familia_try.rb
37
37
  - try/20_redis_object_try.rb
38
38
  - try/21_redis_object_zset_try.rb
@@ -40,12 +40,13 @@ files:
40
40
  - try/23_redis_object_list_try.rb
41
41
  - try/24_redis_object_string_try.rb
42
42
  - try/25_redis_object_hash_try.rb
43
+ - try/26_redis_bool_try.rb
43
44
  - try/30_familia_object_try.rb
44
45
  homepage: https://github.com/delano/familia
45
46
  licenses:
46
47
  - MIT
47
48
  metadata: {}
48
- post_install_message:
49
+ post_install_message:
49
50
  rdoc_options: []
50
51
  require_paths:
51
52
  - lib
@@ -60,8 +61,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
61
  - !ruby/object:Gem::Version
61
62
  version: '0'
62
63
  requirements: []
63
- rubygems_version: 3.4.19
64
- signing_key:
64
+ rubygems_version: 3.1.6
65
+ signing_key:
65
66
  specification_version: 4
66
67
  summary: Organize and store ruby objects in Redis
67
68
  test_files: []
data/try/00_familia.rb DELETED
@@ -1,8 +0,0 @@
1
- require 'familia'
2
- require 'familia/test_helpers'
3
- Familia.apiversion = 'v1'
4
-
5
-
6
- ## .
7
- Bone.redis_objects
8
- #=> true