effective_logging 1.5.9 → 1.6.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 +8 -3
- data/app/controllers/admin/logs_controller.rb +3 -1
- data/app/controllers/effective/logs_controller.rb +1 -1
- data/app/views/active_admin/effective_logging/logs/index.html.haml +3 -1
- data/app/views/admin/logs/index.html.haml +2 -3
- data/app/views/admin/logs/show.html.haml +2 -1
- data/app/views/effective/logs/index.html.haml +4 -2
- data/app/views/effective/logs/show.html.haml +2 -1
- data/{lib/generators/templates → config}/effective_logging.rb +1 -2
- data/lib/effective_logging/engine.rb +1 -1
- data/lib/effective_logging/version.rb +1 -1
- data/lib/generators/effective_logging/install_generator.rb +4 -8
- metadata +4 -9
- data/lib/generators/templates/README +0 -1
- data/spec/effective_logging_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df044f4842187ae687d8fce22ece707399782c32
|
4
|
+
data.tar.gz: d08801613da6ca975bd5fc0fb90834059b221bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61c6a3249e84bb44fcd75af0fcd5d884f23482d6c9b63355f500aa5269ffd3343ce50e774878f4c16a5aa44a862e6eabe89759a4531b0dc47a3b041e4ada3a29
|
7
|
+
data.tar.gz: 33b56849e5103f98ca13091eae5fe92c944a20c23c0a3136f188d22b570addc2e68a5cf13c01ccd41158f69e62a5193cbfd6522cf59954589d1eed676a4eb569
|
data/README.md
CHANGED
@@ -301,6 +301,14 @@ Then you should be able to visit:
|
|
301
301
|
link_to 'Logs', effective_logging.admin_logs_path # /admin/logs
|
302
302
|
```
|
303
303
|
|
304
|
+
But you may need to add the permission (using CanCan):
|
305
|
+
|
306
|
+
```ruby
|
307
|
+
can :manage, Effective::Log
|
308
|
+
can :admin, :effective_logging
|
309
|
+
```
|
310
|
+
|
311
|
+
|
304
312
|
### Build an All Logs Screen
|
305
313
|
|
306
314
|
If you don't want to use the builtin Admin screen, and would rather render the effective_datatable of logs elsewhere
|
@@ -335,9 +343,6 @@ In your controller:
|
|
335
343
|
|
336
344
|
MIT License. Copyright [Code and Effect Inc.](http://www.codeandeffect.com/)
|
337
345
|
|
338
|
-
Code and Effect is the product arm of [AgileStyle](http://www.agilestyle.com/), an Edmonton-based shop that specializes in building custom web applications with Ruby on Rails.
|
339
|
-
|
340
|
-
|
341
346
|
## Testing
|
342
347
|
|
343
348
|
The test suite for this gem is unfortunately not yet complete.
|
@@ -8,10 +8,11 @@ module Admin
|
|
8
8
|
helper EffectiveLoggingHelper
|
9
9
|
|
10
10
|
def index
|
11
|
-
@datatable = Effective::Datatables::Logs.new()
|
11
|
+
@datatable = Effective::Datatables::Logs.new()
|
12
12
|
@page_title = 'Logs'
|
13
13
|
|
14
14
|
EffectiveLogging.authorized?(self, :index, Effective::Log)
|
15
|
+
EffectiveLogging.authorized?(self, :admin, :effective_logging)
|
15
16
|
end
|
16
17
|
|
17
18
|
def show
|
@@ -26,6 +27,7 @@ module Admin
|
|
26
27
|
end
|
27
28
|
|
28
29
|
EffectiveLogging.authorized?(self, :show, @log)
|
30
|
+
EffectiveLogging.authorized?(self, :admin, :effective_logging)
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
@@ -40,7 +40,7 @@ module Effective
|
|
40
40
|
|
41
41
|
# This is the User index event
|
42
42
|
def index
|
43
|
-
@datatable = Effective::Datatables::Logs.new(:user_id => current_user.id)
|
43
|
+
@datatable = Effective::Datatables::Logs.new(:user_id => current_user.id)
|
44
44
|
@page_title = 'My Activity'
|
45
45
|
|
46
46
|
EffectiveLogging.authorized?(self, :index, Effective::Log.new(:user_id => current_user.id))
|
@@ -21,7 +21,7 @@ EffectiveLogging.setup do |config|
|
|
21
21
|
#
|
22
22
|
# Or disable the check completely:
|
23
23
|
# config.authorization_method = false
|
24
|
-
config.authorization_method = Proc.new { |controller, action, resource|
|
24
|
+
config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) } # CanCanCan
|
25
25
|
|
26
26
|
# Register Effective::Logs with ActiveAdmin if ActiveAdmin is present
|
27
27
|
config.use_active_admin = true
|
@@ -43,5 +43,4 @@ EffectiveLogging.setup do |config|
|
|
43
43
|
# Log all successful user login attempts
|
44
44
|
config.user_logins_enabled = true
|
45
45
|
config.user_logouts_enabled = false
|
46
|
-
|
47
46
|
end
|
@@ -6,7 +6,7 @@ module EffectiveLogging
|
|
6
6
|
|
7
7
|
# Set up our default configuration options.
|
8
8
|
initializer "effective_logging.defaults", :before => :load_config_initializers do |app|
|
9
|
-
eval File.read("#{config.root}/
|
9
|
+
eval File.read("#{config.root}/config/effective_logging.rb")
|
10
10
|
end
|
11
11
|
|
12
12
|
# ActiveAdmin (optional)
|
@@ -3,9 +3,9 @@ module EffectiveLogging
|
|
3
3
|
class InstallGenerator < Rails::Generators::Base
|
4
4
|
include Rails::Generators::Migration
|
5
5
|
|
6
|
-
desc
|
6
|
+
desc 'Creates an EffectiveLogging initializer in your application.'
|
7
7
|
|
8
|
-
source_root File.expand_path(
|
8
|
+
source_root File.expand_path('../../templates', __FILE__)
|
9
9
|
|
10
10
|
def self.next_migration_number(dirname)
|
11
11
|
if not ActiveRecord::Base.timestamped_migrations
|
@@ -16,17 +16,13 @@ module EffectiveLogging
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def copy_initializer
|
19
|
-
template
|
19
|
+
template ('../' * 3) + 'config/effective_logging.rb', 'config/initializers/effective_logging.rb'
|
20
20
|
end
|
21
21
|
|
22
22
|
def create_migration_file
|
23
23
|
@logs_table_name = ':' + EffectiveLogging.logs_table_name.to_s
|
24
24
|
|
25
|
-
migration_template '
|
26
|
-
end
|
27
|
-
|
28
|
-
def show_readme
|
29
|
-
readme "README" if behavior == :invoke
|
25
|
+
migration_template ('../' * 3) + 'db/migrate/01_create_effective_logging.rb.erb', 'db/migrate/create_effective_logging.rb'
|
30
26
|
end
|
31
27
|
end
|
32
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- app/views/effective/logs/_log.html.haml
|
110
110
|
- app/views/effective/logs/index.html.haml
|
111
111
|
- app/views/effective/logs/show.html.haml
|
112
|
+
- config/effective_logging.rb
|
112
113
|
- config/routes.rb
|
113
114
|
- db/migrate/01_create_effective_logging.rb.erb
|
114
115
|
- lib/effective_logging.rb
|
@@ -120,10 +121,6 @@ files:
|
|
120
121
|
- lib/effective_logging/user_logger.rb
|
121
122
|
- lib/effective_logging/version.rb
|
122
123
|
- lib/generators/effective_logging/install_generator.rb
|
123
|
-
- lib/generators/templates/README
|
124
|
-
- lib/generators/templates/effective_logging.rb
|
125
|
-
- spec/effective_logging_spec.rb
|
126
|
-
- spec/spec_helper.rb
|
127
124
|
homepage: https://github.com/code-and-effect/effective_logging
|
128
125
|
licenses:
|
129
126
|
- MIT
|
@@ -149,6 +146,4 @@ signing_key:
|
|
149
146
|
specification_version: 4
|
150
147
|
summary: Automatically log all sent emails, user logins, and page views. This also
|
151
148
|
will log custom events from Ruby and JavaScript.
|
152
|
-
test_files:
|
153
|
-
- spec/effective_logging_spec.rb
|
154
|
-
- spec/spec_helper.rb
|
149
|
+
test_files: []
|
@@ -1 +0,0 @@
|
|
1
|
-
Thanks for using EffectiveLogging
|
data/spec/spec_helper.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] ||= 'test'
|
2
|
-
|
3
|
-
require File.expand_path("../dummy/config/environment", __FILE__)
|
4
|
-
|
5
|
-
require 'rspec/rails'
|
6
|
-
require 'rspec/autorun'
|
7
|
-
|
8
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
9
|
-
# in spec/support/ and its subdirectories.
|
10
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f }
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
14
|
-
|
15
|
-
Rails.logger.level = 4 # Output only minimal stuff to test.log
|
16
|
-
|
17
|
-
config.use_transactional_fixtures = true # Make this false to once again use DatabaseCleaner
|
18
|
-
config.infer_base_class_for_anonymous_controllers = false
|
19
|
-
config.order = 'random'
|
20
|
-
end
|
21
|
-
|
22
|
-
class ActiveRecord::Base
|
23
|
-
mattr_accessor :shared_connection
|
24
|
-
@@shared_connection = nil
|
25
|
-
|
26
|
-
def self.connection
|
27
|
-
@@shared_connection || retrieve_connection
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# Forces all threads to share the same connection. This works on
|
32
|
-
# Capybara because it starts the web server in a thread.
|
33
|
-
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|