tram-policy 0.0.3 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ccc42d16b7d4766a4563edd74c431d7fa4da43e
4
- data.tar.gz: 0673bfe221190c2b2f4a007b85c9277eb46476ff
3
+ metadata.gz: 8cb9b1d95aea1a9a93919d38150f6c65900e8247
4
+ data.tar.gz: 686439c0267b6637fdcc888f1be4aef673a4ef89
5
5
  SHA512:
6
- metadata.gz: bd205531e5f8c84f2f9de7db3d3cb7249d92804e221e93a2d57f33d4c41b0c39dcdcb731011d03d826ce6a30a9e2a09c8d1fcb2ea6a2cb0bc0566bab24c7476a
7
- data.tar.gz: 49b6ea096c3faba94755595266f6664e863a9b7895f22861efb4d4a962d0733d95d2627fa8fcc9fbf3bbbfd708fc6a6082340e02db4cd1696220b55f88d1824c
6
+ metadata.gz: d3850a47c670108dba1c7c112aff4197bcf85a7ba41c1f4eac975c6e008e218e8bd4c4fa3eb3e871eaa9ab0e1604aed6a3484865104e21c357d993e813f89190
7
+ data.tar.gz: 1d3a178078a6c88da436c97a6f6cd4cf096947732930840d336b8736e4f35529ec8bea37aa0534ed0517e5ea7d69fa2857f459b35ab7fce3f44b0fdff6bba631
data/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [0.1.0] - [2017-05-31]
8
+ Contains backward-incompatible change.
9
+
10
+ ### Migration
11
+ You should add the namespace to gem-related I18n translations.
12
+
13
+ ```yaml
14
+ # config/locales/tram-policy.en.yml
15
+ ---
16
+ en:
17
+ tram-policy: # The namespace to be added
18
+ my_policy:
19
+ error_key: Error message
20
+ ```
21
+
22
+ ### Changed
23
+ - [BREAKING] a namespace added to scopes for policy error translations (@nepalez)
24
+
7
25
  ## [0.0.3] - [2017-05-24]
8
26
 
9
27
  ### Fixed
data/lib/tram/policy.rb CHANGED
@@ -107,7 +107,7 @@ module Tram
107
107
 
108
108
  def initialize(*)
109
109
  super
110
- @__scope__ = Inflector.underscore(self.class.name)
110
+ @__scope__ = ["tram-policy", Inflector.underscore(self.class.name)]
111
111
  self.class.send(:validators).each do |name, opts|
112
112
  size = errors.count
113
113
  send(name)
@@ -102,15 +102,15 @@ module Tram
102
102
  end
103
103
 
104
104
  def locale_header
105
- "---\n#{@locale}:\n"
105
+ "---\n#{@locale}:\n tram-policy:\n"
106
106
  end
107
107
 
108
108
  def locale_group
109
- @locale_group ||= " #{file}:\n"
109
+ @locale_group ||= " #{file}:\n"
110
110
  end
111
111
 
112
112
  def locale_line(key)
113
- " #{key}: translation missing\n"
113
+ " #{key}: translation missing\n"
114
114
  end
115
115
 
116
116
  def add_locale
@@ -1,6 +1,11 @@
1
1
  RSpec.describe Tram::Policy do
2
2
  before do
3
3
  I18n.available_locales = %w[en]
4
+ I18n.backend.store_translations :en, {
5
+ "tram-policy" => {
6
+ "test/user_policy" => { "name_presence" => "Name is absent" }
7
+ }
8
+ }
4
9
 
5
10
  class Test::UserPolicy < Tram::Policy
6
11
  param :user
@@ -173,7 +178,11 @@ RSpec.describe Tram::Policy do
173
178
 
174
179
  before do
175
180
  I18n.backend.store_translations :en, {
176
- "test/user_policy" => { "name_presence" => "%{level}: Name is absent" }
181
+ "tram-policy" => {
182
+ "test/user_policy" => {
183
+ "name_presence" => "%{level}: Name is absent"
184
+ }
185
+ }
177
186
  }
178
187
  end
179
188
 
data/tram-policy.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "tram-policy"
3
- gem.version = "0.0.3"
3
+ gem.version = "0.1.0"
4
4
  gem.author = ["Viktor Sokolov (gzigzigzeo)", "Andrew Kozin (nepalez)"]
5
5
  gem.email = ["andrew.kozin@gmail.com"]
6
6
  gem.homepage = "https://github.com/tram/tram-policy"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tram-policy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viktor Sokolov (gzigzigzeo)
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-24 00:00:00.000000000 Z
12
+ date: 2017-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-initializer