From 9e0dd9085cba846808e6cd8d697958e6049a0f2c Mon Sep 17 00:00:00 2001 From: aki Date: Mon, 22 Apr 2024 21:26:09 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20html=5Fescape=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=82=92=E5=BF=85=E9=A0=88=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 2 +- lib/copy_tuner_client/configuration.rb | 9 ++++++++- lib/copy_tuner_client/version.rb | 2 +- spec/copy_tuner_client/i18n_backend_spec.rb | 4 ++-- spec/support/client_spec_helpers.rb | 1 + 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 2e70ced..bce6ffe 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "editor.codeActionsOnSave": { - "source.fixAll.eslint": true, + "source.fixAll.eslint": "explicit" }, "typescript.tsdk": "node_modules/typescript/lib", "typescript.preferences.importModuleSpecifier": "non-relative", diff --git a/lib/copy_tuner_client/configuration.rb b/lib/copy_tuner_client/configuration.rb index d5a13be..f8430a3 100644 --- a/lib/copy_tuner_client/configuration.rb +++ b/lib/copy_tuner_client/configuration.rb @@ -157,13 +157,20 @@ def initialize self.upload_disabled_environments = %w[production staging] self.s3_host = 'copy-tuner-data-prod.s3.amazonaws.com' self.disable_copyray_comment_injection = false - self.html_escape = false + # TODO: 0.18.0以降のバージョンで初期値をtrueにしたい + self.html_escape = nil self.ignored_keys = [] self.ignored_key_handler = -> (e) { raise e } @applied = false end + def html_escape + raise 'CopyTunerClient.configuration.html_escape is required' if @html_escape.nil? + + @html_escape + end + # Allows config options to be read like a hash # # @param [Symbol] option Key for a given attribute diff --git a/lib/copy_tuner_client/version.rb b/lib/copy_tuner_client/version.rb index c9aed9a..2872753 100644 --- a/lib/copy_tuner_client/version.rb +++ b/lib/copy_tuner_client/version.rb @@ -1,6 +1,6 @@ module CopyTunerClient # Client version - VERSION = '0.16.3'.freeze + VERSION = '0.17.0'.freeze # API version being used to communicate with the server API_VERSION = '2.0'.freeze diff --git a/spec/copy_tuner_client/i18n_backend_spec.rb b/spec/copy_tuner_client/i18n_backend_spec.rb index aaa2e1c..06c86ff 100644 --- a/spec/copy_tuner_client/i18n_backend_spec.rb +++ b/spec/copy_tuner_client/i18n_backend_spec.rb @@ -111,10 +111,10 @@ def build_backend expect(cache['en.test.key']).to eq 'default %{interpolate}' end - it "marks strings as html safe" do + it "dose not mark strings as html safe" do cache['en.test.key'] = FakeHtmlSafeString.new("Hello") backend = build_backend - expect(backend.translate('en', 'test.key')).to be_html_safe + expect(backend.translate('en', 'test.key')).to_not be_html_safe end it "looks up an array of defaults" do diff --git a/spec/support/client_spec_helpers.rb b/spec/support/client_spec_helpers.rb index db6f63e..7794faa 100644 --- a/spec/support/client_spec_helpers.rb +++ b/spec/support/client_spec_helpers.rb @@ -4,6 +4,7 @@ def reset_config CopyTunerClient.configure(false) do |config| config.api_key = 'abc123' config.s3_host = 'copy-tuner.com' + config.html_escape = true end end end From 7d7f29b6031556b867e8eb1e5aa7173937aa5d37 Mon Sep 17 00:00:00 2001 From: aki Date: Tue, 23 Apr 2024 11:04:27 +0900 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20rails=20main=E3=83=96=E3=83=A9?= =?UTF-8?q?=E3=83=B3=E3=83=81=E3=81=A7=E3=81=AFruby@3.1=E4=BB=A5=E4=B8=8A?= =?UTF-8?q?=E3=81=8C=E5=BF=85=E9=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rspec.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 52f3fbb..bd11fcb 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -29,6 +29,8 @@ jobs: gemfile: "6.1" - ruby: "3.2" gemfile: "6.1" + - ruby: "3.0" + gemfile: "main" steps: - name: Install packages run: | From c837507f9b3eba397b12d6a56272dcf45bc68069 Mon Sep 17 00:00:00 2001 From: aki Date: Tue, 23 Apr 2024 11:09:40 +0900 Subject: [PATCH 3/4] chore: Add ruby@3.3 test --- .github/workflows/rspec.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index bd11fcb..0409d6e 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -22,15 +22,17 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["3.0", 3.1, 3.2] + ruby: ["3.0", 3.1, 3.2, 3,3] gemfile: ["6.1", "7.0", "main"] exclude: + - ruby: "3.0" + gemfile: "main" - ruby: "3.1" gemfile: "6.1" - ruby: "3.2" gemfile: "6.1" - - ruby: "3.0" - gemfile: "main" + - ruby: "3.3" + gemfile: "6.1" steps: - name: Install packages run: | From 87b4fa956571b82ef69a44f4ebc7277fa17ce89c Mon Sep 17 00:00:00 2001 From: aki Date: Tue, 23 Apr 2024 11:10:40 +0900 Subject: [PATCH 4/4] chore: Add rails@7.1 test --- .github/workflows/rspec.yml | 2 +- gemfiles/7.1.gemfile | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 gemfiles/7.1.gemfile diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 0409d6e..551fe40 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: ruby: ["3.0", 3.1, 3.2, 3,3] - gemfile: ["6.1", "7.0", "main"] + gemfile: ["6.1", "7.0", "7.1", "main"] exclude: - ruby: "3.0" gemfile: "main" diff --git a/gemfiles/7.1.gemfile b/gemfiles/7.1.gemfile new file mode 100644 index 0000000..f57276e --- /dev/null +++ b/gemfiles/7.1.gemfile @@ -0,0 +1,5 @@ +source "http://rubygems.org" + +gem "rails", "~> 7.1" + +gemspec :path => "../"