twrk-socialization 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.ruby-version +1 -0
- data/.travis.yml +8 -0
- data/Appraisals +23 -0
- data/CHANGELOG.md +67 -0
- data/Gemfile +3 -0
- data/Guardfile +12 -0
- data/LICENSE +20 -0
- data/README.md +298 -0
- data/Rakefile +14 -0
- data/demo/.gitignore +15 -0
- data/demo/Gemfile +35 -0
- data/demo/README.rdoc +261 -0
- data/demo/Rakefile +7 -0
- data/demo/app/assets/images/rails.png +0 -0
- data/demo/app/assets/javascripts/application.js +15 -0
- data/demo/app/assets/stylesheets/application.css +13 -0
- data/demo/app/controllers/application_controller.rb +3 -0
- data/demo/app/helpers/application_helper.rb +2 -0
- data/demo/app/mailers/.gitkeep +0 -0
- data/demo/app/models/.gitkeep +0 -0
- data/demo/app/models/celebrity.rb +4 -0
- data/demo/app/models/comment.rb +5 -0
- data/demo/app/models/follow.rb +3 -0
- data/demo/app/models/like.rb +2 -0
- data/demo/app/models/mention.rb +2 -0
- data/demo/app/models/movie.rb +3 -0
- data/demo/app/models/user.rb +7 -0
- data/demo/app/views/layouts/application.html.erb +14 -0
- data/demo/config/application.rb +59 -0
- data/demo/config/boot.rb +6 -0
- data/demo/config/database.yml +25 -0
- data/demo/config/environment.rb +5 -0
- data/demo/config/environments/development.rb +37 -0
- data/demo/config/environments/production.rb +67 -0
- data/demo/config/environments/test.rb +37 -0
- data/demo/config/initializers/backtrace_silencers.rb +7 -0
- data/demo/config/initializers/inflections.rb +15 -0
- data/demo/config/initializers/mime_types.rb +5 -0
- data/demo/config/initializers/secret_token.rb +7 -0
- data/demo/config/initializers/session_store.rb +8 -0
- data/demo/config/initializers/wrap_parameters.rb +14 -0
- data/demo/config/locales/en.yml +5 -0
- data/demo/config/routes.rb +58 -0
- data/demo/config.ru +4 -0
- data/demo/db/migrate/20120115051222_create_users.rb +9 -0
- data/demo/db/migrate/20120115051234_create_movies.rb +9 -0
- data/demo/db/migrate/20120115051255_create_celebrities.rb +9 -0
- data/demo/db/migrate/20120115054646_create_follows.rb +14 -0
- data/demo/db/migrate/20120115054647_create_likes.rb +14 -0
- data/demo/db/migrate/20120221200644_create_mentions.rb +14 -0
- data/demo/db/migrate/20120221202703_create_comments.rb +9 -0
- data/demo/db/schema.rb +72 -0
- data/demo/db/seeds.rb +17 -0
- data/demo/lib/assets/.gitkeep +0 -0
- data/demo/lib/tasks/.gitkeep +0 -0
- data/demo/public/404.html +26 -0
- data/demo/public/422.html +26 -0
- data/demo/public/500.html +25 -0
- data/demo/public/favicon.ico +0 -0
- data/demo/public/index.html +204 -0
- data/demo/public/robots.txt +5 -0
- data/demo/script/rails +6 -0
- data/demo/test/fixtures/.gitkeep +0 -0
- data/demo/test/fixtures/celebrities.yml +7 -0
- data/demo/test/fixtures/movies.yml +7 -0
- data/demo/test/fixtures/users.yml +7 -0
- data/demo/test/functional/.gitkeep +0 -0
- data/demo/test/integration/.gitkeep +0 -0
- data/demo/test/performance/browsing_test.rb +12 -0
- data/demo/test/test_helper.rb +13 -0
- data/demo/test/unit/.gitkeep +0 -0
- data/demo/test/unit/celebrity_test.rb +7 -0
- data/demo/test/unit/movie_test.rb +7 -0
- data/demo/test/unit/user_test.rb +7 -0
- data/demo/vendor/assets/javascripts/.gitkeep +0 -0
- data/demo/vendor/assets/stylesheets/.gitkeep +0 -0
- data/demo/vendor/plugins/.gitkeep +0 -0
- data/init.rb +1 -0
- data/lib/generators/socialization/socialization_generator.rb +38 -0
- data/lib/generators/socialization/templates/active_record/migration_follows.rb +14 -0
- data/lib/generators/socialization/templates/active_record/migration_likes.rb +14 -0
- data/lib/generators/socialization/templates/active_record/migration_mentions.rb +14 -0
- data/lib/generators/socialization/templates/active_record/model_follow.rb +2 -0
- data/lib/generators/socialization/templates/active_record/model_like.rb +2 -0
- data/lib/generators/socialization/templates/active_record/model_mention.rb +2 -0
- data/lib/generators/socialization/templates/redis/model_follow.rb +2 -0
- data/lib/generators/socialization/templates/redis/model_like.rb +2 -0
- data/lib/generators/socialization/templates/redis/model_mention.rb +2 -0
- data/lib/socialization/actors/follower.rb +88 -0
- data/lib/socialization/actors/liker.rb +88 -0
- data/lib/socialization/actors/mentioner.rb +88 -0
- data/lib/socialization/config/config.rb +39 -0
- data/lib/socialization/helpers/acts_as_helpers.rb +39 -0
- data/lib/socialization/helpers/string.rb +17 -0
- data/lib/socialization/lib/exceptions.rb +3 -0
- data/lib/socialization/stores/active_record/follow.rb +125 -0
- data/lib/socialization/stores/active_record/like.rb +121 -0
- data/lib/socialization/stores/active_record/mention.rb +125 -0
- data/lib/socialization/stores/active_record/mixins/base.rb +12 -0
- data/lib/socialization/stores/mixins/base.rb +22 -0
- data/lib/socialization/stores/mixins/follow.rb +39 -0
- data/lib/socialization/stores/mixins/like.rb +40 -0
- data/lib/socialization/stores/mixins/mention.rb +40 -0
- data/lib/socialization/stores/redis/base.rb +125 -0
- data/lib/socialization/stores/redis/config.rb +11 -0
- data/lib/socialization/stores/redis/follow.rb +22 -0
- data/lib/socialization/stores/redis/like.rb +22 -0
- data/lib/socialization/stores/redis/mention.rb +22 -0
- data/lib/socialization/stores/redis/mixins/base.rb +8 -0
- data/lib/socialization/version.rb +3 -0
- data/lib/socialization/victims/followable.rb +50 -0
- data/lib/socialization/victims/likeable.rb +51 -0
- data/lib/socialization/victims/mentionable.rb +51 -0
- data/lib/socialization.rb +20 -0
- data/socialization.gemspec +32 -0
- data/spec/actors/follower_spec.rb +113 -0
- data/spec/actors/liker_spec.rb +105 -0
- data/spec/actors/mentioner_spec.rb +105 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/spec_support/data_stores.rb +232 -0
- data/spec/spec_support/matchers.rb +54 -0
- data/spec/stores/active_record/follow_store_spec.rb +147 -0
- data/spec/stores/active_record/like_store_spec.rb +146 -0
- data/spec/stores/active_record/mention_store_spec.rb +148 -0
- data/spec/stores/active_record/mixins/base_spec.rb +25 -0
- data/spec/stores/redis/base_spec.rb +195 -0
- data/spec/stores/redis/config_spec.rb +28 -0
- data/spec/stores/redis/follow_store_spec.rb +26 -0
- data/spec/stores/redis/like_store_spec.rb +23 -0
- data/spec/stores/redis/mention_store_spec.rb +23 -0
- data/spec/string_spec.rb +13 -0
- data/spec/victims/followable_spec.rb +59 -0
- data/spec/victims/likeable_spec.rb +58 -0
- data/spec/victims/mentionable_spec.rb +59 -0
- data/spec/world_spec.rb +107 -0
- metadata +322 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters :format => [:json]
|
9
|
+
end
|
10
|
+
|
11
|
+
# Disable root element in JSON by default.
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
self.include_root_in_json = false
|
14
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
DemoApp::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get 'short'
|
20
|
+
# post 'toggle'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get 'sold'
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get 'recent', :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => 'welcome#index'
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id))(.:format)'
|
58
|
+
end
|
data/demo/config.ru
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateFollows < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :follows do |t|
|
4
|
+
t.string :follower_type
|
5
|
+
t.integer :follower_id
|
6
|
+
t.string :followable_type
|
7
|
+
t.integer :followable_id
|
8
|
+
t.datetime :created_at
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :follows, ["follower_id", "follower_type"], :name => "fk_follows"
|
12
|
+
add_index :follows, ["followable_id", "followable_type"], :name => "fk_followables"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateLikes < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :likes do |t|
|
4
|
+
t.string :liker_type
|
5
|
+
t.integer :liker_id
|
6
|
+
t.string :likeable_type
|
7
|
+
t.integer :likeable_id
|
8
|
+
t.datetime :created_at
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :likes, ["liker_id", "liker_type"], :name => "fk_likes"
|
12
|
+
add_index :likes, ["likeable_id", "likeable_type"], :name => "fk_likeables"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateMentions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :mentions do |t|
|
4
|
+
t.string :mentioner_type
|
5
|
+
t.integer :mentioner_id
|
6
|
+
t.string :mentionable_type
|
7
|
+
t.integer :mentionable_id
|
8
|
+
t.datetime :created_at
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :mentions, ["mentioner_id", "mentioner_type"], :name => "fk_mentions"
|
12
|
+
add_index :mentions, ["mentionable_id", "mentionable_type"], :name => "fk_mentionables"
|
13
|
+
end
|
14
|
+
end
|
data/demo/db/schema.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended to check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(:version => 20120221202703) do
|
14
|
+
|
15
|
+
create_table "celebrities", :force => true do |t|
|
16
|
+
t.string "name"
|
17
|
+
t.datetime "created_at", :null => false
|
18
|
+
t.datetime "updated_at", :null => false
|
19
|
+
end
|
20
|
+
|
21
|
+
create_table "comments", :force => true do |t|
|
22
|
+
t.integer "user_id"
|
23
|
+
t.integer "movie_id"
|
24
|
+
t.string "body"
|
25
|
+
end
|
26
|
+
|
27
|
+
create_table "follows", :force => true do |t|
|
28
|
+
t.string "follower_type"
|
29
|
+
t.integer "follower_id"
|
30
|
+
t.string "followable_type"
|
31
|
+
t.integer "followable_id"
|
32
|
+
t.datetime "created_at"
|
33
|
+
end
|
34
|
+
|
35
|
+
add_index "follows", ["followable_id", "followable_type"], :name => "fk_followables"
|
36
|
+
add_index "follows", ["follower_id", "follower_type"], :name => "fk_follows"
|
37
|
+
|
38
|
+
create_table "likes", :force => true do |t|
|
39
|
+
t.string "liker_type"
|
40
|
+
t.integer "liker_id"
|
41
|
+
t.string "likeable_type"
|
42
|
+
t.integer "likeable_id"
|
43
|
+
t.datetime "created_at"
|
44
|
+
end
|
45
|
+
|
46
|
+
add_index "likes", ["likeable_id", "likeable_type"], :name => "fk_likeables"
|
47
|
+
add_index "likes", ["liker_id", "liker_type"], :name => "fk_likes"
|
48
|
+
|
49
|
+
create_table "mentions", :force => true do |t|
|
50
|
+
t.string "mentioner_type"
|
51
|
+
t.integer "mentioner_id"
|
52
|
+
t.string "mentionable_type"
|
53
|
+
t.integer "mentionable_id"
|
54
|
+
t.datetime "created_at"
|
55
|
+
end
|
56
|
+
|
57
|
+
add_index "mentions", ["mentionable_id", "mentionable_type"], :name => "fk_mentionables"
|
58
|
+
add_index "mentions", ["mentioner_id", "mentioner_type"], :name => "fk_mentions"
|
59
|
+
|
60
|
+
create_table "movies", :force => true do |t|
|
61
|
+
t.string "name"
|
62
|
+
t.datetime "created_at", :null => false
|
63
|
+
t.datetime "updated_at", :null => false
|
64
|
+
end
|
65
|
+
|
66
|
+
create_table "users", :force => true do |t|
|
67
|
+
t.string "name"
|
68
|
+
t.datetime "created_at", :null => false
|
69
|
+
t.datetime "updated_at", :null => false
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
data/demo/db/seeds.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
User.create :name => 'Mia Wallace'
|
2
|
+
User.create :name => 'Vincent Vega'
|
3
|
+
User.create :name => 'Jules Winnfield'
|
4
|
+
User.create :name => 'Butch Coolidge'
|
5
|
+
|
6
|
+
Movie.create :name => 'Pulp Fiction'
|
7
|
+
Movie.create :name => 'Reservoir Dogs'
|
8
|
+
Movie.create :name => 'Kill Bill'
|
9
|
+
Movie.create :name => 'Inglorious Basterds'
|
10
|
+
|
11
|
+
Celebrity.create :name => 'Uma Thurman'
|
12
|
+
Celebrity.create :name => 'John Travlota'
|
13
|
+
Celebrity.create :name => 'Samuel L. Jackson'
|
14
|
+
Celebrity.create :name => 'Bruce Willis'
|
15
|
+
|
16
|
+
c = Comment.create :user_id => 1, :movie_id => 1, :body => 'Awesome movie. Vincent Vega is awesome in it!'
|
17
|
+
c.mention!(User.find_by_name("Vincent Vega"))
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
File without changes
|
@@ -0,0 +1,204 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Ruby on Rails: Welcome aboard</title>
|
5
|
+
<style type="text/css" media="screen">
|
6
|
+
body {
|
7
|
+
margin: 0;
|
8
|
+
margin-bottom: 25px;
|
9
|
+
padding: 0;
|
10
|
+
background-color: #f0f0f0;
|
11
|
+
font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
|
12
|
+
font-size: 13px;
|
13
|
+
color: #333;
|
14
|
+
}
|
15
|
+
|
16
|
+
h1 {
|
17
|
+
font-size: 28px;
|
18
|
+
color: #000;
|
19
|
+
}
|
20
|
+
|
21
|
+
a {color: #03c}
|
22
|
+
a:hover {
|
23
|
+
background-color: #03c;
|
24
|
+
color: white;
|
25
|
+
text-decoration: none;
|
26
|
+
}
|
27
|
+
|
28
|
+
|
29
|
+
#page {
|
30
|
+
background-color: #f0f0f0;
|
31
|
+
width: 750px;
|
32
|
+
margin: 0;
|
33
|
+
margin-left: auto;
|
34
|
+
margin-right: auto;
|
35
|
+
}
|
36
|
+
|
37
|
+
#content {
|
38
|
+
float: left;
|
39
|
+
background-color: white;
|
40
|
+
border: 3px solid #aaa;
|
41
|
+
border-top: none;
|
42
|
+
padding: 25px;
|
43
|
+
width: 500px;
|
44
|
+
}
|
45
|
+
|
46
|
+
#sidebar {
|
47
|
+
float: right;
|
48
|
+
width: 175px;
|
49
|
+
}
|
50
|
+
|
51
|
+
#footer {
|
52
|
+
clear: both;
|
53
|
+
}
|
54
|
+
|
55
|
+
#header, #about, #getting-started {
|
56
|
+
padding-left: 75px;
|
57
|
+
padding-right: 30px;
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
#header {
|
62
|
+
background-image: url("assets/rails.png");
|
63
|
+
background-repeat: no-repeat;
|
64
|
+
background-position: top left;
|
65
|
+
height: 64px;
|
66
|
+
}
|
67
|
+
#header h1, #header h2 {margin: 0}
|
68
|
+
#header h2 {
|
69
|
+
color: #888;
|
70
|
+
font-weight: normal;
|
71
|
+
font-size: 16px;
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
#about h3 {
|
76
|
+
margin: 0;
|
77
|
+
margin-bottom: 10px;
|
78
|
+
font-size: 14px;
|
79
|
+
}
|
80
|
+
|
81
|
+
#about-content {
|
82
|
+
background-color: #ffd;
|
83
|
+
border: 1px solid #fc0;
|
84
|
+
margin-left: -55px;
|
85
|
+
margin-right: -10px;
|
86
|
+
}
|
87
|
+
#about-content table {
|
88
|
+
margin-top: 10px;
|
89
|
+
margin-bottom: 10px;
|
90
|
+
font-size: 11px;
|
91
|
+
border-collapse: collapse;
|
92
|
+
}
|
93
|
+
#about-content td {
|
94
|
+
padding: 10px;
|
95
|
+
padding-top: 3px;
|
96
|
+
padding-bottom: 3px;
|
97
|
+
}
|
98
|
+
#about-content td.name {color: #555}
|
99
|
+
#about-content td.value {color: #000}
|
100
|
+
|
101
|
+
#about-content ul {
|
102
|
+
padding: 0;
|
103
|
+
list-style-type: none;
|
104
|
+
}
|
105
|
+
|
106
|
+
#about-content.failure {
|
107
|
+
background-color: #fcc;
|
108
|
+
border: 1px solid #f00;
|
109
|
+
}
|
110
|
+
#about-content.failure p {
|
111
|
+
margin: 0;
|
112
|
+
padding: 10px;
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
#getting-started {
|
117
|
+
border-top: 1px solid #ccc;
|
118
|
+
margin-top: 25px;
|
119
|
+
padding-top: 15px;
|
120
|
+
}
|
121
|
+
#getting-started h1 {
|
122
|
+
margin: 0;
|
123
|
+
font-size: 20px;
|
124
|
+
}
|
125
|
+
#getting-started h2 {
|
126
|
+
margin: 0;
|
127
|
+
font-size: 14px;
|
128
|
+
font-weight: normal;
|
129
|
+
color: #333;
|
130
|
+
margin-bottom: 25px;
|
131
|
+
}
|
132
|
+
#getting-started ol {
|
133
|
+
margin-left: 0;
|
134
|
+
padding-left: 0;
|
135
|
+
}
|
136
|
+
#getting-started li {
|
137
|
+
font-size: 18px;
|
138
|
+
color: #888;
|
139
|
+
margin-bottom: 25px;
|
140
|
+
}
|
141
|
+
#getting-started li h2 {
|
142
|
+
margin: 0;
|
143
|
+
font-weight: normal;
|
144
|
+
font-size: 18px;
|
145
|
+
color: #333;
|
146
|
+
}
|
147
|
+
#getting-started li p {
|
148
|
+
color: #555;
|
149
|
+
font-size: 13px;
|
150
|
+
}
|
151
|
+
|
152
|
+
|
153
|
+
#sidebar ul {
|
154
|
+
margin-left: 0;
|
155
|
+
padding-left: 0;
|
156
|
+
}
|
157
|
+
#sidebar ul h3 {
|
158
|
+
margin-top: 25px;
|
159
|
+
font-size: 16px;
|
160
|
+
padding-bottom: 10px;
|
161
|
+
border-bottom: 1px solid #ccc;
|
162
|
+
}
|
163
|
+
#sidebar li {
|
164
|
+
list-style-type: none;
|
165
|
+
}
|
166
|
+
#sidebar ul.links li {
|
167
|
+
margin-bottom: 5px;
|
168
|
+
}
|
169
|
+
|
170
|
+
.filename {
|
171
|
+
font-style: italic;
|
172
|
+
}
|
173
|
+
|
174
|
+
.code {
|
175
|
+
font-weight: bold;
|
176
|
+
font-family: Inconsolata, Monaco, "Courier New", monospace
|
177
|
+
}
|
178
|
+
|
179
|
+
</style>
|
180
|
+
<script type="text/javascript">
|
181
|
+
function about() {
|
182
|
+
info = document.getElementById('about-content');
|
183
|
+
if (window.XMLHttpRequest)
|
184
|
+
{ xhr = new XMLHttpRequest(); }
|
185
|
+
else
|
186
|
+
{ xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
|
187
|
+
xhr.open("GET","rails/info/properties",false);
|
188
|
+
xhr.send("");
|
189
|
+
info.innerHTML = xhr.responseText;
|
190
|
+
info.style.display = 'block'
|
191
|
+
}
|
192
|
+
</script>
|
193
|
+
</head>
|
194
|
+
<body>
|
195
|
+
<div style='width:500px; margin: 0 auto;margin-top:80px;'>
|
196
|
+
<h1>Not what you were expecting? Sorry!</h1>
|
197
|
+
<p>I didn't spend time designing a UI for Socialization. Instead, fire up the Rails console using <span class="code">rails console</span> and play with Socialization over there.</p>
|
198
|
+
|
199
|
+
<p>Three models using the Socialization features have been setup for you: User, Celebrity, Movie. I have also created some seed data.</p>
|
200
|
+
|
201
|
+
<p>Make sure you run <span class="code">rake db:migrate</span> and <span class="code">rake db:seed</span> before starting the console.</p>
|
202
|
+
</div>
|
203
|
+
</body>
|
204
|
+
</html>
|
data/demo/script/rails
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rails/performance_test_help'
|
3
|
+
|
4
|
+
class BrowsingTest < ActionDispatch::PerformanceTest
|
5
|
+
# Refer to the documentation for all available options
|
6
|
+
# self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
|
7
|
+
# :output => 'tmp/performance', :formats => [:flat] }
|
8
|
+
|
9
|
+
def test_homepage
|
10
|
+
get '/'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
7
|
+
#
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
+
# -- they do not yet inherit this setting
|
10
|
+
fixtures :all
|
11
|
+
|
12
|
+
# Add more helper methods to be used by all tests here...
|
13
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'socialization'
|