Stream 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 4
4
- :patch: 1
3
+ :minor: 0
4
+ :patch: 8
data/stream.gemspec CHANGED
@@ -2,20 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{Stream}
5
- s.version = "0.0.7"
5
+ s.version = "0.0.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Gretchen Gapol"]
9
9
  s.date = %q{2011-06-27}
10
10
  s.description = %q{news feed}
11
11
  s.email = %q{ggapol@exist.com}
12
- s.extra_rdoc_files = [
13
- "README.rdoc"
14
- ]
12
+ s.extra_rdoc_files = []
15
13
  s.files = [
16
14
  ".gitignore",
17
15
  "MIT-LICENSE",
18
- "README.rdoc",
19
16
  "Rakefile",
20
17
  "VERSION.yml",
21
18
  "generators/stream/USAGE",
@@ -25,13 +22,10 @@ Gem::Specification.new do |s|
25
22
  "init.rb",
26
23
  "lib/stream.rb",
27
24
  "lib/stream/fires.rb",
28
- "lib/stream/macros.rb",
29
25
  "lib/stream/matchers.rb",
30
26
  "stream.gemspec"
31
27
  ]
32
- s.has_rdoc = true
33
28
  s.homepage = %q{http://github.com/gretch}
34
- s.rdoc_options = ["--charset=UTF-8"]
35
29
  s.require_paths = ["lib"]
36
30
  s.rubygems_version = %q{1.3.1}
37
31
  s.summary = %q{news feed}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -16,12 +16,10 @@ description: news feed
16
16
  email: ggapol@exist.com
17
17
  executables: []
18
18
  extensions: []
19
- extra_rdoc_files:
20
- - README.rdoc
19
+ extra_rdoc_files: []
21
20
  files:
22
21
  - .gitignore
23
22
  - MIT-LICENSE
24
- - README.rdoc
25
23
  - Rakefile
26
24
  - VERSION.yml
27
25
  - generators/stream/USAGE
@@ -31,15 +29,13 @@ files:
31
29
  - init.rb
32
30
  - lib/stream.rb
33
31
  - lib/stream/fires.rb
34
- - lib/stream/macros.rb
35
32
  - lib/stream/matchers.rb
36
33
  - stream.gemspec
37
34
  has_rdoc: true
38
35
  homepage: http://github.com/gretch
39
36
  licenses: []
40
37
  post_install_message:
41
- rdoc_options:
42
- - --charset=UTF-8
38
+ rdoc_options: []
43
39
  require_paths:
44
40
  - lib
45
41
  required_ruby_version: !ruby/object:Gem::Requirement
data/README.rdoc DELETED
@@ -1,102 +0,0 @@
1
- = TimelineFu
2
-
3
- Easily build timelines, much like GitHub's news feed.
4
-
5
- == Usage
6
-
7
- TimelineFu requires you to have a TimelineEvent model.
8
- The simplest way is to use the generator.
9
-
10
- $ script/generate timeline_fu && rake db:migrate
11
- exists db/migrate
12
- create db/migrate/20090333222034_create_timeline_events.rb
13
- create app/models/timeline_event.rb
14
- # Migration blabber...
15
-
16
- Next step is to determine what generates an event in your various models.
17
-
18
- class Post < ActiveRecord::Base
19
- #...
20
- belongs_to :author, :class_name => 'Person'
21
- fires :new_post, :on => :create,
22
- :actor => :author
23
- end
24
-
25
- You can add 'fires' statements to as many models as you want on as many models
26
- as you want.
27
-
28
- They are hooked for you after standard ActiveRecord events. In
29
- the previous example, it's an after_create on Posts.
30
-
31
- === Parameters for #fires
32
-
33
- You can supply a few parameters to fires, two of them are mandatory.
34
- - the first param is a custom name for the event type. It'll be your way of figuring out what events your reading back from the timeline_events table later.
35
- - :new_post in the example
36
-
37
- The rest all fit neatly in an options hash.
38
-
39
- - :on => [ActiveRecord event]
40
- - mandatory. You use it to specify whether you want the event created after a create, update or destroy. You can also supply an array of events, e.g. [:create, :update].
41
- - :actor is your way of specifying who took this action.
42
- - In the example, post.author is going to be this person.
43
- - :subject is automatically set to self, which is good most of the time. You can however override it if you need to, using :subject.
44
- - :secondary_subject can let you specify something else that's related to the event. A comment to a blog post would be a good example.
45
- - :if => symbol or proc/lambda lets you put conditions on when a TimelineEvent is created. It's passed right to the after_xxx ActiveRecord event hook, so it's has the same behavior.
46
-
47
- Here's another example:
48
-
49
- class Comment < ActiveRecord::Base
50
- #...
51
- belongs_to :commenter, :class_name => 'Person'
52
- belongs_to :post
53
- fires :new_comment, :on => :create,
54
- :actor => :commenter,
55
- #implicit :subject => self,
56
- :secondary_subject => 'post',
57
- :if => lambda { |comment| comment.commenter != comment.post.author }
58
- end
59
-
60
- === TimelineEvent instantiation
61
-
62
- The ActiveRecord event hook will automatically instantiate a
63
- TimelineEvent instance for you.
64
- It will receive the following parameters in #create!
65
-
66
- - event_type
67
- - "new_comment" in the comment example
68
- - actor
69
- - the commenter
70
- - subject
71
- - the comment instance
72
- - secondary_subject
73
- - the post instance
74
-
75
- The generated model stores most of its info as polymorphic relationships.
76
-
77
- class TimelineEvent < ActiveRecord::Base
78
- belongs_to :actor, :polymorphic => true
79
- belongs_to :subject, :polymorphic => true
80
- belongs_to :secondary_subject, :polymorphic => true
81
- end
82
-
83
- == How you actually get your timeline
84
-
85
- To get your timeline you'll probably have to create your own finder SQL or scopes
86
- (if your situation is extremely simple).
87
-
88
- TimelineFu is not currently providing anything to generate your timeline because
89
- different situations will have wildly different requirements. Like access control
90
- issues and actually just what crazy stuff you're cramming in that timeline.
91
-
92
- We're not saying it can't be done, just that we haven't done it yet.
93
- Contributions are welcome :-)
94
-
95
- == Get it
96
-
97
- # Gemfile
98
- gem "timeline_fu"
99
-
100
- == License
101
-
102
- Copyright (c) 2008 James Golick, released under the MIT license
data/lib/stream/macros.rb DELETED
@@ -1,20 +0,0 @@
1
- module Stream
2
- module Macros
3
- def should_fire_event(event_type, opts = {})
4
- should "fire #{event_type} on #{opts[:on]}" do
5
- matcher = fire_event(event_type, opts)
6
-
7
- assert_accepts matcher, self.class.name.gsub(/Test$/, '').constantize
8
- end
9
- end
10
-
11
- def should_not_fire_event(event_type, opts = {})
12
- should "fire #{event_type} on #{opts[:on]}" do
13
- matcher = fire_event(event_type, opts)
14
-
15
- assert_rejects matcher, self.class.name.gsub(/Test$/, '').constantize
16
- end
17
- end
18
-
19
- end
20
- end