Stream 0.2.3.0 → 0.2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ Generates both the TimelineEvent class and the migration to create its table. The table will have subject, actor and secondary actor as polymorphic associations.
2
+ The use of this generator is optional. See README for more details.
@@ -0,0 +1,9 @@
1
+ class StreamGenerator < Rails::Generator::Base
2
+ def manifest
3
+ record do |m|
4
+ m.migration_template 'migration.rb', 'db/migrate',
5
+ :migration_file_name => 'create_activities'
6
+ m.template 'model.rb', 'app/models/activity.rb'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ class CreateActivities < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :activities do |t|
4
+ t.string :activity_type, :subject_type, :actor_type, :secondary_subject_type
5
+ t.integer :subject_id, :actor_id, :secondary_subject_id
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :activities
12
+ end
13
+ end
14
+
15
+
@@ -0,0 +1,5 @@
1
+ class Activity < ActiveRecord::Base
2
+ belongs_to :actor, :polymorphic => true
3
+ belongs_to :subject, :polymorphic => true
4
+ belongs_to :secondary_subject, :polymorphic => true
5
+ end
data/lib/stream/fires.rb CHANGED
@@ -30,20 +30,23 @@ module Stream
30
30
  end
31
31
  memo
32
32
  end
33
-
33
+
34
+ # create_options[:activity_type] = activity_type.to_s
35
+
34
36
  activity = ActivityItem.create(create_options)
35
-
37
+
36
38
  if activity_type.to_s.eql?'new_message'
37
39
  activity.subject.recipient.activity_items << activity
38
40
  else
39
41
  ([activity.actor] + activity.actor.subscribed_contacts).each{|p| p.activity_items << activity }
40
42
  end
41
-
43
+
42
44
  end
43
45
 
44
46
  send(:"after_#{opts[:on]}", method_name, :if => opts[:if])
45
-
47
+
46
48
  end
47
49
  end
48
50
  end
49
51
  end
52
+
data/stream.gemspec CHANGED
@@ -2,19 +2,23 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{Stream}
5
- s.version = "0.2.3.0"
5
+ s.version = "0.2.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Gretch", "Joe"]
9
- s.date = %q{2011-07-12}
8
+ s.authors = ["Gretchen Gapol", "Joe Ocaba"]
9
+ s.date = %q{2011-07-10}
10
10
  s.description = %q{news feed based on timeline with some modifications}
11
- s.email = %q{ggapol@exist.com joe_ocaba@yahoo.com}
11
+ s.email = %q{ggapol@exist.com}
12
12
  s.extra_rdoc_files = []
13
13
  s.files = [
14
14
  ".gitignore",
15
15
  "MIT-LICENSE",
16
16
  "Rakefile",
17
17
  "VERSION.yml",
18
+ "generators/stream/USAGE",
19
+ "generators/stream/templates/migration.rb",
20
+ "generators/stream/templates/model.rb",
21
+ "generators/stream/stream_generator.rb",
18
22
  "init.rb",
19
23
  "lib/stream.rb",
20
24
  "lib/stream/fires.rb",
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3.0
4
+ version: 0.2.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Gretch
9
- - Joe
8
+ - Gretchen Gapol
9
+ - Joe Ocaba
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-07-12 00:00:00.000000000 Z
13
+ date: 2011-07-10 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: news feed based on timeline with some modifications
16
- email: ggapol@exist.com joe_ocaba@yahoo.com
16
+ email: ggapol@exist.com
17
17
  executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
@@ -22,6 +22,10 @@ files:
22
22
  - MIT-LICENSE
23
23
  - Rakefile
24
24
  - VERSION.yml
25
+ - generators/stream/USAGE
26
+ - generators/stream/templates/migration.rb
27
+ - generators/stream/templates/model.rb
28
+ - generators/stream/stream_generator.rb
25
29
  - init.rb
26
30
  - lib/stream.rb
27
31
  - lib/stream/fires.rb