dump 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +3 -1
  3. data/.rubocop.yml +47 -23
  4. data/.rubocop_todo.yml +105 -12
  5. data/.travis.yml +21 -31
  6. data/Appraisals +63 -0
  7. data/Gemfile +5 -26
  8. data/LICENSE.txt +1 -1
  9. data/README.markdown +3 -3
  10. data/dump.gemspec +11 -4
  11. data/lib/dump.rb +2 -2
  12. data/lib/dump/archive_tar_minitar.rb +1 -0
  13. data/lib/dump/assets.rb +1 -1
  14. data/lib/dump/capistrano.rb +3 -3
  15. data/lib/dump/capistrano/v2.rb +1 -0
  16. data/lib/dump/continious_timeout.rb +2 -2
  17. data/lib/dump/env/filter.rb +5 -5
  18. data/lib/dump/reader.rb +5 -1
  19. data/lib/dump/snapshot.rb +16 -12
  20. data/lib/dump/table_manipulation.rb +7 -1
  21. data/lib/dump/writer.rb +10 -3
  22. data/script/update_readme +1 -1
  23. data/spec/.gitignore +2 -0
  24. data/spec/cycle_spec.rb +1 -4
  25. data/spec/db/schema.rb +1 -1
  26. data/spec/dummy-5.0/.gitignore +21 -0
  27. data/spec/dummy-5.0/config.ru +5 -0
  28. data/spec/dummy-5.0/config/application.rb +25 -0
  29. data/spec/dummy-5.0/config/boot.rb +3 -0
  30. data/spec/dummy-5.0/config/cable.yml +9 -0
  31. data/spec/dummy-5.0/config/database.yml +25 -0
  32. data/spec/dummy-5.0/config/environment.rb +5 -0
  33. data/spec/dummy-5.0/config/environments/development.rb +47 -0
  34. data/spec/dummy-5.0/config/environments/production.rb +78 -0
  35. data/spec/dummy-5.0/config/environments/test.rb +42 -0
  36. data/spec/dummy-5.0/config/initializers/application_controller_renderer.rb +8 -0
  37. data/spec/dummy-5.0/config/initializers/backtrace_silencers.rb +7 -0
  38. data/spec/dummy-5.0/config/initializers/cookies_serializer.rb +5 -0
  39. data/spec/dummy-5.0/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/spec/dummy-5.0/config/initializers/inflections.rb +16 -0
  41. data/spec/dummy-5.0/config/initializers/mime_types.rb +4 -0
  42. data/spec/dummy-5.0/config/initializers/new_framework_defaults.rb +26 -0
  43. data/spec/dummy-5.0/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy-5.0/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy-5.0/config/locales/en.yml +23 -0
  46. data/spec/dummy-5.0/config/puma.rb +47 -0
  47. data/spec/dummy-5.0/config/routes.rb +3 -0
  48. data/spec/dummy-5.0/config/secrets.yml +22 -0
  49. data/spec/dummy-5.0/config/spring.rb +6 -0
  50. data/spec/dummy-5.0/db/seeds.rb +7 -0
  51. data/spec/dummy-5.0/log/.keep +0 -0
  52. data/spec/dummy-5.1/.gitignore +23 -0
  53. data/spec/dummy-5.1/config.ru +5 -0
  54. data/spec/dummy-5.1/config/application.rb +31 -0
  55. data/spec/dummy-5.1/config/boot.rb +3 -0
  56. data/spec/dummy-5.1/config/cable.yml +10 -0
  57. data/spec/dummy-5.1/config/database.yml +25 -0
  58. data/spec/dummy-5.1/config/environment.rb +5 -0
  59. data/spec/dummy-5.1/config/environments/development.rb +47 -0
  60. data/spec/dummy-5.1/config/environments/production.rb +83 -0
  61. data/spec/dummy-5.1/config/environments/test.rb +42 -0
  62. data/spec/dummy-5.1/config/initializers/application_controller_renderer.rb +8 -0
  63. data/spec/dummy-5.1/config/initializers/backtrace_silencers.rb +7 -0
  64. data/spec/dummy-5.1/config/initializers/cookies_serializer.rb +5 -0
  65. data/spec/dummy-5.1/config/initializers/filter_parameter_logging.rb +4 -0
  66. data/spec/dummy-5.1/config/initializers/inflections.rb +16 -0
  67. data/spec/dummy-5.1/config/initializers/mime_types.rb +4 -0
  68. data/spec/dummy-5.1/config/initializers/wrap_parameters.rb +14 -0
  69. data/spec/dummy-5.1/config/locales/en.yml +33 -0
  70. data/spec/dummy-5.1/config/puma.rb +56 -0
  71. data/spec/dummy-5.1/config/routes.rb +3 -0
  72. data/spec/dummy-5.1/config/secrets.yml +32 -0
  73. data/spec/dummy-5.1/config/spring.rb +6 -0
  74. data/spec/dummy-5.1/db/seeds.rb +7 -0
  75. data/spec/dummy-5.1/log/.keep +0 -0
  76. data/spec/dummy-5.1/package.json +5 -0
  77. data/spec/dummy-5.2/.gitignore +28 -0
  78. data/spec/dummy-5.2/config.ru +5 -0
  79. data/spec/dummy-5.2/config/application.rb +33 -0
  80. data/spec/dummy-5.2/config/boot.rb +3 -0
  81. data/spec/dummy-5.2/config/cable.yml +10 -0
  82. data/spec/dummy-5.2/config/database.yml +25 -0
  83. data/spec/dummy-5.2/config/environment.rb +5 -0
  84. data/spec/dummy-5.2/config/environments/development.rb +54 -0
  85. data/spec/dummy-5.2/config/environments/production.rb +85 -0
  86. data/spec/dummy-5.2/config/environments/test.rb +46 -0
  87. data/spec/dummy-5.2/config/initializers/application_controller_renderer.rb +8 -0
  88. data/spec/dummy-5.2/config/initializers/backtrace_silencers.rb +7 -0
  89. data/spec/dummy-5.2/config/initializers/content_security_policy.rb +25 -0
  90. data/spec/dummy-5.2/config/initializers/cookies_serializer.rb +5 -0
  91. data/spec/dummy-5.2/config/initializers/filter_parameter_logging.rb +4 -0
  92. data/spec/dummy-5.2/config/initializers/inflections.rb +16 -0
  93. data/spec/dummy-5.2/config/initializers/mime_types.rb +4 -0
  94. data/spec/dummy-5.2/config/initializers/wrap_parameters.rb +14 -0
  95. data/spec/dummy-5.2/config/locales/en.yml +33 -0
  96. data/spec/dummy-5.2/config/puma.rb +34 -0
  97. data/spec/dummy-5.2/config/routes.rb +3 -0
  98. data/spec/dummy-5.2/config/spring.rb +6 -0
  99. data/spec/dummy-5.2/config/storage.yml +34 -0
  100. data/spec/dummy-5.2/db/seeds.rb +7 -0
  101. data/spec/dummy-5.2/package.json +5 -0
  102. data/spec/dummy_rails_app.rb +3 -5
  103. data/spec/dump/env_spec.rb +7 -7
  104. data/spec/dump/rails_root_spec.rb +1 -1
  105. data/spec/dump/reader_spec.rb +14 -14
  106. data/spec/dump/snapshot_spec.rb +24 -17
  107. data/spec/dump/table_manipulation_spec.rb +8 -5
  108. data/spec/dump/writer_spec.rb +3 -3
  109. data/spec/dump_spec.rb +1 -1
  110. metadata +189 -21
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'dump'
5
- s.version = '1.1.0'
5
+ s.version = '1.2.0'
6
6
  s.summary = %q{Rails app rake and capistrano tasks to create and restore dumps of database and assets}
7
7
  s.homepage = "http://github.com/toy/#{s.name}"
8
8
  s.authors = ['Ivan Kuchin']
@@ -10,15 +10,22 @@ Gem::Specification.new do |s|
10
10
 
11
11
  s.rubyforge_project = s.name
12
12
 
13
+ s.metadata = {
14
+ 'bug_tracker_uri' => "https://github.com/toy/#{s.name}/issues",
15
+ 'documentation_uri' => "https://www.rubydoc.info/gems/#{s.name}/#{s.version}",
16
+ 'source_code_uri' => "https://github.com/toy/#{s.name}",
17
+ }
18
+
13
19
  s.files = `git ls-files`.split("\n")
14
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
21
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
22
  s.require_paths = %w[lib]
17
23
 
18
24
  s.add_dependency 'archive-tar-minitar', '= 0.5.2'
19
- s.add_dependency 'progress', '~> 3.0', '>= 3.0.1'
25
+ s.add_dependency 'progress', '~> 3.0', '>= 3.0.1', '!= 3.2.0', '!= 3.2.1'
26
+
20
27
  s.add_development_dependency 'rspec', '~> 3.0'
21
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9.3')
22
- s.add_development_dependency 'rubocop', '~> 0.27'
28
+ if RUBY_VERSION >= '2.2'
29
+ s.add_development_dependency 'rubocop', '~> 0.59'
23
30
  end
24
31
  end
@@ -61,13 +61,13 @@ module Dump
61
61
 
62
62
  def cleanup(options = {})
63
63
  unless options[:leave].nil? || /^\d+$/ =~ options[:leave] || options[:leave].downcase == 'none'
64
- fail 'LEAVE should be number or "none"'
64
+ fail ArgumentError, 'LEAVE should be number or "none"'
65
65
  end
66
66
 
67
67
  to_delete = []
68
68
 
69
69
  all_dumps = Snapshot.list(options.merge(:all => true))
70
- to_delete.concat(all_dumps.select{ |dump| dump.ext != 'tgz' })
70
+ to_delete.concat(all_dumps.reject{ |dump| dump.ext == 'tgz' })
71
71
 
72
72
  dumps = Snapshot.list(options)
73
73
  leave = (options[:leave] || 5).to_i
@@ -3,6 +3,7 @@ require 'archive/tar/minitar'
3
3
  Archive::Tar::Minitar::Reader::EntryStream.class_eval do
4
4
  def getbyte
5
5
  return nil if @read >= @size
6
+
6
7
  ret = @io.getbyte
7
8
  @read += 1 if ret
8
9
  ret
@@ -5,7 +5,7 @@ require 'dump'
5
5
  module Dump
6
6
  # Helper for listing assets for dump
7
7
  module Assets
8
- SPLITTER = /[:,]/
8
+ SPLITTER = /[:,]/.freeze
9
9
 
10
10
  class << self
11
11
  def assets
@@ -1,7 +1,7 @@
1
1
  require 'capistrano/version'
2
2
 
3
- if defined?(Capistrano::Version) && Capistrano::Version::MAJOR == 2
4
- require 'dump/capistrano/v2'
5
- else
3
+ unless defined?(Capistrano::Version) && Capistrano::Version::MAJOR == 2
6
4
  fail 'Capistrano 3 is not yet supported'
7
5
  end
6
+
7
+ require 'dump/capistrano/v2'
@@ -122,6 +122,7 @@ Capistrano::Configuration.instance(:i_need_this!).load do
122
122
  def print_and_return_or_fail
123
123
  out = yield
124
124
  fail 'Failed creating dump' if out.blank?
125
+
125
126
  print out
126
127
  out.strip
127
128
  end
@@ -3,9 +3,9 @@
3
3
  module Dump
4
4
  # Timeout if does not finish or defer in requested time
5
5
  module ContiniousTimeout
6
- class TimeoutException < ::Exception; end
6
+ class TimeoutException < RuntimeError; end
7
7
 
8
- class RestartException < ::Exception; end
8
+ class RestartException < RuntimeError; end
9
9
 
10
10
  # Object with defer method
11
11
  class Deferer
@@ -7,11 +7,11 @@ module Dump
7
7
  # '-a,b,c' will pass everything except 'a', 'b' and 'c'
8
8
  class Filter
9
9
  attr_reader :invert, :values, :transparent
10
- def initialize(s, splitter = nil)
11
- if s
12
- s = s.dup
13
- @invert = !!s.sub!(/^-/, '')
14
- @values = s.split(splitter || ',').map(&:strip).map(&:downcase).uniq.select(&:present?)
10
+ def initialize(string, splitter = nil)
11
+ if string
12
+ string = string.dup
13
+ @invert = !!string.sub!(/^-/, '')
14
+ @values = string.split(splitter || ',').map(&:strip).map(&:downcase).uniq.select(&:present?)
15
15
  else
16
16
  @transparent = true
17
17
  end
@@ -131,6 +131,7 @@ module Dump
131
131
  Rake::Task['db:create'].invoke
132
132
  when !Dump::Env.no?(:migrate_down)
133
133
  return unless avaliable_tables.include?('schema_migrations')
134
+
134
135
  find_entry('schema_migrations.dump') do |entry|
135
136
  migrated = table_rows('schema_migrations').map{ |row| row['version'] }
136
137
 
@@ -164,6 +165,7 @@ module Dump
164
165
 
165
166
  def read_schema
166
167
  return unless restore_schema?
168
+
167
169
  read_entry_to_file('schema.rb') do |f|
168
170
  Dump::Env.with_env('SCHEMA' => f.path) do
169
171
  Rake::Task['db:schema:load'].invoke
@@ -178,6 +180,7 @@ module Dump
178
180
 
179
181
  def read_tables
180
182
  return if Dump::Env[:restore_tables] && Dump::Env[:restore_tables].empty?
183
+
181
184
  verify_connection
182
185
  config[:tables].with_progress('Tables') do |table, rows|
183
186
  if (restore_schema? && schema_tables.include?(table)) || Dump::Env.filter(:restore_tables).pass?(table)
@@ -229,8 +232,9 @@ module Dump
229
232
 
230
233
  if Dump::Env[:restore_assets]
231
234
  assets_paths.each do |asset|
232
- Dump::Assets.glob_asset_children(asset, '**/*').reverse.each do |child|
235
+ Dump::Assets.glob_asset_children(asset, '**/*').reverse_each do |child|
233
236
  next unless read_asset?(child, Dump.rails_root)
237
+
234
238
  case
235
239
  when File.file?(child)
236
240
  File.unlink(child)
@@ -56,16 +56,17 @@ module Dump
56
56
  end
57
57
 
58
58
  def parts
59
- @parts ||=
60
- if (m = name.match(/^(\d{#{4 + 2 + 2 + 2 + 2 + 2}})(-[^@]+)?((?:@[^@]+)+)?\.(tmp|tgz)$/))
61
- {
62
- :time => m[1],
63
- :desc => m[2] && m[2][1, m[2].length],
64
- :tags => m[3] && m[3][1, m[3].length],
65
- :ext => m[4],
66
- }
67
- else
68
- {}
59
+ @parts ||= begin
60
+ if (m = name.match(/^(\d{#{4 + 2 + 2 + 2 + 2 + 2}})(-[^@]+)?((?:@[^@]+)+)?\.(tmp|tgz)$/))
61
+ {
62
+ :time => m[1],
63
+ :desc => m[2] && m[2][1, m[2].length],
64
+ :tags => m[3] && m[3][1, m[3].length],
65
+ :ext => m[4],
66
+ }
67
+ else
68
+ {}
69
+ end
69
70
  end
70
71
  end
71
72
 
@@ -91,12 +92,13 @@ module Dump
91
92
  alias_method :to_s, :name
92
93
 
93
94
  def size
94
- File.size(path) rescue nil
95
+ File.size?(path)
95
96
  end
96
97
 
97
98
  def human_size
98
99
  number = size
99
100
  return nil if number.nil?
101
+
100
102
  degree = 0
101
103
  symbols = %w[B K M G T]
102
104
  while number >= 1000 && degree < symbols.length - 1
@@ -170,13 +172,15 @@ module Dump
170
172
  groups = Hash.new{ |hash, key| hash[key] = SortedSet.new }
171
173
  tags.to_s.split(',').each do |tag|
172
174
  next unless (m = tag.strip.match(/^(\-|\+)?(.*)$/))
175
+
173
176
  type = {'+' => :mandatory, '-' => :forbidden}[m[1]] || :simple
174
177
  next unless (cleaned_tag = clean_tag(m[2])).present?
178
+
175
179
  groups[type] << cleaned_tag
176
180
  end
177
181
  [:simple, :mandatory].each do |type|
178
182
  if (clashing = (groups[type] & groups[:forbidden])).present?
179
- fail "#{type} tags clashes with forbidden ones: #{clashing}"
183
+ fail ArgumentError, "#{type} tags clashes with forbidden ones: #{clashing}"
180
184
  end
181
185
  end
182
186
  groups.each_with_object({}){ |(key, value), hsh| hsh[key] = value.to_a }
@@ -10,7 +10,11 @@ module Dump
10
10
  end
11
11
 
12
12
  def verify_connection
13
- connection.verify!(0)
13
+ if connection.method(:verify!).arity == 1
14
+ connection.verify!(0)
15
+ else
16
+ connection.verify!
17
+ end
14
18
  end
15
19
 
16
20
  def quote_table_name(table)
@@ -37,6 +41,7 @@ module Dump
37
41
 
38
42
  def fix_sequence!(table)
39
43
  return unless connection.respond_to?(:reset_pk_sequence!)
44
+
40
45
  connection.reset_pk_sequence!(table)
41
46
  end
42
47
 
@@ -118,6 +123,7 @@ module Dump
118
123
  until rows.blank?
119
124
  rows.each(&block)
120
125
  break if rows.count < chunk_size
126
+
121
127
  sql = select_where_primary_key % "> #{rows.last[primary_key].to_i}"
122
128
  rows = select_all_by_sql(sql)
123
129
  end
@@ -42,7 +42,7 @@ module Dump
42
42
  Tempfile.open('dump') do |temp|
43
43
  yield(temp)
44
44
  temp.open
45
- stream.tar.add_file_simple(name, :mode => 0100444, :size => temp.length) do |f|
45
+ stream.tar.add_file_simple(name, :mode => 0o100444, :size => temp.length) do |f|
46
46
  f.write(temp.read(4096)) until temp.eof?
47
47
  end
48
48
  end
@@ -75,14 +75,21 @@ module Dump
75
75
  Marshal.dump(column_names, f)
76
76
  Progress.step
77
77
 
78
- type_cast = if columns.first.respond_to?(:type_cast_from_database)
78
+ type_cast = case
79
+ when columns.first.respond_to?(:type_cast_from_database)
79
80
  proc do |column_name, value|
80
81
  columns_by_name[column_name].type_cast_from_database(value)
81
82
  end
82
- else
83
+ when columns.first.respond_to?(:type_cast)
83
84
  proc do |column_name, value|
84
85
  columns_by_name[column_name].type_cast(value)
85
86
  end
87
+ when connection.respond_to?(:lookup_cast_type_from_column)
88
+ proc do |column_name, value|
89
+ connection.lookup_cast_type_from_column(columns_by_name[column_name]).deserialize(value)
90
+ end
91
+ else
92
+ fail 'Failed to determine the way to convert values from database input to the appropriate ruby type'
86
93
  end
87
94
 
88
95
  each_table_row(table, row_count) do |row|
@@ -11,7 +11,7 @@ lines = readme.readlines.map(&:rstrip)
11
11
  readme.open('w') do |f|
12
12
  lines.each do |line|
13
13
  line.sub!(/^`(.+?)`.*—.*$/) do
14
- key, names = Dump::Env::DICTIONARY.find{ |_key, values| values.include?(Regexp.last_match[1]) }
14
+ key, names = Dump::Env::DICTIONARY.find{ |_key, values| values.include?(Regexp.last_match[1]) }
15
15
  if key
16
16
  names = names.map{ |name| "`#{name}`" }.join(', ')
17
17
  explanation = Dump::Env::EXPLANATIONS[key]
@@ -1,6 +1,8 @@
1
1
  /db/database.yml
2
2
 
3
3
  /dummy-*/.bundle/
4
+ /dummy-*/.ruby-version
5
+ /dummy-*/config/credentials.yml.enc
4
6
  /dummy-*/db/*.sqlite3
5
7
  /dummy-*/db/*.sqlite3-journal
6
8
  /dummy-*/log/*.log
@@ -23,15 +23,12 @@ def use_adapter(adapter)
23
23
  ActiveRecord::Base.establish_connection(config.merge('database' => nil))
24
24
  ActiveRecord::Base.connection.drop_database config['database']
25
25
  ActiveRecord::Base.connection.create_database(config['database'])
26
- ActiveRecord::Base.establish_connection(config)
27
26
  when /^postgresql/
28
27
  ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
29
28
  ActiveRecord::Base.connection.drop_database config['database']
30
29
  ActiveRecord::Base.connection.create_database(config['database'])
31
- ActiveRecord::Base.establish_connection(config)
32
- else
33
- ActiveRecord::Base.establish_connection(config)
34
30
  end
31
+ ActiveRecord::Base.establish_connection(config)
35
32
  load_schema
36
33
  yield
37
34
  ensure
@@ -6,7 +6,7 @@ ActiveRecord::Schema.define(:version => 0) do
6
6
  end
7
7
 
8
8
  create_table :another_chickens, :force => true do |t|
9
- %w[string text decimal datetime timestamp date ].each do |type|
9
+ %w[string text decimal datetime timestamp date].each do |type|
10
10
  t.column "#{type}_col", type
11
11
  end
12
12
  end
@@ -0,0 +1,21 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore Byebug command history file.
21
+ .byebug_history
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
@@ -0,0 +1,25 @@
1
+ require_relative 'boot'
2
+
3
+ require "rails"
4
+ # Pick the frameworks you want:
5
+ require "active_model/railtie"
6
+ require "active_job/railtie"
7
+ require "active_record/railtie"
8
+ require "action_controller/railtie"
9
+ require "action_mailer/railtie"
10
+ require "action_view/railtie"
11
+ require "action_cable/engine"
12
+ # require "sprockets/railtie"
13
+ # require "rails/test_unit/railtie"
14
+
15
+ # Require the gems listed in Gemfile, including any gems
16
+ # you've limited to :test, :development, or :production.
17
+ Bundler.require(*Rails.groups)
18
+
19
+ module Dummy50
20
+ class Application < Rails::Application
21
+ # Settings in config/environments/* take precedence over those specified here.
22
+ # Application configuration should go into files in config/initializers
23
+ # -- all .rb files in that directory are automatically loaded.
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,9 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: redis://localhost:6379/1
@@ -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,5 @@
1
+ # Load the Rails application.
2
+ require_relative 'application'
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,47 @@
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.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ if Rails.root.join('tmp/caching-dev.txt').exist?
17
+ config.action_controller.perform_caching = true
18
+
19
+ config.cache_store = :memory_store
20
+ config.public_file_server.headers = {
21
+ 'Cache-Control' => 'public, max-age=172800'
22
+ }
23
+ else
24
+ config.action_controller.perform_caching = false
25
+
26
+ config.cache_store = :null_store
27
+ end
28
+
29
+ # Don't care if the mailer can't send.
30
+ config.action_mailer.raise_delivery_errors = false
31
+
32
+ config.action_mailer.perform_caching = false
33
+
34
+ # Print deprecation notices to the Rails logger.
35
+ config.active_support.deprecation = :log
36
+
37
+ # Raise an error on page load if there are pending migrations.
38
+ config.active_record.migration_error = :page_load
39
+
40
+
41
+ # Raises error for missing translations
42
+ # config.action_view.raise_on_missing_translations = true
43
+
44
+ # Use an evented file watcher to asynchronously detect changes in source code,
45
+ # routes, locales, etc. This feature depends on the listen gem.
46
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
47
+ end