make_watchable 0.0.2
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 +7 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +78 -0
- data/Rakefile +7 -0
- data/lib/generators/make_watchable/make_watchable_generator.rb +20 -0
- data/lib/generators/make_watchable/templates/migration.rb +22 -0
- data/lib/make_watchable/exceptions.rb +21 -0
- data/lib/make_watchable/version.rb +3 -0
- data/lib/make_watchable/watchable.rb +19 -0
- data/lib/make_watchable/watcher.rb +89 -0
- data/lib/make_watchable/watching.rb +6 -0
- data/lib/make_watchable.rb +36 -0
- data/make_watchable.gemspec +27 -0
- data/spec/database.yml +3 -0
- data/spec/database.yml.sample +3 -0
- data/spec/generators/make_watchable_generator_spec.rb +28 -0
- data/spec/lib/make_watchable_spec.rb +90 -0
- data/spec/models.rb +10 -0
- data/spec/schema.rb +25 -0
- data/spec/spec_helper.rb +37 -0
- metadata +142 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010-2011 by Kai Schlamp
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
= MakeWatchable
|
2
|
+
|
3
|
+
MakeWatchable is an extension for building a user-centric watching system for Rails 3 applications.
|
4
|
+
It currently supports ActiveRecord models.
|
5
|
+
|
6
|
+
== Installation
|
7
|
+
|
8
|
+
add MakeWatchable to your Gemfile
|
9
|
+
|
10
|
+
gem 'make_watchable'
|
11
|
+
|
12
|
+
afterwards execute
|
13
|
+
|
14
|
+
bundle install
|
15
|
+
|
16
|
+
generate the required migration file
|
17
|
+
|
18
|
+
rails generate make_watchable
|
19
|
+
|
20
|
+
migrate the database
|
21
|
+
|
22
|
+
rake db:migrate
|
23
|
+
|
24
|
+
== Usage
|
25
|
+
|
26
|
+
# Specify a model that can be watched.
|
27
|
+
class Repository < ActiveRecord::Base
|
28
|
+
make_watchable
|
29
|
+
end
|
30
|
+
|
31
|
+
# Specify a model that can watch a watchable.
|
32
|
+
class User < ActiveRecord::Base
|
33
|
+
make_watcher
|
34
|
+
end
|
35
|
+
|
36
|
+
# The user can now watch the watchable.
|
37
|
+
# If the user is already watching the watchable then an AlreadyWatchingError is raised.
|
38
|
+
user.watch!(repository)
|
39
|
+
|
40
|
+
# The method without bang(!) does not raise the AlreadyWatchingError, but just return
|
41
|
+
# false when the watcher tries to watch an already watching watchable.
|
42
|
+
user.watch(repository)
|
43
|
+
|
44
|
+
# The user may unwatch a watched watchable.
|
45
|
+
# If the watch was never watching the watchable then an NotWatchingError is raised.
|
46
|
+
user.unwatch!(repository)
|
47
|
+
|
48
|
+
# The method without bang(!) does not raise the NotFlaggedError, but just returns false
|
49
|
+
# if the watcher is not watching the watchable.
|
50
|
+
user.unwatch(repository)
|
51
|
+
|
52
|
+
# Get all watchings of a watchable.
|
53
|
+
repository.watchings
|
54
|
+
|
55
|
+
# Get the watcher of the watching.
|
56
|
+
watching = repository.watchings.first
|
57
|
+
user = watching.watcher
|
58
|
+
|
59
|
+
# Watchings can also be accessed by its watcher.
|
60
|
+
user.watchings
|
61
|
+
|
62
|
+
# Check if the watcher watches a watchable
|
63
|
+
user.watches?(repository)
|
64
|
+
|
65
|
+
# Check if a watchable is watched by a watcher
|
66
|
+
repository.watched_by?(user)
|
67
|
+
|
68
|
+
== Testing
|
69
|
+
|
70
|
+
MakeWatchable uses RSpec for testing and has a rake task for executing the provided specs
|
71
|
+
|
72
|
+
rake spec
|
73
|
+
|
74
|
+
or simply
|
75
|
+
|
76
|
+
rake
|
77
|
+
|
78
|
+
Copyright © 2010-2011 Kai Schlamp (http://www.medihack.org), released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails/generators/migration'
|
2
|
+
require 'rails/generators/active_record'
|
3
|
+
|
4
|
+
class MakeWatchableGenerator < Rails::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
6
|
+
|
7
|
+
desc "Generates a migration for the watching model"
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
@source_root ||= File.dirname(__FILE__) + '/templates'
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.next_migration_number(path)
|
14
|
+
ActiveRecord::Generators::Base.next_migration_number(path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate_migration
|
18
|
+
migration_template 'migration.rb', 'db/migrate/create_make_watchable_tables'
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateMakeWatchableTables < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :watchings do |t|
|
4
|
+
t.string :watchable_type
|
5
|
+
t.integer :watchable_id
|
6
|
+
t.string :watcher_type
|
7
|
+
t.integer :watcher_id
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index :watchings, [:watchable_type, :watchable_id]
|
13
|
+
add_index :watchings, [:watcher_type, :watcher_id, :watchable_type, :watchable_id], :name => "access_watchings"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
remove_index :watchings, :column => [:watchable_type, :watchable_id]
|
18
|
+
remove_index :watchings, :name => "access_watchings"
|
19
|
+
|
20
|
+
drop_table :watchings
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module MakeWatchable
|
2
|
+
module Exceptions
|
3
|
+
class AlreadyWatchingError < StandardError
|
4
|
+
def initialize
|
5
|
+
super "The watcher is already watching this watchable."
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class NotWatchingError < StandardError
|
10
|
+
def initialize
|
11
|
+
super "The watcher is not watching the watchable."
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class InvalidWatchableError < StandardError
|
16
|
+
def initialize
|
17
|
+
super "Invalid watchable."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module MakeWatchable
|
2
|
+
module Watchable
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
has_many :watchings, :class_name => "MakeWatchable::Watching", :as => :watchable
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def watchable?
|
11
|
+
true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def watched_by?(watcher)
|
16
|
+
watcher.watches?(self)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module MakeWatchable
|
2
|
+
module Watcher
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
has_many :watchings, :class_name => "MakeWatchable::Watching", :as => :watcher
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def watcher?
|
11
|
+
true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Watch a +watchable+.
|
16
|
+
# Raises an +AlreadyWatchingError+ if the watcher already is watching the watchable.
|
17
|
+
# Raises an +InvalidWatchableError+ if the watchable is not a valid watchable.
|
18
|
+
def watch!(watchable)
|
19
|
+
check_watchable(watchable)
|
20
|
+
|
21
|
+
if watches?(watchable)
|
22
|
+
raise Exceptions::AlreadyWatchingError.new
|
23
|
+
end
|
24
|
+
|
25
|
+
Watching.create(:watchable => watchable, :watcher => self)
|
26
|
+
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
# Watch a +watchable+, but don't raise an error if the watcher is already watching the
|
31
|
+
# watchable. Instead simply return false then and ignore the watch request.
|
32
|
+
# Raises an +InvalidWatchableError+ if the watchable is not a valid watchable.
|
33
|
+
def watch(watchable)
|
34
|
+
begin
|
35
|
+
watch!(watchable)
|
36
|
+
success = true
|
37
|
+
rescue Exceptions::AlreadyWatchingError
|
38
|
+
success = false
|
39
|
+
end
|
40
|
+
success
|
41
|
+
end
|
42
|
+
|
43
|
+
# Unwatch a +watchable+.
|
44
|
+
# Raises an +NotWatchingError if the watcher is not watching the watchable.
|
45
|
+
# Raises an +InvalidWatchableError+ if the watchable is not a valid watchable.
|
46
|
+
def unwatch!(watchable)
|
47
|
+
check_watchable(watchable)
|
48
|
+
|
49
|
+
watching = fetch_watching(watchable)
|
50
|
+
|
51
|
+
raise Exceptions::NotWatchingError unless watching
|
52
|
+
|
53
|
+
watching.destroy
|
54
|
+
|
55
|
+
true
|
56
|
+
end
|
57
|
+
|
58
|
+
# Unwatch a +watchable+, but don't raise an error if the watcher is not watching
|
59
|
+
# the watchable. Instead returns false.
|
60
|
+
# Raises an +InvalidWatchableError+ if the watchable is not a valid watchable.
|
61
|
+
def unwatch(watchable)
|
62
|
+
begin
|
63
|
+
unwatch!(watchable)
|
64
|
+
success = true
|
65
|
+
rescue Exceptions::NotWatchingError
|
66
|
+
success = false
|
67
|
+
end
|
68
|
+
success
|
69
|
+
end
|
70
|
+
|
71
|
+
# Check if the watcher watches a watchable.
|
72
|
+
def watches?(watchable)
|
73
|
+
fetch_watching(watchable) ? true : false
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def fetch_watching(watchable)
|
79
|
+
watchings.where({
|
80
|
+
:watchable_type => watchable.class.to_s,
|
81
|
+
:watchable_id => watchable.id
|
82
|
+
}).try(:first)
|
83
|
+
end
|
84
|
+
|
85
|
+
def check_watchable(watchable)
|
86
|
+
raise Exceptions::InvalidWatchableError unless watchable.class.watchable?
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'make_watchable/watching'
|
2
|
+
require 'make_watchable/watchable'
|
3
|
+
require 'make_watchable/watcher'
|
4
|
+
require 'make_watchable/exceptions'
|
5
|
+
|
6
|
+
module MakeWatchable
|
7
|
+
def watchable?
|
8
|
+
false
|
9
|
+
end
|
10
|
+
|
11
|
+
def watcher?
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
# Specify a model as watchable.
|
16
|
+
#
|
17
|
+
# Example:
|
18
|
+
# class Repository < ActiveRecord::Base
|
19
|
+
# make_watchable
|
20
|
+
# end
|
21
|
+
def make_watchable
|
22
|
+
include Watchable
|
23
|
+
end
|
24
|
+
|
25
|
+
# Specify a model as watcher.
|
26
|
+
#
|
27
|
+
# Example:
|
28
|
+
# class User < ActiveRecord::Base
|
29
|
+
# make_watcher
|
30
|
+
# end
|
31
|
+
def make_watcher(options = {})
|
32
|
+
include Watcher
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
ActiveRecord::Base.extend MakeWatchable
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path("../lib/make_watchable/version", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "make_watchable"
|
6
|
+
s.version = MakeWatchable::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Kai Schlamp"]
|
9
|
+
s.email = ["schlamp@gmx.de"]
|
10
|
+
s.homepage = "http://github.com/medihack/make_watchable"
|
11
|
+
s.summary = "Rails 3 flagging extension"
|
12
|
+
s.description = "A user-centric watching extension for Rails 3 applications."
|
13
|
+
|
14
|
+
s.required_rubygems_version = ">= 1.3.6"
|
15
|
+
s.rubyforge_project = "make_watchable"
|
16
|
+
|
17
|
+
s.add_dependency "activerecord", "~> 3.0.0"
|
18
|
+
s.add_development_dependency "bundler", "~> 1.0.0"
|
19
|
+
s.add_development_dependency "rspec", "~> 2.5.0"
|
20
|
+
s.add_development_dependency "database_cleaner", "0.6.7.RC"
|
21
|
+
s.add_development_dependency "sqlite3-ruby", "~> 1.3.0"
|
22
|
+
s.add_development_dependency "generator_spec", "~> 0.8.2"
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
26
|
+
s.require_path = 'lib'
|
27
|
+
end
|
data/spec/database.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'action_controller'
|
3
|
+
require 'generator_spec/test_case'
|
4
|
+
require 'generators/make_watchable/make_watchable_generator'
|
5
|
+
|
6
|
+
describe MakeWatchableGenerator do
|
7
|
+
include GeneratorSpec::TestCase
|
8
|
+
destination File.expand_path("/tmp", __FILE__)
|
9
|
+
tests MakeWatchableGenerator
|
10
|
+
|
11
|
+
before do
|
12
|
+
prepare_destination
|
13
|
+
run_generator
|
14
|
+
end
|
15
|
+
|
16
|
+
specify do
|
17
|
+
destination_root.should have_structure {
|
18
|
+
directory "db" do
|
19
|
+
directory "migrate" do
|
20
|
+
migration "create_make_watchable_tables" do
|
21
|
+
contains "class CreateMakeWatchableTables"
|
22
|
+
contains "create_table :watchings"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe "Make Watchable" do
|
4
|
+
before(:each) do
|
5
|
+
@watchable = WatchableModel.create(:name => "Watchable 1")
|
6
|
+
@watcher = WatcherModel.create(:name => "Watcher 1")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should create a watchable instance" do
|
10
|
+
@watchable.class.should == WatchableModel
|
11
|
+
@watchable.class.watchable?.should == true
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should create a watcher instance" do
|
15
|
+
@watcher.class.should == WatcherModel
|
16
|
+
@watcher.class.watcher?.should == true
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "watcher" do
|
20
|
+
describe "watch" do
|
21
|
+
it "should create a watching" do
|
22
|
+
@watchable.watchings.length.should == 0
|
23
|
+
@watcher.watch!(@watchable).should == true
|
24
|
+
@watchable.watchings.reload.length.should == 1
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should only allow to watch a watchable per watcher once with rasing an error" do
|
28
|
+
@watcher.watch!(@watchable)
|
29
|
+
lambda { @watcher.watch!(@watchable) }.should raise_error(MakeWatchable::Exceptions::AlreadyWatchingError)
|
30
|
+
@watchable.watchings.count.should == 1
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should only allow to watch a watchable per watcher once without rasing an error" do
|
34
|
+
@watcher.watch(@watchable)
|
35
|
+
lambda {
|
36
|
+
@watcher.flag(@watchable).should == false
|
37
|
+
}.should_not raise_error(MakeWatchable::Exceptions::AlreadyWatchingError)
|
38
|
+
@watchable.watchings.count.should == 1
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "unwatch" do
|
43
|
+
it "should remove a watching" do
|
44
|
+
@watcher.watch!(@watchable)
|
45
|
+
@watcher.watchings.length.should == 1
|
46
|
+
@watcher.unwatch!(@watchable).should == true
|
47
|
+
@watcher.watchings.reload.length.should == 0
|
48
|
+
end
|
49
|
+
|
50
|
+
it "normal method should return true when successfully unflagged" do
|
51
|
+
@watcher.watch(@watchable)
|
52
|
+
@watcher.unwatch(@watchable).should == true
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should raise error if watcher not watching the watchable with bang method" do
|
56
|
+
lambda { @watcher.unwatch!(@watchable) }.should raise_error(MakeWatchable::Exceptions::NotWatchingError)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should not raise error if watcher not watching the watchable with normal method" do
|
60
|
+
lambda {
|
61
|
+
@watcher.unwatch(@watchable).should == false
|
62
|
+
}.should_not raise_error(MakeWatchable::Exceptions::NotWatchingError)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should check if watcher is watches the watchable" do
|
67
|
+
@watcher.watches?(@watchable).should == false
|
68
|
+
@watcher.watch!(@watchable)
|
69
|
+
@watcher.watches?(@watchable).should == true
|
70
|
+
@watcher.unwatch!(@watchable)
|
71
|
+
@watcher.watches?(@watchable).should == false
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "watchable" do
|
76
|
+
it "should have watchings" do
|
77
|
+
@watchable.watchings.length.should == 0
|
78
|
+
@watcher.watch!(@watchable)
|
79
|
+
@watchable.watchings.reload.length.should == 1
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should check if watchable is watched by watcher" do
|
83
|
+
@watchable.watched_by?(@watcher).should == false
|
84
|
+
@watcher.watch!(@watchable)
|
85
|
+
@watchable.watched_by?(@watcher).should == true
|
86
|
+
@watcher.unwatch!(@watchable)
|
87
|
+
@watchable.watched_by?(@watcher).should == false
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/spec/models.rb
ADDED
data/spec/schema.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
ActiveRecord::Schema.define :version => 0 do
|
2
|
+
create_table :watchable_models, :force => true do |t|
|
3
|
+
t.string :name
|
4
|
+
end
|
5
|
+
|
6
|
+
create_table :watcher_models, :force => true do |t|
|
7
|
+
t.string :name
|
8
|
+
end
|
9
|
+
|
10
|
+
create_table :invalid_watchable_models, :force => true do |t|
|
11
|
+
t.string :name
|
12
|
+
end
|
13
|
+
|
14
|
+
create_table :watchings, :force => true do |t|
|
15
|
+
t.string :watchable_type
|
16
|
+
t.integer :watchable_id
|
17
|
+
t.string :watcher_type
|
18
|
+
t.integer :watcher_id
|
19
|
+
|
20
|
+
t.timestamps
|
21
|
+
end
|
22
|
+
|
23
|
+
add_index :watchings, [:watchable_type, :watchable_id]
|
24
|
+
add_index :watchings, [:watcher_type, :watcher_id, :watchable_type, :watchable_id], :name => "access_watchings"
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'logger'
|
4
|
+
require 'rspec'
|
5
|
+
require 'active_record'
|
6
|
+
require 'database_cleaner'
|
7
|
+
|
8
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
|
9
|
+
require 'make_watchable'
|
10
|
+
|
11
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')
|
12
|
+
ActiveRecord::Base.configurations = YAML::load_file(File.dirname(__FILE__) + '/database.yml')
|
13
|
+
ActiveRecord::Base.establish_connection(ENV['DB'] || 'sqlite3')
|
14
|
+
|
15
|
+
ActiveRecord::Base.silence do
|
16
|
+
ActiveRecord::Migration.verbose = false
|
17
|
+
|
18
|
+
load(File.dirname(__FILE__) + '/schema.rb')
|
19
|
+
load(File.dirname(__FILE__) + '/models.rb')
|
20
|
+
end
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
config.filter_run :focus => true
|
24
|
+
config.run_all_when_everything_filtered = true
|
25
|
+
config.filter_run_excluding :exclude => true
|
26
|
+
|
27
|
+
config.mock_with :rspec
|
28
|
+
|
29
|
+
config.before(:suite) do
|
30
|
+
DatabaseCleaner.strategy = :truncation
|
31
|
+
DatabaseCleaner.clean
|
32
|
+
end
|
33
|
+
|
34
|
+
config.after(:each) do
|
35
|
+
DatabaseCleaner.clean
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: make_watchable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.2
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kai Schlamp
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-06-18 00:00:00 +02:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: activerecord
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 3.0.0
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.0.0
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rspec
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.5.0
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: database_cleaner
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - "="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 0.6.7.RC
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: sqlite3-ruby
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.3.0
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: generator_spec
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 0.8.2
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id006
|
82
|
+
description: A user-centric watching extension for Rails 3 applications.
|
83
|
+
email:
|
84
|
+
- schlamp@gmx.de
|
85
|
+
executables: []
|
86
|
+
|
87
|
+
extensions: []
|
88
|
+
|
89
|
+
extra_rdoc_files: []
|
90
|
+
|
91
|
+
files:
|
92
|
+
- .gitignore
|
93
|
+
- Gemfile
|
94
|
+
- MIT-LICENSE
|
95
|
+
- README.rdoc
|
96
|
+
- Rakefile
|
97
|
+
- lib/generators/make_watchable/make_watchable_generator.rb
|
98
|
+
- lib/generators/make_watchable/templates/migration.rb
|
99
|
+
- lib/make_watchable.rb
|
100
|
+
- lib/make_watchable/exceptions.rb
|
101
|
+
- lib/make_watchable/version.rb
|
102
|
+
- lib/make_watchable/watchable.rb
|
103
|
+
- lib/make_watchable/watcher.rb
|
104
|
+
- lib/make_watchable/watching.rb
|
105
|
+
- make_watchable.gemspec
|
106
|
+
- spec/database.yml
|
107
|
+
- spec/database.yml.sample
|
108
|
+
- spec/generators/make_watchable_generator_spec.rb
|
109
|
+
- spec/lib/make_watchable_spec.rb
|
110
|
+
- spec/models.rb
|
111
|
+
- spec/schema.rb
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
has_rdoc: true
|
114
|
+
homepage: http://github.com/medihack/make_watchable
|
115
|
+
licenses: []
|
116
|
+
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: "0"
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.3.6
|
134
|
+
requirements: []
|
135
|
+
|
136
|
+
rubyforge_project: make_watchable
|
137
|
+
rubygems_version: 1.6.2
|
138
|
+
signing_key:
|
139
|
+
specification_version: 3
|
140
|
+
summary: Rails 3 flagging extension
|
141
|
+
test_files: []
|
142
|
+
|