jets 2.2.3 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78d7a80db572a5ef51188dd5e207f4015c7e72bc31399960364bbc6690c0cea3
4
- data.tar.gz: b2836498d20169d7a641575e7f1c24390d7a1feece8888c3bb1395e7142a7b67
3
+ metadata.gz: cac50647c7713fc980484f19f1270d09940339e9fbc50677aa57296df8235485
4
+ data.tar.gz: 7bf35b3b092ed92fe6195a90aa45bdcd991e99eb5d48309b0df474968a38b8b1
5
5
  SHA512:
6
- metadata.gz: 30437f76a25f501f49b993b76f25e7c0a1b82992c09ae1f53a09db084d2cfb50ec3ee31b1d2300ab9bda85afa8ea7f0b9988fd4ff282dafea0c820b46435847e
7
- data.tar.gz: 7774305203f2a30134ac6b3b2c71e61f471cef63b3bf84eaa76cbd551c0a98c4a655931429eaaad3ebfefc642ae88ab28e9bef07d5e6819019158a8443ad6d84
6
+ metadata.gz: f3049959d4e66829ce91a2a117b9bfbd7e504b7538a3c501f7f3f5c2ffaa7674b1d24c6613e77c2ec9e80ffef5a8bff3bc3a0bad9956c5b8b77ca76dfbf106f0
7
+ data.tar.gz: dcdf12b818f4f460aabab793b9e5d85ed3361f273dd431e3ef2a87392becfd61026f466b538d380b903b6606786963932a476ec235630d0cb7ae5ed3ea6db91c
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [2.2.4]
7
+ - #346 Check that migrations have been ran as part of running project specs. If migrations haven't ran, exit and report an error.
8
+
6
9
  ## [2.2.3]
7
10
  - add newline so github edits dont case extra codebuild commit
8
11
  - #372 fix to allow using only cognito authorizers
@@ -2,4 +2,5 @@ require "jets/overrides/rails/common_methods"
2
2
  require "jets/overrides/rails/url_helper"
3
3
  require "jets/overrides/rails/rendering_helper"
4
4
  require "jets/overrides/rails/asset_tag_helper"
5
- require "jets/overrides/rails/action_controller"
5
+ require "jets/overrides/rails/action_controller"
6
+ require "jets/overrides/rails/migration_checker"
@@ -0,0 +1,30 @@
1
+ module ActiveRecord
2
+ module MigrationChecker
3
+ def prepare_test_db
4
+ current_config = ::ActiveRecord::Base.connection_config
5
+ all_configs = ::ActiveRecord::Base.configurations.configs_for(env_name: Jets.env)
6
+
7
+ needs_update = !all_configs.all? do |db_config|
8
+ ::ActiveRecord::Tasks::DatabaseTasks.schema_up_to_date?(db_config.config, ::ActiveRecord::Base.schema_format, nil, Jets.env, db_config.spec_name)
9
+ end
10
+
11
+ if needs_update
12
+ # Roundtrip to Rake to allow plugins to hook into database initialization.
13
+ FileUtils.cd(Jets.root) do
14
+ ::ActiveRecord::Base.clear_all_connections!
15
+ system("jets db:test:prepare")
16
+ end
17
+ end
18
+
19
+ # Establish a new connection, the old database may be gone (db:test:prepare uses purge)
20
+ ::ActiveRecord::Base.establish_connection(current_config)
21
+
22
+ begin
23
+ check_pending!
24
+ rescue ::ActiveRecord::PendingMigrationError
25
+ puts "Migrations are pending. To resolve this issue, run:\n\n jets db:migrate"
26
+ exit 1
27
+ end
28
+ end
29
+ end
30
+ end
@@ -9,6 +9,12 @@ module Jets
9
9
  end
10
10
  end
11
11
 
12
+ unless ENV["SKIP_MIGRATION_CHECK"] == "true"
13
+ ActiveRecord::Tasks::DatabaseTasks.db_dir = "#{Jets.root}/db"
14
+ ActiveRecord::Migration.extend ActiveRecord::MigrationChecker
15
+ ActiveRecord::Migration.prepare_test_db
16
+ end
17
+
12
18
  require "rspec"
13
19
  RSpec.configure do |c|
14
20
  c.include Jets::SpecHelpers
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "2.2.3"
2
+ VERSION = "2.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-23 00:00:00.000000000 Z
11
+ date: 2019-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -847,6 +847,7 @@ files:
847
847
  - lib/jets/overrides/rails/action_controller.rb
848
848
  - lib/jets/overrides/rails/asset_tag_helper.rb
849
849
  - lib/jets/overrides/rails/common_methods.rb
850
+ - lib/jets/overrides/rails/migration_checker.rb
850
851
  - lib/jets/overrides/rails/rendering_helper.rb
851
852
  - lib/jets/overrides/rails/url_helper.rb
852
853
  - lib/jets/poly_fun.rb