phraseapp-in-context-editor-ruby 3.0.1 → 3.1.1

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
  SHA256:
3
- metadata.gz: 959f0ae7643190cc4795de334ab0d9b64fb52486b1de166ccdcfab9d50f29c78
4
- data.tar.gz: c12667b6c1da8dea65ff830647828c34216d723de98c815e6628265d639e1e7b
3
+ metadata.gz: 1d26e42fffd5138a7fecf9273413a584f2e0bac55f0c9ec280f2ff3f2c48701b
4
+ data.tar.gz: 675aa580225c7edf371c0b031a9b4dba485e36c72a71ebdbc991738548eb9ae3
5
5
  SHA512:
6
- metadata.gz: 5e7f7de78f617562fe35effa1162c97d5dc0b938549155ed5ff9d6223821f3380bc361956c5b78d00c5d8a2470bc6802ea8cc2a97989d0c93c880f5188d1904b
7
- data.tar.gz: 8467589b50d701dd648efe7546cce5b3680f282b3545ed11f698d9424438f4721e69be95ffee7e16ef972db0f7525c83df397c2d494611155069fb6b2eb05e3a
6
+ metadata.gz: 45d475e3a53d156711097c0926df63c9bc89a0ad78ffb56b908e48d11b5db0cc70267ac629edd0d24c7a0835572411fce36ff08b9de021e2787a1c389a11ae7d
7
+ data.tar.gz: 546bd0fa0eca47a62078b7f20b0e2ed1215fad2c73dcb0367f01c25fe235e64a16c4301d0a48ff665f67ed93a293b5556e5aadeadbe1fc2911f2b419e0ee074a
@@ -3,9 +3,20 @@ on:
3
3
  push:
4
4
  branches:
5
5
  - master
6
+
7
+ permissions:
8
+ contents: read
9
+
6
10
  jobs:
7
11
  release:
8
12
  runs-on: ubuntu-latest
13
+
14
+ permissions:
15
+ contents: write
16
+ id-token: write
17
+ issues: write
18
+ pull-requests: write
19
+
9
20
  steps:
10
21
  - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
11
22
  - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
@@ -13,14 +24,11 @@ jobs:
13
24
  node-version: 20
14
25
  - uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939
15
26
  with:
16
- ruby-version: '3.2' # Not needed with a .ruby-version file
27
+ ruby-version: "3.2" # Not needed with a .ruby-version file
17
28
 
18
29
  - name: Install dependencies
19
30
  run: npm install && bundle install
20
31
 
21
- - name: Build and validate gem
22
- run: gem build
23
-
24
32
  - name: Semantic Release
25
33
  uses: cycjimmy/semantic-release-action@61680d0e9b02ff86f5648ade99e01be17f0260a4
26
34
  env:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [3.1.1](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v3.1.0...v3.1.1) (2024-06-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Adjust workflow permissions so it can bump version ([#85](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/85)) ([42e00ed](https://github.com/phrase/phraseapp-in-context-editor-ruby/commit/42e00ed821fb594415a1b12d3c3e3ac2c24f951f))
7
+
8
+ # [3.1.0](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v3.0.1...v3.1.0) (2024-06-14)
9
+
10
+
11
+ ### Features
12
+
13
+ * Add config option to ignore keys ([#82](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/82)) ([657b9f3](https://github.com/phrase/phraseapp-in-context-editor-ruby/commit/657b9f3ebce1ca2a364af1b9b84b0b28ee733983))
14
+
1
15
  ## [3.0.1](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v3.0.0...v3.0.1) (2024-06-14)
2
16
 
3
17
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phraseapp-in-context-editor-ruby (3.0.0)
4
+ phraseapp-in-context-editor-ruby (3.1.0)
5
5
  i18n (~> 1.0)
6
6
  json (~> 2.0)
7
7
  request_store (~> 1.2)
@@ -9,6 +9,10 @@ PhraseApp::InContextEditor.configure do |config|
9
9
  config.account_id = "<%= options[:account_id] %>"
10
10
  config.datacenter = "eu"
11
11
 
12
+ # Configure an array of key names that should not be handled
13
+ # by the In-Context-Editor.
14
+ # config.ignored_keys = ["number.*", "foo.bar"]
15
+
12
16
  # Phrase uses decorators to generate a unique identification key
13
17
  # in context of your document. However, this might result in conflicts
14
18
  # with other libraries (e.g. client-side template engines) that use a similar syntax.
@@ -3,8 +3,6 @@ require_relative "delegate/i18n_delegate"
3
3
  module PhraseApp
4
4
  module InContextEditor
5
5
  class BackendService
6
- attr_accessor :blacklisted_keys
7
-
8
6
  def initialize(args = {})
9
7
  self
10
8
  end
@@ -20,7 +18,14 @@ module PhraseApp
20
18
  protected
21
19
 
22
20
  def to_be_translated_without_phraseapp?(...)
23
- PhraseApp::InContextEditor.disabled? || has_been_forced_to_resolve_with_phraseapp?(...)
21
+ PhraseApp::InContextEditor.disabled? || ignored_key?(...) || has_been_forced_to_resolve_with_phraseapp?(...)
22
+ end
23
+
24
+ def ignored_key?(*args)
25
+ key = given_key_from_args(args)
26
+ PhraseApp::InContextEditor.ignored_keys.any? do |ignored_key|
27
+ key.to_s[/\A#{ignored_key.gsub("*", ".*")}\Z/]
28
+ end
24
29
  end
25
30
 
26
31
  def has_been_forced_to_resolve_with_phraseapp?(*args)
@@ -9,7 +9,8 @@ module PhraseApp
9
9
  backend: PhraseApp::InContextEditor::BackendService.new,
10
10
  prefix: "{{__",
11
11
  suffix: "__}}",
12
- origin: "in-context-editor-ruby"
12
+ origin: "in-context-editor-ruby",
13
+ ignored_keys: []
13
14
  }.freeze
14
15
 
15
16
  CONFIG_OPTIONS.each do |option, default_value|
@@ -1,3 +1,3 @@
1
1
  module PhraseappInContextEditor
2
- VERSION = "3.0.1"
2
+ VERSION = "3.1.1"
3
3
  end
@@ -37,6 +37,10 @@ module PhraseApp
37
37
  config.datacenter
38
38
  end
39
39
 
40
+ def ignored_keys
41
+ config.ignored_keys
42
+ end
43
+
40
44
  def enabled=(value)
41
45
  config.enabled = value
42
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phraseapp-in-context-editor-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phrase