cachers 0.1.1 → 4.0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -19
- data/lib/cachers/railtie.rb +8 -2
- data/lib/cachers/version.rb +3 -1
- data/lib/cachers.rb +1 -0
- data/lib/generators/{cachers → cacher}/cacher_generator.rb +3 -3
- data/lib/generators/{cachers → cacher}/templates/cacher.rb +0 -0
- data/lib/tasks/cachers.rake +3 -3
- data/test/dummy/app/cachers/user_cacher.rb +2 -2
- data/test/dummy/bin/bundle +1 -0
- data/test/dummy/bin/rails +1 -0
- data/test/dummy/bin/rake +1 -0
- data/test/dummy/bin/setup +1 -0
- data/test/dummy/config/database.yml.travis +2 -11
- data/test/dummy/config/environments/development.rb +1 -1
- data/test/dummy/config/environments/production.rb +1 -1
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/dummy/config/secrets.yml +2 -2
- data/test/dummy/log/test.log +575 -976
- data/test/dummy/public/404.html +57 -63
- data/test/dummy/public/422.html +57 -63
- data/test/dummy/public/500.html +56 -62
- data/test/generator_test.rb +3 -4
- data/test/record_test.rb +7 -4
- data/test/task_test.rb +35 -0
- data/test/test_helper.rb +0 -7
- metadata +8 -12
- data/test/dummy/db/schema.rb +0 -25
- data/test/dummy/log/development.log +0 -35
- data/test/tasks_test.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5b9863ef1acdeef1bbf35cae0fa7be7500cc2c2
|
4
|
+
data.tar.gz: a9126090eea437a17033e9277898efcae266bd42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbea260e6d0d93f16f6907e4bdf2fc27cd5904341b5981d8f0b351ba4a684b0189cacd2590a194660f4531122aa7a8a2060465b72204b198696ede02d34a4e66
|
7
|
+
data.tar.gz: b8a6ecb77c8b82d25ed919d0238f0abbded2c00e58280750c50ed6b6393fabd2d95b1af935df938600fa17eb83fae8d306f534b0d3d423002fbfddb1836d5620
|
data/Rakefile
CHANGED
@@ -4,26 +4,8 @@ rescue LoadError
|
|
4
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
5
|
end
|
6
6
|
|
7
|
-
require 'rdoc/task'
|
8
|
-
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
11
|
-
rdoc.title = 'Cachers'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.rdoc')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
7
|
Bundler::GemHelper.install_tasks
|
23
8
|
|
24
|
-
APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
|
25
|
-
load 'rails/tasks/engine.rake'
|
26
|
-
|
27
9
|
require 'rake/testtask'
|
28
10
|
|
29
11
|
Rake::TestTask.new(:test) do |t|
|
@@ -31,7 +13,7 @@ Rake::TestTask.new(:test) do |t|
|
|
31
13
|
t.libs << 'test'
|
32
14
|
t.pattern = 'test/**/*_test.rb'
|
33
15
|
t.verbose = false
|
16
|
+
t.warning = false
|
34
17
|
end
|
35
18
|
|
36
|
-
|
37
19
|
task default: :test
|
data/lib/cachers/railtie.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
module Cachers
|
2
2
|
class Railtie < Rails::Railtie
|
3
3
|
|
4
|
-
|
5
|
-
Dir[Rails.root.join('app/cachers/*')].each
|
4
|
+
config.after_initialize do
|
5
|
+
Dir[Rails.root.join('app/cachers/*')].each do |file|
|
6
|
+
load file
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
rake_tasks do
|
11
|
+
load 'tasks/cachers.rake'
|
6
12
|
end
|
7
13
|
|
8
14
|
end
|
data/lib/cachers/version.rb
CHANGED
data/lib/cachers.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require 'rails/generators
|
1
|
+
require 'rails/generators'
|
2
2
|
|
3
3
|
module Cachers
|
4
4
|
module Generators
|
5
|
-
class CacherGenerator < Rails::Generators::NamedBase
|
5
|
+
class CacherGenerator < ::Rails::Generators::NamedBase
|
6
6
|
|
7
7
|
source_root File.expand_path('../templates', __FILE__)
|
8
8
|
|
9
|
-
def
|
9
|
+
def create_cacher_file
|
10
10
|
template 'cacher.rb', "app/cachers/#{file_name}_cacher.rb"
|
11
11
|
end
|
12
12
|
|
File without changes
|
data/lib/tasks/cachers.rake
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
namespace :cachers do
|
2
|
-
desc '
|
2
|
+
desc 'Cache all records.'
|
3
3
|
task cache: :environment do
|
4
4
|
Cachers.cache
|
5
5
|
end
|
6
6
|
|
7
|
-
desc '
|
7
|
+
desc 'Recache all records.'
|
8
8
|
task recache: :environment do
|
9
9
|
Cachers.recache
|
10
10
|
end
|
11
11
|
|
12
|
-
desc '
|
12
|
+
desc 'Uncache all records.'
|
13
13
|
task uncache: :environment do
|
14
14
|
Cachers.uncache
|
15
15
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class UserCacher < Cachers::Base
|
2
2
|
|
3
3
|
def cache
|
4
|
-
$redis.set key, record.
|
4
|
+
$redis.set key, record.id
|
5
5
|
end
|
6
6
|
|
7
7
|
def uncache
|
@@ -11,7 +11,7 @@ class UserCacher < Cachers::Base
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def key
|
14
|
-
"users/#{record.
|
14
|
+
"users/#{record.name}"
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
data/test/dummy/bin/bundle
CHANGED
data/test/dummy/bin/rails
CHANGED
data/test/dummy/bin/rake
CHANGED
data/test/dummy/bin/setup
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
mysql: &mysql
|
2
|
-
adapter: <%= 'jdbc' if RUBY_ENGINE == 'jruby' %>mysql<%= '2' if RUBY_ENGINE != 'jruby' %>
|
3
|
-
|
4
|
-
postgres: &postgres
|
5
|
-
adapter: <%= 'jdbc' if RUBY_ENGINE == 'jruby' %>postgresql
|
6
|
-
|
7
|
-
sqlite: &sqlite
|
8
|
-
adapter: <%= 'jdbc' if RUBY_ENGINE == 'jruby' %>sqlite3
|
9
|
-
|
10
1
|
test:
|
11
|
-
|
12
|
-
database:
|
2
|
+
adapter: <%= 'jdbc' if RUBY_ENGINE == 'jruby' %>postgresql
|
3
|
+
database: travis
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
@@ -17,7 +17,7 @@ Dummy::Application.configure do
|
|
17
17
|
config.static_cache_control = 'public, max-age=3600'
|
18
18
|
|
19
19
|
# Show full error reports and disable caching.
|
20
|
-
config.consider_all_requests_local
|
20
|
+
config.consider_all_requests_local = true
|
21
21
|
config.action_controller.perform_caching = false
|
22
22
|
|
23
23
|
# Raise exceptions instead of rendering exception templates.
|
@@ -11,10 +11,10 @@
|
|
11
11
|
# if you're sharing your code publicly.
|
12
12
|
|
13
13
|
development:
|
14
|
-
secret_key_base:
|
14
|
+
secret_key_base: 2c1c8d4cbaa726b21aa6483b7d556125f4897508e2b94f8b3ddaec675168382c9b3b6eb5a9359d2fade03f539c16ac1ef905891c2410f2fd00b83b76c1666feb
|
15
15
|
|
16
16
|
test:
|
17
|
-
secret_key_base:
|
17
|
+
secret_key_base: 9dd531171128e7c3d11dd2c5c18c84ba43d29b677043002634a6f4d58bf2687a283b7b6dc6af741d63c3824f11fa1f858010d7c2509a932023f2ece0d3bfe6cf
|
18
18
|
|
19
19
|
# Do not keep production secrets in the repository,
|
20
20
|
# instead read values from the environment.
|