maestrano-connector-rails 2.3.5 → 2.3.6

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
  SHA1:
3
- metadata.gz: 281bc1ff015d7a52fea1344faf8043cb24d0dff7
4
- data.tar.gz: a0cea7d9c59defc98176b45b64909afe523a7aa1
3
+ metadata.gz: 49ad895ae9f7ccb8c717de5c94315cb461014e4a
4
+ data.tar.gz: e44a61f6ed398c3bf11c5e0101c448b113f346a1
5
5
  SHA512:
6
- metadata.gz: 0cee71417cd68c6cc2b620a5ece25bc5dee1877a8327d47d1e7433e364e2fff1fa8c5eae1dc07b910f109df394fcad53801f4c2c1e3dcb129acfeb2e3227d874
7
- data.tar.gz: 4501102c4571eab87459e7f84fdcb5e538bf7522b5dba7704e1693f12ec029a2ca103f52dff4613f6641efd142a4e829dffb48ef6c26f3228de71623e213d8f3
6
+ metadata.gz: 2ec144e8478ce9a39030a7d92cae478d2a3c8881ea73ab480aaa565c767c3fe4612757bbdc0911c438744dd98109b817702fd201b63140ddc311b45c6477d09d
7
+ data.tar.gz: b57077d44bc54a32e6893177cd44097dab5d88aa6c082e56f376cafb5bfbd7dae0e443825eec3b5d7431606a8e97aec408676995cd79abb4ac331de16b389e5a
@@ -1,3 +1,11 @@
1
+ ## [v2.3.6](https://github.com/maestrano/maestrano-connector-rails/tree/v2.3.6)
2
+ [Full Changelog](https://github.com/maestrano/maestrano-connector-rails/compare/v2.3.5...v2.3.6)
3
+
4
+ **Fixed bugs:**
5
+
6
+ - Lock concurrent-ruby to 1.0.5 [\#182](https://github.com/maestrano/maestrano-connector-rails/pull/182) ([ouranos](https://github.com/ouranos))
7
+ - \[APPINT-1146\] Fix database encoding configuration [\#181](https://github.com/maestrano/maestrano-connector-rails/pull/181) ([ouranos](https://github.com/ouranos))
8
+
1
9
  ## [v2.3.5](https://github.com/maestrano/maestrano-connector-rails/tree/v2.3.5) (2018-11-02)
2
10
  [Full Changelog](https://github.com/maestrano/maestrano-connector-rails/compare/v2.3.4...v2.3.5)
3
11
 
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Only applicable for MySQL
4
+ if ActiveRecord::Base.connection_config[:adapter] == 'mysql2'
5
+ # Get the configured encoding
6
+ configured_encoding = ActiveRecord::Base.connection_config[:encoding]
7
+
8
+ # Get the actual character set from the DB
9
+ database_charset = ActiveRecord::Base.connection.exec_query('SELECT @@character_set_database as charset').first['charset']
10
+
11
+ msg = <<~LOG
12
+ WARNING: The configured db encoding `#{configured_encoding}` is different from the actual one `#{database_charset}`!
13
+ This is likely to cause issues with special characters.
14
+ Please see https://maestrano.atlassian.net/wiki/x/rQ0nBg or run:
15
+ $ rails g connector:charset_migration
16
+ LOG
17
+
18
+ if configured_encoding != database_charset
19
+ Rails.logger.warn msg
20
+ warn msg
21
+ end
22
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/named_base'
4
+ require 'rails/generators/active_record/migration'
5
+
6
+ module Connector
7
+ module Generators
8
+ class CharsetMigrationGenerator < ::Rails::Generators::Base
9
+ include ActiveRecord::Generators::Migration
10
+
11
+ source_root File.expand_path('templates', __dir__)
12
+
13
+ def copy_migration
14
+ migration_template 'migration.rb', 'db/migrate/convert_tables_to_utf8.rb'
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ConvertTablesToUtf8 < ActiveRecord::Migration
4
+ def change_encoding(encoding, collation)
5
+ # Allow for different adapter in different environment
6
+ unless ActiveRecord::Base.connection_config[:adapter] == 'mysql2'
7
+ say "Skipping conversion as non MySQL database (#{ActiveRecord::Base.connection_config[:adapter]})"
8
+ return
9
+ end
10
+ tables = connection.tables
11
+ dbname = ActiveRecord::Base.connection_config[:database]
12
+ say_with_time "Converting database to #{encoding}" do
13
+ execute <<-SQL
14
+ ALTER DATABASE `#{dbname}` CHARACTER SET #{encoding} COLLATE #{collation};
15
+ SQL
16
+ end
17
+ tables.each do |tablename|
18
+ say_with_time "Converting table `#{tablename}` to #{encoding}" do
19
+ execute <<-SQL
20
+ ALTER TABLE `#{dbname}`.`#{tablename}` CONVERT TO CHARACTER SET #{encoding} COLLATE #{collation};
21
+ SQL
22
+ end
23
+ end
24
+ end
25
+
26
+ def change
27
+ reversible do |dir|
28
+ dir.up do
29
+ change_encoding('utf8', 'utf8_general_ci')
30
+ end
31
+ dir.down do
32
+ change_encoding('latin1', 'latin1_swedish_ci')
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,7 +1,7 @@
1
1
  module Maestrano
2
2
  module Connector
3
3
  module Rails
4
- VERSION = '2.3.5'.freeze
4
+ VERSION = '2.3.6'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -30,6 +30,8 @@ Gem::Specification.new do |s|
30
30
  s.add_runtime_dependency('autoprefixer-rails')
31
31
  s.add_runtime_dependency('bootstrap-sass')
32
32
  s.add_runtime_dependency('config')
33
+ # v1.1 breaks the build. See: https://github.com/ruby-concurrency/concurrent-ruby/issues/768
34
+ s.add_runtime_dependency('concurrent-ruby', '~> 1.0.5')
33
35
  s.add_runtime_dependency('figaro')
34
36
  s.add_runtime_dependency('jquery-rails', '>= 4.0.4')
35
37
  s.add_runtime_dependency('jsonapi-resources')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maestrano-connector-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.5
4
+ version: 2.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maestrano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-01 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: concurrent-ruby
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.0.5
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.5
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: figaro
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -500,6 +514,7 @@ files:
500
514
  - app/resources/maestrano/api/organization_resource.rb
501
515
  - app/resources/maestrano/api/synchronization_resource.rb
502
516
  - app/resources/maestrano/api/user_resource.rb
517
+ - config/initializers/db_encoding.rb
503
518
  - config/initializers/json_api.rb
504
519
  - config/initializers/retriable.rb
505
520
  - config/routes.rb
@@ -518,6 +533,8 @@ files:
518
533
  - db/migrate/20170202033323_update_organization_metadata.rb
519
534
  - db/migrate/20170315032224_add_metadata_to_id_map.rb
520
535
  - lib/generators/connector/USAGE
536
+ - lib/generators/connector/charset_migration/charset_migration_generator.rb
537
+ - lib/generators/connector/charset_migration/templates/migration.rb
521
538
  - lib/generators/connector/complex_entity_generator.rb
522
539
  - lib/generators/connector/install_generator.rb
523
540
  - lib/generators/connector/templates/account_controller.rb