mobility 0.8.0 → 0.8.1

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: 93685e1d8296d7f0f9c2a74e07a40af397fa1eef52d2d8c51d63ac6ed7a33812
4
- data.tar.gz: be5beb1769d824f8687b0d2e5b796738ffa98dd35e6018de126ce909e089c278
3
+ metadata.gz: 379c09aba475fbc7b7491e64cbbbd7eb6fa3ac46b546c318ca645345f2a548cf
4
+ data.tar.gz: 5359a8a04ea4db2e30d43e14f79ba2c962555362e4a8e5f1d5412d481b101c9f
5
5
  SHA512:
6
- metadata.gz: 0dfa4ca2101b75d34a62d8a445bb58cf84a75d39346568bd816d064bdfc637fb11e8e79cf963789d18cde779ce588fff596d264b728f68cf53c382ad57a5ccb9
7
- data.tar.gz: 3b907f55dffe8823d12f2b04bb57fea611cea6ac316f4572859c484e8692a89179d1114c8966ad801007d6833615943abf9c7ff89be5c924f9b9b719cdc25894
6
+ metadata.gz: fe6c5ade9de6a5f35ef84c5daa8c822e397e608f60c9f3d34451b1091a89f2eed5c9c58801afd1603c0ad1ceb2c58d26865a3b0297b4f2fa5f8ac3886712788c
7
+ data.tar.gz: 8b6fbbf4c0833d6921c002136ec10ce6baec7dd0b20886b9c4dece81099cd4444e1bbd6dd5067d0392ec8a7b538ae1a170340107d6aa60325437e9859cb507ee
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -2,15 +2,32 @@
2
2
 
3
3
  ## 0.8
4
4
 
5
+ ### 0.8.1 (September 25, 2018)
6
+ * Default ActiveRecord Table/KeyValue backends to OUTER JOIN
7
+ ([#277](https://github.com/shioyama/mobility/pull/277))
8
+ * Default Sequel Table/KeyValue backends to OUTER JOIN
9
+ ([#279](https://github.com/shioyama/mobility/pull/279))
10
+ * Do not skip generator on `:revoke` behavior
11
+ ([#274](https://github.com/shioyama/mobility/pull/274)). Thanks
12
+ [mauriciopasquier](https://github.com/mauriciopasquier)!
13
+ * Bump i18n dependency to allow versions up to 2.0
14
+ ([#280](https://github.com/shioyama/mobility/pull/280))
15
+ * Use `references` and `foreign_key` in Table migration generator
16
+ ([#282](https://github.com/shioyama/mobility/pull/282) and
17
+ [#283](https://github.com/shioyama/mobility/pull/283)) Thanks
18
+ [omitter](https://github.com/omitter)!
19
+
5
20
  ### 0.8.0 (September 11, 2018)
6
21
  * Support order clause on translated queries (ActiveRecord)
7
- ([#261](https://github.com/shioyama/mobility/pull/261))
22
+ ([#261](https://github.com/shioyama/mobility/pull/261))
8
23
  * Restructure Sequel querying into plugin
9
24
  ([#255](https://github.com/shioyama/mobility/pull/255),
10
25
  [#267](https://github.com/shioyama/mobility/pull/267),
11
26
  [#268](https://github.com/shioyama/mobility/pull/267))
12
27
  * Default locale to Mobility.locale in apply_scope
13
28
  ([#263](https://github.com/shioyama/mobility/pull/263))
29
+ * Require Ruby version 2.3.7 or greater
30
+ ([#242](https://github.com/shioyama/mobility/pull/242))
14
31
 
15
32
  ### 0.7.6 (July 6, 2018)
16
33
  * Sequel pg_hash require hash_initializer
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mobility (0.8.0.alpha1)
5
- i18n (>= 0.6.10, < 1.1)
4
+ mobility (0.8.0)
5
+ i18n (>= 0.6.10, < 2)
6
6
  request_store (~> 1.0)
7
7
 
8
8
  GEM
@@ -61,7 +61,7 @@ GEM
61
61
  guard (~> 2.1)
62
62
  guard-compat (~> 1.1)
63
63
  rspec (>= 2.99.0, < 4.0)
64
- i18n (1.0.1)
64
+ i18n (1.1.0)
65
65
  concurrent-ruby (~> 1.0)
66
66
  listen (3.1.5)
67
67
  rb-fsevent (~> 0.9, >= 0.9.4)
data/README.md CHANGED
@@ -51,7 +51,7 @@ Installation
51
51
  Add this line to your application's Gemfile:
52
52
 
53
53
  ```ruby
54
- gem 'mobility', '~> 0.8.0'
54
+ gem 'mobility', '~> 0.8.1'
55
55
  ```
56
56
 
57
57
  Mobility is cryptographically signed. To be sure the gem you install hasn't
@@ -930,6 +930,9 @@ Integrations
930
930
 
931
931
  * [friendly_id-mobility](https://github.com/shioyama/friendly_id-mobility): Use
932
932
  Mobility with [FriendlyId](https://github.com/norman/friendly_id).
933
+ * [mobility-ransack](https://github.com/shioyama/mobility-ransack): Search
934
+ attributes translated by Mobility with
935
+ [Ransack](https://github.com/activerecord-hackery/ransack).
933
936
 
934
937
  Tutorials
935
938
  ---------
@@ -143,7 +143,7 @@ Implements the {Mobility::Backends::KeyValue} backend for ActiveRecord models.
143
143
 
144
144
  def visit_Mobility_Arel_Attribute(object)
145
145
  if object.backend_class == backend_class && object.locale == locale
146
- { object.attribute_name => INNER_JOIN }
146
+ { object.attribute_name => OUTER_JOIN }
147
147
  end
148
148
  end
149
149
 
@@ -233,7 +233,7 @@ columns to that table.
233
233
  # join when required. Use options[:table_name] here since we don't
234
234
  # know if the other backend has a +table_name+ option accessor.
235
235
  (backend_class.table_name == object.backend_class.options[:table_name]) &&
236
- (locale == object.locale) && INNER_JOIN
236
+ (locale == object.locale) && OUTER_JOIN || nil
237
237
  end
238
238
  end
239
239
 
@@ -97,6 +97,11 @@ Implements the {Mobility::Backends::KeyValue} backend for Sequel models.
97
97
  else
98
98
  {}
99
99
  end
100
+ elsif boolean.op == :'='
101
+ hash = visit(boolean.args, locale)
102
+ # TODO: simplify to hash.transform_values { :inner } when
103
+ # support for Ruby 2.3 is deprecated
104
+ Hash[hash.keys.map { |key| [key, :inner] }]
100
105
  elsif boolean.op == :OR
101
106
  hash = boolean.args.map { |op| visit(op, locale) }.
102
107
  compact.inject(&:merge)
@@ -116,7 +121,7 @@ Implements the {Mobility::Backends::KeyValue} backend for Sequel models.
116
121
 
117
122
  def visit_sql_identifier(identifier, locale)
118
123
  if identifier.backend_class == self && identifier.locale == locale
119
- { identifier.attribute_name => :inner }
124
+ { identifier.attribute_name => :left_outer }
120
125
  else
121
126
  {}
122
127
  end
@@ -102,16 +102,16 @@ Implements the {Mobility::Backends::Table} backend for Sequel models.
102
102
  end
103
103
 
104
104
  def visit_sql_identifier(identifier, locale)
105
- (table_alias(locale) == identifier.table) && :inner
105
+ (table_alias(locale) == identifier.table) && :inner || nil
106
106
  end
107
107
 
108
108
  def visit_boolean(boolean, locale)
109
109
  if boolean.op == :'='
110
- boolean.args.any? { |op| visit(op, locale) } && :inner
110
+ boolean.args.any? { |op| visit(op, locale) } && :inner || nil
111
111
  elsif boolean.op == :IS
112
- boolean.args.any?(&:nil?) && :left_outer
112
+ boolean.args.any?(&:nil?) && :left_outer || nil
113
113
  elsif boolean.op == :OR
114
- boolean.args.any? { |op| visit(op, locale) } && :left_outer
114
+ boolean.args.any? { |op| visit(op, locale) } && :left_outer || nil
115
115
  else
116
116
  visit(boolean.args, locale)
117
117
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mobility
4
- VERSION = "0.8.0"
4
+ VERSION = "0.8.1"
5
5
  end
@@ -9,7 +9,7 @@ module Mobility
9
9
  include ::Mobility::ActiveRecordMigrationCompatibility
10
10
 
11
11
  def create_migration_file
12
- if self.class.migration_exists?(migration_dir, migration_file)
12
+ if behavior == :invoke && self.class.migration_exists?(migration_dir, migration_file)
13
13
  ::Kernel.warn "Migration already exists: #{migration_file}"
14
14
  else
15
15
  migration_template "#{template}.rb", "db/migrate/#{migration_file}.rb"
@@ -35,7 +35,7 @@ module Mobility
35
35
 
36
36
  def add_mobility_migration(template)
37
37
  migration_dir = File.expand_path("db/migrate")
38
- if self.class.migration_exists?(migration_dir, template)
38
+ if behavior == :invoke && self.class.migration_exists?(migration_dir, template)
39
39
  ::Kernel.warn "Migration already exists: #{template}"
40
40
  else
41
41
  migration_template "#{template}.rb", "db/migrate/#{template}.rb"
@@ -12,7 +12,7 @@ class <%= migration_class_name %> < <%= activerecord_migration_class %>
12
12
  <% end -%>
13
13
 
14
14
  t.string :locale, null: false
15
- t.integer :<%= foreign_key %>, null: false
15
+ t.references :<%=model_table_name.singularize %>, null: false, foreign_key: true, index: false
16
16
 
17
17
  t.timestamps null: false
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobility
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Salzberg
@@ -35,7 +35,7 @@ cert_chain:
35
35
  m46ezJjnr4uXgSNuTs+RdM6DtrKaFG2HuziSP+dzmWqZiUgj1eTACYsPwfF/Z1Z6
36
36
  2DiDkec/SK4qJBMlNYPo/PTZuh5m1jROtf/hyS0VXJmm+uWc
37
37
  -----END CERTIFICATE-----
38
- date: 2018-09-11 00:00:00.000000000 Z
38
+ date: 2018-09-25 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: request_store
@@ -60,7 +60,7 @@ dependencies:
60
60
  version: 0.6.10
61
61
  - - "<"
62
62
  - !ruby/object:Gem::Version
63
- version: '1.1'
63
+ version: '2'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
@@ -70,7 +70,7 @@ dependencies:
70
70
  version: 0.6.10
71
71
  - - "<"
72
72
  - !ruby/object:Gem::Version
73
- version: '1.1'
73
+ version: '2'
74
74
  - !ruby/object:Gem::Dependency
75
75
  name: database_cleaner
76
76
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file