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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5fb58df84041f8120945f6218fd107e8a922819
4
- data.tar.gz: 0a7d89341138021997492a7e05056b10c9cd48d5
3
+ metadata.gz: c5b9863ef1acdeef1bbf35cae0fa7be7500cc2c2
4
+ data.tar.gz: a9126090eea437a17033e9277898efcae266bd42
5
5
  SHA512:
6
- metadata.gz: 5b148623bb1c9dc1a35429131e42e92782dbc2e4632c287ef457b414fbaef586e69d77ac417683f90178f700d59c8baac134cdf760edd90a2d4a4d84f6d39d3e
7
- data.tar.gz: e8f5e80ea9e3cdac57b55af8da469e98e82f73159b13660cbb3fc493d7c29803640e4cc8e24116a4b37b124ebfb41fb89bb99538f97bfce10eae3257a64f7685
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
@@ -1,8 +1,14 @@
1
1
  module Cachers
2
2
  class Railtie < Rails::Railtie
3
3
 
4
- initializer :cachers do
5
- Dir[Rails.root.join('app/cachers/*')].each { |file| load file }
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
@@ -1,3 +1,5 @@
1
1
  module Cachers
2
- VERSION = '0.1.1'
2
+
3
+ VERSION = '4.0.0.0'
4
+
3
5
  end
data/lib/cachers.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'cachers/base'
2
2
  require 'cachers/concern'
3
3
  require 'cachers/railtie'
4
+ require 'cachers/version'
4
5
 
5
6
  module Cachers
6
7
  class << self
@@ -1,12 +1,12 @@
1
- require 'rails/generators/named_base'
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 create_model_cacher
9
+ def create_cacher_file
10
10
  template 'cacher.rb', "app/cachers/#{file_name}_cacher.rb"
11
11
  end
12
12
 
@@ -1,15 +1,15 @@
1
1
  namespace :cachers do
2
- desc 'Finds each model cacheable and cache all his records.'
2
+ desc 'Cache all records.'
3
3
  task cache: :environment do
4
4
  Cachers.cache
5
5
  end
6
6
 
7
- desc 'Finds each model cacheable and recache all his records.'
7
+ desc 'Recache all records.'
8
8
  task recache: :environment do
9
9
  Cachers.recache
10
10
  end
11
11
 
12
- desc 'Finds each model cacheable and uncache all his records.'
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.name
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.id}"
14
+ "users/#{record.name}"
15
15
  end
16
16
 
17
17
  end
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
4
  load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/rails CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  APP_PATH = File.expand_path('../../config/application', __FILE__)
3
4
  require_relative '../config/boot'
4
5
  require 'rails/commands'
data/test/dummy/bin/rake CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  require_relative '../config/boot'
3
4
  require 'rake'
4
5
  Rake.application.run
data/test/dummy/bin/setup CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  require 'pathname'
3
4
 
4
5
  # path to your application root.
@@ -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
- <<: *<%= ENV['DB'] %>
12
- database: <%= ENV['DB'] == 'sqlite' ? 'db/travis.sqlite3' : 'travis' %>
2
+ adapter: <%= 'jdbc' if RUBY_ENGINE == 'jruby' %>postgresql
3
+ database: travis
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # In the development environment your application's code is reloaded on
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # Code is not reloaded between requests.
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
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 = true
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: 921ea9f25943669d3a4b0a6c8762cb6a97a00c42732c84b3a4c80900d4f2be79081cad03e0ec8d5d0f2f293874b2bbd04c1444e7a6d6b9147de8f4ffb3acff11
14
+ secret_key_base: 2c1c8d4cbaa726b21aa6483b7d556125f4897508e2b94f8b3ddaec675168382c9b3b6eb5a9359d2fade03f539c16ac1ef905891c2410f2fd00b83b76c1666feb
15
15
 
16
16
  test:
17
- secret_key_base: 0e085a62fbfd58069441e0eb7dd8c3d0a7035017443181a5fba2c04041a03f8d0d427216ac56a51da79125898d125bb9fb8badb48404919fe3188eb309231570
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.