combustion 0.7.0 → 0.9.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 (50) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -1
  3. data/.rubocop.yml +39 -0
  4. data/.travis.yml +5 -5
  5. data/Appraisals +17 -0
  6. data/Gemfile +2 -0
  7. data/HISTORY +12 -0
  8. data/README.md +2 -2
  9. data/Rakefile +11 -1
  10. data/combustion.gemspec +26 -22
  11. data/exe/combust +3 -2
  12. data/gemfiles/rails_3.1.gemfile +1 -0
  13. data/gemfiles/rails_3.2.gemfile +1 -0
  14. data/gemfiles/rails_4.0.gemfile +1 -0
  15. data/gemfiles/rails_4.1.gemfile +1 -0
  16. data/gemfiles/rails_4.2.gemfile +2 -0
  17. data/gemfiles/rails_5.0.gemfile +2 -0
  18. data/gemfiles/rails_5.1.gemfile +2 -0
  19. data/gemfiles/rails_5.2.gemfile +8 -0
  20. data/lib/combustion/application.rb +23 -28
  21. data/lib/combustion/configurations/action_controller.rb +11 -0
  22. data/lib/combustion/configurations/action_mailer.rb +10 -0
  23. data/lib/combustion/configurations/active_record.rb +13 -0
  24. data/lib/combustion/database/load_schema.rb +14 -4
  25. data/lib/combustion/database/migrate.rb +29 -12
  26. data/lib/combustion/database/reset.rb +40 -21
  27. data/lib/combustion/database.rb +23 -14
  28. data/lib/combustion/databases/base.rb +4 -2
  29. data/lib/combustion/databases/firebird.rb +3 -1
  30. data/lib/combustion/databases/mysql.rb +55 -26
  31. data/lib/combustion/databases/oracle.rb +3 -1
  32. data/lib/combustion/databases/postgresql.rb +12 -11
  33. data/lib/combustion/databases/sql_server.rb +4 -2
  34. data/lib/combustion/databases/sqlite.rb +9 -7
  35. data/lib/combustion/generator.rb +16 -14
  36. data/lib/combustion.rb +34 -22
  37. data/spec/database_spec.rb +16 -12
  38. data/spec/dummy/db/migrate/20150717075542_create_dummy_test_table.rb +3 -1
  39. data/spec/dummy/db/migrate/20150717075543_create_dummy_test_table_in_another_db.rb +3 -1
  40. data/spec/dummy/lib/engine.rb +3 -1
  41. data/spec/dummy/spec/internal/app/models/model.rb +3 -1
  42. data/spec/dummy/spec/internal/app/models/model_in_another_db.rb +3 -1
  43. data/spec/dummy/spec/internal/config/routes.rb +3 -1
  44. data/spec/dummy/spec/internal/db/schema.rb +4 -1
  45. data/spec/spec_helper.rb +7 -6
  46. data/templates/config.ru +4 -2
  47. data/templates/routes.rb +3 -1
  48. data/templates/schema.rb +4 -1
  49. metadata +22 -4
  50. data/bin/literals +0 -9
@@ -1,25 +1,34 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Combustion
2
4
  module Databases
3
- #
4
5
  end
5
6
 
6
7
  class Database
8
+ DEFAULT_OPTIONS = {
9
+ :database_reset => true,
10
+ :load_schema => true,
11
+ :database_migrate => true
12
+ }.freeze
13
+
7
14
  def self.setup(options = {})
8
- Combustion::Database::Reset.call if options.fetch(:database_reset, true)
9
- Combustion::Database::LoadSchema.call if options.fetch(:load_schema, true)
10
- Combustion::Database::Migrate.call if options.fetch(:database_migrate, true)
15
+ options = DEFAULT_OPTIONS.merge options
16
+
17
+ Combustion::Database::Reset.call if options[:database_reset]
18
+ Combustion::Database::LoadSchema.call if options[:load_schema]
19
+ Combustion::Database::Migrate.call if options[:database_migrate]
11
20
  end
12
21
  end
13
22
  end
14
23
 
15
- require 'combustion/database/load_schema'
16
- require 'combustion/database/migrate'
17
- require 'combustion/database/reset'
24
+ require "combustion/databases/base"
25
+ require "combustion/databases/firebird"
26
+ require "combustion/databases/mysql"
27
+ require "combustion/databases/oracle"
28
+ require "combustion/databases/postgresql"
29
+ require "combustion/databases/sql_server"
30
+ require "combustion/databases/sqlite"
18
31
 
19
- require 'combustion/databases/base'
20
- require 'combustion/databases/firebird'
21
- require 'combustion/databases/mysql'
22
- require 'combustion/databases/oracle'
23
- require 'combustion/databases/postgresql'
24
- require 'combustion/databases/sql_server'
25
- require 'combustion/databases/sqlite'
32
+ require "combustion/database/load_schema"
33
+ require "combustion/database/migrate"
34
+ require "combustion/database/reset"
@@ -1,4 +1,6 @@
1
- require 'active_support/core_ext/module/delegation'
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/module/delegation"
2
4
 
3
5
  class Combustion::Databases::Base
4
6
  def initialize(configuration)
@@ -9,7 +11,7 @@ class Combustion::Databases::Base
9
11
  drop
10
12
  create
11
13
 
12
- establish_connection(:test)
14
+ establish_connection Rails.env.to_sym
13
15
  end
14
16
 
15
17
  private
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Combustion::Databases::Firebird < Combustion::Databases::Base
2
4
  def reset
3
- establish_connection :test
5
+ establish_connection Rails.env.to_sym
4
6
  connection.recreate_database!
5
7
  end
6
8
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Combustion::Databases::MySQL < Combustion::Databases::Base
2
- ACCESS_DENIED_ERROR = 10145
4
+ ACCESS_DENIED_ERROR = 10_145
3
5
 
4
6
  def reset
5
- establish_connection(configuration.merge('database' => nil))
7
+ establish_connection(configuration.merge("database" => nil))
6
8
 
7
9
  super
8
10
  end
@@ -10,34 +12,36 @@ class Combustion::Databases::MySQL < Combustion::Databases::Base
10
12
  private
11
13
 
12
14
  def charset
13
- configuration['charset'] || ENV['CHARSET'] || 'utf8'
15
+ configuration["charset"] || ENV["CHARSET"] || "utf8"
16
+ end
17
+
18
+ def charset_error
19
+ return "" unless config["charset"]
20
+
21
+ "(if you set the charset manually, make sure you have a matching collation)"
14
22
  end
15
23
 
16
24
  def collation
17
- configuration['collation'] || ENV['COLLATION'] || 'utf8_unicode_ci'
25
+ configuration["collation"] || ENV["COLLATION"] || "utf8_unicode_ci"
18
26
  end
19
27
 
20
28
  def create
21
- connection.create_database configuration['database'], creation_options
29
+ connection.create_database configuration["database"], creation_options
22
30
  establish_connection configuration
23
31
  rescue error_class => error
24
- if error.errno == ACCESS_DENIED_ERROR
25
- create_as_root
26
- else
27
- $stderr.puts error.error
28
- $stderr.puts "Couldn't create database for #{config.inspect}, charset: #{charset}, collation: #{collation}"
29
- $stderr.puts "(if you set the charset manually, make sure you have a matching collation)" if config['charset']
30
- end
32
+ rescue_create_from error
31
33
  end
32
34
 
33
- def create_as_root
34
- print "#{sqlerr.error}. \nPlease provide the root password for your mysql installation\n>"
35
- root_password = $stdin.gets.strip
35
+ def create_as_root(error)
36
36
  establish_connection configuration.merge(
37
- 'database' => nil, 'username' => 'root', 'password' => root_password
37
+ "database" => nil,
38
+ "username" => "root",
39
+ "password" => request_password(error)
38
40
  )
39
- connection.create_database config['database'], creation_options
41
+
42
+ connection.create_database config["database"], creation_options
40
43
  connection.execute grant_statement
44
+
41
45
  establish_connection configuration
42
46
  end
43
47
 
@@ -46,24 +50,49 @@ class Combustion::Databases::MySQL < Combustion::Databases::Base
46
50
  end
47
51
 
48
52
  def drop
49
- connection.drop_database configuration['database']
53
+ connection.drop_database configuration["database"]
50
54
  end
51
55
 
52
56
  def error_class
53
- if configuration['adapter'] =~ /jdbc/
54
- #FIXME After Jdbcmysql gives this class
55
- require 'active_record/railties/jdbcmysql_error'
56
- error_class = ArJdbcMySQL::Error
57
+ if configuration["adapter"][/jdbc/]
58
+ # FIXME: After Jdbcmysql gives this class
59
+ require "active_record/railties/jdbcmysql_error"
60
+ ArJdbcMySQL::Error
61
+ elsif config["adapter"][/mysql2/] && defined?(Mysql2)
62
+ Mysql2::Error
57
63
  else
58
- error_class = config['adapter'] =~ /mysql2/ && defined?(Mysql2) ? Mysql2::Error : Mysql::Error
64
+ Mysql::Error
59
65
  end
60
66
  end
61
67
 
62
68
  def grant_statement
63
69
  <<-SQL
64
- GRANT ALL PRIVILEGES ON #{configuration['database']}.*
65
- TO '#{configuration['username']}'@'localhost'
66
- IDENTIFIED BY '#{configuration['password']}' WITH GRANT OPTION;
70
+ GRANT ALL PRIVILEGES ON #{configuration["database"]}.*
71
+ TO '#{configuration["username"]}'@'localhost'
72
+ IDENTIFIED BY '#{configuration["password"]}' WITH GRANT OPTION;
67
73
  SQL
68
74
  end
75
+
76
+ def request_password(error)
77
+ print <<-TXT.strip
78
+ #{error.error}.
79
+ Please provide the root password for your mysql installation
80
+ >
81
+ TXT
82
+
83
+ $stdin.gets.strip
84
+ end
85
+
86
+ def rescue_create_from(error)
87
+ if error.errno == ACCESS_DENIED_ERROR
88
+ create_as_root(error)
89
+ return
90
+ end
91
+
92
+ warn <<-TXT
93
+ #{error.error}
94
+ Couldn't create database for #{config.inspect}, charset: #{charset}, collation: #{collation}
95
+ #{charset_error}
96
+ TXT
97
+ end
69
98
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Combustion::Databases::Oracle < Combustion::Databases::Base
2
4
  def reset
3
- establish_connection :test
5
+ establish_connection Rails.env.to_sym
4
6
  connection.structure_drop.split(";\n\n").each do |ddl|
5
7
  connection.execute(ddl)
6
8
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Combustion::Databases::PostgreSQL < Combustion::Databases::Base
2
4
  def reset
3
5
  base.clear_active_connections!
@@ -10,31 +12,30 @@ class Combustion::Databases::PostgreSQL < Combustion::Databases::Base
10
12
 
11
13
  def create
12
14
  connection.create_database(
13
- configuration['database'],
14
- configuration.merge('encoding' => encoding)
15
+ configuration["database"],
16
+ configuration.merge("encoding" => encoding)
15
17
  )
16
-
17
- rescue Exception => error
18
- $stderr.puts error, *(error.backtrace)
19
- $stderr.puts "Couldn't create database for #{configuration.inspect}"
18
+ rescue StandardError => error
19
+ warn error, *error.backtrace
20
+ warn "Couldn't create database for #{configuration.inspect}"
20
21
  end
21
22
 
22
23
  def drop
23
- connection.drop_database(configuration['database'])
24
+ connection.drop_database(configuration["database"])
24
25
  end
25
26
 
26
27
  def encoding
27
- configuration['encoding'] || ENV['CHARSET'] || 'utf8'
28
+ configuration["encoding"] || ENV["CHARSET"] || "utf8"
28
29
  end
29
30
 
30
31
  def postgres_configuration
31
32
  configuration.merge(
32
- 'database' => 'postgres',
33
- 'schema_search_path' => schema_search_path
33
+ "database" => "postgres",
34
+ "schema_search_path" => schema_search_path
34
35
  )
35
36
  end
36
37
 
37
38
  def schema_search_path
38
- configuration['adapter'][/postgis/] ? 'public, postgis' : 'public'
39
+ configuration["adapter"][/postgis/] ? "public, postgis" : "public"
39
40
  end
40
41
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Combustion::Databases::SQLServer < Combustion::Databases::Base
2
4
  def reset
3
- establish_connection configuration.merge('database' => 'master')
4
- connection.recreate_database! configuration['database']
5
+ establish_connection configuration.merge("database" => "master")
6
+ connection.recreate_database! configuration["database"]
5
7
  end
6
8
  end
@@ -1,20 +1,22 @@
1
- require 'fileutils'
2
- require 'pathname'
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+ require "pathname"
3
5
 
4
6
  class Combustion::Databases::SQLite < Combustion::Databases::Base
5
7
  private
6
8
 
7
9
  def create
8
10
  if exists?
9
- $stderr.puts "#{config['database']} already exists"
11
+ warn "#{config["database"]} already exists"
10
12
  return
11
13
  end
12
14
 
13
15
  establish_connection configuration
14
16
  connection
15
- rescue Exception => error
16
- $stderr.puts error, *(error.backtrace)
17
- $stderr.puts "Couldn't create database for #{configuration.inspect}"
17
+ rescue StandardError => error
18
+ warn error, *error.backtrace
19
+ warn "Couldn't create database for #{configuration.inspect}"
18
20
  end
19
21
 
20
22
  def drop
@@ -30,6 +32,6 @@ class Combustion::Databases::SQLite < Combustion::Databases::Base
30
32
  end
31
33
 
32
34
  def path
33
- @path ||= Pathname.new configuration['database']
35
+ @path ||= Pathname.new configuration["database"]
34
36
  end
35
37
  end
@@ -1,29 +1,31 @@
1
- require 'thor/group'
1
+ # frozen_string_literal: true
2
+
3
+ require "thor/group"
2
4
 
3
5
  module Combustion
4
6
  class Generator < Thor::Group
5
7
  include Thor::Actions
6
8
 
7
9
  def self.source_root
8
- File.expand_path File.join(File.dirname(__FILE__), '..', '..')
10
+ File.expand_path File.join(File.dirname(__FILE__), "..", "..")
9
11
  end
10
12
 
11
13
  def create_directories
12
- empty_directory 'spec/internal'
13
- empty_directory 'spec/internal/config'
14
- empty_directory 'spec/internal/db'
15
- empty_directory 'spec/internal/log'
16
- empty_directory 'spec/internal/public'
14
+ empty_directory "spec/internal"
15
+ empty_directory "spec/internal/config"
16
+ empty_directory "spec/internal/db"
17
+ empty_directory "spec/internal/log"
18
+ empty_directory "spec/internal/public"
17
19
  end
18
20
 
19
21
  def create_files
20
- template 'templates/routes.rb', 'spec/internal/config/routes.rb'
21
- template 'templates/database.yml', 'spec/internal/config/database.yml'
22
- template 'templates/schema.rb', 'spec/internal/db/schema.rb'
23
- template 'templates/config.ru', 'config.ru'
24
- create_file 'spec/internal/public/favicon.ico'
25
- create_file 'spec/internal/log/.gitignore' do
26
- '*.log'
22
+ template "templates/routes.rb", "spec/internal/config/routes.rb"
23
+ template "templates/database.yml", "spec/internal/config/database.yml"
24
+ template "templates/schema.rb", "spec/internal/db/schema.rb"
25
+ template "templates/config.ru", "config.ru"
26
+ create_file "spec/internal/public/favicon.ico"
27
+ create_file "spec/internal/log/.gitignore" do
28
+ "*.log"
27
29
  end
28
30
  end
29
31
  end
data/lib/combustion.rb CHANGED
@@ -1,38 +1,48 @@
1
- require 'rails'
2
- require 'active_support/dependencies'
1
+ # frozen_string_literal: true
2
+
3
+ require "rails"
4
+ require "active_support/dependencies"
3
5
 
4
6
  module Combustion
5
- mattr_accessor :path, :schema_format
6
- mattr_reader :setup_environment
7
+ module Configurations
8
+ end
9
+
10
+ mattr_accessor :path, :schema_format, :setup_environment
7
11
 
8
- self.path = '/spec/internal'
12
+ self.path = "/spec/internal"
9
13
  self.schema_format = :ruby
10
14
 
11
- if Rails.version.to_s > '3.1'
12
- Modules = %w( active_record action_controller action_view action_mailer
13
- sprockets )
15
+ MODULES = if Rails.version.to_f >= 3.1
16
+ %w[ active_record action_controller action_view action_mailer sprockets ]
14
17
  else
15
- Modules = %w( active_record action_controller action_view action_mailer )
18
+ %w[ active_record action_controller action_view action_mailer ]
16
19
  end
17
20
 
18
21
  def self.initialize!(*modules, &block)
19
- @@setup_environment = block if block_given?
22
+ self.setup_environment = block if block_given?
20
23
 
21
24
  options = modules.extract_options!
22
- modules = Modules if modules == [:all]
25
+ modules = MODULES if modules == [:all]
23
26
  modules.each { |mod| require "#{mod}/railtie" }
24
27
 
25
28
  Bundler.require :default, Rails.env
26
29
 
27
30
  Combustion::Application.configure_for_combustion
31
+ include_database modules, options
32
+ Combustion::Application.initialize!
33
+ include_rspec
34
+ end
28
35
 
29
- if modules.map(&:to_s).include? 'active_record'
30
- Combustion::Application.config.to_prepare do
31
- Combustion::Database.setup(options)
32
- end
36
+ def self.include_database(modules, options)
37
+ return unless modules.map(&:to_s).include? "active_record"
38
+
39
+ Combustion::Application.config.to_prepare do
40
+ Combustion::Database.setup(options)
33
41
  end
42
+ end
34
43
 
35
- Combustion::Application.initialize!
44
+ def self.include_rspec
45
+ return unless defined?(RSpec) && RSpec.respond_to?(:configure)
36
46
 
37
47
  RSpec.configure do |config|
38
48
  include_capybara_into config
@@ -41,7 +51,7 @@ module Combustion
41
51
  if Combustion::Application.routes.respond_to?(:mounted_helpers)
42
52
  config.include Combustion::Application.routes.mounted_helpers
43
53
  end
44
- end if defined?(RSpec) && RSpec.respond_to?(:configure)
54
+ end
45
55
  end
46
56
 
47
57
  def self.include_capybara_into(config)
@@ -49,12 +59,14 @@ module Combustion
49
59
 
50
60
  config.include Capybara::RSpecMatchers if defined?(Capybara::RSpecMatchers)
51
61
  config.include Capybara::DSL if defined?(Capybara::DSL)
62
+ return if defined?(Capybara::RSpecMatchers) || defined?(Capybara::DSL)
52
63
 
53
- unless defined?(Capybara::RSpecMatchers) || defined?(Capybara::DSL)
54
- config.include Capybara
55
- end
64
+ config.include Capybara
56
65
  end
57
66
  end
58
67
 
59
- require 'combustion/application'
60
- require 'combustion/database'
68
+ require "combustion/application"
69
+ require "combustion/configurations/action_controller"
70
+ require "combustion/configurations/action_mailer"
71
+ require "combustion/configurations/active_record"
72
+ require "combustion/database"
@@ -1,28 +1,32 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Combustion
2
4
  describe Database do
3
5
  before(:all) do
4
- Dir.chdir(File.expand_path('../dummy', __FILE__)) do
6
+ Dir.chdir(File.expand_path("dummy", __dir__)) do
5
7
  Combustion.initialize! :active_record
6
8
  end
7
9
  end
8
10
 
9
- it 'creates dummy table from migration in base database' do
10
- expect(Model.connection.table_exists?('dummy_table')).to eq true
11
- expect(Model.connection.table_exists?('dummy_in_another_db')).to eq false
11
+ it "creates dummy table from migration in base database" do
12
+ expect(Model.connection.table_exists?("dummy_table")).to eq true
13
+ expect(Model.connection.table_exists?("dummy_in_another_db")).to eq false
12
14
  end
13
15
 
14
- it 'creates another dummy table from another database' do
15
- expect(ModelInAnotherDb.connection.table_exists?('dummy_table')).to eq false
16
- expect(ModelInAnotherDb.connection.table_exists?('dummy_in_another_db')).to eq true
17
-
16
+ it "creates another dummy table from another database" do
17
+ expect(ModelInAnotherDb.connection.table_exists?("dummy_table")).
18
+ to eq false
19
+ expect(ModelInAnotherDb.connection.table_exists?("dummy_in_another_db")).
20
+ to eq true
18
21
  end
19
22
 
20
- it 'returns test databse for model with default connection' do
21
- expect(Model.connection_config[:database]).to match /test/
23
+ it "returns test database for model with default connection" do
24
+ expect(Model.connection_config[:database]).to match(/test/)
22
25
  end
23
26
 
24
- it 'returns test_another databse for model with connection to second database' do
25
- expect(ModelInAnotherDb.connection_config[:database]).to match /test_another/
27
+ it "returns test_another for model with connection to second database" do
28
+ expect(ModelInAnotherDb.connection_config[:database]).
29
+ to match(/test_another/)
26
30
  end
27
31
  end
28
32
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  superclass = ActiveRecord::VERSION::MAJOR < 5 ?
2
4
  ActiveRecord::Migration : ActiveRecord::Migration[4.2]
3
5
  class CreateDummyTestTable < superclass
4
6
  def change
5
- create_table 'dummy_table'
7
+ create_table "dummy_table"
6
8
  end
7
9
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  superclass = ActiveRecord::VERSION::MAJOR < 5 ?
2
4
  ActiveRecord::Migration : ActiveRecord::Migration[4.2]
3
5
  class CreateDummyTestTableInAnotherDb < superclass
4
6
  def change
5
- create_table 'dummy_in_another_db'
7
+ create_table "dummy_in_another_db"
6
8
  end
7
9
 
8
10
  def connection
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dummy
2
4
  class Engine < ::Rails::Engine
3
- initializer :dummy, before: :load_init_rb do |app|
5
+ initializer :dummy, :before => :load_init_rb do |app|
4
6
  app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
5
7
  end
6
8
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Model < ActiveRecord::Base
2
- self.table_name = 'dummy_table'
4
+ self.table_name = "dummy_table"
3
5
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ModelInAnotherDb < ActiveRecord::Base
2
- self.table_name = 'dummy_in_another_db'
4
+ self.table_name = "dummy_in_another_db"
3
5
 
4
6
  establish_connection :test_another
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.routes.draw do
2
- #
4
+ # Add your own routes here, or remove this file if you don't have need for it.
3
5
  end
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ActiveRecord::Schema.define do
2
- #
4
+ # Set up any tables you need to exist for your test suite that don't belong
5
+ # in migrations.
3
6
  end
data/spec/spec_helper.rb CHANGED
@@ -1,14 +1,15 @@
1
- # coding: utf-8
2
- require 'bundler/setup'
3
- require 'combustion'
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/setup"
4
+ require "combustion"
4
5
 
5
6
  if Rails::VERSION::STRING.to_f < 4.1
6
- require 'active_record'
7
- require 'active_record/connection_adapters/mysql2_adapter'
7
+ require "active_record"
8
+ require "active_record/connection_adapters/mysql2_adapter"
8
9
 
9
10
  class ActiveRecord::ConnectionAdapters::Mysql2Adapter
10
11
  NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
11
12
  end
12
13
  end
13
14
 
14
- require File.expand_path("../dummy/lib/engine.rb", __FILE__)
15
+ require File.expand_path("dummy/lib/engine.rb", __dir__)
data/templates/config.ru CHANGED
@@ -1,5 +1,7 @@
1
- require 'rubygems'
2
- require 'bundler'
1
+ # frozen_string_literal: true
2
+
3
+ require "rubygems"
4
+ require "bundler"
3
5
 
4
6
  Bundler.require :default, :development
5
7
 
data/templates/routes.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.routes.draw do
2
- #
4
+ # Add your own routes here, or remove this file if you don't have need for it.
3
5
  end
data/templates/schema.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ActiveRecord::Schema.define do
2
- #
4
+ # Set up any tables you need to exist for your test suite that don't belong
5
+ # in migrations.
3
6
  end