models_auditor 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/lib/capistrano/rails/audit_migrations.rb +1 -0
- data/lib/capistrano/tasks/audit_migrations.rake +33 -0
- data/lib/models_auditor/audit.rb +1 -1
- data/lib/models_auditor/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eefac2c75092c811395c67fbf5731b6bbf9cae0
|
4
|
+
data.tar.gz: fc29fe418d8f1943acb71da82388b802e7e15cd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0fd677022be453b8d61bcde43aa491186c8e61f0accc2e4cbc4d17c50484be725d9366ca93354e03bf90ff23cd9ba18d171afc9ec2cf7ecb70eb1497d126e55
|
7
|
+
data.tar.gz: 06457a6d6ac6c0a9ef8e23e5b85153ecf82f606d77ef8e58af0411feaeca7d892c6f0ae1b4eed049cf99d88f1be6d74f5ab5e03458dcc4b4c4c2a3ec9900123d
|
data/README.md
CHANGED
@@ -108,5 +108,22 @@ If you want to use a database prefix not from config. You may specify it as an a
|
|
108
108
|
|
109
109
|
`rake db:audit:create[audit_shmaudit]`
|
110
110
|
|
111
|
+
## Capistrano
|
112
|
+
|
113
|
+
Add line to the Capfile
|
114
|
+
|
115
|
+
`require 'models_auditor/capistrano/rails/audit_migrations'`
|
116
|
+
|
117
|
+
**Migrate**
|
118
|
+
|
119
|
+
The capistrano migrate task
|
120
|
+
|
121
|
+
`cap deploy:audit_migrate`
|
122
|
+
|
123
|
+
will be executed automatically after `deploy:migrate` cap task
|
124
|
+
|
125
|
+
**Rollback**
|
126
|
+
|
127
|
+
`cap deploy:audit_rollback`
|
111
128
|
|
112
129
|
This project rocks and uses MIT-LICENSE.
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../../tasks/audit_migrations.rake', __FILE__)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
|
3
|
+
desc 'Runs rake db:audit:migrate if migrations are set'
|
4
|
+
task :audit_migrate do
|
5
|
+
on primary fetch(:migration_role) do
|
6
|
+
info '[deploy:audit_migrate] Checking changes in /db/audit_migrate'
|
7
|
+
if test("diff -q #{release_path}/db/audit_migrate #{current_path}/db/audit_migrate")
|
8
|
+
info '[deploy:audit_migrate] Skip `deploy:audit_migrate` (nothing changed in db/audit_migrate)'
|
9
|
+
else
|
10
|
+
info '[deploy:audit_migrate] Run `rake db:audit:migrate`'
|
11
|
+
within release_path do
|
12
|
+
with rails_env: fetch(:rails_env) do
|
13
|
+
execute :rake, 'db:audit:migrate'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Runs rake db:audit:rollback'
|
21
|
+
task :audit_rollback do
|
22
|
+
on primary fetch(:migration_role) do
|
23
|
+
info '[deploy:audit_rollback] Run `rake db:audit:rollback`'
|
24
|
+
within release_path do
|
25
|
+
with rails_env: fetch(:rails_env) do
|
26
|
+
execute :rake, 'db:audit:rollback'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
after 'deploy:migrate', 'deploy:audit_migrate'
|
33
|
+
end
|
data/lib/models_auditor/audit.rb
CHANGED
@@ -85,7 +85,7 @@ module ModelsAuditor
|
|
85
85
|
ModelsAuditor.log_error(record.errors.full_messages)
|
86
86
|
end
|
87
87
|
end
|
88
|
-
rescue
|
88
|
+
rescue StandardError => e
|
89
89
|
ModelsAuditor.log_error("Couldn't logged changes of #{self.class.name} id: #{self.try(:id)}")
|
90
90
|
ModelsAuditor.log_error(e.message)
|
91
91
|
ModelsAuditor.log_error(e.backtrace.take(100).join("\n"))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: models_auditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Gorbunov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -133,6 +133,8 @@ files:
|
|
133
133
|
- app/views/models_auditor/audit/index.html.erb
|
134
134
|
- config/config_option_descriptions.yml
|
135
135
|
- config/routes.rb
|
136
|
+
- lib/capistrano/rails/audit_migrations.rb
|
137
|
+
- lib/capistrano/tasks/audit_migrations.rake
|
136
138
|
- lib/generators/models_auditor/db_config/USAGE
|
137
139
|
- lib/generators/models_auditor/db_config/db_config_generator.rb
|
138
140
|
- lib/generators/models_auditor/install/USAGE
|