warming_drawer 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # WarmingDrawer
2
2
  [![Build Status](https://secure.travis-ci.org/echobind/warming_drawer.png?branch=master)](https://travis-ci.org/echobind/warming_drawer) [![Dependency Status](https://gemnasium.com/echobind/warming_drawer.png)](https://gemnasium.com/echobind/warming_drawer) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/echobind/warming_drawer)
3
3
 
4
- Warms caches based on a specified url using an optional background queueing system. For now, only supports Sidekiq or the lack of a queing system, but in the future will support others.
4
+ Warms caches based on a specified urls using an optional background queueing system. For now, only supports Sidekiq or the lack of a queueing system, but in the future will support others.
5
5
 
6
6
  ## Installation
7
7
 
@@ -9,17 +9,37 @@ Add this line to your application's Gemfile:
9
9
 
10
10
  gem 'warming_drawer'
11
11
 
12
- And then execute:
13
-
14
- $ bundle
15
-
16
- Or install it yourself as:
17
-
18
- $ gem install warming_drawer
19
-
20
12
  ## Usage
21
-
22
- TODO: Write usage instructions here
13
+ Configure WarmingDrawer:
14
+
15
+ ```ruby
16
+ # config/initializers/warming_drawer.rb
17
+ WarmingDrawer.configure do |config|
18
+ config.basic_auth_username = ENV['BASIC_AUTH_USER']
19
+ config.basic_auth_password = ENV['BASIC_AUTH_PASS']
20
+ config.queue_name = ENV['MY_QUEUE_NAME']
21
+ config.queue_system = :sidekiq
22
+ end
23
+ ```
24
+
25
+ Pass a set of urls that you want to warm the cache for using either arguments or an array:
26
+
27
+ ```ruby
28
+ # using arguments in Rails:
29
+ member_urls = members.map{ |m| member_url m }
30
+ WarmingDrawer.warm *member_urls
31
+
32
+ # using an array without Rails:
33
+ urls_to_cache = ['http://foo.com', 'http://oof.com']
34
+ WarmingDrawer.warm urls_to_cache
35
+ ```
36
+
37
+ WarmingDrawer will queue a get request to each url in sequence. Note that in Rails, you must have caching turned on for things to go into the queue.
38
+
39
+ ```ruby
40
+ # development.rb
41
+ config.action_controller.perform_caching = true
42
+ ```
23
43
 
24
44
  ## Contributing
25
45
 
@@ -1,3 +1,3 @@
1
1
  module WarmingDrawer
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -17,7 +17,7 @@ module WarmingDrawer
17
17
  # Warms a cache. Delegates to the proper worker depending on the type.
18
18
  # If being used within Rails, returns false unless action_controller caching is enabled.
19
19
  #
20
- # @param [Array] Arguments or Array to warm
20
+ # @param [Array] args Arguments or Array to warm
21
21
  # @return [Boolean]
22
22
  # @example
23
23
  # WarmingDrawer.warm('http://sweet.dev/1', 'http://sweet2.dev/2', :type => :url)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warming_drawer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-14 00:00:00.000000000 Z
12
+ date: 2012-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq