pg_comment 0.1.2 → 0.2.0

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 (56) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +5 -1
  3. data/.rspec +2 -0
  4. data/README.markdown +16 -13
  5. data/Rakefile +37 -5
  6. data/lib/pg_comment/connection_adapters/abstract/schema_statements.rb +10 -0
  7. data/lib/pg_comment/connection_adapters/postgresql_adapter.rb +24 -0
  8. data/lib/pg_comment/migration/command_recorder.rb +15 -2
  9. data/lib/pg_comment/schema_dumper.rb +6 -0
  10. data/lib/pg_comment/version.rb +1 -1
  11. data/pg_comment.gemspec +3 -1
  12. data/spec/comments_spec.rb +42 -0
  13. data/spec/dummy/Rakefile +7 -0
  14. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  15. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  17. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  18. data/spec/dummy/app/mailers/.gitkeep +0 -0
  19. data/spec/dummy/app/models/.gitkeep +0 -0
  20. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  21. data/spec/dummy/config/application.rb +60 -0
  22. data/spec/dummy/config/boot.rb +10 -0
  23. data/spec/dummy/config/database.yml +12 -0
  24. data/spec/dummy/config/environment.rb +5 -0
  25. data/spec/dummy/config/environments/development.rb +37 -0
  26. data/spec/dummy/config/environments/production.rb +67 -0
  27. data/spec/dummy/config/environments/test.rb +37 -0
  28. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/spec/dummy/config/initializers/inflections.rb +15 -0
  30. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  31. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  32. data/spec/dummy/config/initializers/session_store.rb +8 -0
  33. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  34. data/spec/dummy/config/locales/en.yml +5 -0
  35. data/spec/dummy/config/routes.rb +58 -0
  36. data/spec/dummy/config.ru +4 -0
  37. data/spec/dummy/db/migrate/20130502030557_create_vegetables.rb +23 -0
  38. data/spec/dummy/db/schema.rb +31 -0
  39. data/spec/dummy/lib/assets/.gitkeep +0 -0
  40. data/spec/dummy/log/.gitkeep +0 -0
  41. data/spec/dummy/public/404.html +26 -0
  42. data/spec/dummy/public/422.html +26 -0
  43. data/spec/dummy/public/500.html +25 -0
  44. data/spec/dummy/public/favicon.ico +0 -0
  45. data/spec/dummy/script/rails +6 -0
  46. data/spec/lib/pg_comment/connection_adapters/abstract/schema_definitions_spec.rb +46 -0
  47. data/spec/lib/pg_comment/connection_adapters/abstract/schema_statements_spec.rb +25 -0
  48. data/spec/lib/pg_comment/connection_adapters/postgresql_adapter_spec.rb +63 -0
  49. data/spec/lib/pg_comment/migration/command_recorder_spec.rb +40 -0
  50. data/spec/lib/pg_comment/schema_dumper_spec.rb +23 -0
  51. data/spec/spec_helper.rb +16 -0
  52. metadata +75 -16
  53. data/test/fake_connection.rb +0 -9
  54. data/test/postgre_sql_adapter_test.rb +0 -91
  55. data/test/schema_dumper_test.rb +0 -42
  56. data/test/test_helper.rb +0 -16
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjI1NzkwMjU1OTMzZGJhOTZlMDdmNjUxZGVhNDM3OGMyMzg1ODQ4Mw==
5
+ data.tar.gz: !binary |-
6
+ MmNjZTE3M2ExY2Q4NzFmZTQ5NzQ3YTJjYTQ0MTBjZTRjMGZmMDNiOQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MDFjYzM4OTk2YTRjMjQxYTkzOTE2OTk0ZWQwNjYyZjljOWU2MTYxMzM4YjE5
10
+ MWQ3NWM3YzY3ODgwY2ExYmYyYzBlMmFjNTMyOGEyZmVhMDVkMGJhNmFmNTUx
11
+ ZDc5YmU2MDk4ZWJiYzU4Mzc3MGQ1NmI3NTliMWI3NGM1ZDU2YjA=
12
+ data.tar.gz: !binary |-
13
+ ZmY2NDg4NTEyNzRiNTJjZTI1M2E1NDFhNGRiMGIyMzc4MGIwZDJkM2VmMDgx
14
+ YjI4Y2UyZWEzN2Y0NDM5YjdiYWRjODFjM2RmYjFkZDg2NjU2N2NkYTRmYTRh
15
+ MGZkNDM2YTBiZDRkMTJlOThjNTUyZjQ2NGQzYzc1YzU0MDRkMjE=
data/.gitignore CHANGED
@@ -4,4 +4,8 @@ Gemfile.lock
4
4
  pkg/*
5
5
  .idea
6
6
  .rvmrc
7
- coverage/*
7
+ coverage/*
8
+
9
+ spec/dummy/db/*.sqlite3
10
+ spec/dummy/log/*.log
11
+ spec/dummy/tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format nested
data/README.markdown CHANGED
@@ -4,15 +4,10 @@ https://github.com/albertosaurus/pg_comment
4
4
 
5
5
  In any PostgreSQL database where the Rails app is not the only consumer, it is very helpful to have comments
6
6
  on the various elements of the schema. PgComment extends the migrations DSL with methods to set and remove
7
- comments on columns and tables. It also dumps those comments into your schema.rb.
7
+ comments on columns, tables and indexes. It also dumps those comments into your schema.rb.
8
8
 
9
- Obviously, only the PostgreSQL adapter is supported. All bug reports are welcome.
10
-
11
- ## NOTE:
12
-
13
- I'm deprecating this in favor of PgPower: https://github.com/TMXCredit/pg_power It uses this db comment code,
14
- plus gives all sorts of other goodies like schemas and partial indexes. Since it uses this very code to
15
- support database comments, the comment syntax is 100% compatible.
9
+ Obviously, only the PostgreSQL adapter (ether 'pg' or 'activerecord-jdbcpostgresql-adapter')
10
+ is supported. All bug reports are welcome.
16
11
 
17
12
  ## Requirements
18
13
 
@@ -35,16 +30,18 @@ Alternatively you can manually install from RubyGems:
35
30
 
36
31
  ## Usage
37
32
 
38
- PgComment adds five methods to the migrations DSL:
33
+ PgComment adds eight methods to the migrations DSL:
39
34
 
40
35
  * `set_table_comment(table_name, comment)`
41
36
  * `remove_table_comment(table_name)`
42
37
  * `set_column_comment(table_name, column_name, comment)`
43
38
  * `remove_column_comment(table_name, column_name, comment)`
44
- * `set_column_comments(table_name, comments)`
45
- * `remove_column_comments(table_name, *comments)`
39
+ * `set_column_comments(table_name, column_comment_hash)`
40
+ * `remove_column_comments(table_name, *column_names)`
41
+ * `set_index_comment(index_name, comment)`
42
+ * `remove_index_comment(index_name)`
46
43
 
47
- ## Examples
44
+ ### Examples
48
45
 
49
46
  ```ruby
50
47
  # Set a comment on the given table.
@@ -66,9 +63,15 @@ set_column_comments :phone_numbers,
66
63
 
67
64
  # Remove comments from multiple columns in the table.
68
65
  remove_column_comments :phone_numbers, :npa, :nxx
66
+
67
+ # Set a comment on an index
68
+ set_index_comment :index_phone_numbers_on_npa, 'Unique index on area code'
69
+
70
+ # Remove a comment from an index
71
+ remove_index_comment :index_phone_numbers_on_npa
69
72
  ```
70
73
 
71
- PgComment also adds extra methods to change_table.
74
+ PgComment also adds extra methods to `change_table`.
72
75
 
73
76
  ```ruby
74
77
  # Set comments:
data/Rakefile CHANGED
@@ -1,8 +1,40 @@
1
1
  require "bundler/gem_tasks"
2
- require "rake/testtask"
3
2
 
4
- Rake::TestTask.new do |t|
5
- t.libs << "test"
6
- t.test_files = FileList['test/*test.rb']
7
- t.verbose = true
3
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
4
+ load 'rails/tasks/engine.rake'
5
+
6
+ desc 'Run specs'
7
+ task 'spec' => ['db:drop', 'db:create', 'db:migrate', 'app:spec']
8
+ task :default => :spec
9
+
10
+ def gemspec
11
+ @gem_spec ||= eval( open( `ls *.gemspec`.strip ){|file| file.read } )
12
+ end
13
+
14
+ def gem_version
15
+ gemspec.version
16
+ end
17
+
18
+ def gem_version_tag
19
+ "v#{gem_version}"
20
+ end
21
+
22
+ def gem_name
23
+ gemspec.name
24
+ end
25
+
26
+ def gem_file_name
27
+ "#{gem_name}-#{gem_version}.gem"
28
+ end
29
+
30
+ namespace :git do
31
+ desc "Create git version tag #{gem_version}"
32
+ task :tag do
33
+ sh "git tag -a #{gem_version_tag} -m \"Version #{gem_version}\""
34
+ end
35
+
36
+ desc "Push git tag to GitHub"
37
+ task :push_tags do
38
+ sh 'git push --tags'
39
+ end
8
40
  end
@@ -69,6 +69,16 @@ module PgComment
69
69
 
70
70
  end
71
71
 
72
+ # Sets the comment on the given index
73
+ def set_index_comment(index_name, comment)
74
+
75
+ end
76
+
77
+ # Removes the comment from the given index
78
+ def remove_index_comment(index_name)
79
+
80
+ end
81
+
72
82
  end
73
83
  end
74
84
  end
@@ -36,6 +36,17 @@ module PgComment
36
36
  remove_column_comment table_name, column_name
37
37
  end
38
38
  end
39
+
40
+ def set_index_comment(index_name, comment)
41
+ sql = "COMMENT ON INDEX #{quote_string(index_name)} IS $$#{comment}$$;"
42
+ execute sql
43
+ end
44
+
45
+ def remove_index_comment(index_name)
46
+ sql = "COMMENT ON INDEX #{quote_string(index_name)} IS NULL;"
47
+ execute sql
48
+ end
49
+
39
50
  =begin
40
51
  --Fetch all comments
41
52
  SELECT c.relname as table_name, a.attname as column_name, d.description as comment
@@ -57,6 +68,19 @@ WHERE c.relkind = 'r' AND c.relname = '#{table_name}'
57
68
  [ row['column_name'], row['comment'] ]
58
69
  end
59
70
  end
71
+
72
+ def index_comments
73
+ com = select_all %{
74
+ SELECT c.relname AS index_name, d.description AS comment
75
+ FROM pg_description d
76
+ JOIN pg_class c ON c.oid = d.objoid
77
+ WHERE c.relkind = 'i'
78
+ }
79
+ com.inject({}) do |hash, row|
80
+ hash[row['index_name']] = row['comment']
81
+ hash
82
+ end
83
+ end
60
84
  end
61
85
  end
62
86
  end
@@ -6,7 +6,7 @@ module PgComment
6
6
  end
7
7
 
8
8
  def remove_table_comment(*args)
9
- record(:remove_table_comments, args)
9
+ record(:remove_table_comment, args)
10
10
  end
11
11
 
12
12
  def set_column_comment(*args)
@@ -25,6 +25,14 @@ module PgComment
25
25
  record(:remove_column_comments, args)
26
26
  end
27
27
 
28
+ def set_index_comment(*args)
29
+ record(:set_index_comment, args)
30
+ end
31
+
32
+ def remove_index_comment(*args)
33
+ record(:remove_index_comment, args)
34
+ end
35
+
28
36
  def invert_set_table_comment(args)
29
37
  table_name = args.first
30
38
  [:remove_table_comment, [table_name]]
@@ -37,9 +45,14 @@ module PgComment
37
45
  end
38
46
 
39
47
  def invert_set_column_comments(args)
40
- i_args = [args[0]] + args[1].collect{|name, value| name }
48
+ i_args = [args[0]] + args[1].collect{|name, _| name }
41
49
  [:remove_column_comments, i_args]
42
50
  end
51
+
52
+ def invert_set_index_comment(args)
53
+ index_name = args.first
54
+ [:remove_index_comment, [index_name]]
55
+ end
43
56
  end
44
57
  end
45
58
  end
@@ -29,6 +29,12 @@ module PgComment
29
29
  stream.puts comment_statements.join("\n")
30
30
  stream.puts
31
31
  end
32
+
33
+ unless (index_comments = @connection.index_comments).empty?
34
+ index_comments.each_pair do |index_name, comment|
35
+ stream.puts " set_index_comment '#{index_name}', '#{comment.gsub(/'/, "\\\\'")}'"
36
+ end
37
+ end
32
38
  end
33
39
  private :dump_comments
34
40
  end
@@ -1,3 +1,3 @@
1
1
  module PgComment
2
- VERSION = "0.1.2"
2
+ VERSION = '0.2.0'
3
3
  end
data/pg_comment.gemspec CHANGED
@@ -19,5 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_dependency('activerecord', '~> 3.0')
22
- s.add_development_dependency("test-unit")
22
+ s.add_development_dependency('rails', '~> 3.2')
23
+ s.add_development_dependency('pg')
24
+ s.add_development_dependency('rspec-rails')
23
25
  end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Comments' do
4
+
5
+ def connection
6
+ ActiveRecord::Base.connection
7
+ end
8
+
9
+ def get_table_comment(table_name)
10
+ connection.query(<<-SQL).flatten.first
11
+ SELECT pg_desc.description
12
+ FROM pg_catalog.pg_description pg_desc
13
+ INNER JOIN pg_catalog.pg_class pg_class ON pg_class.oid = pg_desc.objoid
14
+ INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
15
+ WHERE pg_class.relname = '#{table_name}'
16
+ AND pg_desc.objsubid = 0 -- means table
17
+ SQL
18
+ end
19
+
20
+ def get_column_comment(table_name, column)
21
+ connection.query(<<-SQL).flatten.first
22
+ SELECT d.description
23
+ FROM pg_description d
24
+ JOIN pg_class c on c.oid = d.objoid
25
+ JOIN pg_attribute a ON c.oid = a.attrelid AND a.attnum = d.objsubid
26
+ JOIN pg_namespace ON c.relnamespace = pg_namespace.oid
27
+ WHERE c.relkind = 'r'
28
+ AND c.relname = '#{table_name}'
29
+ AND a.attname = '#{column}'
30
+ SQL
31
+ end
32
+
33
+ it 'should create table comments' do
34
+ get_table_comment('vegetables').should == 'Healthy and delicious'
35
+ end
36
+
37
+ it 'should create column comments' do
38
+ get_column_comment('vegetables', 'name').should == 'The name of the vegetable'
39
+ get_column_comment('vegetables', 'price').should == 'vegetable cost'
40
+ get_column_comment('vegetables', 'comment').should == 'thoughts'
41
+ end
42
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ 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
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
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,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,60 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ Bundler.require *Rails.groups(:assets => %w(development test))
7
+ end
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Custom directories with classes and modules you want to be autoloadable.
16
+ # config.autoload_paths += %W(#{config.root}/extras)
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named.
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running.
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+
29
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
+ # config.i18n.default_locale = :de
32
+
33
+ # Configure the default encoding used in templates for Ruby 1.9.
34
+ config.encoding = "utf-8"
35
+
36
+ # Configure sensitive parameters which will be filtered from the log file.
37
+ config.filter_parameters += [:password]
38
+
39
+ # Enable escaping HTML in JSON.
40
+ config.active_support.escape_html_entities_in_json = true
41
+
42
+ # Use SQL instead of Active Record's schema dumper when creating the database.
43
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
44
+ # like if you have constraints or database-specific column types
45
+ # config.active_record.schema_format = :sql
46
+
47
+ # Enforce whitelist mode for mass assignment.
48
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
49
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
50
+ # parameters by using an attr_accessible or attr_protected declaration.
51
+ config.active_record.whitelist_attributes = true
52
+
53
+ # Enable the asset pipeline
54
+ config.assets.enabled = true
55
+
56
+ # Version of your assets, change this if you want to expire all your assets
57
+ config.assets.version = '1.0'
58
+ end
59
+ end
60
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,12 @@
1
+ development: &default
2
+ adapter: postgresql
3
+ encoding: unicode
4
+ database: pg_comment_dummy_development
5
+ pool: 5
6
+ username: postgres
7
+ password: secret
8
+ host: localhost
9
+
10
+ test:
11
+ <<: *default
12
+ database: pg_comment_dummy_test
@@ -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!
@@ -0,0 +1,37 @@
1
+ Dummy::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
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
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
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
32
+ # Do not compress assets
33
+ config.assets.compress = false
34
+
35
+ # Expands the lines which load the assets
36
+ config.assets.debug = true
37
+ end
@@ -0,0 +1,67 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to nil and saved in location specified by config.assets.prefix
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end
@@ -0,0 +1,37 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '28f38793f7e09f0a5b2bff7679c626a0b3c6a4e299191e6b27d498b522ece7d7b9ddde67afbd912174098ec5ba13624f21f87676caea188bfe21a2326e2ba765'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store