public_activity 0.3.4 → 0.4.0.rc1

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.
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: public_activity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
5
- prerelease:
4
+ version: 0.4.0.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Piotrek Okoński
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-14 00:00:00.000000000 Z
13
+ date: 2012-08-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -44,6 +44,22 @@ dependencies:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: 3.0.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: actionpack
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 3.0.0
47
63
  - !ruby/object:Gem::Dependency
48
64
  name: i18n
49
65
  requirement: !ruby/object:Gem::Requirement
@@ -61,23 +77,55 @@ dependencies:
61
77
  - !ruby/object:Gem::Version
62
78
  version: 0.5.0
63
79
  - !ruby/object:Gem::Dependency
64
- name: pusher
80
+ name: simplecov
65
81
  requirement: !ruby/object:Gem::Requirement
66
82
  none: false
67
83
  requirements:
68
84
  - - ! '>='
69
85
  - !ruby/object:Gem::Version
70
- version: '0'
71
- type: :runtime
86
+ version: 0.6.4
87
+ type: :development
72
88
  prerelease: false
73
89
  version_requirements: !ruby/object:Gem::Requirement
74
90
  none: false
75
91
  requirements:
76
92
  - - ! '>='
77
93
  - !ruby/object:Gem::Version
78
- version: '0'
94
+ version: 0.6.4
95
+ - !ruby/object:Gem::Dependency
96
+ name: bundler
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '1.1'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '1.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0.9'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0.9'
79
127
  - !ruby/object:Gem::Dependency
80
- name: rspec
128
+ name: sqlite3
81
129
  requirement: !ruby/object:Gem::Requirement
82
130
  none: false
83
131
  requirements:
@@ -92,6 +140,38 @@ dependencies:
92
140
  - - ! '>='
93
141
  - !ruby/object:Gem::Version
94
142
  version: '0'
143
+ - !ruby/object:Gem::Dependency
144
+ name: mocha
145
+ requirement: !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ! '>='
149
+ - !ruby/object:Gem::Version
150
+ version: 0.12.1
151
+ type: :development
152
+ prerelease: false
153
+ version_requirements: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: 0.12.1
159
+ - !ruby/object:Gem::Dependency
160
+ name: rails
161
+ requirement: !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: 3.0.0
167
+ type: :development
168
+ prerelease: false
169
+ version_requirements: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: 3.0.0
95
175
  description: Smooth activity tracking for your ActiveRecord models. Provides Activity
96
176
  model with details about actions performed by your users, like adding comments,
97
177
  responding etc.
@@ -101,32 +181,27 @@ extensions: []
101
181
  extra_rdoc_files: []
102
182
  files:
103
183
  - lib/generators/public_activity.rb
184
+ - lib/generators/public_activity/activity/activity_generator.rb
185
+ - lib/generators/public_activity/activity/templates/activity.rb
104
186
  - lib/generators/public_activity/migration/migration_generator.rb
105
187
  - lib/generators/public_activity/migration/templates/migration.rb
188
+ - lib/generators/public_activity/migration_upgrade/migration_upgrade_generator.rb
189
+ - lib/generators/public_activity/migration_upgrade/templates/upgrade.rb
106
190
  - lib/public_activity.rb
107
191
  - lib/public_activity/activist.rb
108
192
  - lib/public_activity/activity.rb
109
193
  - lib/public_activity/common.rb
110
194
  - lib/public_activity/creation.rb
111
195
  - lib/public_activity/destruction.rb
196
+ - lib/public_activity/store_controller.rb
112
197
  - lib/public_activity/tracked.rb
113
198
  - lib/public_activity/update.rb
114
199
  - lib/public_activity/version.rb
200
+ - lib/public_activity/view_helpers.rb
115
201
  - Gemfile
116
202
  - Rakefile
117
203
  - README.md
118
204
  - MIT-LICENSE
119
- - spec/db/database.yml
120
- - spec/db/schema.rb
121
- - spec/fixtures/categories.yml
122
- - spec/fixtures/departments.yml
123
- - spec/fixtures/notes.yml
124
- - spec/public_activity_spec.rb
125
- - spec/spec_helper.rb
126
- - spec/support/en.yml
127
- - spec/support/models.rb
128
- - spec/support/pba.yml
129
- - spec/version_spec.rb
130
205
  homepage: https://github.com/pokonski/public_activity
131
206
  licenses: []
132
207
  post_install_message:
@@ -138,29 +213,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
213
  requirements:
139
214
  - - ! '>='
140
215
  - !ruby/object:Gem::Version
141
- version: '0'
216
+ version: 1.8.7
142
217
  required_rubygems_version: !ruby/object:Gem::Requirement
143
218
  none: false
144
219
  requirements:
145
- - - ! '>='
220
+ - - ! '>'
146
221
  - !ruby/object:Gem::Version
147
- version: '0'
222
+ version: 1.3.1
148
223
  requirements: []
149
224
  rubyforge_project:
150
225
  rubygems_version: 1.8.24
151
226
  signing_key:
152
227
  specification_version: 3
153
228
  summary: Smooth activity tracking for ActiveRecord models
154
- test_files:
155
- - spec/db/database.yml
156
- - spec/db/schema.rb
157
- - spec/fixtures/categories.yml
158
- - spec/fixtures/departments.yml
159
- - spec/fixtures/notes.yml
160
- - spec/public_activity_spec.rb
161
- - spec/spec_helper.rb
162
- - spec/support/en.yml
163
- - spec/support/models.rb
164
- - spec/support/pba.yml
165
- - spec/version_spec.rb
229
+ test_files: []
166
230
  has_rdoc:
data/spec/db/database.yml DELETED
@@ -1,18 +0,0 @@
1
- sqlite3:
2
- adapter: <%= "jdbc" if defined? JRUBY_VERSION %>sqlite3
3
- database: awesome_nested_set.sqlite3.db
4
- sqlite3mem:
5
- adapter: <%= "jdbc" if defined? JRUBY_VERSION %>sqlite3
6
- database: ":memory:"
7
- postgresql:
8
- adapter: postgresql
9
- username: postgres
10
- password: postgres
11
- database: public_activity_plugin_test
12
- min_messages: ERROR
13
- mysql:
14
- adapter: mysql2
15
- host: localhost
16
- username: root
17
- password:
18
- database: public_activity_plugin_test
data/spec/db/schema.rb DELETED
@@ -1,27 +0,0 @@
1
- ActiveRecord::Schema.define(:version => 0) do
2
-
3
- create_table :categories, :force => true do |t|
4
- t.column :name, :string
5
- end
6
-
7
- create_table :departments, :force => true do |t|
8
- t.column :name, :string
9
- end
10
-
11
- create_table :notes, :force => true do |t|
12
- t.column :body, :text
13
- t.column :category_id, :integer
14
- end
15
-
16
- create_table :activities, :force => true do |t|
17
- t.integer :trackable_id
18
- t.string :trackable_type
19
- t.integer :owner_id
20
- t.string :owner_type
21
- t.string :key
22
- t.text :parameters
23
- t.datetime :created_at
24
- t.datetime :updated_at
25
- end
26
-
27
- end
@@ -1,18 +0,0 @@
1
- cat1:
2
- id: 1
3
- name: Category 1
4
- cat2:
5
- id: 2
6
- name: Category 2
7
- cat3:
8
- id: 3
9
- name: Category 3
10
- cat4:
11
- id: 4
12
- name: Category 4
13
- cat5:
14
- id: 5
15
- name: Category 5
16
- cat6:
17
- id: 6
18
- name: Category 6
@@ -1,3 +0,0 @@
1
- top:
2
- id: 1
3
- name: Dept 1
@@ -1,8 +0,0 @@
1
- note1:
2
- id: 1
3
- body: Note 1
4
- category_id: 1
5
- note2:
6
- id: 2
7
- body: Note 2
8
- category_id: 200
@@ -1,131 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "public_activity" do
4
- before(:all) do
5
- self.class.fixtures :categories, :departments, :notes
6
- end
7
-
8
- describe "tracked" do
9
-
10
- it "should create a record in activity table" do
11
- #we should have no records
12
- PublicActivity::Activity.count.should == 0
13
-
14
- lambda do
15
- category = Category.create(:name => "test cat")
16
- activity = PublicActivity::Activity.last
17
- activity.trackable_id.should == category.id
18
- end.should change(PublicActivity::Activity, :count).by(1)
19
- end
20
-
21
- describe "activity model" do
22
- before(:each) do
23
- @category = Category.create(:name => "test cat")
24
- end
25
-
26
- it "should have a nil owner" do
27
- activity = PublicActivity::Activity.last
28
- activity.owner.should be_nil
29
- end
30
-
31
- it "should have an owner" do
32
- department = Department.create(:name => "test dept")
33
- @category.activity_owner = department
34
- @category.save
35
-
36
- activity = PublicActivity::Activity.last
37
- activity.owner.should_not be_nil
38
- end
39
-
40
- it "should have activites" do
41
- @category.activities.should_not be_nil
42
- end
43
-
44
- it "should translate" do
45
- @category.activities.last.text.should_not be_nil
46
- @category.activities.last.text.should == "New test cat category has been created"
47
- end
48
-
49
- it "should track deletes" do
50
- lambda do
51
- @category.destroy
52
- @category.activities.last.text.should == "Someone deleted the category!"
53
- end.should change(PublicActivity::Activity, :count).by(1)
54
- end
55
-
56
- it "should track updates" do
57
- lambda do
58
- @category.name = "new cat"
59
- @category.save
60
- @category.activities.last.text.should == "Someone modified the category"
61
- end.should change(PublicActivity::Activity, :count).by(1)
62
- end
63
-
64
- it "should evaluate associations" do
65
- note = Note.find(1)
66
- note.body = "New Test"
67
- note.save
68
- note.activities.last.text.should == "Someone modified note New Test with category Category 1"
69
- end
70
- end
71
-
72
- describe "tracked options" do
73
- it "should not track destroy for note (only)" do
74
- lambda do
75
- note = Note.find(1)
76
- note.destroy
77
- end.should change(PublicActivity::Activity, :count).by(0)
78
- end
79
-
80
- it "should not track create for department (except)" do
81
- lambda do
82
- dept = Department.find(1)
83
- dept.name = "new name"
84
- dept.save
85
- end.should change(PublicActivity::Activity, :count).by(1)
86
-
87
- lambda do
88
- dept = Department.find(1)
89
- dept.destroy
90
- end.should change(PublicActivity::Activity, :count).by(1)
91
-
92
- lambda do
93
- dept = Department.new
94
- dept.name = "some name"
95
- dept.save
96
- end.should change(PublicActivity::Activity, :count).by(0)
97
-
98
- end
99
- end
100
- end
101
-
102
- describe "activist" do
103
-
104
- before(:each) do
105
- @category = Category.create(:name => "test cat")
106
- @department = Department.create(:name => "test dept")
107
- @category.activity_owner = @department
108
- @category.save
109
- end
110
-
111
- it "should have activites" do
112
- @department.activities.should_not be_nil
113
- end
114
- end
115
-
116
- describe "template failures" do
117
- it "should not die on nil" do
118
- PublicActivity::Activity.template = nil
119
- @category = Category.create(:name => "test cat")
120
- @category.activities.last.text.should == "Template not defined"
121
- end
122
-
123
- it "should evaluate associations" do
124
- note = Note.find(2)
125
- note.body = "New Test"
126
- note.save
127
- note.activities.last.text.should == "Template not defined"
128
- end
129
-
130
- end
131
- end
data/spec/spec_helper.rb DELETED
@@ -1,34 +0,0 @@
1
- $:.unshift(File.dirname(__FILE__) + '/../lib')
2
- plugin_test_dir = File.dirname(__FILE__)
3
-
4
- require 'rubygems'
5
- require 'bundler/setup'
6
-
7
- require 'rspec'
8
- require 'logger'
9
-
10
- require 'active_support'
11
- require 'active_model'
12
- require 'active_record'
13
- require 'action_controller'
14
-
15
- require 'public_activity'
16
- PublicActivity::Activity.template = YAML.load_file(plugin_test_dir + "/support/pba.yml")
17
-
18
- ActiveRecord::Base.logger = Logger.new(plugin_test_dir + "/debug.log")
19
-
20
- require 'yaml'
21
- require 'erb'
22
- ActiveRecord::Base.configurations = YAML::load(ERB.new(IO.read(plugin_test_dir + "/db/database.yml")).result)
23
- ActiveRecord::Base.establish_connection(ENV["DB"] || "sqlite3mem")
24
- ActiveRecord::Migration.verbose = false
25
- load(File.join(plugin_test_dir, "db", "schema.rb"))
26
- I18n.load_path += Dir[plugin_test_dir + "/support/en.yml"]
27
-
28
- require 'support/models'
29
-
30
- require 'rspec/rails'
31
- RSpec.configure do |config|
32
- config.fixture_path = "#{plugin_test_dir}/fixtures"
33
- config.use_transactional_fixtures = true
34
- end
data/spec/support/en.yml DELETED
@@ -1,6 +0,0 @@
1
- en:
2
- activity:
3
- category:
4
- create: 'New category has been created'
5
- update: 'Someone modified the category'
6
- destroy: 'Someone deleted the category!'
@@ -1,14 +0,0 @@
1
- class Department < ActiveRecord::Base
2
- tracked(:except => [:create])
3
- activist
4
- end
5
-
6
- class Category < ActiveRecord::Base
7
- tracked(:only => [:create, :update, :destroy])
8
- validates_presence_of :name
9
- end
10
-
11
- class Note < ActiveRecord::Base
12
- tracked(:only => [:update])
13
- belongs_to :category
14
- end
data/spec/support/pba.yml DELETED
@@ -1,9 +0,0 @@
1
- activity:
2
- category:
3
- create: "New <%= trackable.name %> category has been created"
4
- update: 'Someone modified the category'
5
- destroy: 'Someone deleted the category!'
6
- note:
7
- create: "New note <%= trackable.body %> has been created"
8
- update: 'Someone modified note <%= trackable.body %> with category <%= trackable.category.name %>'
9
- destroy: 'Someone deleted the note!'
data/spec/version_spec.rb DELETED
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe PublicActivity, 'VERSION' do
4
- it 'is present' do
5
- PublicActivity::VERSION.should_not be_nil
6
- end
7
-
8
- #it 'is frozen' do
9
- # PublicActivity::VERSION.frozen?.should be(true)
10
- #end
11
- end