combustion 1.1.2 → 1.3.2
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.
- checksums.yaml +4 -4
- data/Appraisals +30 -15
- data/Gemfile +10 -1
- data/README.md +3 -3
- data/lib/combustion/application.rb +8 -3
- data/lib/combustion/configurations/active_record.rb +4 -0
- data/lib/combustion/configurations/active_storage.rb +9 -0
- data/lib/combustion/database/reset.rb +35 -7
- data/lib/combustion/databases/mysql.rb +15 -15
- data/lib/combustion/databases/postgresql.rb +7 -7
- data/lib/combustion/databases/sql_server.rb +2 -2
- data/lib/combustion/databases/sqlite.rb +2 -2
- data/lib/combustion/generator.rb +1 -0
- data/lib/combustion.rb +22 -8
- data/spec/database_spec.rb +21 -20
- data/spec/dummy/spec/internal/app/assets/config/manifest.js +1 -0
- data/spec/dummy/spec/internal/config/database.yml +4 -0
- data/spec/spec_helper.rb +4 -1
- data/templates/storage.yml +3 -0
- metadata +24 -23
- data/.gitignore +0 -12
- data/.rubocop.yml +0 -39
- data/.travis.yml +0 -23
- data/HISTORY +0 -106
- data/combustion.gemspec +0 -32
- data/spec/dummy/spec/internal/log/.gitignore +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39f83842b1e3640bdda8adf04dbcafba5585f631c9cac38593bfa1cf6e2cfe9e
|
4
|
+
data.tar.gz: 27033c85fed3a308d3b948589c3b7718b3e519e1678fe1485c3602fd2fa2a3f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7946f7712e79c002ec2f96621668c8e28761bbfff99d5da9dd4f8adebeca0feae00b8ca97c4f317bd1c015f086b0c74622c7326c3e7dcc775c5b9e75b2672cb
|
7
|
+
data.tar.gz: 37f64f59e58314e2835b6ed840ece3fd7fcf95be92e5ce154346ae79c6efb51421063421113cbbc6ff9d5a526bf0fbf255b31232e02c92c0017efc850a81bb19
|
data/Appraisals
CHANGED
@@ -37,21 +37,23 @@ if RUBY_VERSION.to_f <= 2.3
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
if RUBY_VERSION.to_f < 3.0
|
41
|
+
appraise "rails-5.0" do
|
42
|
+
gem "rails", "~> 5.0.2"
|
43
|
+
gem "mysql2", "~> 0.4.4"
|
44
|
+
gem "pg", "< 1.0"
|
45
|
+
end
|
45
46
|
|
46
|
-
appraise "rails-5.1" do
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
47
|
+
appraise "rails-5.1" do
|
48
|
+
gem "rails", "~> 5.1.0"
|
49
|
+
gem "mysql2", "~> 0.4.4"
|
50
|
+
gem "pg", "< 1.0"
|
51
|
+
end
|
51
52
|
|
52
|
-
appraise "rails-5.2" do
|
53
|
-
|
54
|
-
|
53
|
+
appraise "rails-5.2" do
|
54
|
+
gem "rails", "~> 5.2.0"
|
55
|
+
gem "mysql2", "~> 0.5.0"
|
56
|
+
end
|
55
57
|
end
|
56
58
|
|
57
59
|
if RUBY_VERSION.to_f >= 2.5
|
@@ -61,9 +63,22 @@ if RUBY_VERSION.to_f >= 2.5
|
|
61
63
|
gem "sqlite3", "~> 1.4"
|
62
64
|
end
|
63
65
|
|
66
|
+
appraise "rails-6.1" do
|
67
|
+
gem "rails", "~> 6.1.0"
|
68
|
+
gem "mysql2", "~> 0.5.0"
|
69
|
+
gem "sqlite3", "~> 1.4"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
if RUBY_VERSION.to_f >= 2.7
|
74
|
+
appraise "rails-7.0" do
|
75
|
+
gem "rails", "~> 7.0.0.alpha2"
|
76
|
+
gem "mysql2", "~> 0.5.0"
|
77
|
+
gem "sqlite3", "~> 1.4"
|
78
|
+
end
|
79
|
+
|
64
80
|
appraise "rails-edge" do
|
65
|
-
gem "rails", :git => "https://github.com/rails/rails.git"
|
66
|
-
gem "arel", :git => "https://github.com/rails/arel.git"
|
81
|
+
gem "rails", :git => "https://github.com/rails/rails.git", :branch => "main"
|
67
82
|
gem "mysql2", "~> 0.5.0"
|
68
83
|
gem "sqlite3", "~> 1.4"
|
69
84
|
end
|
data/Gemfile
CHANGED
@@ -4,10 +4,19 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
|
7
|
+
if RUBY_VERSION.to_f < 3.0
|
8
|
+
gem "sqlite3", "~> 1.3.13"
|
9
|
+
else
|
10
|
+
gem "sqlite3", "~> 1.4"
|
11
|
+
end
|
8
12
|
|
9
13
|
if RUBY_VERSION.to_f < 2.3
|
10
14
|
gem "i18n", "< 1.6"
|
11
15
|
gem "nio4r", "< 2.4"
|
12
16
|
gem "nokogiri", "< 1.10.3"
|
13
17
|
end
|
18
|
+
|
19
|
+
if RUBY_VERSION.to_f > 2.4
|
20
|
+
gem "rubocop", "~> 0.92"
|
21
|
+
gem "rubocop-packaging", "~> 0.5"
|
22
|
+
end
|
data/README.md
CHANGED
@@ -10,10 +10,10 @@ Get the gem into either your gemspec or your Gemfile, depending on how you manag
|
|
10
10
|
|
11
11
|
```ruby
|
12
12
|
# gemspec
|
13
|
-
gem.add_development_dependency 'combustion', '~> 1.
|
13
|
+
gem.add_development_dependency 'combustion', '~> 1.3'
|
14
14
|
|
15
15
|
# Gemfile
|
16
|
-
gem 'combustion', '~> 1.
|
16
|
+
gem 'combustion', '~> 1.3'
|
17
17
|
```
|
18
18
|
|
19
19
|
In your `spec_helper.rb`, get Combustion to set itself up - which has to happen before you introduce `rspec/rails` and - if being used - `capybara/rails`. Here's an example within context:
|
@@ -208,4 +208,4 @@ The tests are extremely minimal, and patches to extend the suite are especially
|
|
208
208
|
|
209
209
|
## Credits
|
210
210
|
|
211
|
-
Copyright (c) 2011-
|
211
|
+
Copyright (c) 2011-2021, Combustion is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to HyperTiny for encouraging its development, and [all who have contributed patches](https://github.com/pat/combustion/contributors).
|
@@ -6,6 +6,13 @@ Rails.env = ENV["RAILS_ENV"] || "test"
|
|
6
6
|
|
7
7
|
module Combustion
|
8
8
|
class Application < Rails::Application
|
9
|
+
CONFIGURERS = [
|
10
|
+
Combustion::Configurations::ActiveRecord,
|
11
|
+
Combustion::Configurations::ActionController,
|
12
|
+
Combustion::Configurations::ActionMailer,
|
13
|
+
Combustion::Configurations::ActiveStorage
|
14
|
+
].freeze
|
15
|
+
|
9
16
|
version = Rails.version.to_f
|
10
17
|
|
11
18
|
# Core Settings
|
@@ -26,9 +33,7 @@ module Combustion
|
|
26
33
|
def self.configure_for_combustion
|
27
34
|
config.root = File.expand_path File.join(Dir.pwd, Combustion.path)
|
28
35
|
|
29
|
-
|
30
|
-
Combustion::Configurations::ActionController.call config
|
31
|
-
Combustion::Configurations::ActionMailer.call config
|
36
|
+
CONFIGURERS.each { |configurer| configurer.call config }
|
32
37
|
|
33
38
|
config.assets.enabled = true if defined?(Sprockets)
|
34
39
|
end
|
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
class Combustion::Configurations::ActiveRecord
|
4
4
|
def self.call(config)
|
5
|
+
if ActiveRecord::VERSION::MAJOR >= 7
|
6
|
+
config.active_record.legacy_connection_handling = false
|
7
|
+
end
|
8
|
+
|
5
9
|
return unless defined?(ActiveRecord::Railtie)
|
6
10
|
return unless ::ActiveRecord.constants.include?(:MassAssignmentSecurity)
|
7
11
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Combustion::Database::Reset
|
4
|
+
# https://github.com/ruby/psych/pull/358/files#diff-fcdbfb11714f576f58ba9f866052bc79R322
|
5
|
+
RUBY_VERSION_WITH_NEW_SAFE_LOAD_METHOD_SIGNATURE = "2.6.0"
|
6
|
+
|
4
7
|
UnsupportedDatabase = Class.new StandardError
|
5
8
|
|
6
9
|
OPERATOR_PATTERNS = {
|
@@ -19,15 +22,22 @@ class Combustion::Database::Reset
|
|
19
22
|
end
|
20
23
|
|
21
24
|
def initialize
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
# TODO: remove when no longer support 2.5.8
|
26
|
+
if RUBY_VERSION >= RUBY_VERSION_WITH_NEW_SAFE_LOAD_METHOD_SIGNATURE
|
27
|
+
ActiveRecord::Base.configurations = YAML.safe_load(
|
28
|
+
ERB.new(database_yaml).result, :aliases => true
|
29
|
+
)
|
30
|
+
else
|
31
|
+
ActiveRecord::Base.configurations = YAML.safe_load(
|
32
|
+
ERB.new(database_yaml).result, [], [], true
|
33
|
+
)
|
34
|
+
end
|
25
35
|
end
|
26
36
|
|
27
37
|
def call
|
28
|
-
resettable_db_configs.
|
29
|
-
adapter = configuration[
|
30
|
-
configuration[
|
38
|
+
resettable_db_configs.each do |configuration|
|
39
|
+
adapter = configuration[:adapter] ||
|
40
|
+
configuration[:url].split("://").first
|
31
41
|
|
32
42
|
operator_class(adapter).new(configuration).reset
|
33
43
|
end
|
@@ -52,10 +62,28 @@ class Combustion::Database::Reset
|
|
52
62
|
# All database configs except Rails default environments
|
53
63
|
# that are not currently in use
|
54
64
|
def resettable_db_configs
|
65
|
+
if ActiveRecord::VERSION::STRING.to_f > 6.0
|
66
|
+
return resettable_db_configs_for_6_1
|
67
|
+
end
|
68
|
+
|
55
69
|
all_configurations = ActiveRecord::Base.configurations.to_h
|
56
70
|
unused_environments = RAILS_DEFAULT_ENVIRONMENTS - [Rails.env.to_s]
|
57
71
|
resettable_environments = all_configurations.keys - unused_environments
|
58
72
|
|
59
|
-
all_configurations.
|
73
|
+
all_configurations.
|
74
|
+
select { |name| resettable_environments.include?(name) }.
|
75
|
+
values.
|
76
|
+
collect(&:with_indifferent_access)
|
77
|
+
end
|
78
|
+
|
79
|
+
def resettable_db_configs_for_6_1
|
80
|
+
all_configurations = ActiveRecord::Base.configurations.configurations
|
81
|
+
unused_environments = RAILS_DEFAULT_ENVIRONMENTS - [Rails.env.to_s]
|
82
|
+
resettable_environments = all_configurations.collect(&:env_name).uniq -
|
83
|
+
unused_environments
|
84
|
+
|
85
|
+
all_configurations.
|
86
|
+
select { |config| resettable_environments.include?(config.env_name) }.
|
87
|
+
collect(&:configuration_hash)
|
60
88
|
end
|
61
89
|
end
|
@@ -4,7 +4,7 @@ class Combustion::Databases::MySQL < Combustion::Databases::Base
|
|
4
4
|
ACCESS_DENIED_ERROR = 10_145
|
5
5
|
|
6
6
|
def reset
|
7
|
-
establish_connection(configuration.merge(
|
7
|
+
establish_connection(configuration.merge(:database => nil))
|
8
8
|
|
9
9
|
super
|
10
10
|
end
|
@@ -12,21 +12,21 @@ class Combustion::Databases::MySQL < Combustion::Databases::Base
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def charset
|
15
|
-
configuration[
|
15
|
+
configuration[:charset] || ENV["CHARSET"] || "utf8"
|
16
16
|
end
|
17
17
|
|
18
18
|
def charset_error
|
19
|
-
return "" unless
|
19
|
+
return "" unless configuration[:charset]
|
20
20
|
|
21
21
|
"(if you set the charset manually, make sure you have a matching collation)"
|
22
22
|
end
|
23
23
|
|
24
24
|
def collation
|
25
|
-
configuration[
|
25
|
+
configuration[:collation] || ENV["COLLATION"] || "utf8_unicode_ci"
|
26
26
|
end
|
27
27
|
|
28
28
|
def create
|
29
|
-
connection.create_database configuration[
|
29
|
+
connection.create_database configuration[:database], creation_options
|
30
30
|
establish_connection configuration
|
31
31
|
rescue error_class => error
|
32
32
|
rescue_create_from error
|
@@ -34,12 +34,12 @@ class Combustion::Databases::MySQL < Combustion::Databases::Base
|
|
34
34
|
|
35
35
|
def create_as_root(error)
|
36
36
|
establish_connection configuration.merge(
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
:database => nil,
|
38
|
+
:username => "root",
|
39
|
+
:password => request_password(error)
|
40
40
|
)
|
41
41
|
|
42
|
-
connection.create_database
|
42
|
+
connection.create_database configuration[:database], creation_options
|
43
43
|
connection.execute grant_statement
|
44
44
|
|
45
45
|
establish_connection configuration
|
@@ -50,15 +50,15 @@ class Combustion::Databases::MySQL < Combustion::Databases::Base
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def drop
|
53
|
-
connection.drop_database configuration[
|
53
|
+
connection.drop_database configuration[:database]
|
54
54
|
end
|
55
55
|
|
56
56
|
def error_class
|
57
|
-
if configuration[
|
57
|
+
if configuration[:adapter][/jdbc/]
|
58
58
|
# FIXME: After Jdbcmysql gives this class
|
59
59
|
require "active_record/railties/jdbcmysql_error"
|
60
60
|
ArJdbcMySQL::Error
|
61
|
-
elsif
|
61
|
+
elsif configuration[:adapter][/mysql2/] && defined?(Mysql2)
|
62
62
|
Mysql2::Error
|
63
63
|
else
|
64
64
|
Mysql::Error
|
@@ -68,8 +68,8 @@ class Combustion::Databases::MySQL < Combustion::Databases::Base
|
|
68
68
|
def grant_statement
|
69
69
|
<<-SQL
|
70
70
|
GRANT ALL PRIVILEGES ON #{configuration["database"]}.*
|
71
|
-
TO '#{configuration[
|
72
|
-
IDENTIFIED BY '#{configuration[
|
71
|
+
TO '#{configuration[:username]}'@'localhost'
|
72
|
+
IDENTIFIED BY '#{configuration[:password]}' WITH GRANT OPTION;
|
73
73
|
SQL
|
74
74
|
end
|
75
75
|
|
@@ -91,7 +91,7 @@ Please provide the root password for your mysql installation
|
|
91
91
|
|
92
92
|
warn <<-TXT
|
93
93
|
#{error.error}
|
94
|
-
Couldn't create database for #{
|
94
|
+
Couldn't create database for #{configuration.inspect}, charset: #{charset}, collation: #{collation}
|
95
95
|
#{charset_error}
|
96
96
|
TXT
|
97
97
|
end
|
@@ -12,8 +12,8 @@ class Combustion::Databases::PostgreSQL < Combustion::Databases::Base
|
|
12
12
|
|
13
13
|
def create
|
14
14
|
connection.create_database(
|
15
|
-
configuration[
|
16
|
-
configuration.merge(
|
15
|
+
configuration[:database],
|
16
|
+
configuration.merge(:encoding => encoding)
|
17
17
|
)
|
18
18
|
rescue StandardError => error
|
19
19
|
warn error, *error.backtrace
|
@@ -21,21 +21,21 @@ class Combustion::Databases::PostgreSQL < Combustion::Databases::Base
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def drop
|
24
|
-
connection.drop_database(configuration[
|
24
|
+
connection.drop_database(configuration[:database])
|
25
25
|
end
|
26
26
|
|
27
27
|
def encoding
|
28
|
-
configuration[
|
28
|
+
configuration[:encoding] || ENV["CHARSET"] || "utf8"
|
29
29
|
end
|
30
30
|
|
31
31
|
def postgres_configuration
|
32
32
|
configuration.merge(
|
33
|
-
|
34
|
-
|
33
|
+
:database => "postgres",
|
34
|
+
:schema_search_path => schema_search_path
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
38
38
|
def schema_search_path
|
39
|
-
configuration[
|
39
|
+
configuration[:adapter][/postgis/] ? "public, postgis" : "public"
|
40
40
|
end
|
41
41
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class Combustion::Databases::SQLServer < Combustion::Databases::Base
|
4
4
|
def reset
|
5
|
-
establish_connection configuration.merge(
|
6
|
-
connection.recreate_database! configuration[
|
5
|
+
establish_connection configuration.merge(:database => "master")
|
6
|
+
connection.recreate_database! configuration[:database]
|
7
7
|
end
|
8
8
|
end
|
@@ -8,7 +8,7 @@ class Combustion::Databases::SQLite < Combustion::Databases::Base
|
|
8
8
|
|
9
9
|
def create
|
10
10
|
if exists?
|
11
|
-
warn "#{config[
|
11
|
+
warn "#{config[:database]} already exists"
|
12
12
|
return
|
13
13
|
end
|
14
14
|
|
@@ -32,6 +32,6 @@ class Combustion::Databases::SQLite < Combustion::Databases::Base
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def path
|
35
|
-
@path ||= Pathname.new configuration[
|
35
|
+
@path ||= Pathname.new configuration[:database]
|
36
36
|
end
|
37
37
|
end
|
data/lib/combustion/generator.rb
CHANGED
@@ -23,6 +23,7 @@ module Combustion
|
|
23
23
|
template "templates/database.yml", "spec/internal/config/database.yml"
|
24
24
|
template "templates/schema.rb", "spec/internal/db/schema.rb"
|
25
25
|
template "templates/config.ru", "config.ru"
|
26
|
+
template "templates/storage.yml", "spec/internal/config/storage.yml"
|
26
27
|
|
27
28
|
create_file "spec/internal/app/assets/config/manifest.js"
|
28
29
|
create_file "spec/internal/public/favicon.ico"
|
data/lib/combustion.rb
CHANGED
@@ -12,18 +12,31 @@ module Combustion
|
|
12
12
|
self.path = "/spec/internal"
|
13
13
|
self.schema_format = :ruby
|
14
14
|
|
15
|
-
MODULES =
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
MODULES = begin
|
16
|
+
hash = {
|
17
|
+
:active_model => "active_model/railtie",
|
18
|
+
:active_record => "active_record/railtie",
|
19
|
+
:action_controller => "action_controller/railtie",
|
20
|
+
:action_mailer => "action_mailer/railtie",
|
21
|
+
:action_view => "action_view/railtie"
|
22
|
+
}
|
23
|
+
|
24
|
+
hash[:sprockets] = "sprockets/railtie" if Rails.version.to_f >= 3.1
|
25
|
+
hash[:active_job] = "active_job/railtie" if Rails.version.to_f >= 4.2
|
26
|
+
hash[:action_cable] = "action_cable/engine" if Rails.version.to_f >= 5.0
|
27
|
+
hash[:active_storage] = "active_storage/engine" if Rails.version.to_f >= 5.2
|
28
|
+
hash[:action_text] = "action_text/engine" if Rails.version.to_f >= 6.0
|
29
|
+
hash[:action_mailbox] = "action_mailbox/engine" if Rails.version.to_f >= 6.0
|
30
|
+
|
31
|
+
hash
|
32
|
+
end.freeze
|
20
33
|
|
21
34
|
def self.initialize!(*modules, &block)
|
22
35
|
self.setup_environment = block if block_given?
|
23
36
|
|
24
37
|
options = modules.extract_options!
|
25
|
-
modules = MODULES if modules == [:all]
|
26
|
-
modules.each { |mod| require "#{mod}/railtie" }
|
38
|
+
modules = MODULES.keys if modules == [:all]
|
39
|
+
modules.each { |mod| require MODULES.fetch(mod, "#{mod}/railtie") }
|
27
40
|
|
28
41
|
Bundler.require :default, Rails.env
|
29
42
|
|
@@ -65,8 +78,9 @@ module Combustion
|
|
65
78
|
end
|
66
79
|
end
|
67
80
|
|
68
|
-
require "combustion/application"
|
69
81
|
require "combustion/configurations/action_controller"
|
70
82
|
require "combustion/configurations/action_mailer"
|
71
83
|
require "combustion/configurations/active_record"
|
84
|
+
require "combustion/configurations/active_storage"
|
85
|
+
require "combustion/application"
|
72
86
|
require "combustion/database"
|
data/spec/database_spec.rb
CHANGED
@@ -1,30 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
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
|
14
|
-
end
|
3
|
+
RSpec.describe Combustion::Database do
|
4
|
+
it "creates dummy table from migration in base database" do
|
5
|
+
expect(Model.connection.table_exists?("dummy_table")).to eq true
|
6
|
+
expect(Model.connection.table_exists?("dummy_in_another_db")).to eq false
|
7
|
+
end
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
9
|
+
it "creates another dummy table from another database" do
|
10
|
+
expect(ModelInAnotherDb.connection.table_exists?("dummy_table")).
|
11
|
+
to eq false
|
12
|
+
expect(ModelInAnotherDb.connection.table_exists?("dummy_in_another_db")).
|
13
|
+
to eq true
|
14
|
+
end
|
22
15
|
|
23
|
-
|
16
|
+
it "returns test database for model with default connection" do
|
17
|
+
if ActiveRecord::VERSION::STRING.to_f > 6.0
|
18
|
+
expect(Model.connection_db_config.database).to match(/test/)
|
19
|
+
else
|
24
20
|
expect(Model.connection_config[:database]).to match(/test/)
|
25
21
|
end
|
22
|
+
end
|
26
23
|
|
27
|
-
|
24
|
+
it "returns test_another for model with connection to second database" do
|
25
|
+
if ActiveRecord::VERSION::STRING.to_f > 6.0
|
26
|
+
expect(ModelInAnotherDb.connection_db_config.database).
|
27
|
+
to match(/test_another/)
|
28
|
+
else
|
28
29
|
expect(ModelInAnotherDb.connection_config[:database]).
|
29
30
|
to match(/test_another/)
|
30
31
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
//
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "bundler/setup"
|
4
3
|
require "combustion"
|
5
4
|
|
6
5
|
if Rails::VERSION::STRING.to_f < 4.1
|
@@ -13,3 +12,7 @@ if Rails::VERSION::STRING.to_f < 4.1
|
|
13
12
|
end
|
14
13
|
|
15
14
|
require File.expand_path("dummy/lib/engine.rb", __dir__)
|
15
|
+
|
16
|
+
Dir.chdir(File.expand_path("dummy", __dir__)) do
|
17
|
+
Combustion.initialize! :all
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: combustion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.
|
61
|
+
version: '2.3'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.
|
68
|
+
version: '2.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mysql2
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.81.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
138
|
+
version: 0.81.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: sqlite3
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,23 +158,19 @@ executables:
|
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
|
-
- ".gitignore"
|
162
161
|
- ".rspec"
|
163
|
-
- ".rubocop.yml"
|
164
|
-
- ".travis.yml"
|
165
162
|
- Appraisals
|
166
163
|
- Gemfile
|
167
|
-
- HISTORY
|
168
164
|
- LICENCE
|
169
165
|
- README.md
|
170
166
|
- Rakefile
|
171
|
-
- combustion.gemspec
|
172
167
|
- exe/combust
|
173
168
|
- lib/combustion.rb
|
174
169
|
- lib/combustion/application.rb
|
175
170
|
- lib/combustion/configurations/action_controller.rb
|
176
171
|
- lib/combustion/configurations/action_mailer.rb
|
177
172
|
- lib/combustion/configurations/active_record.rb
|
173
|
+
- lib/combustion/configurations/active_storage.rb
|
178
174
|
- lib/combustion/database.rb
|
179
175
|
- lib/combustion/database/load_schema.rb
|
180
176
|
- lib/combustion/database/migrate.rb
|
@@ -191,22 +187,23 @@ files:
|
|
191
187
|
- spec/dummy/db/migrate/20150717075542_create_dummy_test_table.rb
|
192
188
|
- spec/dummy/db/migrate/20150717075543_create_dummy_test_table_in_another_db.rb
|
193
189
|
- spec/dummy/lib/engine.rb
|
190
|
+
- spec/dummy/spec/internal/app/assets/config/manifest.js
|
194
191
|
- spec/dummy/spec/internal/app/models/model.rb
|
195
192
|
- spec/dummy/spec/internal/app/models/model_in_another_db.rb
|
196
193
|
- spec/dummy/spec/internal/config/database.yml
|
197
194
|
- spec/dummy/spec/internal/config/routes.rb
|
198
195
|
- spec/dummy/spec/internal/db/schema.rb
|
199
|
-
- spec/dummy/spec/internal/log/.gitignore
|
200
196
|
- spec/spec_helper.rb
|
201
197
|
- templates/config.ru
|
202
198
|
- templates/database.yml
|
203
199
|
- templates/routes.rb
|
204
200
|
- templates/schema.rb
|
201
|
+
- templates/storage.yml
|
205
202
|
homepage: https://github.com/pat/combustion
|
206
203
|
licenses:
|
207
204
|
- MIT
|
208
205
|
metadata: {}
|
209
|
-
post_install_message:
|
206
|
+
post_install_message:
|
210
207
|
rdoc_options: []
|
211
208
|
require_paths:
|
212
209
|
- lib
|
@@ -221,19 +218,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
218
|
- !ruby/object:Gem::Version
|
222
219
|
version: '0'
|
223
220
|
requirements: []
|
224
|
-
rubygems_version: 3.
|
225
|
-
signing_key:
|
221
|
+
rubygems_version: 3.1.4
|
222
|
+
signing_key:
|
226
223
|
specification_version: 4
|
227
224
|
summary: Elegant Rails Engine Testing
|
228
225
|
test_files:
|
229
|
-
- spec/
|
230
|
-
- spec/dummy/db/migrate/20150717075542_create_dummy_test_table.rb
|
231
|
-
- spec/dummy/db/migrate/20150717075543_create_dummy_test_table_in_another_db.rb
|
232
|
-
- spec/dummy/lib/engine.rb
|
226
|
+
- spec/spec_helper.rb
|
233
227
|
- spec/dummy/spec/internal/app/models/model.rb
|
234
228
|
- spec/dummy/spec/internal/app/models/model_in_another_db.rb
|
235
|
-
- spec/dummy/spec/internal/config/
|
229
|
+
- spec/dummy/spec/internal/app/assets/config/manifest.js
|
236
230
|
- spec/dummy/spec/internal/config/routes.rb
|
231
|
+
- spec/dummy/spec/internal/config/database.yml
|
237
232
|
- spec/dummy/spec/internal/db/schema.rb
|
238
|
-
- spec/dummy/
|
239
|
-
- spec/
|
233
|
+
- spec/dummy/lib/engine.rb
|
234
|
+
- spec/dummy/db/migrate/20150717075542_create_dummy_test_table.rb
|
235
|
+
- spec/dummy/db/migrate/20150717075543_create_dummy_test_table_in_another_db.rb
|
236
|
+
- spec/database_spec.rb
|
237
|
+
- ".rspec"
|
238
|
+
- Appraisals
|
239
|
+
- Gemfile
|
240
|
+
- Rakefile
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
inherit_from:
|
2
|
-
- https://gist.githubusercontent.com/pat/ba3b8ffb1901bfe5439b460943b6b019/raw/.rubocop.yml
|
3
|
-
|
4
|
-
AllCops:
|
5
|
-
TargetRubyVersion: 2.2
|
6
|
-
|
7
|
-
Bundler/OrderedGems:
|
8
|
-
Exclude:
|
9
|
-
- 'gemfiles/*'
|
10
|
-
|
11
|
-
Layout/DotPosition:
|
12
|
-
EnforcedStyle: trailing
|
13
|
-
|
14
|
-
Layout/CaseIndentation:
|
15
|
-
EnforcedStyle: end
|
16
|
-
|
17
|
-
Layout/EndAlignment:
|
18
|
-
EnforcedStyleAlignWith: variable
|
19
|
-
|
20
|
-
Layout/IndentHeredoc:
|
21
|
-
Enabled: false
|
22
|
-
|
23
|
-
Metrics/BlockLength:
|
24
|
-
Exclude:
|
25
|
-
- 'combustion.gemspec'
|
26
|
-
|
27
|
-
Style/ClassAndModuleChildren:
|
28
|
-
Enabled: false
|
29
|
-
|
30
|
-
Style/Documentation:
|
31
|
-
Enabled: false
|
32
|
-
|
33
|
-
Style/FrozenStringLiteralComment:
|
34
|
-
Exclude:
|
35
|
-
- 'gemfiles/*'
|
36
|
-
|
37
|
-
Style/MultilineTernaryOperator:
|
38
|
-
Exclude:
|
39
|
-
- 'spec/dummy/db/migrate/*.rb'
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
dist: xenial
|
3
|
-
env:
|
4
|
-
matrix:
|
5
|
-
- "DB_ADAPTER=sqlite3"
|
6
|
-
- "DB_ADAPTER=postgresql"
|
7
|
-
- "DB_ADAPTER=mysql2"
|
8
|
-
rvm:
|
9
|
-
- 2.2.10
|
10
|
-
- 2.3.8
|
11
|
-
- 2.4.6
|
12
|
-
- 2.5.5
|
13
|
-
- 2.6.3
|
14
|
-
before_install:
|
15
|
-
- gem install bundler --version "~> 1.17"
|
16
|
-
install:
|
17
|
-
- bundle _1.17.3_ install --jobs=3 --retry=3
|
18
|
-
before_script:
|
19
|
-
- bundle exec appraisal install
|
20
|
-
script: bundle exec appraisal rake
|
21
|
-
services:
|
22
|
-
- mysql
|
23
|
-
- postgresql
|
data/HISTORY
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
1.1.2 - November 4th 2019
|
2
|
-
* Generate an empty asset manifest file for Rails 6.
|
3
|
-
|
4
|
-
1.1.1 - August 3rd 2019
|
5
|
-
* Fix for latest Rails 6.0 release candidate.
|
6
|
-
* Test suite updates (Rails edge, sqlite3, Rubocop)
|
7
|
-
|
8
|
-
1.1.0 - February 13th 2019
|
9
|
-
* Rails 6.0 support.
|
10
|
-
|
11
|
-
1.0.0 - October 3rd 2018
|
12
|
-
* No functional changes.
|
13
|
-
* Added documentation about database preparation options.
|
14
|
-
|
15
|
-
0.9.1 - April 25th 2018
|
16
|
-
* Fix Rails 5.2 compatibility by not setting the deprecated secret_token configuration option.
|
17
|
-
|
18
|
-
0.9.0 - March 26th 2018
|
19
|
-
* Only reset databases that are either custom or the current one (Moritz Winter).
|
20
|
-
* More consistency around environment handling (rather than presuming it's always the test environment).
|
21
|
-
|
22
|
-
0.8.0 - February 1st 2018
|
23
|
-
* Rails 5.2.0 support.
|
24
|
-
* Requiring digest from std-lib directly.
|
25
|
-
* Refactoring for cleaner code.
|
26
|
-
|
27
|
-
0.7.0 - June 20th 2017
|
28
|
-
* Confirm support for MRI frozen string literals.
|
29
|
-
* Hide migration output (Michael Grosser).
|
30
|
-
|
31
|
-
0.6.0 - March 28th 2017
|
32
|
-
* Optionally disable database reset, schema loading, migrations (Sergey Kucher).
|
33
|
-
* Allow for multiple test databases (Semyon Pupkov).
|
34
|
-
|
35
|
-
0.5.5 - July 23rd 2016
|
36
|
-
* Add PostGIS support (Roland Koch).
|
37
|
-
* MySQL parameter fix (Mathieu Leduc-Hamel).
|
38
|
-
|
39
|
-
0.5.4 - January 12th 2016
|
40
|
-
* Remove silent_stream call for Rails 5.0 compatability (Bryan Ricker).
|
41
|
-
* Fix duplicate migrations error (Semyon Pupkov).
|
42
|
-
|
43
|
-
0.5.3 - March 1st 2015
|
44
|
-
* Use migrations from dependent gems (Korotaev Danil, Меркушин Михаил).
|
45
|
-
|
46
|
-
0.5.2 - July 18th 2014
|
47
|
-
* Note MIT licence in gemspec (@ktdreyer).
|
48
|
-
* Use local create/drop methods when resetting database (Bryan Ricker).
|
49
|
-
* ERB is now supported in config/database.yml, matching Rails (@patorash).
|
50
|
-
* The database now is configured before the application is loaded (@patorash).
|
51
|
-
* Documentation and generated config.ru now specify explicly loading all Rails libraries by default (Pat Allan).
|
52
|
-
|
53
|
-
0.5.1 - July 25th 2013
|
54
|
-
* Mass assignment errors raise exceptions instead of just being logged (Pat Allan).
|
55
|
-
* whilelist_attributes is only set for Rails 3.2 apps (Philip Arndt).
|
56
|
-
* Support ActiveRecord 3.0.x (Philip Arndt).
|
57
|
-
* Allow custom application configuration (Pablo Herrero).
|
58
|
-
|
59
|
-
0.5.0 - May 1st 2013
|
60
|
-
* whitelist_attributes is now set within configure_for_combustion, as it depends on which Railties are loaded.
|
61
|
-
* Make sure Rails gems are loaded before the engine's gem (Pablo Herrero).
|
62
|
-
* Fixed Rails version comparison (Josh Adam).
|
63
|
-
|
64
|
-
0.4.0 - March 16th 2013
|
65
|
-
* Don't delete the SQLite test database if it doesn't exist (Michael Gee, Alexander Rozumiy).
|
66
|
-
* Support for secret_key_base for Rails 4 apps (Philip Arndt).
|
67
|
-
* eager_load is set to true when using the production environment (Philip Arndt).
|
68
|
-
* whiny_nils is not set if using Rails 4 (Philip Arndt).
|
69
|
-
* Mysql2 can raise Mysql::Error with JRuby (Philip Arndt).
|
70
|
-
* Whitelist attributes typo is fixed (Geoff Hodgson).
|
71
|
-
* Mass assignment checks are now turned on, so errors are raised. This matches Rails' defaults for test environments (Josh Adams).
|
72
|
-
* Combustion no longer loads all of the Rails stack by default, just Railties and ActiveSupport. A combustion-rails gem will be created that uses all of Rails by default (Philip Arndt).
|
73
|
-
* Combustion classes now all define the outer module, so each can be required by themselves, should you desire (Philip Arndt).
|
74
|
-
|
75
|
-
0.3.3 - December 23rd 2012
|
76
|
-
* Removing version file - version number can just live in the gemspec.
|
77
|
-
* Load ActionController and ActionMailer via their Railties, not non-existent Engines (Chris Beer).
|
78
|
-
* SQL Schema support (Geoff Hodgson).
|
79
|
-
* Documentation fixes (Philip Arndt, Inge Jørgensen, Erkan Yilmaz).
|
80
|
-
* Include migrations from the internal app when migrating the database (Warren Seen).
|
81
|
-
* Correctly drop the test database when using SQLite (Warren Seen).
|
82
|
-
* Don't attempt to load sprockets for Rails 3.0.x (Alex Rozumey).
|
83
|
-
|
84
|
-
0.3.2 - March 3rd 2012
|
85
|
-
* Tentative Rails 3.0 and migrations support.
|
86
|
-
* Allow for different internal app directory.
|
87
|
-
|
88
|
-
0.3.1 - September 12th 2011
|
89
|
-
* Allow for different versions of Capybara (Leo Liang).
|
90
|
-
* Including Capybara::DSL instead of Capybara.
|
91
|
-
* Require 3.1.0 or better.
|
92
|
-
* Allow for JRuby in the database.yml template (Philip Arndt).
|
93
|
-
|
94
|
-
0.3.0 - September 2nd 2011
|
95
|
-
* Simple generator to create a pretty minimal internal Rails app.
|
96
|
-
|
97
|
-
0.2.0 - August 30th 2011
|
98
|
-
* Documentation.
|
99
|
-
* Allow developers to choose which Rails modules they wish to be loaded.
|
100
|
-
* Load Rails routes and Capybara helpers into RSpec examples when appropriate.
|
101
|
-
|
102
|
-
0.1.1 - August 24th 2011
|
103
|
-
* Support assets properly by loading ActionView and Sprockets railties.
|
104
|
-
|
105
|
-
0.1.0 - August 19th 2011
|
106
|
-
* First release, extracted from Dobro for HyperTiny.
|
data/combustion.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = "combustion"
|
5
|
-
s.version = "1.1.2"
|
6
|
-
s.authors = ["Pat Allan"]
|
7
|
-
s.email = ["pat@freelancing-gods.com"]
|
8
|
-
s.homepage = "https://github.com/pat/combustion"
|
9
|
-
s.summary = "Elegant Rails Engine Testing"
|
10
|
-
s.description = "Test your Rails Engines without needing a full Rails app"
|
11
|
-
s.license = "MIT"
|
12
|
-
|
13
|
-
s.files = `git ls-files`.split("\n")
|
14
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
-
s.executables = `git ls-files -- exe/*`.split("\n").map do |file|
|
16
|
-
File.basename(file)
|
17
|
-
end
|
18
|
-
s.bindir = "exe"
|
19
|
-
s.require_paths = ["lib"]
|
20
|
-
|
21
|
-
s.add_runtime_dependency "activesupport", ">= 3.0.0"
|
22
|
-
s.add_runtime_dependency "railties", ">= 3.0.0"
|
23
|
-
s.add_runtime_dependency "thor", ">= 0.14.6"
|
24
|
-
|
25
|
-
s.add_development_dependency "appraisal", "~> 2.1.0"
|
26
|
-
s.add_development_dependency "mysql2"
|
27
|
-
s.add_development_dependency "pg"
|
28
|
-
s.add_development_dependency "rails"
|
29
|
-
s.add_development_dependency "rspec"
|
30
|
-
s.add_development_dependency "rubocop", "~> 0.68.0"
|
31
|
-
s.add_development_dependency "sqlite3"
|
32
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
*.log
|