social_connections 0.0.1
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/.gitignore +5 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README +25 -0
- data/Rakefile +26 -0
- data/db/keep-this-dir.txt +1 -0
- data/db/social_connections_plugin.sqlite3 +0 -0
- data/init.rb +3 -0
- data/install.rb +1 -0
- data/lib/app/mailers/digest_mailer.rb +17 -0
- data/lib/app/models/social_activity.rb +37 -0
- data/lib/app/models/social_connection.rb +6 -0
- data/lib/app/views/digest_mailer/digest.html.erb +1 -0
- data/lib/db/migrate/20110516181115_create_social_connections.rb +13 -0
- data/lib/social_connections/acts_as_connectable.rb +58 -0
- data/lib/social_connections/social_aggregator.rb +14 -0
- data/lib/social_connections/version.rb +3 -0
- data/lib/social_connections.rb +12 -0
- data/lib/tasks/social_connections.rake +14 -0
- data/social_connections.gemspec +22 -0
- data/spec/activities_aggregator_spec.rb +41 -0
- data/spec/social_activities_spec.rb +67 -0
- data/test/activities_test.rb +9 -0
- data/test/acts_as_connectable_test.rb +33 -0
- data/test/database.yml +4 -0
- data/test/debug.log +9140 -0
- data/test/schema.rb +25 -0
- data/test/social_connection_test.rb +10 -0
- data/test/social_connections_test.rb +8 -0
- data/test/test_helper.rb +47 -0
- data/uninstall.rb +1 -0
- metadata +96 -0
data/test/schema.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
2
|
+
create_table :social_connections, :force => true do |t|
|
3
|
+
t.integer :source_id
|
4
|
+
t.string :source_type
|
5
|
+
t.integer :target_id
|
6
|
+
t.string :target_type
|
7
|
+
end
|
8
|
+
create_table :social_activities, :force => true do |t|
|
9
|
+
t.integer :owner_id
|
10
|
+
t.string :owner_type
|
11
|
+
t.integer :subject_id
|
12
|
+
t.string :subject_type
|
13
|
+
t.integer :target_id
|
14
|
+
t.string :target_type
|
15
|
+
t.string :verb
|
16
|
+
t.text :options_as_json
|
17
|
+
t.boolean :unseen, :default => true
|
18
|
+
end
|
19
|
+
|
20
|
+
# the 'connectables' table is for the tests
|
21
|
+
create_table :connectables, :force => true do |t|
|
22
|
+
t.string :name
|
23
|
+
t.string :email
|
24
|
+
end
|
25
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'test/unit'
|
6
|
+
require 'active_support'
|
7
|
+
require 'active_support/core_ext'
|
8
|
+
require 'active_record'
|
9
|
+
require 'action_mailer'
|
10
|
+
|
11
|
+
require File.dirname(__FILE__) + '/../init'
|
12
|
+
|
13
|
+
class Connectable < ActiveRecord::Base
|
14
|
+
acts_as_connectable :verbs => [ :likes, :recommends, :comments ]
|
15
|
+
def to_s
|
16
|
+
"Connectable '#{self.name}'"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_schema
|
21
|
+
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
22
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
23
|
+
|
24
|
+
db_adapter = ENV['DB']
|
25
|
+
|
26
|
+
# no db passed, try one of these fine config-free DBs before bombing.
|
27
|
+
db_adapter ||=
|
28
|
+
begin
|
29
|
+
require 'rubygems'
|
30
|
+
require 'sqlite'
|
31
|
+
'sqlite'
|
32
|
+
rescue MissingSourceFile
|
33
|
+
begin
|
34
|
+
require 'sqlite3'
|
35
|
+
'sqlite3'
|
36
|
+
rescue MissingSourceFile
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
if db_adapter.nil?
|
41
|
+
raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
|
42
|
+
end
|
43
|
+
|
44
|
+
ActiveRecord::Base.establish_connection(config[db_adapter])
|
45
|
+
load(File.dirname(__FILE__) + "/schema.rb")
|
46
|
+
end
|
47
|
+
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: social_connections
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Chris
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-06-24 00:00:00 +02:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: The idea is to provide pluggable social connections, activities and a method to digest those activities (e.g. in daily emails).
|
18
|
+
email:
|
19
|
+
- christian.oloff+gem@gmail.com
|
20
|
+
executables: []
|
21
|
+
|
22
|
+
extensions: []
|
23
|
+
|
24
|
+
extra_rdoc_files: []
|
25
|
+
|
26
|
+
files:
|
27
|
+
- .gitignore
|
28
|
+
- Gemfile
|
29
|
+
- MIT-LICENSE
|
30
|
+
- README
|
31
|
+
- Rakefile
|
32
|
+
- db/keep-this-dir.txt
|
33
|
+
- db/social_connections_plugin.sqlite3
|
34
|
+
- init.rb
|
35
|
+
- install.rb
|
36
|
+
- lib/app/mailers/digest_mailer.rb
|
37
|
+
- lib/app/models/social_activity.rb
|
38
|
+
- lib/app/models/social_connection.rb
|
39
|
+
- lib/app/views/digest_mailer/digest.html.erb
|
40
|
+
- lib/db/migrate/20110516181115_create_social_connections.rb
|
41
|
+
- lib/social_connections.rb
|
42
|
+
- lib/social_connections/acts_as_connectable.rb
|
43
|
+
- lib/social_connections/social_aggregator.rb
|
44
|
+
- lib/social_connections/version.rb
|
45
|
+
- lib/tasks/social_connections.rake
|
46
|
+
- social_connections.gemspec
|
47
|
+
- spec/activities_aggregator_spec.rb
|
48
|
+
- spec/social_activities_spec.rb
|
49
|
+
- test/activities_test.rb
|
50
|
+
- test/acts_as_connectable_test.rb
|
51
|
+
- test/database.yml
|
52
|
+
- test/debug.log
|
53
|
+
- test/schema.rb
|
54
|
+
- test/social_connection_test.rb
|
55
|
+
- test/social_connections_test.rb
|
56
|
+
- test/test_helper.rb
|
57
|
+
- uninstall.rb
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: https://sites.google.com/site/socialconnections7/
|
60
|
+
licenses: []
|
61
|
+
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project: social_connections
|
82
|
+
rubygems_version: 1.6.1
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: Social connections for ActiveRecord.
|
86
|
+
test_files:
|
87
|
+
- spec/activities_aggregator_spec.rb
|
88
|
+
- spec/social_activities_spec.rb
|
89
|
+
- test/activities_test.rb
|
90
|
+
- test/acts_as_connectable_test.rb
|
91
|
+
- test/database.yml
|
92
|
+
- test/debug.log
|
93
|
+
- test/schema.rb
|
94
|
+
- test/social_connection_test.rb
|
95
|
+
- test/social_connections_test.rb
|
96
|
+
- test/test_helper.rb
|