File tree Expand file tree Collapse file tree 5 files changed +30
-1
lines changed Expand file tree Collapse file tree 5 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 196196
1971971 . Add the ` kredis ` gem to your Gemfile: ` gem 'kredis' `
1981982 . Run ` ./bin/bundle install `
199- 3 . Add a default configuration under ` config/redis/shared.yml `
199+ 3 . Run ` ./bin/rails kredis:install ` to add a default configuration under ` config/redis/shared.yml `
200200
201201A default configuration can look like this for ` config/redis/shared.yml ` :
202202
Original file line number Diff line number Diff line change 1+ yaml_path = Rails . root . join ( "config/redis/shared.yml" )
2+ unless yaml_path . exist?
3+ say "Adding `config/redis/shared.yml`"
4+ empty_directory yaml_path . parent . to_s
5+ copy_file "#{ __dir__ } /shared.yml" , yaml_path
6+ end
Original file line number Diff line number Diff line change 1+ production : &production
2+ host : <%= ENV.fetch("REDIS_SHARED_HOST", "127.0.0.1") %>
3+ port : <%= ENV.fetch("REDIS_SHARED_PORT", "6379") %>
4+ timeout : 1
5+
6+ development : &development
7+ host : <%= ENV.fetch("REDIS_SHARED_HOST", "127.0.0.1") %>
8+ port : <%= ENV.fetch("REDIS_SHARED_PORT", "6379") %>
9+ timeout : 1
10+
11+ test :
12+ << : *development
Original file line number Diff line number Diff line change @@ -30,4 +30,9 @@ class Kredis::Railtie < ::Rails::Railtie
3030 include Kredis ::Attributes
3131 end
3232 end
33+
34+ rake_tasks do
35+ path = File . expand_path ( ".." , __dir__ )
36+ Dir . glob ( "#{ path } /tasks/**/*.rake" ) . each { |f | load f }
37+ end
3338end
Original file line number Diff line number Diff line change 1+ namespace :kredis do
2+ desc "Install kredis"
3+ task :install do
4+ system "#{ RbConfig . ruby } ./bin/rails app:template LOCATION=#{ File . expand_path ( "../../install/install.rb" , __dir__ ) } "
5+ end
6+ end
You can’t perform that action at this time.
0 commit comments