Skip to content

Commit

Permalink
An alternative to paper_trail/pull/492
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredbeck committed Jun 21, 2015
0 parents commit bcac9a1
Show file tree
Hide file tree
Showing 65 changed files with 938 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
@@ -0,0 +1,17 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp
8 changes: 8 additions & 0 deletions Gemfile
@@ -0,0 +1,8 @@
source 'https://rubygems.org'

gem 'activemodel'
gem 'activerecord'
gem 'activesupport'
gem 'railties'
gem 'sqlite3'
gem 'paper_trail', '4.0.0.rc1'
78 changes: 78 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,78 @@
GEM
remote: https://rubygems.org/
specs:
actionpack (4.2.2)
actionview (= 4.2.2)
activesupport (= 4.2.2)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.2)
activesupport (= 4.2.2)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activemodel (4.2.2)
activesupport (= 4.2.2)
builder (~> 3.1)
activerecord (4.2.2)
activemodel (= 4.2.2)
activesupport (= 4.2.2)
arel (~> 6.0)
activesupport (4.2.2)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.0)
builder (3.2.2)
erubis (2.7.0)
i18n (0.7.0)
json (1.8.3)
loofah (2.0.2)
nokogiri (>= 1.5.9)
mini_portile (0.6.2)
minitest (5.7.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
paper_trail (4.0.0.rc1)
activerecord (>= 3.0, < 6.0)
activesupport (>= 3.0, < 6.0)
request_store (~> 1.1.0)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
railties (4.2.2)
actionpack (= 4.2.2)
activesupport (= 4.2.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
request_store (1.1.0)
sqlite3 (1.3.10)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
activemodel
activerecord
activesupport
paper_trail (= 4.0.0.rc1)
railties
sqlite3
28 changes: 28 additions & 0 deletions README.rdoc
@@ -0,0 +1,28 @@
== README

This README would normally document whatever steps are necessary to get the
application up and running.

Things you may want to cover:

* Ruby version

* System dependencies

* Configuration

* Database creation

* Database initialization

* How to run the test suite

* Services (job queues, cache servers, search engines, etc.)

* Deployment instructions

* ...


Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.
6 changes: 6 additions & 0 deletions Rakefile
@@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

Rails.application.load_tasks
Empty file added app/assets/images/.keep
Empty file.
16 changes: 16 additions & 0 deletions app/assets/javascripts/application.js
@@ -0,0 +1,16 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
15 changes: 15 additions & 0 deletions app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
@@ -0,0 +1,5 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end
Empty file added app/controllers/concerns/.keep
Empty file.
2 changes: 2 additions & 0 deletions app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
module ApplicationHelper
end
Empty file added app/mailers/.keep
Empty file.
Empty file added app/models/.keep
Empty file.
4 changes: 4 additions & 0 deletions app/models/abstract_version.rb
@@ -0,0 +1,4 @@
class AbstractVersion < ::ActiveRecord::Base
include PaperTrail::VersionConcern
self.abstract_class = true
end
3 changes: 3 additions & 0 deletions app/models/banana.rb
@@ -0,0 +1,3 @@
class Banana < ::ActiveRecord::Base
has_paper_trail class_name: 'BananaVersion'
end
3 changes: 3 additions & 0 deletions app/models/banana_version.rb
@@ -0,0 +1,3 @@
class BananaVersion < AbstractVersion
self.table_name = :banana_versions
end
Empty file added app/models/concerns/.keep
Empty file.
14 changes: 14 additions & 0 deletions app/views/layouts/application.html.erb
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>PtCvc</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>
3 changes: 3 additions & 0 deletions bin/bundle
@@ -0,0 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
8 changes: 8 additions & 0 deletions bin/rails
@@ -0,0 +1,8 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
8 changes: 8 additions & 0 deletions bin/rake
@@ -0,0 +1,8 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require_relative '../config/boot'
require 'rake'
Rake.application.run
29 changes: 29 additions & 0 deletions bin/setup
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
require 'pathname'

# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)

Dir.chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file:

puts "== Installing dependencies =="
system "gem install bundler --conservative"
system "bundle check || bundle install"

# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# system "cp config/database.yml.sample config/database.yml"
# end

puts "\n== Preparing database =="
system "bin/rake db:setup"

puts "\n== Removing old logs and tempfiles =="
system "rm -f log/*"
system "rm -rf tmp/cache"

puts "\n== Restarting application server =="
system "touch tmp/restart.txt"
end
15 changes: 15 additions & 0 deletions bin/spring
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby

# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.

unless defined?(Spring)
require "rubygems"
require "bundler"

if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
gem "spring", match[1]
require "spring/binstub"
end
end
4 changes: 4 additions & 0 deletions config.ru
@@ -0,0 +1,4 @@
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
26 changes: 26 additions & 0 deletions config/application.rb
@@ -0,0 +1,26 @@
require File.expand_path('../boot', __FILE__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module PtCvc
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de

# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end
3 changes: 3 additions & 0 deletions config/boot.rb
@@ -0,0 +1,3 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
25 changes: 25 additions & 0 deletions config/database.yml
@@ -0,0 +1,25 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000

development:
<<: *default
database: db/development.sqlite3

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3

production:
<<: *default
database: db/production.sqlite3
5 changes: 5 additions & 0 deletions config/environment.rb
@@ -0,0 +1,5 @@
# Load the Rails application.
require File.expand_path('../application', __FILE__)

# Initialize the Rails application.
Rails.application.initialize!
41 changes: 41 additions & 0 deletions config/environments/development.rb
@@ -0,0 +1,41 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false

# Do not eager load code on boot.
config.eager_load = false

# Show full error reports and disable caching.
config.consider_all_requests_local = true
# config.action_controller.perform_caching = false

# Don't care if the mailer can't send.
# config.action_mailer.raise_delivery_errors = false

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
# config.assets.debug = true

# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
# config.assets.digest = true

# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
# config.assets.raise_runtime_errors = true

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end

0 comments on commit bcac9a1

Please sign in to comment.