vertica_history 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/vertica_history/application.js +13 -0
- data/app/assets/stylesheets/vertica_history/application.css +15 -0
- data/app/controllers/vertica_history/application_controller.rb +4 -0
- data/app/controllers/vertica_history/vertica_history_controller.rb +121 -0
- data/app/helpers/vertica_history/application_helper.rb +4 -0
- data/app/views/layouts/vertica_history/application.html.erb +14 -0
- data/app/views/vertica_history/vertica_history/index.html.erb +22 -0
- data/app/views/vertica_history/vertica_history/view_history.html.erb +86 -0
- data/config/routes.rb +4 -0
- data/lib/rails_admin/config/actions/vertica_history.rb +25 -0
- data/lib/tasks/vertica_history_tasks.rake +4 -0
- data/lib/vertica_history/engine.rb +7 -0
- data/lib/vertica_history/version.rb +3 -0
- data/lib/vertica_history.rb +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/test_helper.rb +21 -0
- data/test/vertica_history_test.rb +7 -0
- metadata +174 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f9965f4d73109c94beedb553c232c3639d49758f
|
4
|
+
data.tar.gz: be8b7bbde4b446be5ec1b18c7ac75b88d29e492f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 01cdfe73b1ead8dc6730cf15adfe283ccb5d8663b1a43ecd34587a6c3fd2451742935ef7240d6df198f95496061248481d6dcca9c5f62c90f3f3b17bf3b17f1d
|
7
|
+
data.tar.gz: 39926782b8f28f914e5965a48bf8c311291c51333dc0f6ec1246ce5813f753ee05219c6960c393b343517e2e40832a5d6eba19203086778a3406e314da14c10d
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
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 = 'VerticaHistory'
|
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
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Bundler::GemHelper.install_tasks
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
@@ -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 any plugin's vendor/assets/javascripts directory 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/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,121 @@
|
|
1
|
+
module VerticaHistory
|
2
|
+
class VerticaHistoryController < ApplicationController
|
3
|
+
# before_filter { |c| c.authorize_ability :can_edit }
|
4
|
+
before_filter :fetch_columns
|
5
|
+
|
6
|
+
def index
|
7
|
+
end
|
8
|
+
|
9
|
+
def view_history
|
10
|
+
connection_configurations = {
|
11
|
+
host: Rails.configuration.vertica_host,
|
12
|
+
user: Rails.configuration.vertica_user,
|
13
|
+
password: Rails.configuration.vertica_password,
|
14
|
+
ssl: Rails.configuration.vertica_ssl || true,
|
15
|
+
port: Rails.configuration.vertica_port || 5433,
|
16
|
+
database: Rails.configuration.vertica_database,
|
17
|
+
role: Rails.configuration.vertica_role,
|
18
|
+
search_path: Rails.configuration.vertica_search_path || nil,
|
19
|
+
row_style: Rails.configuration.vertica_row_style || :hash
|
20
|
+
}
|
21
|
+
|
22
|
+
schema = Rails.configuration.vertica_schema
|
23
|
+
id = params['id']
|
24
|
+
history = []
|
25
|
+
|
26
|
+
if (@column_filter.nil? && @value_filter.nil?)
|
27
|
+
@value_filter = [params['filter_column']]
|
28
|
+
@column_filter = [params['filter_field']]
|
29
|
+
else
|
30
|
+
@column_filter += [params['filter_field']]
|
31
|
+
@value_filter += [params['filter_column']]
|
32
|
+
end
|
33
|
+
|
34
|
+
order_by = params['order_by'] || 'vertica_updated_at'
|
35
|
+
@columns = params['columns'] || params['attribute-keys'] || @all_columns
|
36
|
+
table_name = params['class_name']
|
37
|
+
|
38
|
+
|
39
|
+
connection = Vertica.connect(connection_configurations)
|
40
|
+
@columns = @columns + ['vertica_updated_at'] unless @columns.include?('vertica_updated_at')
|
41
|
+
|
42
|
+
if @columns == ["*", "vertica_updated_at"]
|
43
|
+
unless (@column_filter.compact.empty? && @value_filter.compact.empty?)
|
44
|
+
sub_query = ""
|
45
|
+
|
46
|
+
@query_hash = Hash[@column_filter.zip(@value_filter)]
|
47
|
+
@query_hash.delete_if { |key, value| value.to_s.strip == '' }
|
48
|
+
@query_hash.each do |col, val|
|
49
|
+
next if col.nil? || val.nil?
|
50
|
+
sub_query = sub_query + "AND #{col}='#{val}' "
|
51
|
+
end
|
52
|
+
|
53
|
+
result = connection.query("SELECT * from #{schema}.#{table_name.pluralize} where id=#{id} #{sub_query} order by #{order_by};")
|
54
|
+
else
|
55
|
+
result = connection.query("SELECT * from #{schema}.#{table_name.pluralize} where id=#{id} order by #{order_by};")
|
56
|
+
end
|
57
|
+
@columns = ['vertica_updated_at'] + @model.columns.map { |c| c.name }
|
58
|
+
|
59
|
+
elsif @columns.include?("*")
|
60
|
+
unless (@column_filter.compact.empty? && @value_filter.compact.empty?)
|
61
|
+
sub_query = ""
|
62
|
+
|
63
|
+
@query_hash = Hash[@column_filter.zip(@value_filter)]
|
64
|
+
@query_hash.delete_if { |key, value| value.to_s.strip == '' }
|
65
|
+
|
66
|
+
@query_hash.each do |col, val|
|
67
|
+
next if col.nil? || val.nil?
|
68
|
+
sub_query = sub_query + "AND #{col}='#{val}' "
|
69
|
+
end
|
70
|
+
|
71
|
+
result = connection.query("SELECT * from #{schema}.#{table_name.pluralize} where id=#{id} #{sub_query} order by #{order_by};")
|
72
|
+
else
|
73
|
+
result = connection.query("SELECT * from #{schema}.#{table_name.pluralize} where id=#{id} order by #{order_by};")
|
74
|
+
end
|
75
|
+
@columns = ['vertica_updated_at'] + @model.columns.map { |c| c.name }
|
76
|
+
|
77
|
+
|
78
|
+
else
|
79
|
+
query_columns = ""
|
80
|
+
@columns.each { |c| query_columns = query_columns + c + "," }
|
81
|
+
query_columns = query_columns[0..-2]
|
82
|
+
unless (@column_filter.compact.empty? && @value_filter.compact.empty?)
|
83
|
+
sub_query = ""
|
84
|
+
|
85
|
+
|
86
|
+
@query_hash = Hash[@column_filter.zip(@value_filter)]
|
87
|
+
@query_hash.delete_if { |key, value| value.to_s.strip == '' }
|
88
|
+
@query_hash.each do |col, val|
|
89
|
+
next if col.nil? || val.nil?
|
90
|
+
sub_query = sub_query + "AND #{col}='#{val}' "
|
91
|
+
end
|
92
|
+
|
93
|
+
result = connection.query("SELECT #{query_columns} from #{schema}.#{table_name.pluralize} where id=#{id} #{sub_query} order by #{order_by};")
|
94
|
+
else
|
95
|
+
result = connection.query("SELECT #{query_columns} from #{schema}.#{table_name.pluralize} where id=#{id} order by #{order_by};")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
@total_records = result.count
|
100
|
+
|
101
|
+
result.each do |row|
|
102
|
+
history << row
|
103
|
+
end
|
104
|
+
|
105
|
+
@history = Kaminari.paginate_array(history, total_count: history.count).page(params[:page]).per(20)
|
106
|
+
connection.close
|
107
|
+
|
108
|
+
rescue => e
|
109
|
+
Rails.logger.info("Unable to submit query to Vertica: #{e}")
|
110
|
+
flash[:error] = "Unable to submit query to Vertica: #{e.message}"
|
111
|
+
redirect_to "/rails_admin/#{@model}/#{id}"
|
112
|
+
end
|
113
|
+
|
114
|
+
def fetch_columns
|
115
|
+
@id = params['id']
|
116
|
+
@model ||= params['class_name'].camelize.constantize
|
117
|
+
@columns = @model.columns.map { |c| c.name }
|
118
|
+
@all_columns = @model.columns.map { |c| c.name }
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>VerticaHistory</title>
|
5
|
+
<%= stylesheet_link_tag "vertica_history/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "vertica_history/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h1>Select Attributes for Vertica History for <%= @model %> <%= @id %></h1>
|
2
|
+
<div>Select Attributes you want to see in the table for the history of the records in vertica</div>
|
3
|
+
|
4
|
+
<%= form_for(@model.to_s.to_sym, url:{:controller=>'admin/vertica_history', :action=>'view_history'}, method: 'get', html: { class: 'form-horizontal' }) do |f| %>
|
5
|
+
|
6
|
+
<% @columns.each do |key| %>
|
7
|
+
<div id=<%= key %>>
|
8
|
+
<li style="list-style-type: none;">
|
9
|
+
<%= check_box_tag 'attribute-keys[]', key -%>
|
10
|
+
<%= h key -%>
|
11
|
+
</li>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
<li style="list-style-type: none;">
|
15
|
+
<%= check_box_tag 'attribute-keys[]', "*" -%>
|
16
|
+
<%= h "All Attributes" -%>
|
17
|
+
</li>
|
18
|
+
<%= f.submit('View History', class: 'btn btn-primary') %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<div class="pull-left"><%= link_to "Cancel", "/rails_admin/#{@model}/#{@id}" %></div>
|
22
|
+
</div>
|
@@ -0,0 +1,86 @@
|
|
1
|
+
<script>
|
2
|
+
$(document).ready(function() {
|
3
|
+
$('#backToModel').click(function() {
|
4
|
+
window.location.href = '/rails_admin/' + '<%= @model %>' + '/' + '<%= @id %>';
|
5
|
+
})
|
6
|
+
})
|
7
|
+
</script>
|
8
|
+
<style>
|
9
|
+
th {
|
10
|
+
width: 10px;
|
11
|
+
}
|
12
|
+
</style>
|
13
|
+
|
14
|
+
|
15
|
+
<div style="overflow: auto;">
|
16
|
+
<h1>Vertica History for <%= @model %> <%= @id %> - Total: <%= @total_records %> records found</h1>
|
17
|
+
|
18
|
+
<FORM style="padding-bottom: 20px">
|
19
|
+
<INPUT Type="button" VALUE="Back to Model View" id='backToModel'></FORM>
|
20
|
+
|
21
|
+
<div>Select New Attributes you want to see in the table for the history of the records in vertica</div>
|
22
|
+
<%= form_for(@model.to_s.to_sym, url: { :controller => 'admin/vertica_history', :action => 'view_history' }, method: 'get', html: { class: 'form-horizontal' }) do |f| %>
|
23
|
+
|
24
|
+
<% @all_columns.each do |key| %>
|
25
|
+
<div id=<%= key %>>
|
26
|
+
<li style="list-style-type: none;">
|
27
|
+
<%= check_box_tag 'attribute-keys[]', key -%>
|
28
|
+
<%= h key -%>
|
29
|
+
</li>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
<li style="list-style-type: none;">
|
33
|
+
<%= check_box_tag 'attribute-keys[]', "*" -%>
|
34
|
+
<%= h "All Attributes" -%>
|
35
|
+
</li>
|
36
|
+
<%= f.submit('Change Attributes', class: 'btn btn-primary') %>
|
37
|
+
<% end %>
|
38
|
+
<p></p>
|
39
|
+
|
40
|
+
<%= form_for(@model.to_s.to_sym, url: { :controller => 'admin/vertica_history', :action => 'view_history' }, method: 'get', html: { class: 'form-horizontal' }) do |f| %>
|
41
|
+
|
42
|
+
<h3>Filters</h3>
|
43
|
+
<%= text_field_tag :filter_column, nil, placeholder: 'Enter filter value...' %>
|
44
|
+
<%= select_tag :filter_field, options_for_select(@columns), :include_blank => true%>
|
45
|
+
|
46
|
+
<%= f.submit('Update/Filter Query', class: 'btn btn-primary') %>
|
47
|
+
<% end %>
|
48
|
+
|
49
|
+
<% if @query_hash.present? %>
|
50
|
+
<h3>Current Filters:</h3>
|
51
|
+
<% @query_hash.each do |col, val| %>
|
52
|
+
<p><%= col %> = <%= val %></p>
|
53
|
+
<% end %>
|
54
|
+
|
55
|
+
<%= form_for(@model.to_s.to_sym, url: { :controller => 'admin/vertica_history', :action => 'view_history' }, method: 'get', html: { class: 'form-horizontal' }) do |f| %>
|
56
|
+
<%= f.submit('Clear Filters', class: 'btn btn-primary') %>
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
|
60
|
+
|
61
|
+
</div>
|
62
|
+
<div>
|
63
|
+
<p></p>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div id="paginate">
|
67
|
+
<table class="table table-striped table-bordered table-condensed text-center">
|
68
|
+
<tr>
|
69
|
+
<% @columns.each do |col| %>
|
70
|
+
<th> <%= col.camelize %> <%= link_to '⇑'.html_safe, admin_vertica_history_view_history_path(order_by: (col + ' asc'), columns: @columns) %>
|
71
|
+
<%= link_to '⇓'.html_safe, admin_vertica_history_view_history_path(order_by: (col + ' desc'), columns: @columns) %></th>
|
72
|
+
<% end %>
|
73
|
+
</tr>
|
74
|
+
<% @history.each do |data| %>
|
75
|
+
<tr style="word-wrap: break-word;">
|
76
|
+
<% @columns.each do |col| %>
|
77
|
+
<td>
|
78
|
+
<%= data[col.to_sym] %>
|
79
|
+
</td>
|
80
|
+
<% end %>
|
81
|
+
</tr>
|
82
|
+
<% end %>
|
83
|
+
<%= paginate @history %>
|
84
|
+
</table>
|
85
|
+
</div>
|
86
|
+
</div>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_admin/config/actions'
|
2
|
+
require 'rails_admin/config/actions/base'
|
3
|
+
|
4
|
+
module RailsAdmin
|
5
|
+
module Config
|
6
|
+
module Actions
|
7
|
+
class VerticaHistory < RailsAdmin::Config::Actions::Base
|
8
|
+
RailsAdmin::Config::Actions.register(self)
|
9
|
+
|
10
|
+
register_instance_option(:member) { true }
|
11
|
+
register_instance_option(:pjax) { false }
|
12
|
+
|
13
|
+
register_instance_option :controller do
|
14
|
+
Proc.new do
|
15
|
+
redirect_to "/admin/vertica_history/#{params['model_name'].underscore.downcase.to_param}/#{params['id']}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
register_instance_option :link_icon do
|
20
|
+
'icon-time'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
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>.
|
data/test/dummy/Rakefile
ADDED
@@ -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 any plugin's vendor/assets/javascripts directory 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/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -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>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "vertica_history"
|
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
|
+
|
22
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
+
config.active_record.raise_in_transactional_callbacks = true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
|
30
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
31
|
+
# yet still be able to expire them through the digest params.
|
32
|
+
config.assets.digest = true
|
33
|
+
|
34
|
+
# Adds additional error checking when serving assets at runtime.
|
35
|
+
# Checks for improperly declared sprockets dependencies.
|
36
|
+
# Raises helpful error messages.
|
37
|
+
config.assets.raise_runtime_errors = true
|
38
|
+
|
39
|
+
# Raises error for missing translations
|
40
|
+
# config.action_view.raise_on_missing_translations = true
|
41
|
+
end
|