audit_trails 0.0.1

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.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +4 -0
  4. data/Rakefile +34 -0
  5. data/app/controllers/audit_trails/application_controller.rb +5 -0
  6. data/app/controllers/audit_trails/home_controller.rb +24 -0
  7. data/app/helpers/audit_trails/application_helper.rb +4 -0
  8. data/app/helpers/audit_trails/home_helper.rb +4 -0
  9. data/app/models/audit_trails/audit.rb +15 -0
  10. data/app/models/audit_trails/audit_back_log.rb +5 -0
  11. data/app/views/audit_trails/home/index.html.erb +42 -0
  12. data/app/views/hlayouts/audit_trails/application.html.erb +14 -0
  13. data/config/routes.rb +3 -0
  14. data/db/migrate/20131223143623_create_audit_trails_audits.rb +40 -0
  15. data/lib/audit_trails/ar_enhanced.rb +47 -0
  16. data/lib/audit_trails/audit_db.rb +22 -0
  17. data/lib/audit_trails/engine.rb +5 -0
  18. data/lib/audit_trails/version.rb +3 -0
  19. data/lib/audit_trails.rb +16 -0
  20. data/lib/tasks/audit_trails_backup.rake +31 -0
  21. data/lib/tasks/audit_trails_tasks.rake +38 -0
  22. data/test/audit_trails_test.rb +7 -0
  23. data/test/controllers/audit_trails/home_controller_test.rb +11 -0
  24. data/test/dummy/README.rdoc +29 -0
  25. data/test/dummy/Rakefile +6 -0
  26. data/test/dummy/app/assets/javascripts/application.js +13 -0
  27. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  28. data/test/dummy/app/controllers/application_controller.rb +5 -0
  29. data/test/dummy/app/helpers/application_helper.rb +2 -0
  30. data/test/dummy/app/models/post.rb +2 -0
  31. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  32. data/test/dummy/backups/1_audit_trails.sql +1 -0
  33. data/test/dummy/backups/2_audit_trails.sql +1 -0
  34. data/test/dummy/backups/3_audit_trails.sql +1 -0
  35. data/test/dummy/bin/bundle +3 -0
  36. data/test/dummy/bin/rails +4 -0
  37. data/test/dummy/bin/rake +4 -0
  38. data/test/dummy/config/application.rb +23 -0
  39. data/test/dummy/config/boot.rb +5 -0
  40. data/test/dummy/config/database.yml +18 -0
  41. data/test/dummy/config/environment.rb +5 -0
  42. data/test/dummy/config/environments/development.rb +29 -0
  43. data/test/dummy/config/environments/production.rb +80 -0
  44. data/test/dummy/config/environments/test.rb +36 -0
  45. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  46. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  47. data/test/dummy/config/initializers/inflections.rb +16 -0
  48. data/test/dummy/config/initializers/mime_types.rb +5 -0
  49. data/test/dummy/config/initializers/secret_token.rb +12 -0
  50. data/test/dummy/config/initializers/session_store.rb +3 -0
  51. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  52. data/test/dummy/config/locales/en.yml +23 -0
  53. data/test/dummy/config/routes.rb +3 -0
  54. data/test/dummy/config.ru +4 -0
  55. data/test/dummy/db/migrate/20131224060120_create_posts.rb +9 -0
  56. data/test/dummy/db/migrate/20131227072919_create_audit_trails_audits.audit_trails.rb +40 -0
  57. data/test/dummy/db/schema.rb +22 -0
  58. data/test/dummy/db_audit_trails/database_audit_trails.yml +17 -0
  59. data/test/dummy/db_audit_trails/migrate/20131223143623_create_audit_trails_audits.rb +14 -0
  60. data/test/dummy/db_audit_trails/schema.rb +28 -0
  61. data/test/dummy/db_audit_trails/seeds.rb +0 -0
  62. data/test/dummy/log/development.log +0 -0
  63. data/test/dummy/public/404.html +58 -0
  64. data/test/dummy/public/422.html +58 -0
  65. data/test/dummy/public/500.html +57 -0
  66. data/test/dummy/public/favicon.ico +0 -0
  67. data/test/dummy/test/fixtures/posts.yml +7 -0
  68. data/test/dummy/test/models/post_test.rb +7 -0
  69. data/test/dummy/tmp/cache/assets/development/sprockets/0b853215499987d1639a0c28c89dd4cf +0 -0
  70. data/test/dummy/tmp/cache/assets/development/sprockets/4de97ccf16f269f7aa802e1eaa6c98ea +0 -0
  71. data/test/dummy/tmp/cache/assets/development/sprockets/55ee89a0ed00a92a5f5fef5bb8ede760 +0 -0
  72. data/test/dummy/tmp/cache/assets/development/sprockets/736aa3074e6b2785019f362d265c1213 +0 -0
  73. data/test/dummy/tmp/cache/assets/development/sprockets/80c6b116bf7a37d42b3f8df6b1499574 +0 -0
  74. data/test/dummy/tmp/cache/assets/development/sprockets/89884074c59294ac505e492d5d18da87 +0 -0
  75. data/test/dummy/tmp/cache/assets/development/sprockets/a4fa736d2837c0d06163d899b962ead3 +0 -0
  76. data/test/dummy/tmp/cache/assets/development/sprockets/a7d7c93c0c9fd617ffd98cffceb528a6 +0 -0
  77. data/test/dummy/tmp/cache/assets/development/sprockets/afb796add0f8e384a863ca676cda4ff1 +0 -0
  78. data/test/dummy/tmp/cache/assets/development/sprockets/c644fb9e08bf57429b244bdc81b762e0 +0 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/da591551a38b6e823be84fd426f72a2d +0 -0
  80. data/test/dummy/tmp/cache/assets/development/sprockets/efbb51f306f7f7aca5d3bec5eda884b3 +0 -0
  81. data/test/dummy/tmp/pids/server.pid +1 -0
  82. data/test/fixtures/audit_trails/audits.yml +11 -0
  83. data/test/helpers/audit_trails/home_helper_test.rb +6 -0
  84. data/test/integration/navigation_test.rb +10 -0
  85. data/test/models/audit_trails/audit_test.rb +9 -0
  86. data/test/test_helper.rb +15 -0
  87. metadata +221 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5f5c7657ef725020c72b3237090efd5735f6d597
4
+ data.tar.gz: c094d200540132960df022bdf73c28c165b60093
5
+ SHA512:
6
+ metadata.gz: 5d236f90763c63c6d4799904e98c3f73e7c115bb5bf6c6228b206a6aa99c82d341c90233c175dd3dd0319743ec0f35418b61fe8462d0274bb0a431ccefdfa1bb
7
+ data.tar.gz: f10ecd51902b00596ede4f7dc8d28734d66b7ff88b07a048079c593948e0816646f1a7ac9f7e4d8398772fb62a9aeb08ababfaa4eea87d7e7507e2b538d3f6f9
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,4 @@
1
+ = AuditTrails
2
+
3
+ bundle exec rake audit_trails:db:drop audit_trails:db:create audit_trails:db:migrate
4
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'AuditTrails'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'lib'
28
+ t.libs << 'test'
29
+ t.pattern = 'test/**/*_test.rb'
30
+ t.verbose = false
31
+ end
32
+
33
+
34
+ task default: :test
@@ -0,0 +1,5 @@
1
+ module AuditTrails
2
+ class ApplicationController < ActionController::Base
3
+ include AuditTrails::SystemController
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ require_dependency "audit_trails/application_controller"
2
+
3
+ module AuditTrails
4
+ class HomeController < ApplicationController
5
+ def index
6
+ if params[:sql].nil?
7
+ @activities = Audit.paginate(:page => params[:page], :per_page => 2).order("id DESC")
8
+ else
9
+ begin
10
+ sql_files_path = File.join(Rails.root, 'backups')
11
+ @sql = (params[:sql].to_i == 0) ? Dir.glob("#{sql_files_path}/*.{sql}").count : params[:sql].to_i - 1
12
+ AuditBackLog.connection.execute(IO.read(File.join("#{sql_files_path}", "#{@sql}_audit_trails.sql"))) #rescue true
13
+ rescue ActiveRecord::RecordNotUnique => e
14
+ Rails.logger.info 'Tried to load already loaded sql file'
15
+ rescue Errno::ENOENT => e
16
+ Rails.logger.info e.message
17
+ @sql = nil
18
+ end
19
+ @activities = AuditBackLog.paginate(:page => params[:page], :per_page => 2).order("id DESC")
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ module AuditTrails
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module AuditTrails
2
+ module HomeHelper
3
+ end
4
+ end
@@ -0,0 +1,15 @@
1
+ # Todo : Database recreate on x number of entry and treat new db as active db.
2
+ # Todo : on load more request decide and implement multi-database
3
+ # TODO : Handle Audit Table Schema changes
4
+ # Todo : Remove ActiveRecord::SchemaMigration.create from Activity
5
+ # Todo : Through Test.
6
+ module AuditTrails
7
+ class Audit < ActiveRecord::Base
8
+ establish_connection AuditTrails::AuditDb.adbconf
9
+ # Fixme Associations are not working. Ask Sachin to help
10
+ belongs_to :user
11
+ belongs_to :recipient, :polymorphic => true
12
+ end
13
+ end
14
+
15
+
@@ -0,0 +1,5 @@
1
+ module AuditTrails
2
+ class AuditBackLog < Audit
3
+ AuditTrails::AuditBackLog.table_name = 'audit_trails_audits_backlogs'
4
+ end
5
+ end
@@ -0,0 +1,42 @@
1
+ <div class="content-data stacked">
2
+ <div class="widget_header"><i class="icon-road"></i>
3
+
4
+ <h3>AuditTrails</h3>
5
+ </div>
6
+ <div class="widget_container">
7
+ <table class="table table-bordered tablesorter">
8
+ <thead>
9
+ <tr>
10
+ <th class="inline_30">Id</th>
11
+ <th>Activity</th>
12
+ <th class="inline_80">Activity on</th>
13
+ <th data-sort="false">Parameters changes</th>
14
+ <th class="inline_80">Ip Address</th>
15
+ <th class="inline_80">Activity by</th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <% if @activities.count <= 0 %>
20
+ <tr>
21
+ <td colspan="4">No audit trail available.</td>
22
+ </tr>
23
+ <% else %>
24
+ <% @activities.each do |activity| %>
25
+ <tr>
26
+ <td><%= activity.id %></td>
27
+ <td><%= activity.key %></td>
28
+ <td><%= activity.recipient_type %>(<%= activity.recipient_id %>)</td>
29
+ <td><%= YAML.load(activity.parameters) %></td>
30
+ <td><%= activity.ip_address %></td>
31
+ <td><%= User.find(activity.user_id).username rescue 'no user' %></td>
32
+ </tr>
33
+ <% end %>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ <%= will_paginate @activities %>
38
+ </div>
39
+ </div>
40
+ <% @sql ||= 0 %>
41
+
42
+ <%= link_to 'Load More...', audit_trails.root_url(sql: @sql), remote: true if @activities.total_pages == @activities.current_page and !@sql.nil? %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>AuditTrails</title>
5
+ <%= stylesheet_link_tag "audit_trails/application", media: "all" %>
6
+ <%= javascript_include_tag "audit_trails/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ AuditTrails::Engine.routes.draw do
2
+ root :to => "home#index"
3
+ end
@@ -0,0 +1,40 @@
1
+ # This migration comes from audit_trails (originally 20131223143623)
2
+ class CreateAuditTrailsAudits < ActiveRecord::Migration
3
+
4
+ def connection
5
+ ActiveRecord::Base.establish_connection(AuditTrails::AuditDb.adbconf).connection
6
+ end
7
+
8
+ def change
9
+ # Active Audit Table
10
+ create_table :audit_trails_audits do |t|
11
+ t.string :key
12
+ t.belongs_to :recipient, :polymorphic => true
13
+ t.integer :user_id
14
+ t.text :parameters
15
+ t.string :ip_address
16
+ t.text :message
17
+
18
+ t.timestamps
19
+ end
20
+
21
+ # BackLog Audit Table
22
+ create_table :audit_trails_audits_backlogs do |t|
23
+ t.string :key
24
+ t.belongs_to :recipient, :polymorphic => true
25
+ t.integer :user_id
26
+ t.text :parameters
27
+ t.string :ip_address
28
+ t.text :message
29
+
30
+ t.timestamps
31
+ end
32
+
33
+ self.revert_connection
34
+ end
35
+
36
+ def revert_connection
37
+ ActiveRecord::Base.establish_connection(AuditTrails::AuditDb.rdbconf).connection
38
+ end
39
+
40
+ end
@@ -0,0 +1,47 @@
1
+ module AuditTrails
2
+ class ActiveRecord::Base
3
+ # To change this template use File | Settings | File Templates.
4
+ around_create :log_create_activity, :unless => lambda { self.class.name == 'AuditTrails::Audit' }
5
+ around_update :log_update_activity, :unless => lambda { self.class.name == 'AuditTrails::Audit' }
6
+ around_destroy :log_destroy_activity, :unless => lambda { self.class.name == 'AuditTrails::Audit' }
7
+
8
+ def log_activity(key, changes, owner, ip_address, object = nil, message = nil)
9
+ begin
10
+ owner_id = owner.id rescue nil
11
+ AuditTrails::Audit.create(:key => key, :user_id => owner_id, :recipient => object,
12
+ :parameters => YAML.dump(changes), :message => message, :ip_address => ip_address)
13
+
14
+ rescue Exception => ex
15
+ Rails.logger.error ex.message
16
+ Rails.logger.error ex.backtrace
17
+ end
18
+ end
19
+
20
+ def log_create_activity
21
+ changes = self.changes
22
+ yield
23
+ log_activity("#{self.class.name}.create", changes, current_user, get_ip_address, self) unless (self.class.name == 'ActiveRecord::SchemaMigration')
24
+ end
25
+
26
+ def log_update_activity
27
+ changes = self.changes
28
+ yield
29
+ log_activity("#{self.class.name}.update", changes, current_user, get_ip_address, self)
30
+ end
31
+
32
+ def log_destroy_activity
33
+ changes = self.changes
34
+ yield
35
+ log_activity("#{self.class.name}.destroy", changes, current_user, get_ip_address, self)
36
+ end
37
+
38
+ def current_user
39
+ Thread.current.thread_variable_get('controller').current_user rescue nil
40
+ end
41
+
42
+ def get_ip_address
43
+ Thread.current.thread_variable_get('controller').get_ip_address rescue '127.0.0.1'
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,22 @@
1
+ module AuditTrails
2
+ class AuditDb
3
+ def self.adbconf
4
+ begin
5
+ db_configurations = YAML::load(IO.read('config/database_audit_trails.yml'))[Rails.env]
6
+ rescue
7
+ _database = File.join(Rails.root, 'config', 'database.yml')
8
+ db_configurations = YAML::load(IO.read(_database))["audit_#{Rails.env}"]
9
+ rescue
10
+ db_configurations = YAML::load(IO.read(_database))[Rails.env]
11
+ end
12
+ db_configurations
13
+ end
14
+
15
+ def self.rdbconf
16
+ _database = File.join(Rails.root, 'config', 'database.yml')
17
+ db_configurations = YAML::load(IO.read(_database))[Rails.env]
18
+ db_configurations
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ module AuditTrails
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace AuditTrails
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module AuditTrails
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,16 @@
1
+ require "audit_trails/engine"
2
+ require "audit_trails/version"
3
+ require "audit_trails/ar_enhanced"
4
+ require "audit_trails/audit_db"
5
+
6
+ module AuditTrails
7
+ module SystemController
8
+ def self.included(base)
9
+ base.send(:before_filter, :store_current_controller)
10
+ end
11
+
12
+ def store_current_controller
13
+ Thread.current.thread_variable_set('controller', self)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,31 @@
1
+ namespace :db do
2
+ desc "swap table names and Backup Audit trails data to sql."
3
+ task :backup => [:environment] do
4
+ unless AuditTrails::Audit.count < 3
5
+ begin
6
+ base_path = Rails.root
7
+ backup_location = File.join(base_path, 'backups')
8
+ FileUtils.mkdir_p(backup_location)
9
+ filename = (Dir.glob("#{backup_location}/*.{sql}").count + 1).to_s + '_audit_trails.sql'
10
+ backup_file = File.join(backup_location, filename)
11
+ db_config = AuditTrails::Audit.connection_config
12
+ o_tblname = AuditTrails::Audit.table_name
13
+ n_tblname = AuditTrails::AuditBackLog.table_name
14
+ AuditTrails::Audit.connection.execute("delete from #{n_tblname}")
15
+ AuditTrails::Audit.connection.execute("RENAME TABLE #{o_tblname} TO temp")
16
+ AuditTrails::Audit.connection.execute("RENAME TABLE #{n_tblname} TO #{o_tblname}")
17
+ AuditTrails::Audit.connection.execute("RENAME TABLE temp TO #{n_tblname}")
18
+ `mysqldump -u#{db_config[:username]} -p#{db_config[:password]} --compact -t #{db_config[:database]} #{n_tblname} > #{backup_file}`
19
+ AuditTrails::Audit.connection.execute("delete from #{n_tblname}")
20
+ raise "Unable to make DB backup!" if ($?.to_i > 0)
21
+ #`gzip -9 #{backup_file}` #Fixme If Required.
22
+ rescue Exception => e
23
+ puts e.backtrace
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+
30
+
31
+
@@ -0,0 +1,38 @@
1
+ #namespace :audit_trails do
2
+ #
3
+ # desc "Configure the variables that rails need in order to look up for the db configuration in a different folder"
4
+ # task :set_custom_db_config_paths do
5
+ # # This is the minimum required to tell rails to use a different location for all the files related to the database.
6
+ # ENV['SCHEMA'] = 'db_audit_trails/schema.rb'
7
+ # Rails.application.config.paths['db'] = ['db_audit_trails']
8
+ # Rails.application.config.paths['db/migrate'] = ['db_audit_trails/migrate']
9
+ # Rails.application.config.paths['db/seeds'] = ['db_audit_trails/seeds.rb']
10
+ # Rails.application.config.paths['config/database'] = ['db_audit_trails/database_audit_trails.yml']
11
+ # end
12
+ #
13
+ # namespace :db do
14
+ # task :drop => :set_custom_db_config_paths do
15
+ # Rake::Task["db:drop"].invoke
16
+ # end
17
+ #
18
+ # task :create => :set_custom_db_config_paths do
19
+ # Rake::Task["db:create"].invoke
20
+ # end
21
+ #
22
+ # task :migrate => :set_custom_db_config_paths do
23
+ # Rake::Task["db:migrate"].invoke
24
+ # end
25
+ #
26
+ # task :rollback => :set_custom_db_config_paths do
27
+ # Rake::Task["db:rollback"].invoke
28
+ # end
29
+ #
30
+ # task :seed => :set_custom_db_config_paths do
31
+ # Rake::Task["db:seed"].invoke
32
+ # end
33
+ #
34
+ # task :version => :set_custom_db_config_paths do
35
+ # Rake::Task["db:version"].invoke
36
+ # end
37
+ # end
38
+ #end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class AuditTrailsTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, AuditTrails
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ module AuditTrails
4
+ class HomeControllerTest < ActionController::TestCase
5
+ test "should get index" do
6
+ get :index
7
+ assert_response :success
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,29 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
29
+
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class Post < ActiveRecord::Base
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1 @@
1
+ INSERT INTO `audit_trails_audits_backlogs` VALUES (1,'ActiveRecord::SchemaMigration.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\nversion:\n- \n- 20131226084022\n','127.0.0.1',NULL,'2013-12-26 15:40:25','2013-12-26 15:40:25'),(2,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 15:42:07.229465764 Z\nupdated_at:\n- \n- 2013-12-26 15:42:07.229465764 Z\n','127.0.0.1',NULL,'2013-12-26 15:42:07','2013-12-26 15:42:07'),(3,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 15:42:07.942162535 Z\nupdated_at:\n- \n- 2013-12-26 15:42:07.942162535 Z\n','127.0.0.1',NULL,'2013-12-26 15:42:07','2013-12-26 15:42:07'),(4,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 15:42:08.597295925 Z\nupdated_at:\n- \n- 2013-12-26 15:42:08.597295925 Z\n','127.0.0.1',NULL,'2013-12-26 15:42:08','2013-12-26 15:42:08'),(5,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 15:42:09.205502322 Z\nupdated_at:\n- \n- 2013-12-26 15:42:09.205502322 Z\n','127.0.0.1',NULL,'2013-12-26 15:42:09','2013-12-26 15:42:09');
@@ -0,0 +1 @@
1
+ INSERT INTO `audit_trails_audits_backlogs` VALUES (1,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:09:56.479768284 Z\nupdated_at:\n- \n- 2013-12-26 16:09:56.479768284 Z\n','127.0.0.1',NULL,'2013-12-26 16:09:56','2013-12-26 16:09:56'),(2,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:09:57.250719740 Z\nupdated_at:\n- \n- 2013-12-26 16:09:57.250719740 Z\n','127.0.0.1',NULL,'2013-12-26 16:09:57','2013-12-26 16:09:57'),(3,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:09:57.877478606 Z\nupdated_at:\n- \n- 2013-12-26 16:09:57.877478606 Z\n','127.0.0.1',NULL,'2013-12-26 16:09:57','2013-12-26 16:09:57'),(4,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:09:58.523194152 Z\nupdated_at:\n- \n- 2013-12-26 16:09:58.523194152 Z\n','127.0.0.1',NULL,'2013-12-26 16:09:58','2013-12-26 16:09:58'),(5,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:09:59.115226204 Z\nupdated_at:\n- \n- 2013-12-26 16:09:59.115226204 Z\n','127.0.0.1',NULL,'2013-12-26 16:09:59','2013-12-26 16:09:59'),(6,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:09:59.692308697 Z\nupdated_at:\n- \n- 2013-12-26 16:09:59.692308697 Z\n','127.0.0.1',NULL,'2013-12-26 16:09:59','2013-12-26 16:09:59');
@@ -0,0 +1 @@
1
+ INSERT INTO `audit_trails_audits_backlogs` VALUES (6,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:12:31.088958824 Z\nupdated_at:\n- \n- 2013-12-26 16:12:31.088958824 Z\n','127.0.0.1',NULL,'2013-12-26 16:12:31','2013-12-26 16:12:31'),(7,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:12:31.595627751 Z\nupdated_at:\n- \n- 2013-12-26 16:12:31.595627751 Z\n','127.0.0.1',NULL,'2013-12-26 16:12:31','2013-12-26 16:12:31'),(8,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:12:32.041379897 Z\nupdated_at:\n- \n- 2013-12-26 16:12:32.041379897 Z\n','127.0.0.1',NULL,'2013-12-26 16:12:32','2013-12-26 16:12:32'),(9,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:12:32.482604429 Z\nupdated_at:\n- \n- 2013-12-26 16:12:32.482604429 Z\n','127.0.0.1',NULL,'2013-12-26 16:12:32','2013-12-26 16:12:32'),(10,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:12:32.940809063 Z\nupdated_at:\n- \n- 2013-12-26 16:12:32.940809063 Z\n','127.0.0.1',NULL,'2013-12-26 16:12:32','2013-12-26 16:12:32'),(11,'Post.create',NULL,NULL,NULL,'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontent:\n- \n- 123414234aaa\ncreated_at:\n- \n- 2013-12-26 16:12:33.444304194 Z\nupdated_at:\n- \n- 2013-12-26 16:12:33.444304194 Z\n','127.0.0.1',NULL,'2013-12-26 16:12:33','2013-12-26 16:12:33');
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "audit_trails"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
+ # config.time_zone = 'Central Time (US & Canada)'
17
+
18
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
+ # config.i18n.default_locale = :de
21
+ end
22
+ end
23
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,18 @@
1
+ development:
2
+ adapter: mysql2
3
+ encoding: utf8
4
+ database: audit_trails_development_trick
5
+ pool: 5
6
+ username: root
7
+ password: root
8
+ socket: /var/run/mysqld/mysqld.sock
9
+
10
+ audit_development:
11
+ adapter: mysql2
12
+ encoding: utf8
13
+ database: audit_trails_logs
14
+ pool: 5
15
+ username: root
16
+ password: root
17
+ socket: /var/run/mysqld/mysqld.sock
18
+
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Dummy::Application.initialize!