partisan 0.0.1 → 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/.rspec +1 -0
- data/{LICENSE.txt → LICENSE.md} +0 -0
- data/README.md +12 -16
- data/lib/partisan/railtie.rb +1 -1
- data/lib/partisan/version.rb +1 -1
- data/spec/followable_spec.rb +1 -1
- data/spec/follower_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/macros/database_macros.rb +2 -2
- metadata +35 -16
- checksums.yaml +0 -7
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/{LICENSE.txt → LICENSE.md}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,20 +1,17 @@
|
|
1
1
|
# Partisan
|
2
2
|
|
3
|
-
Partisan is a Ruby library that allows ActiveRecord records to
|
3
|
+
Partisan is a Ruby library that allows ActiveRecord records to follow other records.
|
4
4
|
|
5
|
-
It’s heavily inspired by `acts_as_follower`.
|
5
|
+
It’s heavily inspired by `acts_as_follower`. However, it’s not 100% compatible with `acts_as_follower` as I removed some “features”:
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
*
|
10
|
-
* Array with all types of followers/following
|
11
|
-
* `*_count` methods
|
7
|
+
* Block a follower
|
8
|
+
* Methods that returned mixed types of followers/following
|
9
|
+
* `*_count` methods (see the new features list)
|
12
10
|
|
13
11
|
But I also added awesome new ones:
|
14
12
|
|
15
|
-
*
|
16
|
-
|
17
|
-
* followers/followings now returns ActiveRecord::Relation for easy chaining/scoping/paginating...
|
13
|
+
* You can use `following_team_ids` but also `following_team_names` (basically any `following_team_<column>s`). It takes advantage of the `pluck` method, so it doesn’t create an instance of each follower, it just return the relevant column values. (Go check `pluck` documentation, it’s simply awesome).
|
14
|
+
* The `followers` and `followings` mthods now return an `ActiveRecord::Relation` for easy chaining, scoping, counting, pagination, etc.
|
18
15
|
|
19
16
|
## Installation
|
20
17
|
|
@@ -66,15 +63,14 @@ fan.following?(band)
|
|
66
63
|
fan.unfollow(band)
|
67
64
|
fan.following?(band)
|
68
65
|
# => false
|
69
|
-
|
70
66
|
```
|
71
67
|
|
72
|
-
Most of the times, you would want to get a quick look at about how many
|
68
|
+
Most of the times, you would want to get a quick look at about how many fans follow a certain resource. That could be an expensive operation.
|
73
69
|
|
74
|
-
However, if the *followed* record has
|
70
|
+
However, if the *followed* record has a `followers_count` column, Partisan will populate its value with how many followers the record has.
|
75
71
|
|
76
72
|
```ruby
|
77
|
-
|
73
|
+
fan.follow(band)
|
78
74
|
|
79
75
|
band.followers.count
|
80
76
|
# SQL query that counts records and returns `1`
|
@@ -83,11 +79,11 @@ band.followers_count
|
|
83
79
|
# Quick lookup into the column and returns `1`
|
84
80
|
```
|
85
81
|
|
86
|
-
The same concept applies to `followable` with a `following_count` column
|
82
|
+
The same concept applies to `followable` with a `following_count` column.
|
87
83
|
|
88
84
|
## License
|
89
85
|
|
90
|
-
`Partisan` is © 2013 [Mirego](http://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](https://github.com/mirego/
|
86
|
+
`Partisan` is © 2013 [Mirego](http://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](https://github.com/mirego/partisan/blob/master/LICENSE.md) file.
|
91
87
|
|
92
88
|
## About Mirego
|
93
89
|
|
data/lib/partisan/railtie.rb
CHANGED
data/lib/partisan/version.rb
CHANGED
data/spec/followable_spec.rb
CHANGED
data/spec/follower_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -12,7 +12,7 @@ module DatabaseMacros
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.database_file
|
15
|
-
@database_file || File.
|
15
|
+
@database_file || File.expand_path('../test.db', __FILE__)
|
16
16
|
end
|
17
17
|
|
18
18
|
def setup_database
|
@@ -33,7 +33,7 @@ module DatabaseMacros
|
|
33
33
|
|
34
34
|
# Run the built-in migration
|
35
35
|
def run_default_migration
|
36
|
-
load File.
|
36
|
+
load File.expand_path('../../../../lib/generators/partisan/templates/migration.rb', __FILE__)
|
37
37
|
AddFollowsMigration.new.up
|
38
38
|
end
|
39
39
|
end
|
metadata
CHANGED
@@ -1,32 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: partisan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Simon Prévost
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-24 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 3.0.0
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 3.0.0
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: bundler
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,43 +46,49 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rake
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- - '>='
|
51
|
+
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- - '>='
|
59
|
+
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: rspec
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- - '>='
|
67
|
+
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '0'
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- - '>='
|
75
|
+
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: '0'
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: sqlite3
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
|
-
- - '>='
|
83
|
+
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
75
85
|
version: '0'
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
|
-
- - '>='
|
91
|
+
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
82
93
|
version: '0'
|
83
94
|
description: Partisan is a Ruby library that allows ActiveRecord records to be follower
|
@@ -90,8 +101,9 @@ extensions: []
|
|
90
101
|
extra_rdoc_files: []
|
91
102
|
files:
|
92
103
|
- .gitignore
|
104
|
+
- .rspec
|
93
105
|
- Gemfile
|
94
|
-
- LICENSE.
|
106
|
+
- LICENSE.md
|
95
107
|
- README.md
|
96
108
|
- Rakefile
|
97
109
|
- lib/generators/partisan/USAGE
|
@@ -114,26 +126,33 @@ files:
|
|
114
126
|
homepage: https://github.com/simonprev/partisan
|
115
127
|
licenses:
|
116
128
|
- BSD 3-Clause
|
117
|
-
metadata: {}
|
118
129
|
post_install_message:
|
119
130
|
rdoc_options: []
|
120
131
|
require_paths:
|
121
132
|
- lib
|
122
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
123
135
|
requirements:
|
124
|
-
- - '>='
|
136
|
+
- - ! '>='
|
125
137
|
- !ruby/object:Gem::Version
|
126
138
|
version: '0'
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
hash: 1786164620138942413
|
127
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
128
144
|
requirements:
|
129
|
-
- - '>='
|
145
|
+
- - ! '>='
|
130
146
|
- !ruby/object:Gem::Version
|
131
147
|
version: '0'
|
148
|
+
segments:
|
149
|
+
- 0
|
150
|
+
hash: 1786164620138942413
|
132
151
|
requirements: []
|
133
152
|
rubyforge_project:
|
134
|
-
rubygems_version:
|
153
|
+
rubygems_version: 1.8.23
|
135
154
|
signing_key:
|
136
|
-
specification_version:
|
155
|
+
specification_version: 3
|
137
156
|
summary: Partisan is a Ruby library that allows ActiveRecord records to be follower
|
138
157
|
and followable
|
139
158
|
test_files:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 915b00e7ddd9b09bc6a7e260e56d475a45b8daaf
|
4
|
-
data.tar.gz: affbbc560d7a023b40b85216ac65b035490a793c
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 3d1c0843ee2e7ce9c1558490f6ea37b6fdf3911a0af79959f1343a627163ec430293951233104b67438bdd59414fe32519054684d16321a64d9aec97ddf71ef1
|
7
|
-
data.tar.gz: df350de0310c0a71e68bb752d8986afc74fa0e0f5f878aefbde51782f37933c059b11dbb6b8d797ce683a68a0c9b9ffc2bc751a70dae56ae80fd7298119b9257
|