Skip to content

Commit f3ec34e

Browse files
committed
[#17] Cleanup pre rc1 version
Finalize version for 1.0.0-rc1 release Update version across files and streamline logging. Remove debug mode, adjust trace logging, and optimize version handling for cleaner code and improved performance.
1 parent 91cf0f0 commit f3ec34e

8 files changed

+25
-16
lines changed

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
familia (1.0.0.pre.pre.rc1)
4+
familia (1.0.0.pre.rc1)
55
redis (>= 4.8.1, < 6.0)
66
uri-redis (~> 1.3)
77

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Familia - 1.0.0-pre.rc1
1+
# Familia - 1.0.0-rc1
22

33
**Organize and store ruby objects in Redis. A Ruby ORM for Redis.**
44

55
## Installation
66

77
Get it in one of the following ways:
88

9-
* In your Gemfile: `gem 'familia', '>= 1.0.0-pre.rc1'`
9+
* In your Gemfile: `gem 'familia', '>= 1.0.0-rc1'`
1010
* Install it by hand: `gem install familia`
1111
* Or for development: `git clone [email protected]:delano/familia.git`
1212

VERSION.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
:MAJOR: 1
33
:MINOR: 0
44
:PATCH: 0
5+
:PRE: rc1

familia.gemspec

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# frozen_string_literal: true
22

3+
require_relative 'lib/familia/version'
4+
35
Gem::Specification.new do |spec|
46
spec.name = 'familia'
5-
spec.version = '1.0.0-pre.rc1'
7+
spec.version = Familia::VERSION.to_s
68
spec.summary = 'An ORM for Redis in Ruby.'
79
spec.description = "Familia: #{spec.summary}. Organize and store ruby objects in Redis"
810
spec.authors = ['Delano Mandelbaum']

lib/familia.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88

99
require_relative 'familia/errors'
1010
require_relative 'familia/version'
11-
require_relative 'familia/logging'
12-
require_relative 'familia/connection'
13-
require_relative 'familia/settings'
14-
require_relative 'familia/utils'
15-
1611

1712
# Familia - A family warehouse for Redis
1813
#
@@ -36,7 +31,7 @@
3631
#
3732
module Familia
3833

39-
@debug = true
34+
@debug = false
4035
@members = []
4136

4237
class << self
@@ -61,6 +56,11 @@ def configure
6156
end
6257
end
6358

59+
require_relative 'familia/logging'
60+
require_relative 'familia/connection'
61+
require_relative 'familia/settings'
62+
require_relative 'familia/utils'
63+
6464
extend Logging
6565
extend Connection
6666
extend Settings

lib/familia/logging.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module LoggerTraceRefinement
77
# Set to same value as Logger::DEBUG since 0 is the floor
88
# without either more invasive changes to the Logger class
99
# or a CustomLogger class that inherits from Logger.
10-
TRACE = 0 # can't set within the refine block
10+
TRACE = 2 unless defined?(TRACE)
1111
refine Logger do
1212

1313
def trace(progname = nil, &block)
@@ -120,7 +120,7 @@ module Logging
120120
attr_reader :logger
121121

122122
# Gives our logger the ability to use our trace method.
123-
using LoggerTraceRefinement
123+
#using LoggerTraceRefinement if Familia.debug
124124

125125
def info(*msg)
126126
@logger.info(*msg)
@@ -131,6 +131,7 @@ def warn(*msg)
131131
end
132132

133133
def ld(*msg)
134+
return unless Familia.debug?
134135
@logger.debug(*msg)
135136
end
136137

@@ -162,7 +163,7 @@ def trace(label, redis_instance, ident, context = nil)
162163
context.reject! { |line| line =~ %r{lib/familia} }
163164
context.first
164165
end
165-
@logger.trace format('[%s] %s -> %s <- at %s', label, instance_id, ident, codeline)
166+
@logger.debug format('[%s] %s -> %s <- at %s', label, instance_id, ident, codeline)
166167
end
167168

168169
end

lib/familia/version.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ module Familia
66
module VERSION
77
def self.to_s
88
load_config
9-
[@version[:MAJOR], @version[:MINOR], @version[:PATCH]].join('.')
9+
version = [@version[:MAJOR], @version[:MINOR], @version[:PATCH]].join('.')
10+
version += "-#{@version[:PRE]}" if @version[:PRE]
11+
version
1012
end
1113
alias inspect to_s
14+
1215
def self.version
1316
@version ||= load_config
1417
@version
1518
end
19+
1620
def self.load_config
17-
YAML.load_file(File.join(FAMILIA_LIB_HOME, '..', 'VERSION.yml'))
21+
version_file_path = File.join(__dir__, '..', '..', 'VERSION.yml')
22+
@version = YAML.load_file(version_file_path)
1823
end
1924
end
2025
end

try/test_helpers.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require_relative '../lib/familia'
55

66
# ENV['FAMILIA_TRACE'] = '1'
7-
Familia.debug = true
7+
#Familia.debug = true
88
Familia.enable_redis_logging = true
99
Familia.enable_redis_counter = true
1010

0 commit comments

Comments
 (0)