db_memoize 0.3.13 → 0.3.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/VERSION +1 -1
- metadata +10 -26
- data/.gitignore +0 -10
- data/.rspec +0 -2
- data/.rubocop.yml +0 -63
- data/.travis.yml +0 -11
- data/Gemfile +0 -4
- data/Rakefile +0 -20
- data/bin/console +0 -14
- data/bin/rake +0 -29
- data/bin/rspec +0 -29
- data/bin/rubocop +0 -29
- data/bin/setup +0 -8
- data/db_memoize.gemspec +0 -34
- data/scripts/release +0 -2
- data/scripts/release.rb +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02711b08b08a96a33495f37b69c62efb8191799fd9a9eb118493469ead8d7432
|
4
|
+
data.tar.gz: 603be57b75810c724d439ebb4fa4cb45e9b0f157a6f687e460c32f0a23e22483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ee92a4172a3bd44339096499f4d25aab23fad440ca2d155015cb5823e137e7bdf7cf63f24cbae8b69588415e1abb2cf26376febdecc9a69d439343318b4a184
|
7
|
+
data.tar.gz: 576d3bdfb75370ee5f411ae2e6ddb649ed7ae74599100cef7f9d3d21e72ec36cb7ba00d27f5c7c2d224b77595e2f7f078188715f8226997bc185d53ac028c614
|
data/README.md
CHANGED
@@ -68,7 +68,8 @@ Instead of ActiveRecord instances it's sufficient to pass in the ids of the reco
|
|
68
68
|
|
69
69
|
### Gotchas
|
70
70
|
|
71
|
-
The cached values themselves are active records (of type `DbMemoize::Value`) and are saved in the database.
|
71
|
+
The cached values themselves are active records (of type `DbMemoize::Value`) and are saved in the database.
|
72
|
+
They are also registered as an association, so you can access all of the cached values of an object like this:
|
72
73
|
|
73
74
|
record.memoized_values
|
74
75
|
|
@@ -120,5 +121,6 @@ Note that db_memoize needs Postgres. To set up the database needed to run tests,
|
|
120
121
|
|
121
122
|
### Updating from earlier versions
|
122
123
|
|
123
|
-
It is generally impossible to update from earlier versions and keep the cached data.
|
124
|
-
|
124
|
+
It is generally impossible to update from earlier versions and keep the cached data.
|
125
|
+
DbMemoize should always be able to rerun migrations to update database structures to the latest
|
126
|
+
version - feel free to add in as many migrations as you like :)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.14
|
metadata
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_memoize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- johannes-kostas goetzinger
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple-sql
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.4.20
|
20
17
|
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: '0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.4.20
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.4.20
|
30
27
|
- - "~>"
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: '0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.4.20
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: railties
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,21 +163,9 @@ executables: []
|
|
163
163
|
extensions: []
|
164
164
|
extra_rdoc_files: []
|
165
165
|
files:
|
166
|
-
- ".gitignore"
|
167
|
-
- ".rspec"
|
168
|
-
- ".rubocop.yml"
|
169
|
-
- ".travis.yml"
|
170
|
-
- Gemfile
|
171
166
|
- LICENSE
|
172
167
|
- README.md
|
173
|
-
- Rakefile
|
174
168
|
- VERSION
|
175
|
-
- bin/console
|
176
|
-
- bin/rake
|
177
|
-
- bin/rspec
|
178
|
-
- bin/rubocop
|
179
|
-
- bin/setup
|
180
|
-
- db_memoize.gemspec
|
181
169
|
- lib/db_memoize.rb
|
182
170
|
- lib/db_memoize/helpers.rb
|
183
171
|
- lib/db_memoize/migrations.rb
|
@@ -187,9 +175,6 @@ files:
|
|
187
175
|
- lib/db_memoize/version.rb
|
188
176
|
- lib/tasks/clear.rake
|
189
177
|
- lib/tasks/warmup.rake
|
190
|
-
- log/.keep
|
191
|
-
- scripts/release
|
192
|
-
- scripts/release.rb
|
193
178
|
homepage: https://github.com/mediapeers/db_memoize
|
194
179
|
licenses:
|
195
180
|
- MIT
|
@@ -209,8 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
194
|
- !ruby/object:Gem::Version
|
210
195
|
version: '0'
|
211
196
|
requirements: []
|
212
|
-
|
213
|
-
rubygems_version: 2.7.7
|
197
|
+
rubygems_version: 3.0.4
|
214
198
|
signing_key:
|
215
199
|
specification_version: 4
|
216
200
|
summary: library to cache (memoize) method return values in database
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.3
|
3
|
-
Include:
|
4
|
-
- Rakefile
|
5
|
-
- config.ru
|
6
|
-
- lib/**/*.rb
|
7
|
-
Exclude:
|
8
|
-
- Rakefile
|
9
|
-
- bin/*
|
10
|
-
- config.ru
|
11
|
-
- config/**/*
|
12
|
-
- vendor/**/*
|
13
|
-
|
14
|
-
Style/FrozenStringLiteralComment:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Metrics/LineLength:
|
18
|
-
Max: 140
|
19
|
-
|
20
|
-
Style/Documentation:
|
21
|
-
Enabled: false
|
22
|
-
|
23
|
-
Style/BlockDelimiters:
|
24
|
-
Enabled: false
|
25
|
-
|
26
|
-
Style/CollectionMethods:
|
27
|
-
PreferredMethods:
|
28
|
-
collect: 'map'
|
29
|
-
collect!: 'map!'
|
30
|
-
inject: 'reduce'
|
31
|
-
detect: 'find'
|
32
|
-
find_all: 'select'
|
33
|
-
|
34
|
-
Style/TrivialAccessors:
|
35
|
-
Enabled: true
|
36
|
-
ExactNameMatch: true
|
37
|
-
AllowPredicates: true
|
38
|
-
|
39
|
-
# TODO in the future try to reduce this section:
|
40
|
-
Metrics/AbcSize:
|
41
|
-
Max: 36
|
42
|
-
|
43
|
-
Metrics/ClassLength:
|
44
|
-
Max: 125
|
45
|
-
|
46
|
-
Metrics/ModuleLength:
|
47
|
-
Max: 150
|
48
|
-
|
49
|
-
Metrics/MethodLength:
|
50
|
-
Max: 30
|
51
|
-
|
52
|
-
# "Prefer !expression.nil? over expression != nil." no way!
|
53
|
-
Style/NonNilCheck:
|
54
|
-
Enabled: false
|
55
|
-
|
56
|
-
Style/SymbolArray:
|
57
|
-
Enabled: false
|
58
|
-
|
59
|
-
Lint/MissingCopEnableDirective:
|
60
|
-
Enabled: false
|
61
|
-
|
62
|
-
Style/ModuleFunction:
|
63
|
-
Enabled: false
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require "rspec/core/rake_task"
|
2
|
-
|
3
|
-
RSpec::Core::RakeTask.new(:spec)
|
4
|
-
|
5
|
-
task 'db:test:create' do
|
6
|
-
Rake.sh 'dropdb db_memoize_test -U postgres || true'
|
7
|
-
Rake.sh 'createdb db_memoize_test -U postgres'
|
8
|
-
end
|
9
|
-
|
10
|
-
task :default => %w(db:test:create spec)
|
11
|
-
|
12
|
-
desc "release a new development gem version"
|
13
|
-
task :release do
|
14
|
-
sh "scripts/release.rb"
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "release a new stable gem version"
|
18
|
-
task "release:stable" do
|
19
|
-
sh "BRANCH=stable scripts/release.rb"
|
20
|
-
end
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "db_memoize"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/rake
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'rake' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'rspec' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/rubocop
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'rubocop' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("rubocop", "rubocop")
|
data/bin/setup
DELETED
data/db_memoize.gemspec
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "db_memoize"
|
7
|
-
spec.version = File.read("VERSION")
|
8
|
-
spec.licenses = ['MIT']
|
9
|
-
spec.authors = ["johannes-kostas goetzinger"]
|
10
|
-
spec.email = ["goetzinger@mediapeers.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{library to cache (memoize) method return values in database}
|
13
|
-
spec.description = %q{library to cache (memoize) method return values in database}
|
14
|
-
spec.homepage = "https://github.com/mediapeers/db_memoize"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
-
f.match(%r{^(test|spec|features)/})
|
18
|
-
end
|
19
|
-
spec.bindir = 'exe'
|
20
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = ['lib']
|
22
|
-
|
23
|
-
spec.add_dependency 'simple-sql', '>= 0.4.20', '~> 0'
|
24
|
-
spec.add_development_dependency 'railties', '~> 4.2'
|
25
|
-
spec.add_development_dependency 'activerecord', '~> 4.2.10'
|
26
|
-
|
27
|
-
spec.add_development_dependency 'rake', '~> 12.0'
|
28
|
-
spec.add_development_dependency 'pg', '~> 0.20'
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.8'
|
30
|
-
spec.add_development_dependency 'simplecov', '~> 0.16'
|
31
|
-
spec.add_development_dependency 'rubocop', '~> 0.59.2'
|
32
|
-
spec.add_development_dependency 'database_cleaner', '~> 1.5.3'
|
33
|
-
spec.add_development_dependency 'factory_girl', '~> 4.7.0'
|
34
|
-
end
|
data/scripts/release
DELETED
data/scripts/release.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# -- helpers ------------------------------------------------------------------
|
4
|
-
|
5
|
-
def sys(cmd)
|
6
|
-
STDERR.puts "> #{cmd}"
|
7
|
-
system cmd
|
8
|
-
return true if $?.success?
|
9
|
-
|
10
|
-
STDERR.puts "> #{cmd} returned with exitstatus #{$?.exitstatus}"
|
11
|
-
$?.success?
|
12
|
-
end
|
13
|
-
|
14
|
-
def sys!(cmd, error: nil)
|
15
|
-
return true if sys(cmd)
|
16
|
-
STDERR.puts error if error
|
17
|
-
exit 1
|
18
|
-
end
|
19
|
-
|
20
|
-
def die!(msg)
|
21
|
-
STDERR.puts msg
|
22
|
-
exit 1
|
23
|
-
end
|
24
|
-
|
25
|
-
ROOT = File.expand_path("#{File.dirname(__FILE__)}/..")
|
26
|
-
|
27
|
-
GEMSPEC = Dir.glob("*.gemspec").first || die!("Missing gemspec file.")
|
28
|
-
|
29
|
-
# -- Version reading and bumping ----------------------------------------------
|
30
|
-
|
31
|
-
module Version
|
32
|
-
extend self
|
33
|
-
|
34
|
-
VERSION_FILE = "#{Dir.getwd}/VERSION"
|
35
|
-
|
36
|
-
def read_version
|
37
|
-
version = File.exist?(VERSION_FILE) ? File.read(VERSION_FILE) : "0.0.1"
|
38
|
-
version.chomp!
|
39
|
-
raise "Invalid version number in #{VERSION_FILE}" unless version =~ /^\d+\.\d+\.\d+$/
|
40
|
-
version
|
41
|
-
end
|
42
|
-
|
43
|
-
def auto_version_bump
|
44
|
-
old_version_number = read_version
|
45
|
-
old = old_version_number.split('.')
|
46
|
-
|
47
|
-
current = old[0..-2] << old[-1].next
|
48
|
-
current.join('.')
|
49
|
-
end
|
50
|
-
|
51
|
-
def bump_version
|
52
|
-
next_version = ENV["VERSION"] || auto_version_bump
|
53
|
-
File.open(VERSION_FILE, "w") { |io| io.write next_version }
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# -- check, bump, release a new gem version -----------------------------------
|
58
|
-
|
59
|
-
Dir.chdir ROOT
|
60
|
-
$BASE_BRANCH = ENV['BRANCH'] || 'master'
|
61
|
-
|
62
|
-
# ENV["BUNDLE_GEMFILE"] = "#{Dir.getwd}/Gemfile"
|
63
|
-
# sys! "bundle install"
|
64
|
-
|
65
|
-
sys! "git diff --exit-code > /dev/null", error: 'There are unstaged changes in your working directory'
|
66
|
-
sys! "git diff --cached --exit-code > /dev/null", error: 'There are staged but uncommitted changes'
|
67
|
-
|
68
|
-
sys! "git checkout #{$BASE_BRANCH}"
|
69
|
-
sys! "git pull"
|
70
|
-
|
71
|
-
Version.bump_version
|
72
|
-
version = Version.read_version
|
73
|
-
|
74
|
-
sys! "git add VERSION"
|
75
|
-
sys! "git commit -m \"bump gem to v#{version}\""
|
76
|
-
sys! "git tag -a v#{version} -m \"Tag #{version}\""
|
77
|
-
|
78
|
-
sys! "gem build #{GEMSPEC}"
|
79
|
-
|
80
|
-
sys! "git push origin #{$BASE_BRANCH}"
|
81
|
-
sys! 'git push --tags --force'
|
82
|
-
|
83
|
-
# sys! "bundle exec fury push #{Dir.glob('*.gem').first} --as mediapeers"
|
84
|
-
sys! "gem push #{Dir.glob('*.gem').first}"
|
85
|
-
|
86
|
-
sys! "mkdir -p pkg"
|
87
|
-
sys! "mv *.gem pkg"
|
88
|
-
|
89
|
-
STDERR.puts <<-MSG
|
90
|
-
================================================================================
|
91
|
-
Thank you for releasing a new gem version. You made my day.
|
92
|
-
================================================================================
|
93
|
-
MSG
|