diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 551fe40..7c3061c 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -22,17 +22,9 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["3.0", 3.1, 3.2, 3,3] - gemfile: ["6.1", "7.0", "7.1", "main"] - exclude: - - ruby: "3.0" - gemfile: "main" - - ruby: "3.1" - gemfile: "6.1" - - ruby: "3.2" - gemfile: "6.1" - - ruby: "3.3" - gemfile: "6.1" + ruby: [3.1, 3.2, 3,3] + gemfile: ["7.0", "7.1", "7.2", "main"] + exclude: [] steps: - name: Install packages run: | diff --git a/README.md b/README.md index e3bacda..06ead1b 100644 --- a/README.md +++ b/README.md @@ -34,16 +34,6 @@ bundle exec rake copy_tuner:export これで、`config/locales/copy_tuner.yml` に翻訳ファイルが作成されます。 -## IE等のレガシーブラウザ対応が必要な場合 - -以下のスクリプトタグを追加する。(必要なpolyfillを個別に読み込んでも可) - -``` - -``` - -[Polyfill service](https://cdn.polyfill.io/v2/docs/) - Development ================= diff --git a/copy_tuner_client.gemspec b/copy_tuner_client.gemspec index bd3cc0a..691166d 100644 --- a/copy_tuner_client.gemspec +++ b/copy_tuner_client.gemspec @@ -1,13 +1,12 @@ -# -*- encoding: utf-8 -*- -$LOAD_PATH.push File.expand_path('../lib', __FILE__) +$LOAD_PATH.push File.expand_path('lib', __dir__) require 'copy_tuner_client/version' Gem::Specification.new do |s| - s.required_ruby_version = '>= 3.0.0' + s.required_ruby_version = '>= 3.1.0' s.add_dependency 'i18n', '>= 0.5.0' s.add_dependency 'json' s.add_dependency 'nokogiri' - s.add_development_dependency 'rails', '~> 6.1' + s.add_development_dependency 'rails', '~> 7.0' s.add_development_dependency 'rake' s.add_development_dependency 'rspec' s.add_development_dependency 'sham_rack' @@ -17,14 +16,14 @@ Gem::Specification.new do |s| s.add_development_dependency 'webmock' s.add_development_dependency 'yard' s.authors = ['SonicGarden'] - s.email = 'info@sonicgarden.jp' + s.email = 'info@sonicgarden.jp' s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } s.files = `git ls-files`.split("\n") s.homepage = 'https://github.com/SonicGarden/copy-tuner-ruby-client' - s.name = 'copy_tuner_client' + s.name = 'copy_tuner_client' s.platform = Gem::Platform::RUBY s.require_paths = ['lib'] s.summary = 'Client for the CopyTuner copy management service' - s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.version = CopyTunerClient::VERSION + s.metadata['rubygems_mfa_required'] = 'true' end diff --git a/gemfiles/6.1.gemfile b/gemfiles/7.2.gemfile similarity index 100% rename from gemfiles/6.1.gemfile rename to gemfiles/7.2.gemfile diff --git a/lib/copy_tuner_client/configuration.rb b/lib/copy_tuner_client/configuration.rb index f8430a3..b57ae7f 100644 --- a/lib/copy_tuner_client/configuration.rb +++ b/lib/copy_tuner_client/configuration.rb @@ -11,15 +11,14 @@ module CopyTunerClient # Used to set up and modify settings for the client. class Configuration - # These options will be present in the Hash returned by {#to_hash}. - OPTIONS = [:api_key, :development_environments, :environment_name, :host, - :http_open_timeout, :http_read_timeout, :client_name, :client_url, - :client_version, :port, :protocol, :proxy_host, :proxy_pass, - :proxy_port, :proxy_user, :secure, :polling_delay, :sync_interval, - :sync_interval_staging, :sync_ignore_path_regex, :logger, - :framework, :middleware, :disable_middleware, :disable_test_translation, - :ca_file, :exclude_key_regexp, :s3_host, :locales, :ignored_keys, :ignored_key_handler].freeze + OPTIONS = %i[api_key development_environments environment_name host + http_open_timeout http_read_timeout client_name client_url + client_version port protocol proxy_host proxy_pass + proxy_port proxy_user secure polling_delay sync_interval + sync_interval_staging sync_ignore_path_regex logger + framework middleware disable_middleware disable_test_translation + ca_file exclude_key_regexp s3_host locales ignored_keys ignored_key_handler].freeze # @return [String] The API key for your project, found on the project edit form. attr_accessor :api_key @@ -137,14 +136,14 @@ class Configuration # @return [Proc] attr_accessor :ignored_key_handler - alias_method :secure?, :secure + alias secure? secure # Instantiated from {CopyTunerClient.configure}. Sets defaults. def initialize self.client_name = 'CopyTuner Client' self.client_url = 'https://rubygems.org/gems/copy_tuner_client' self.client_version = VERSION - self.development_environments = %w(development staging) + self.development_environments = %w[development staging] self.host = 'copy-tuner.com' self.http_open_timeout = 5 self.http_read_timeout = 5 @@ -153,14 +152,14 @@ def initialize self.sync_interval = 60 self.sync_interval_staging = 0 self.secure = true - self.test_environments = %w(test cucumber) + self.test_environments = %w[test cucumber] self.upload_disabled_environments = %w[production staging] - self.s3_host = 'copy-tuner-data-prod.s3.amazonaws.com' + self.s3_host = 'copy-tuner.sg-apps.com' # NOTE: cloudfront host self.disable_copyray_comment_injection = false # TODO: 0.18.0以降のバージョンで初期値をtrueにしたい self.html_escape = nil self.ignored_keys = [] - self.ignored_key_handler = -> (e) { raise e } + self.ignored_key_handler = ->(e) { raise e } @applied = false end @@ -238,13 +237,11 @@ def applied? # # When {#test?} returns +false+, the poller will be started. def apply - self.locales ||= begin - if defined?(::Rails) - self.locales = ::Rails.application.config.i18n.available_locales.presence || Array(::Rails.application.config.i18n.default_locale) - else - self.locales = [:en] - end - end + self.locales ||= self.locales = if defined?(::Rails) + ::Rails.application.config.i18n.available_locales.presence || Array(::Rails.application.config.i18n.default_locale) + else + [:en] + end self.client ||= Client.new(to_hash) self.cache ||= Cache.new(client, to_hash) @@ -253,8 +250,8 @@ def apply I18n.backend = I18nBackend.new(cache) if enable_middleware? - logger.info "Using copytuner sync middleware" - request_sync_options = {:poller => @poller, :cache => cache, :interval => sync_interval, :ignore_regex => sync_ignore_path_regex} + logger.info 'Using copytuner sync middleware' + request_sync_options = { poller: @poller, cache:, interval: sync_interval, ignore_regex: sync_ignore_path_regex } if middleware_position.is_a?(Hash) && middleware_position[:before] middleware.insert_before middleware_position[:before], RequestSync, request_sync_options middleware.insert_before middleware_position[:before], CopyTunerClient::CopyrayMiddleware @@ -266,7 +263,7 @@ def apply middleware.use CopyTunerClient::CopyrayMiddleware end else - logger.info "[[[Warn]]] Not using copytuner sync middleware" unless middleware + logger.info '[[[Warn]]] Not using copytuner sync middleware' unless middleware end @applied = true @@ -278,8 +275,8 @@ def apply process_guard.start end - if !(test? && disable_test_translation) - logger.info "Download translation now" + unless test? && disable_test_translation + logger.info 'Download translation now' cache.download end end @@ -302,19 +299,19 @@ def protocol # @return [String] a description of the environment in which this configuration was built. def environment_info parts = ["Ruby: #{RUBY_VERSION}", framework, "Env: #{environment_name}"] - parts.compact.map { |part| "[#{part}]" }.join(" ") + parts.compact.map { |part| "[#{part}]" }.join(' ') end # Wraps the given logger in a PrefixedLogger. This way, CopyTunerClient # log messages are recognizable. # @param original_logger [Logger] the upstream logger to use, which must respond to the standard +Logger+ severity methods. def logger=(original_logger) - @logger = PrefixedLogger.new("** [CopyTuner]", original_logger) + @logger = PrefixedLogger.new('** [CopyTuner]', original_logger) end # Sync interval for Rack Middleware def sync_interval - if environment_name == "staging" + if environment_name == 'staging' @sync_interval_staging else @sync_interval @@ -323,7 +320,7 @@ def sync_interval # @return [String] current project url by api_key def project_url - URI::Generic.build(:scheme => self.protocol, :host => self.host, :port => self.port.to_i, :path => "/projects/#{self.api_key}").to_s + URI::Generic.build(scheme: self.protocol, host: self.host, port: self.port.to_i, path: "/projects/#{self.api_key}").to_s end private diff --git a/lib/copy_tuner_client/version.rb b/lib/copy_tuner_client/version.rb index addee7a..6db3a19 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.18.0'.freeze + VERSION = '0.19.0'.freeze # API version being used to communicate with the server API_VERSION = '2.0'.freeze