acts_as_amico 0.1.0

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.
Files changed (61) hide show
  1. data/.gitignore +11 -0
  2. data/.rspec +2 -0
  3. data/.rvmrc +1 -0
  4. data/API.md +361 -0
  5. data/CHANGELOG.md +16 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.md +185 -0
  9. data/Rakefile +20 -0
  10. data/acts_as_amico.gemspec +28 -0
  11. data/lib/acts_as_amico/amico_user.rb +69 -0
  12. data/lib/acts_as_amico/railtie.rb +20 -0
  13. data/lib/acts_as_amico/version.rb +3 -0
  14. data/lib/acts_as_amico.rb +9 -0
  15. data/spec/amico/amico_user_spec.rb +700 -0
  16. data/spec/dummy/Rakefile +7 -0
  17. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  18. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  19. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  20. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  21. data/spec/dummy/app/mailers/.gitkeep +0 -0
  22. data/spec/dummy/app/models/.gitkeep +0 -0
  23. data/spec/dummy/app/models/admin.rb +11 -0
  24. data/spec/dummy/app/models/rest_object.rb +7 -0
  25. data/spec/dummy/app/models/thing.rb +3 -0
  26. data/spec/dummy/app/models/user.rb +3 -0
  27. data/spec/dummy/app/models/widget.rb +3 -0
  28. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  29. data/spec/dummy/config/application.rb +44 -0
  30. data/spec/dummy/config/boot.rb +10 -0
  31. data/spec/dummy/config/database.yml +22 -0
  32. data/spec/dummy/config/environment.rb +5 -0
  33. data/spec/dummy/config/environments/development.rb +30 -0
  34. data/spec/dummy/config/environments/production.rb +60 -0
  35. data/spec/dummy/config/environments/test.rb +39 -0
  36. data/spec/dummy/config/initializers/amico.rb +14 -0
  37. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/spec/dummy/config/initializers/inflections.rb +10 -0
  39. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  40. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  41. data/spec/dummy/config/initializers/session_store.rb +8 -0
  42. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  43. data/spec/dummy/config/locales/en.yml +5 -0
  44. data/spec/dummy/config/routes.rb +58 -0
  45. data/spec/dummy/config.ru +4 -0
  46. data/spec/dummy/db/migrate/20111114184611_create_users.rb +10 -0
  47. data/spec/dummy/db/migrate/20111114184654_create_admins.rb +10 -0
  48. data/spec/dummy/db/migrate/20111114184712_create_things.rb +10 -0
  49. data/spec/dummy/db/migrate/20111114184731_create_widgets.rb +10 -0
  50. data/spec/dummy/db/schema.rb +44 -0
  51. data/spec/dummy/lib/assets/.gitkeep +0 -0
  52. data/spec/dummy/log/.gitkeep +0 -0
  53. data/spec/dummy/public/404.html +26 -0
  54. data/spec/dummy/public/422.html +26 -0
  55. data/spec/dummy/public/500.html +26 -0
  56. data/spec/dummy/public/favicon.ico +0 -0
  57. data/spec/dummy/script/rails +6 -0
  58. data/spec/factories/people.rb +12 -0
  59. data/spec/factories/stuff.rb +11 -0
  60. data/spec/spec_helper.rb +39 -0
  61. metadata +239 -0
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,10 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.string :guid
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreateAdmins < ActiveRecord::Migration
2
+ def change
3
+ create_table :admins do |t|
4
+ t.string :name
5
+ t.string :guid
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreateThings < ActiveRecord::Migration
2
+ def change
3
+ create_table :things do |t|
4
+ t.string :name
5
+ t.string :guid
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreateWidgets < ActiveRecord::Migration
2
+ def change
3
+ create_table :widgets do |t|
4
+ t.string :name
5
+ t.string :guid
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,44 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20111114184731) do
15
+
16
+ create_table "admins", :force => true do |t|
17
+ t.string "name"
18
+ t.string "guid"
19
+ t.datetime "created_at"
20
+ t.datetime "updated_at"
21
+ end
22
+
23
+ create_table "things", :force => true do |t|
24
+ t.string "name"
25
+ t.string "guid"
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ end
29
+
30
+ create_table "users", :force => true do |t|
31
+ t.string "name"
32
+ t.string "guid"
33
+ t.datetime "created_at"
34
+ t.datetime "updated_at"
35
+ end
36
+
37
+ create_table "widgets", :force => true do |t|
38
+ t.string "name"
39
+ t.string "guid"
40
+ t.datetime "created_at"
41
+ t.datetime "updated_at"
42
+ end
43
+
44
+ end
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,26 @@
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
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -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'
@@ -0,0 +1,12 @@
1
+ require 'uuidtools'
2
+ FactoryGirl.define do
3
+
4
+ factory :user do
5
+ sequence(:name) { |i| "Regular User #{i}" }
6
+ end
7
+
8
+ factory :admin do
9
+ sequence(:name) { UUIDTools::UUID.random_create.to_str }
10
+ end
11
+
12
+ end
@@ -0,0 +1,11 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :thing do
4
+ sequence(:name) { |i| "Thing #{i}" }
5
+ end
6
+
7
+ factory :widget do
8
+ sequence(:name) { |i| "Widget #{i}" }
9
+ end
10
+
11
+ end
@@ -0,0 +1,39 @@
1
+ require 'rubygems'
2
+ require 'rspec'
3
+ require 'amico'
4
+ require 'acts_as_amico'
5
+ require 'factory_girl'
6
+ require 'fakeweb'
7
+
8
+ ENV["RAILS_ENV"] = "test"
9
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
10
+ require "rails/test_help"
11
+ require "rspec/rails"
12
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
13
+ Rails.backtrace_cleaner.remove_silencers!
14
+ FactoryGirl.find_definitions
15
+
16
+ RSpec.configure do |config|
17
+ require 'rspec/expectations'
18
+ config.include RSpec::Matchers
19
+ config.color_enabled = true
20
+
21
+ # == Mock Framework
22
+ config.mock_with :rspec
23
+
24
+ config.before(:all) do
25
+ Amico.configure do |configuration|
26
+ redis = Redis.new(:db => 15)
27
+ configuration.redis = redis
28
+ end
29
+ end
30
+
31
+ config.before(:each) do
32
+ Amico.redis.flushdb
33
+ end
34
+
35
+ config.after(:all) do
36
+ Amico.redis.flushdb
37
+ Amico.redis.quit
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,239 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_amico
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - John Metta
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: redis
16
+ requirement: &70327359086680 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70327359086680
25
+ - !ruby/object:Gem::Dependency
26
+ name: amico
27
+ requirement: &70327359083860 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70327359083860
36
+ - !ruby/object:Gem::Dependency
37
+ name: rails
38
+ requirement: &70327359095000 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 3.1.1
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70327359095000
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec-rails
49
+ requirement: &70327359093680 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70327359093680
58
+ - !ruby/object:Gem::Dependency
59
+ name: sqlite3
60
+ requirement: &70327359092760 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70327359092760
69
+ - !ruby/object:Gem::Dependency
70
+ name: factory_girl_rails
71
+ requirement: &70327359090840 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70327359090840
80
+ - !ruby/object:Gem::Dependency
81
+ name: fakeweb
82
+ requirement: &70327359088640 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70327359088640
91
+ - !ruby/object:Gem::Dependency
92
+ name: uuidtools
93
+ requirement: &70327359103680 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70327359103680
102
+ description: Rails injectable Relationships (e.g. friendships) backed by Redis
103
+ email:
104
+ - mail@johnmetta.com
105
+ executables: []
106
+ extensions: []
107
+ extra_rdoc_files: []
108
+ files:
109
+ - .gitignore
110
+ - .rspec
111
+ - .rvmrc
112
+ - API.md
113
+ - CHANGELOG.md
114
+ - Gemfile
115
+ - LICENSE.txt
116
+ - README.md
117
+ - Rakefile
118
+ - acts_as_amico.gemspec
119
+ - lib/acts_as_amico.rb
120
+ - lib/acts_as_amico/amico_user.rb
121
+ - lib/acts_as_amico/railtie.rb
122
+ - lib/acts_as_amico/version.rb
123
+ - spec/amico/amico_user_spec.rb
124
+ - spec/dummy/Rakefile
125
+ - spec/dummy/app/assets/javascripts/application.js
126
+ - spec/dummy/app/assets/stylesheets/application.css
127
+ - spec/dummy/app/controllers/application_controller.rb
128
+ - spec/dummy/app/helpers/application_helper.rb
129
+ - spec/dummy/app/mailers/.gitkeep
130
+ - spec/dummy/app/models/.gitkeep
131
+ - spec/dummy/app/models/admin.rb
132
+ - spec/dummy/app/models/rest_object.rb
133
+ - spec/dummy/app/models/thing.rb
134
+ - spec/dummy/app/models/user.rb
135
+ - spec/dummy/app/models/widget.rb
136
+ - spec/dummy/app/views/layouts/application.html.erb
137
+ - spec/dummy/config.ru
138
+ - spec/dummy/config/application.rb
139
+ - spec/dummy/config/boot.rb
140
+ - spec/dummy/config/database.yml
141
+ - spec/dummy/config/environment.rb
142
+ - spec/dummy/config/environments/development.rb
143
+ - spec/dummy/config/environments/production.rb
144
+ - spec/dummy/config/environments/test.rb
145
+ - spec/dummy/config/initializers/amico.rb
146
+ - spec/dummy/config/initializers/backtrace_silencers.rb
147
+ - spec/dummy/config/initializers/inflections.rb
148
+ - spec/dummy/config/initializers/mime_types.rb
149
+ - spec/dummy/config/initializers/secret_token.rb
150
+ - spec/dummy/config/initializers/session_store.rb
151
+ - spec/dummy/config/initializers/wrap_parameters.rb
152
+ - spec/dummy/config/locales/en.yml
153
+ - spec/dummy/config/routes.rb
154
+ - spec/dummy/db/migrate/20111114184611_create_users.rb
155
+ - spec/dummy/db/migrate/20111114184654_create_admins.rb
156
+ - spec/dummy/db/migrate/20111114184712_create_things.rb
157
+ - spec/dummy/db/migrate/20111114184731_create_widgets.rb
158
+ - spec/dummy/db/schema.rb
159
+ - spec/dummy/lib/assets/.gitkeep
160
+ - spec/dummy/log/.gitkeep
161
+ - spec/dummy/public/404.html
162
+ - spec/dummy/public/422.html
163
+ - spec/dummy/public/500.html
164
+ - spec/dummy/public/favicon.ico
165
+ - spec/dummy/script/rails
166
+ - spec/factories/people.rb
167
+ - spec/factories/stuff.rb
168
+ - spec/spec_helper.rb
169
+ homepage: https://github.com/mettadore/acts_as_amico
170
+ licenses: []
171
+ post_install_message:
172
+ rdoc_options: []
173
+ require_paths:
174
+ - lib
175
+ required_ruby_version: !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubyforge_project:
189
+ rubygems_version: 1.8.17
190
+ signing_key:
191
+ specification_version: 3
192
+ summary: Rails injectable Relationships (e.g. friendships) backed by Redis
193
+ test_files:
194
+ - spec/amico/amico_user_spec.rb
195
+ - spec/dummy/Rakefile
196
+ - spec/dummy/app/assets/javascripts/application.js
197
+ - spec/dummy/app/assets/stylesheets/application.css
198
+ - spec/dummy/app/controllers/application_controller.rb
199
+ - spec/dummy/app/helpers/application_helper.rb
200
+ - spec/dummy/app/mailers/.gitkeep
201
+ - spec/dummy/app/models/.gitkeep
202
+ - spec/dummy/app/models/admin.rb
203
+ - spec/dummy/app/models/rest_object.rb
204
+ - spec/dummy/app/models/thing.rb
205
+ - spec/dummy/app/models/user.rb
206
+ - spec/dummy/app/models/widget.rb
207
+ - spec/dummy/app/views/layouts/application.html.erb
208
+ - spec/dummy/config.ru
209
+ - spec/dummy/config/application.rb
210
+ - spec/dummy/config/boot.rb
211
+ - spec/dummy/config/database.yml
212
+ - spec/dummy/config/environment.rb
213
+ - spec/dummy/config/environments/development.rb
214
+ - spec/dummy/config/environments/production.rb
215
+ - spec/dummy/config/environments/test.rb
216
+ - spec/dummy/config/initializers/amico.rb
217
+ - spec/dummy/config/initializers/backtrace_silencers.rb
218
+ - spec/dummy/config/initializers/inflections.rb
219
+ - spec/dummy/config/initializers/mime_types.rb
220
+ - spec/dummy/config/initializers/secret_token.rb
221
+ - spec/dummy/config/initializers/session_store.rb
222
+ - spec/dummy/config/initializers/wrap_parameters.rb
223
+ - spec/dummy/config/locales/en.yml
224
+ - spec/dummy/config/routes.rb
225
+ - spec/dummy/db/migrate/20111114184611_create_users.rb
226
+ - spec/dummy/db/migrate/20111114184654_create_admins.rb
227
+ - spec/dummy/db/migrate/20111114184712_create_things.rb
228
+ - spec/dummy/db/migrate/20111114184731_create_widgets.rb
229
+ - spec/dummy/db/schema.rb
230
+ - spec/dummy/lib/assets/.gitkeep
231
+ - spec/dummy/log/.gitkeep
232
+ - spec/dummy/public/404.html
233
+ - spec/dummy/public/422.html
234
+ - spec/dummy/public/500.html
235
+ - spec/dummy/public/favicon.ico
236
+ - spec/dummy/script/rails
237
+ - spec/factories/people.rb
238
+ - spec/factories/stuff.rb
239
+ - spec/spec_helper.rb