wfl_simple_activity 0.1.0 → 0.1.7
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.
- checksums.yaml +4 -4
- data/lib/generators/wfl_simple_activity/install_generator.rb +32 -0
- data/lib/generators/wfl_simple_activity/templates/activity.rb +6 -0
- data/lib/generators/wfl_simple_activity/templates/common_activity.rb +14 -0
- data/lib/generators/wfl_simple_activity/templates/create_activities.rb +23 -0
- data/lib/wfl_simple_activity/common_activity.rb +15 -0
- data/lib/wfl_simple_activity/version.rb +1 -1
- data/lib/wfl_simple_activity.rb +2 -0
- data/wfl_simple_activity-0.1.0.gem +0 -0
- data/wfl_simple_activity-0.1.1.gem +0 -0
- data/wfl_simple_activity-0.1.2.gem +0 -0
- data/wfl_simple_activity-0.1.3.gem +0 -0
- data/wfl_simple_activity-0.1.4.gem +0 -0
- data/wfl_simple_activity-0.1.5.gem +0 -0
- data/wfl_simple_activity-0.1.6.gem +0 -0
- data/wfl_simple_activity.gemspec +3 -1
- metadata +27 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0775ce1b9306fc42f12b1f40b35c0cd27039ed7ae21a0c6180b3bf59e59e2a0c
|
|
4
|
+
data.tar.gz: 3c7f4cb7f3baa96f413887e75201fab83b4baa35fd9117a8658ede67c6c3b2aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c541e7e51b33bc23f1a9af6ca343d7d87206ed5207486aaa691496d75eb282ce0fe0d93fe9096b882f79e2cd52353ffc9433d05cf442dace4d259ffb0d601857
|
|
7
|
+
data.tar.gz: d664caddcee8731b58b104980234e2fc72cd5dd0116e91fa9ec4fd2af017182b3fbe8e20ea9ea1f3541728d1f3656affeb18ad66c9f6c49d919fbcbf0ebcdaa0
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'rails/generators/base'
|
|
2
|
+
require 'rails/generators/migration'
|
|
3
|
+
require 'rails/generators/active_record'
|
|
4
|
+
|
|
5
|
+
module WflSimpleActivity
|
|
6
|
+
module Generators
|
|
7
|
+
class InstallGenerator < Rails::Generators::Base
|
|
8
|
+
include Rails::Generators::Migration
|
|
9
|
+
|
|
10
|
+
desc "Description: Create yml template for rules. Generate migration file for activities table. Create custom activity model(default to Activity)"
|
|
11
|
+
|
|
12
|
+
self.source_paths << File.join(File.dirname(__FILE__), 'templates')
|
|
13
|
+
|
|
14
|
+
def self.next_migration_number(path)
|
|
15
|
+
ActiveRecord::Generators::Base.next_migration_number(path)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def create_migration_file
|
|
19
|
+
migration_template "create_activities.rb", "db/migrate/create_activities.rb"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def copy_common_activity
|
|
23
|
+
copy_file "common_activity.rb", "app/models/common_activity.rb"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def copy_activity_model
|
|
27
|
+
copy_file "activity.rb", "config/initializers/activity.rb"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module CommonActivity
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
included do |base|
|
|
4
|
+
include PublicActivity::Model
|
|
5
|
+
tracked(
|
|
6
|
+
owner: proc { |controller, model| controller&.current_user },
|
|
7
|
+
model_changes: proc {|controller, model| model.changes},
|
|
8
|
+
recipient: proc { |controller, model| model },
|
|
9
|
+
params: {
|
|
10
|
+
request_params: proc {|controller, model| controller&.params&.to_h}
|
|
11
|
+
}
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
t.text :model_changes
|
|
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
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'public_activity'
|
|
2
|
+
module CommonActivity
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
included do |base|
|
|
5
|
+
include PublicActivity::Model
|
|
6
|
+
tracked(
|
|
7
|
+
owner: proc { |controller, model| controller&.current_user },
|
|
8
|
+
model_changes: proc {|controller, model| model.changes},
|
|
9
|
+
recipient: proc { |controller, model| model },
|
|
10
|
+
params: {
|
|
11
|
+
request_params: proc {|controller, model| controller&.params&.to_h}
|
|
12
|
+
}
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/wfl_simple_activity.rb
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/wfl_simple_activity.gemspec
CHANGED
|
@@ -27,6 +27,8 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
28
28
|
spec.require_paths = ["lib"]
|
|
29
29
|
|
|
30
|
+
spec.add_dependency "public_activity"
|
|
31
|
+
|
|
30
32
|
spec.add_development_dependency "bundler", "~> 2.0"
|
|
31
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
32
|
-
end
|
|
34
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wfl_simple_activity
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- longhaoran
|
|
@@ -10,6 +10,20 @@ bindir: exe
|
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2019-12-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: public_activity
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: bundler
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -51,8 +65,20 @@ files:
|
|
|
51
65
|
- Rakefile
|
|
52
66
|
- bin/console
|
|
53
67
|
- bin/setup
|
|
68
|
+
- lib/generators/wfl_simple_activity/install_generator.rb
|
|
69
|
+
- lib/generators/wfl_simple_activity/templates/activity.rb
|
|
70
|
+
- lib/generators/wfl_simple_activity/templates/common_activity.rb
|
|
71
|
+
- lib/generators/wfl_simple_activity/templates/create_activities.rb
|
|
54
72
|
- lib/wfl_simple_activity.rb
|
|
73
|
+
- lib/wfl_simple_activity/common_activity.rb
|
|
55
74
|
- lib/wfl_simple_activity/version.rb
|
|
75
|
+
- wfl_simple_activity-0.1.0.gem
|
|
76
|
+
- wfl_simple_activity-0.1.1.gem
|
|
77
|
+
- wfl_simple_activity-0.1.2.gem
|
|
78
|
+
- wfl_simple_activity-0.1.3.gem
|
|
79
|
+
- wfl_simple_activity-0.1.4.gem
|
|
80
|
+
- wfl_simple_activity-0.1.5.gem
|
|
81
|
+
- wfl_simple_activity-0.1.6.gem
|
|
56
82
|
- wfl_simple_activity.gemspec
|
|
57
83
|
homepage:
|
|
58
84
|
licenses: []
|