pusherable 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml CHANGED
@@ -1,7 +1,6 @@
1
+ language: ruby
1
2
  script: "bundle install && bundle exec rake"
2
3
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
4
  - 1.9.3
6
5
  env:
7
6
  - DB=sqlite3
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in pusherable.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ gem 'rake'
8
+ end
data/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # Pusherable
2
2
 
3
+ [![Build Status](https://travis-ci.org/tonycoco/pusherable.png)](https://travis-ci.org/tonycoco/pusherable)
4
+
3
5
  Adds callback hooks for your ActiveRecord models for sending messages to a Pusher channel.
4
6
 
5
7
  ## Installation
6
8
 
7
- Add this line to your application's Gemfile:
9
+ Install and configure Pusher to work on your application by following the [pusher gem's instructions](https://github.com/pusher/pusher-gem).
10
+
11
+ Then, add this line to your application's Gemfile:
8
12
 
9
13
  gem 'pusherable'
10
14
 
@@ -24,11 +28,6 @@ Add in the following lines to any ActiveRecord model class:
24
28
 
25
29
  On your subscribed client(s), events will be triggered by Pusher reflecting your ActiveRecord create/update/destroy actions.
26
30
 
27
- ### Example
28
-
29
- If you have a model called, __Story__, and you create a new record, Pusher will receive an event called, "story.create".
30
- It will also carry a payload of data containing the __model_id__
31
-
32
31
  Here is a list of the ActiveRecord callbacks that trigger Pusher events...
33
32
 
34
33
  ```
@@ -37,6 +36,19 @@ Here is a list of the ActiveRecord callbacks that trigger Pusher events...
37
36
  "model.destroy" => before_destroy
38
37
  ```
39
38
 
39
+ ### Example
40
+
41
+ If you have an ActiveRecord model called, __Post__, and you create a new record, Pusher will receive an event called, "post.create".
42
+ It will also carry a payload of data containing the __model_id__. Future implementations may carry a changeset in the data. For now, let's keep it simple.
43
+
44
+ The following callbacks that trigger Pusher events in this __Post__ example will then be...
45
+
46
+ ```
47
+ "post.create" => after_create
48
+ "post.update" => after_update
49
+ "post.destroy" => before_destroy
50
+ ```
51
+
40
52
  ## Contributing
41
53
 
42
54
  1. Fork it
@@ -44,3 +56,4 @@ Here is a list of the ActiveRecord callbacks that trigger Pusher events...
44
56
  3. Commit your changes (`git commit -am 'Add some feature'`)
45
57
  4. Push to the branch (`git push origin my-new-feature`)
46
58
  5. Create new Pull Request
59
+ st
@@ -1,3 +1,3 @@
1
1
  module Pusherable
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
data/lib/pusherable.rb CHANGED
@@ -6,6 +6,8 @@ module Pusherable
6
6
  end
7
7
 
8
8
  def pusherable(pusherable_channel='test_channel')
9
+ raise "Please `gem install pusher` and configure it to run in your app!" if Pusher.app_id.blank? || Pusher.key.blank? || Pusher.secret.blank?
10
+
9
11
  class_attribute :pusherable_channel
10
12
  self.pusherable_channel = pusherable_channel
11
13
 
@@ -6,17 +6,6 @@ describe Pusherable do
6
6
  NonPusherableModel.pusherable?.should == false
7
7
  PusherableModel.pusherable?.should == true
8
8
  end
9
-
10
- it 'should set the channel to push to' do
11
- DefaultedPusherableModel.pusherable_channel.should == 'test_channel'
12
- PusherableModel.pusherable_channel.should == 'our_channel'
13
-
14
- default_model = DefaultedPusherableModel.new
15
- setup_model = PusherableModel.new
16
-
17
- default_model.pusherable_channel.should == 'test_channel'
18
- setup_model.pusherable_channel.should == 'our_channel'
19
- end
20
9
  end
21
10
 
22
11
  describe 'callbacks' do
@@ -54,4 +43,17 @@ describe Pusherable do
54
43
  @non_pusherable_model.destroy
55
44
  end
56
45
  end
46
+
47
+ describe 'channels' do
48
+ it 'should get and set the channel to push to' do
49
+ DefaultedPusherableModel.pusherable_channel.should == 'test_channel'
50
+ PusherableModel.pusherable_channel.should == 'our_channel'
51
+
52
+ default_model = DefaultedPusherableModel.new
53
+ setup_model = PusherableModel.new
54
+
55
+ default_model.pusherable_channel.should == 'test_channel'
56
+ setup_model.pusherable_channel.should == 'our_channel'
57
+ end
58
+ end
57
59
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: pusherable
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.2
5
+ version: 1.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tony Coconate
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-25 00:00:00.000000000 Z
12
+ date: 2013-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  segments:
159
159
  - 0
160
- hash: 1360421831016748583
160
+ hash: 724947674044802988
161
161
  version: '0'
162
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  none: false
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  - !ruby/object:Gem::Version
167
167
  segments:
168
168
  - 0
169
- hash: 1360421831016748583
169
+ hash: 724947674044802988
170
170
  version: '0'
171
171
  requirements: []
172
172
  rubyforge_project: