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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c56031f528265bd29b5ad3e5a6777f87c15275a1
4
- data.tar.gz: 9dd9730ea1237141d1ef8772928c65317fdf21ea
3
+ metadata.gz: df044f4842187ae687d8fce22ece707399782c32
4
+ data.tar.gz: d08801613da6ca975bd5fc0fb90834059b221bf6
5
5
  SHA512:
6
- metadata.gz: 0ec3e3de1a369e7d40d5974b605032bd495ccc465519adfed4b6ff22d8a4350b12f4844ab5af6d2c86aa8ed9703fe2aa8f69ce289ef21d6860e761650e47b650
7
- data.tar.gz: e1416af20d48313956c5e1adb4db2be10105f76af08149458cfa57b77216d7dadede1776225f99e75f4817d93ad99e827fbeefedc0fee9ca9990000ba0368b97
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() if defined?(EffectiveDatatables)
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) if defined?(EffectiveDatatables)
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))
@@ -1,5 +1,7 @@
1
1
  .fluid-container
2
2
  .row
3
3
  .col-sm-12
4
- = render_datatable @datatable do
4
+ - if @datatable.present?
5
+ = render_datatable(@datatable)
6
+ - else
5
7
  %p There are no logs
@@ -1,4 +1,3 @@
1
- %h2= @page_title
1
+ %h1.effective-admin-heading= @page_title
2
2
 
3
- = render_datatable @datatable do
4
- %p There are no logs
3
+ = render_datatable(@datatable)
@@ -1,3 +1,4 @@
1
- %h2= @page_title
1
+ %h1.effective-admin-heading= @page_title
2
+
2
3
  = render_log(@log)
3
4
 
@@ -1,4 +1,6 @@
1
- %h2= @page_title
1
+ %h1.effective-heading= @page_title
2
2
 
3
- = render_datatable @datatable do
3
+ - if @datatable.present?
4
+ = render_datatable(@datatable)
5
+ - else
4
6
  %p You have no previous recorded activity
@@ -1,2 +1,3 @@
1
- %h2= @page_title
1
+ %h1.effective-heading= @page_title
2
+
2
3
  = render_log(@log)
@@ -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| true } # All users can see every screen
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}/lib/generators/templates/effective_logging.rb")
9
+ eval File.read("#{config.root}/config/effective_logging.rb")
10
10
  end
11
11
 
12
12
  # ActiveAdmin (optional)
@@ -1,3 +1,3 @@
1
1
  module EffectiveLogging
2
- VERSION = '1.5.9'.freeze
2
+ VERSION = '1.6.0'.freeze
3
3
  end
@@ -3,9 +3,9 @@ module EffectiveLogging
3
3
  class InstallGenerator < Rails::Generators::Base
4
4
  include Rails::Generators::Migration
5
5
 
6
- desc "Creates an EffectiveLogging initializer in your application."
6
+ desc 'Creates an EffectiveLogging initializer in your application.'
7
7
 
8
- source_root File.expand_path("../../templates", __FILE__)
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 "effective_logging.rb", "config/initializers/effective_logging.rb"
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 '../../../db/migrate/01_create_effective_logging.rb.erb', 'db/migrate/create_effective_logging.rb'
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.5.9
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-10-22 00:00:00.000000000 Z
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
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe EffectiveLogging do
4
- it 'should be a module' do
5
- assert_kind_of Module, EffectiveLogging
6
- end
7
- end
@@ -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