public_activity 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +7 -9
- data/lib/generators/public_activity/migration/templates/migration.rb +3 -1
- data/lib/public_activity.rb +2 -2
- data/lib/public_activity/actions/update.rb +2 -1
- data/lib/public_activity/config.rb +49 -19
- data/lib/public_activity/orm/active_record/activity.rb +15 -2
- data/lib/public_activity/orm/mongoid/activity.rb +10 -4
- data/lib/public_activity/renderable.rb +2 -1
- data/lib/public_activity/testing.rb +5 -5
- data/lib/public_activity/utility/view_helpers.rb +3 -1
- data/lib/public_activity/version.rb +1 -1
- data/test/migrations/001_create_activities.rb +1 -0
- data/test/migrations/002_create_articles.rb +4 -2
- data/test/migrations/003_create_users.rb +4 -2
- data/test/migrations/004_add_nonstandard_to_activities.rb +3 -1
- data/test/migrations_base.rb +5 -0
- data/test/mongoid.yml +2 -2
- data/test/test_activist.rb +1 -1
- data/test/test_common.rb +20 -3
- data/test/test_controller_integration.rb +3 -3
- data/test/test_helper.rb +15 -2
- data/test/test_testing.rb +5 -1
- data/test/test_tracking.rb +7 -2
- metadata +25 -8
- data/test/migrations/001_create_activities.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7898488841ef521c0116e25424aa74919e5dddb714fab5462e3c9699fa42d410
|
4
|
+
data.tar.gz: e0ab8d01799d0ed377831bd7cb89a98015385d3594a316d2d9abf73f15653f47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a6e3034bbeaa15528b77df4d514314acfbe21d527022800e2893f40b586a02ce4a73ef1c006ffcf19f9e3b7c8b7a99f3fcc4d124cdc753a52e109b9dbf1b9ca
|
7
|
+
data.tar.gz: 7cf64d2a8b18de233e963c3eab76658d0dd68f34080c64d43c33fd70dc2a4ec461402c4e9b79cd3560e38f2707ac8eb59046f3488a955977c24d1e23604ae639
|
data/README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
# PublicActivity [![Build Status](https://secure.travis-ci.org/
|
1
|
+
# PublicActivity [![Build Status](https://secure.travis-ci.org/chaps-io/public_activity.png)](http://travis-ci.org/pokonski/public_activity) [![Dependency Status](https://gemnasium.com/chaps-io/public_activity.png)](https://gemnasium.com/chaps-io/public_activity) [![Code Climate](https://codeclimate.com/github/chaps-io/public_activity.png)](https://codeclimate.com/github/chaps-io/public_activity) [![Gem Version](https://badge.fury.io/rb/public_activity.png)](http://badge.fury.io/rb/public_activity)
|
2
2
|
|
3
3
|
`public_activity` provides easy activity tracking for your **ActiveRecord**, **Mongoid 3** and **MongoMapper** models
|
4
|
-
in Rails 3. Simply put: it records what has been changed or created and gives you the ability to present those
|
4
|
+
in Rails 3.0 - 5.0. Simply put: it records what has been changed or created and gives you the ability to present those
|
5
5
|
recorded activities to users - in a similar way to how GitHub does it.
|
6
6
|
|
7
|
-
## Rails
|
8
|
-
|
9
|
-
**As of 1.4.0 version, public_activity now supports both Rails 3.X and 4.0.**
|
7
|
+
## Rails 5
|
10
8
|
|
9
|
+
**As of 1.6.0 version, public_activity also supports Rails up to 5.0.**
|
11
10
|
|
12
11
|
## Table of contents
|
13
12
|
|
@@ -177,7 +176,7 @@ The activity will be wrapped with the `app/views/layouts/_activity.erb` layout,
|
|
177
176
|
Sometimes, it's desirable to pass additional local variables to partials. It can be done this way:
|
178
177
|
|
179
178
|
```erb
|
180
|
-
<%= render_activity(@activity, locals: {friends: current_user.friends} %>
|
179
|
+
<%= render_activity(@activity, locals: {friends: current_user.friends}) %>
|
181
180
|
```
|
182
181
|
|
183
182
|
*Note*: Before 1.4.0, one could pass variables directly to the options hash for `#render_activity` and access it from activity parameters. This functionality is retained in 1.4.0 and later, but the `:locals` method is **preferred**, since it prevents bugs from shadowing variables from activity parameters in the database.
|
@@ -210,11 +209,10 @@ This structure is valid for activities with keys `"activity.article.create"` or
|
|
210
209
|
|
211
210
|
## Testing
|
212
211
|
|
213
|
-
For RSpec you can first disable `public_activity` and add the `test_helper` in
|
214
|
-
the `spec_helper.rb` with
|
212
|
+
For RSpec you can first disable `public_activity` and add the `test_helper` in `rails_helper.rb` with:
|
215
213
|
|
216
214
|
```ruby
|
217
|
-
#
|
215
|
+
#rails_helper.rb
|
218
216
|
require 'public_activity/testing'
|
219
217
|
|
220
218
|
PublicActivity.enabled = false
|
data/lib/public_activity.rb
CHANGED
@@ -27,7 +27,7 @@ module PublicActivity
|
|
27
27
|
# @param value [Boolean]
|
28
28
|
# @since 0.5.0
|
29
29
|
def self.enabled=(value)
|
30
|
-
|
30
|
+
config.enabled(value)
|
31
31
|
end
|
32
32
|
|
33
33
|
# Returns `true` if PublicActivity is on, `false` otherwise.
|
@@ -35,7 +35,7 @@ module PublicActivity
|
|
35
35
|
# @return [Boolean]
|
36
36
|
# @since 0.5.0
|
37
37
|
def self.enabled?
|
38
|
-
|
38
|
+
config.enabled
|
39
39
|
end
|
40
40
|
|
41
41
|
# Returns PublicActivity's configuration object.
|
@@ -11,7 +11,8 @@ module PublicActivity
|
|
11
11
|
|
12
12
|
# Creates activity upon modification of the tracked model
|
13
13
|
def activity_on_update
|
14
|
-
|
14
|
+
# Either use #changed? method for Rails < 5.1 or #saved_changes? for recent versions
|
15
|
+
create_activity(:update) if respond_to?(:saved_changes?) ? saved_changes? : changed?
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -4,15 +4,6 @@ module PublicActivity
|
|
4
4
|
# Class used to initialize configuration object.
|
5
5
|
class Config
|
6
6
|
include ::Singleton
|
7
|
-
attr_accessor :enabled, :table_name
|
8
|
-
|
9
|
-
@@orm = :active_record
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
# Indicates whether PublicActivity is enabled globally
|
13
|
-
@enabled = true
|
14
|
-
@table_name = "activities"
|
15
|
-
end
|
16
7
|
|
17
8
|
# Evaluates given block to provide DSL configuration.
|
18
9
|
# @example Initializer for Rails
|
@@ -23,15 +14,11 @@ module PublicActivity
|
|
23
14
|
# end
|
24
15
|
def self.set &block
|
25
16
|
b = Block.new
|
26
|
-
b.instance_eval
|
27
|
-
@@orm = b.orm unless b.orm.nil?
|
17
|
+
b.instance_eval(&block)
|
28
18
|
instance
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# Set the ORM for use by PublicActivity.
|
33
|
-
def self.orm(orm = nil)
|
34
|
-
@@orm = (orm ? orm.to_sym : false) || @@orm
|
19
|
+
orm(b.orm) unless b.orm.nil?
|
20
|
+
enabled(b.enabled) unless b.enabled.nil?
|
21
|
+
table_name(b.table_name) unless b.table_name.nil?
|
35
22
|
end
|
36
23
|
|
37
24
|
# alias for {#orm}
|
@@ -40,15 +27,58 @@ module PublicActivity
|
|
40
27
|
orm(orm)
|
41
28
|
end
|
42
29
|
|
30
|
+
# alias for {#enabled}
|
31
|
+
# @see #enabled
|
32
|
+
def self.enabled=(en = nil)
|
33
|
+
enabled(en)
|
34
|
+
end
|
35
|
+
|
43
36
|
# instance version of {Config#orm}
|
44
37
|
# @see Config#orm
|
45
38
|
def orm(orm=nil)
|
46
39
|
self.class.orm(orm)
|
47
40
|
end
|
48
41
|
|
42
|
+
# instance version of {Config#table_name}
|
43
|
+
# @see Config#orm
|
44
|
+
def table_name(name = nil)
|
45
|
+
self.class.table_name(name)
|
46
|
+
end
|
47
|
+
|
48
|
+
# instance version of {Config#enabled}
|
49
|
+
# @see Config#orm
|
50
|
+
def enabled(en = nil)
|
51
|
+
self.class.enabled(en)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Set the ORM for use by PublicActivity.
|
55
|
+
def self.orm(orm = nil)
|
56
|
+
if orm.nil?
|
57
|
+
Thread.current[:public_activity_orm] || :active_record
|
58
|
+
else
|
59
|
+
Thread.current[:public_activity_orm] = orm.to_sym
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.table_name(name = nil)
|
64
|
+
if name.nil?
|
65
|
+
Thread.current[:public_activity_table_name] || "activities"
|
66
|
+
else
|
67
|
+
Thread.current[:public_activity_table_name] = name
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.enabled(en = nil)
|
72
|
+
if en.nil?
|
73
|
+
value = Thread.current[:public_activity_enabled]
|
74
|
+
value.nil? ? true : value
|
75
|
+
else
|
76
|
+
Thread.current[:public_activity_enabled] = en
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
49
80
|
# Provides simple DSL for the config block.
|
50
81
|
class Block
|
51
|
-
attr_reader :orm, :enabled, :table_name
|
52
82
|
# @see Config#orm
|
53
83
|
def orm(orm = nil)
|
54
84
|
@orm = (orm ? orm.to_sym : false) || @orm
|
@@ -63,7 +93,7 @@ module PublicActivity
|
|
63
93
|
# Sets the table_name
|
64
94
|
# for the model
|
65
95
|
def table_name(name = nil)
|
66
|
-
|
96
|
+
@table_name = (name.nil? ? @table_name : name)
|
67
97
|
end
|
68
98
|
end
|
69
99
|
end
|
@@ -6,17 +6,30 @@ module PublicActivity
|
|
6
6
|
class Activity < ::ActiveRecord::Base
|
7
7
|
include Renderable
|
8
8
|
self.table_name = PublicActivity.config.table_name
|
9
|
+
self.abstract_class = true
|
9
10
|
|
10
11
|
# Define polymorphic association to the parent
|
11
12
|
belongs_to :trackable, :polymorphic => true
|
12
|
-
|
13
|
+
|
14
|
+
case ::ActiveRecord::VERSION::MAJOR
|
15
|
+
when 3..4
|
13
16
|
# Define ownership to a resource responsible for this activity
|
14
17
|
belongs_to :owner, :polymorphic => true
|
15
18
|
# Define ownership to a resource targeted by this activity
|
16
19
|
belongs_to :recipient, :polymorphic => true
|
20
|
+
when 5
|
21
|
+
with_options(:required => false) do
|
22
|
+
# Define ownership to a resource responsible for this activity
|
23
|
+
belongs_to :owner, :polymorphic => true
|
24
|
+
# Define ownership to a resource targeted by this activity
|
25
|
+
belongs_to :recipient, :polymorphic => true
|
26
|
+
end
|
17
27
|
end
|
28
|
+
|
18
29
|
# Serialize parameters Hash
|
19
|
-
|
30
|
+
if table_exists? && ![:json, :jsonb, :hstore].include?(columns_hash['parameters'].type)
|
31
|
+
serialize :parameters, Hash
|
32
|
+
end
|
20
33
|
|
21
34
|
if ::ActiveRecord::VERSION::MAJOR < 4 || defined?(ProtectedAttributes)
|
22
35
|
attr_accessible :key, :owner, :parameters, :recipient, :trackable
|
@@ -8,15 +8,21 @@ module PublicActivity
|
|
8
8
|
class Activity
|
9
9
|
include ::Mongoid::Document
|
10
10
|
include ::Mongoid::Timestamps
|
11
|
-
include ::Mongoid::Attributes::Dynamic if
|
11
|
+
include ::Mongoid::Attributes::Dynamic if ::Mongoid::VERSION.split('.')[0].to_i >= 4
|
12
12
|
include Renderable
|
13
13
|
|
14
|
+
if ::Mongoid::VERSION.split('.')[0].to_i >= 7
|
15
|
+
opts = { polymorphic: true, optional: false }
|
16
|
+
else
|
17
|
+
opts = { polymorphic: true }
|
18
|
+
end
|
19
|
+
|
14
20
|
# Define polymorphic association to the parent
|
15
|
-
belongs_to :trackable,
|
21
|
+
belongs_to :trackable, opts
|
16
22
|
# Define ownership to a resource responsible for this activity
|
17
|
-
belongs_to :owner,
|
23
|
+
belongs_to :owner, opts
|
18
24
|
# Define ownership to a resource targeted by this activity
|
19
|
-
belongs_to :recipient,
|
25
|
+
belongs_to :recipient, opts
|
20
26
|
|
21
27
|
field :key, type: String
|
22
28
|
field :parameters, type: Hash
|
@@ -100,7 +100,8 @@ module PublicActivity
|
|
100
100
|
|
101
101
|
if params.has_key? :display
|
102
102
|
if params[:display].to_sym == :"i18n"
|
103
|
-
|
103
|
+
text = self.text(params)
|
104
|
+
return context.render :text => text, :plain => text
|
104
105
|
else
|
105
106
|
partial_path = File.join(partial_root, params[:display].to_s)
|
106
107
|
end
|
@@ -12,11 +12,11 @@ module PublicActivity
|
|
12
12
|
# # your test code here
|
13
13
|
# end
|
14
14
|
def self.with_tracking
|
15
|
-
current = PublicActivity.enabled
|
16
|
-
PublicActivity.enabled
|
15
|
+
current = PublicActivity.config.enabled
|
16
|
+
PublicActivity.config.enabled(true)
|
17
17
|
yield
|
18
18
|
ensure
|
19
|
-
PublicActivity.enabled
|
19
|
+
PublicActivity.config.enabled(current)
|
20
20
|
end
|
21
21
|
|
22
22
|
# Execute the code block with PublicActiviy deactive
|
@@ -27,9 +27,9 @@ module PublicActivity
|
|
27
27
|
# end
|
28
28
|
def self.without_tracking
|
29
29
|
current = PublicActivity.enabled?
|
30
|
-
PublicActivity.enabled
|
30
|
+
PublicActivity.config.enabled(false)
|
31
31
|
yield
|
32
32
|
ensure
|
33
|
-
PublicActivity.enabled
|
33
|
+
PublicActivity.config.enabled(current)
|
34
34
|
end
|
35
35
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
test/migrations/../../lib/generators/public_activity/migration/templates/migration.rb
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'migrations_base.rb'
|
2
|
+
|
3
|
+
class CreateArticles < MigrationsBase
|
2
4
|
def self.up
|
3
5
|
puts "creating"
|
4
6
|
create_table :articles do |t|
|
@@ -8,4 +10,4 @@ class CreateArticles < ActiveRecord::Migration
|
|
8
10
|
t.timestamps
|
9
11
|
end
|
10
12
|
end
|
11
|
-
end
|
13
|
+
end
|
data/test/mongoid.yml
CHANGED
data/test/test_activist.rb
CHANGED
data/test/test_common.rb
CHANGED
@@ -48,6 +48,16 @@ describe PublicActivity::Common do
|
|
48
48
|
subject.create_activity("some.key").wont_be_nil
|
49
49
|
end
|
50
50
|
|
51
|
+
it 'update action should not create activity on save unless model changed' do
|
52
|
+
subject.save
|
53
|
+
before_count = subject.activities.count
|
54
|
+
subject.save
|
55
|
+
subject.save
|
56
|
+
after_count = subject.activities.count
|
57
|
+
before_count.must_equal after_count
|
58
|
+
end
|
59
|
+
|
60
|
+
|
51
61
|
it 'allows passing owner through #create_activity' do
|
52
62
|
article = article().new
|
53
63
|
article.save
|
@@ -94,6 +104,13 @@ describe PublicActivity::Common do
|
|
94
104
|
activity.owner.must_equal @owner
|
95
105
|
end
|
96
106
|
|
107
|
+
it 'reports PublicActivity::Activity as the base class' do
|
108
|
+
if ENV["PA_ORM"] == "active_record" # Only relevant for ActiveRecord
|
109
|
+
subject.save
|
110
|
+
subject.activities.last.class.base_class.must_equal PublicActivity::Activity
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
97
114
|
describe '#prepare_key' do
|
98
115
|
describe 'for class#activity_key method' do
|
99
116
|
before do
|
@@ -156,9 +173,9 @@ describe PublicActivity::Common do
|
|
156
173
|
controller = mock('controller')
|
157
174
|
controller.expects(:current_user).returns(:cu)
|
158
175
|
PublicActivity.set_controller(controller)
|
159
|
-
p = proc {|
|
160
|
-
assert_equal :cu,
|
161
|
-
assert_equal 5,
|
176
|
+
p = proc {|c, m|
|
177
|
+
assert_equal :cu, c.current_user
|
178
|
+
assert_equal 5, m.accessor
|
162
179
|
}
|
163
180
|
PublicActivity.resolve_value(context, p)
|
164
181
|
PublicActivity.resolve_value(context, :accessor)
|
@@ -2,7 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class StoringController < ActionView::TestCase::TestController
|
4
4
|
include PublicActivity::StoreController
|
5
|
-
include ActionController::Testing
|
5
|
+
include ActionController::Testing
|
6
6
|
end
|
7
7
|
|
8
8
|
describe PublicActivity::StoreController do
|
@@ -27,9 +27,9 @@ describe PublicActivity::StoreController do
|
|
27
27
|
PublicActivity.set_controller(1)
|
28
28
|
PublicActivity.get_controller.must_equal 1
|
29
29
|
|
30
|
-
|
30
|
+
Thread.new {
|
31
31
|
PublicActivity.set_controller(2)
|
32
|
-
PublicActivity.get_controller
|
32
|
+
assert_equal 2, PublicActivity.get_controller
|
33
33
|
PublicActivity.set_controller(nil)
|
34
34
|
}
|
35
35
|
|
data/test/test_helper.rb
CHANGED
@@ -14,6 +14,7 @@ require 'public_activity'
|
|
14
14
|
require 'public_activity/testing'
|
15
15
|
require 'pry'
|
16
16
|
require 'minitest/autorun'
|
17
|
+
require 'mocha/minitest'
|
17
18
|
|
18
19
|
PublicActivity::Config.orm = (ENV['PA_ORM'] || :active_record)
|
19
20
|
|
@@ -24,7 +25,15 @@ when :active_record
|
|
24
25
|
require 'stringio' # silence the output
|
25
26
|
$stdout = StringIO.new # from migrator
|
26
27
|
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
|
27
|
-
|
28
|
+
|
29
|
+
migrations_path = File.expand_path('../migrations', __FILE__)
|
30
|
+
|
31
|
+
if ActiveRecord.version.release() < Gem::Version.new('5.2.0')
|
32
|
+
ActiveRecord::Migrator.migrate(migrations_path)
|
33
|
+
else
|
34
|
+
ActiveRecord::MigrationContext.new(migrations_path).migrate
|
35
|
+
end
|
36
|
+
|
28
37
|
$stdout = STDOUT
|
29
38
|
|
30
39
|
def article(options = {})
|
@@ -70,7 +79,11 @@ when :mongoid
|
|
70
79
|
include Mongoid::Timestamps
|
71
80
|
include PublicActivity::Model
|
72
81
|
|
73
|
-
|
82
|
+
if ::Mongoid::VERSION.split('.')[0].to_i >= 7
|
83
|
+
belongs_to :user, optional: true
|
84
|
+
else
|
85
|
+
belongs_to :user
|
86
|
+
end
|
74
87
|
|
75
88
|
field :name, type: String
|
76
89
|
field :published, type: Boolean
|
data/test/test_testing.rb
CHANGED
@@ -2,6 +2,10 @@ require 'test_helper'
|
|
2
2
|
describe PublicActivity do
|
3
3
|
|
4
4
|
describe "self.with_tracking" do
|
5
|
+
after do
|
6
|
+
PublicActivity.enabled = true
|
7
|
+
end
|
8
|
+
|
5
9
|
it "enables tracking inside the block" do
|
6
10
|
PublicActivity.enabled = false
|
7
11
|
|
@@ -28,4 +32,4 @@ describe PublicActivity do
|
|
28
32
|
end
|
29
33
|
end
|
30
34
|
end
|
31
|
-
end
|
35
|
+
end
|
data/test/test_tracking.rb
CHANGED
@@ -33,7 +33,11 @@ describe PublicActivity::Tracked do
|
|
33
33
|
include Mongoid::Timestamps
|
34
34
|
include PublicActivity::Model
|
35
35
|
|
36
|
-
|
36
|
+
if ::Mongoid::VERSION.split('.')[0].to_i >= 7
|
37
|
+
belongs_to :user, optional: true
|
38
|
+
else
|
39
|
+
belongs_to :user
|
40
|
+
end
|
37
41
|
|
38
42
|
field :name, type: String
|
39
43
|
field :published, type: Boolean
|
@@ -70,7 +74,7 @@ describe PublicActivity::Tracked do
|
|
70
74
|
art = ActivistAndTrackedArticle.new
|
71
75
|
art.save
|
72
76
|
art.activities.last.trackable_id.must_equal art.id
|
73
|
-
art.activities.last.owner_id
|
77
|
+
assert_nil art.activities.last.owner_id
|
74
78
|
end
|
75
79
|
|
76
80
|
describe 'custom fields' do
|
@@ -154,6 +158,7 @@ describe PublicActivity::Tracked do
|
|
154
158
|
PublicActivity::Activity.count.must_equal activity_count_before
|
155
159
|
|
156
160
|
klass.public_activity_on
|
161
|
+
@article.name = 'Changed Article'
|
157
162
|
@article.save
|
158
163
|
PublicActivity::Activity.count.must_be :>, activity_count_before
|
159
164
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: public_activity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotrek Okoński
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -87,14 +87,14 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
90
|
+
version: 1.5.0
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
97
|
+
version: 1.5.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: simplecov
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: 0.7.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: test-unit
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 3.2.8
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 3.2.8
|
112
126
|
- !ruby/object:Gem::Dependency
|
113
127
|
name: minitest
|
114
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,14 +157,14 @@ dependencies:
|
|
143
157
|
requirements:
|
144
158
|
- - "~>"
|
145
159
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
160
|
+
version: 0.9.11
|
147
161
|
type: :development
|
148
162
|
prerelease: false
|
149
163
|
version_requirements: !ruby/object:Gem::Requirement
|
150
164
|
requirements:
|
151
165
|
- - "~>"
|
152
166
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
167
|
+
version: 0.9.11
|
154
168
|
- !ruby/object:Gem::Dependency
|
155
169
|
name: pry
|
156
170
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,6 +235,7 @@ files:
|
|
221
235
|
- test/migrations/002_create_articles.rb
|
222
236
|
- test/migrations/003_create_users.rb
|
223
237
|
- test/migrations/004_add_nonstandard_to_activities.rb
|
238
|
+
- test/migrations_base.rb
|
224
239
|
- test/mongo_mapper.yml
|
225
240
|
- test/mongoid.yml
|
226
241
|
- test/test_activist.rb
|
@@ -237,7 +252,8 @@ files:
|
|
237
252
|
- test/views/layouts/_activity.erb
|
238
253
|
- test/views/public_activity/_test.erb
|
239
254
|
homepage: https://github.com/pokonski/public_activity
|
240
|
-
licenses:
|
255
|
+
licenses:
|
256
|
+
- MIT
|
241
257
|
metadata: {}
|
242
258
|
post_install_message:
|
243
259
|
rdoc_options: []
|
@@ -255,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
271
|
version: '0'
|
256
272
|
requirements: []
|
257
273
|
rubyforge_project:
|
258
|
-
rubygems_version: 2.
|
274
|
+
rubygems_version: 2.7.6
|
259
275
|
signing_key:
|
260
276
|
specification_version: 4
|
261
277
|
summary: Easy activity tracking for ActiveRecord models
|
@@ -264,6 +280,7 @@ test_files:
|
|
264
280
|
- test/migrations/002_create_articles.rb
|
265
281
|
- test/migrations/003_create_users.rb
|
266
282
|
- test/migrations/004_add_nonstandard_to_activities.rb
|
283
|
+
- test/migrations_base.rb
|
267
284
|
- test/mongo_mapper.yml
|
268
285
|
- test/mongoid.yml
|
269
286
|
- test/test_activist.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# Migration responsible for creating a table with activities
|
2
|
-
class CreateActivities < ActiveRecord::Migration
|
3
|
-
# Create table
|
4
|
-
def self.up
|
5
|
-
create_table :activities do |t|
|
6
|
-
t.belongs_to :trackable, :polymorphic => true
|
7
|
-
t.belongs_to :owner, :polymorphic => true
|
8
|
-
t.string :key
|
9
|
-
t.text :parameters
|
10
|
-
t.belongs_to :recipient, :polymorphic => true
|
11
|
-
|
12
|
-
t.timestamps
|
13
|
-
end
|
14
|
-
|
15
|
-
add_index :activities, [:trackable_id, :trackable_type]
|
16
|
-
add_index :activities, [:owner_id, :owner_type]
|
17
|
-
add_index :activities, [:recipient_id, :recipient_type]
|
18
|
-
end
|
19
|
-
# Drop table
|
20
|
-
def self.down
|
21
|
-
drop_table :activities
|
22
|
-
end
|
23
|
-
end
|