lokalise_rails 5.1.0 → 5.2.0

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: 22e008938f4d8c056bd3ab42087a3ea5a996e32e0c5fc1eb5fbcaab978235c42
4
- data.tar.gz: e2ca1a4c9a6888e357c660ec721c8d6cee37ce51297ed5afb3992b7cbaba6b64
3
+ metadata.gz: 0f210fb25454eb844cf639a709f81271aad408589d9b0269e6553fcfc02d112c
4
+ data.tar.gz: c2063c8f253c577412797aad2e2299cde7c715439fb2ddfc34b27c2c592ba7d2
5
5
  SHA512:
6
- metadata.gz: 56a4e4b06697bb5b1ddf40f43792e75b2321028665059833c7986d41821717f64cb3ea950b19a05fc9434854c8bfec61e4dd84f895172e0b53ac985265a4ccbd
7
- data.tar.gz: 82c589564b69dbc2d2e6921e2f6e5164959bbcf08ea2a5dd9822de474fc6d11c27429f957a2d05128e3927b0ecbe9da5bcdc4d4a9de6081a6b5be42dce6841be
6
+ metadata.gz: ef1fd7e991348827a51f221851a9343ce473b1c1c8b85b77b63feb70ed22d15231d1339c8371e3435fa59543c6a52448470e7800c03e8d54402464251263bfe0
7
+ data.tar.gz: bcb9c3741313418c3fc35c121071884cdd7083ad8d66fb1d8f41357d7df68cfbfefd65dae677a73ea5e5361d7b914e64751429a89221804bd65b1bf62879b06f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.2.0 (26-Jan-2023)
4
+
5
+ * The gem can now be added to the `development` group instead of `production` to reduce the bundle size
6
+ * Update dependences, test with Ruby 3.2
7
+
3
8
  ## 5.1.0 (26-Aug-2022)
4
9
 
5
10
  * Fixed an issue with `\n` being improperly imported
data/Gemfile CHANGED
@@ -5,16 +5,15 @@ source 'http://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  group :test do
8
- gem 'codecov', '~> 0.2'
9
8
  gem 'dotenv', '~> 2.5'
10
- gem 'rails', '~> 7.0'
9
+ gem 'rails', '~> 7.0.4'
11
10
  gem 'rake', '~> 13.0'
12
11
  gem 'rspec', '~> 3.6'
13
12
  gem 'rubocop', '~> 1.0'
14
13
  gem 'rubocop-performance', '~> 1.5'
14
+ gem 'rubocop-rake', '~> 0.6'
15
15
  gem 'rubocop-rspec', '~> 2.6'
16
- gem 'simplecov', '~> 0.16'
17
- gem 'sprockets-rails', '~> 3'
18
- gem 'tzinfo-data' # , platforms: %i[mingw mswin x64_mingw jruby]
19
- gem 'vcr', '~> 6.1'
16
+ gem 'simplecov', '~> 0.22'
17
+ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
18
+ gem 'webmock', '~> 3.14'
20
19
  end
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Lokalise team, Ilya Krukowski
3
+ Copyright (c) 2023 Lokalise team, Ilya Krukowski
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  ![Gem](https://img.shields.io/gem/v/lokalise_rails)
4
4
  ![CI](https://github.com/bodrovis/lokalise_rails/actions/workflows/ci.yml/badge.svg)
5
- [![Test Coverage](https://codecov.io/gh/bodrovis/lokalise_rails/graph/badge.svg)](https://codecov.io/gh/bodrovis/lokalise_rails)
6
5
  ![Downloads total](https://img.shields.io/gem/dt/lokalise_rails)
7
6
 
8
7
  This gem provides [Lokalise](http://lokalise.com) integration for Ruby on Rails and allows to exchange translation files easily. It relies on [lokalise_manager](https://github.com/bodrovis/lokalise_manager) which perform the actual import/export and can be used to run this task in any Ruby script.
@@ -13,13 +12,13 @@ This gem provides [Lokalise](http://lokalise.com) integration for Ruby on Rails
13
12
 
14
13
  ### Requirements
15
14
 
16
- This gem requires Ruby 2.5+ and Rails 5.1+. It might work with older versions of Rails though. You will also need to [setup a Lokalise account](https://app.lokalise.com/signup) and create a [translation project](https://docs.lokalise.com/en/articles/1400460-projects). Finally, you will need to generate a [read/write API token](https://docs.lokalise.com/en/articles/1929556-api-tokens) at your Lokalise profile.
15
+ This gem requires Ruby 2.7+ and Rails 5.1+. It might work with older versions of Rails though. You will also need to [setup a Lokalise account](https://app.lokalise.com/signup) and create a [translation project](https://docs.lokalise.com/en/articles/1400460-projects). Finally, you will need to generate a [read/write API token](https://docs.lokalise.com/en/articles/1929556-api-tokens) at your Lokalise profile.
17
16
 
18
17
  Alternatively, you can utilize a token obtained via OAuth 2 flow. When using such a token, you'll have to set `:use_oauth2_token` option to `true` (please check [options docs](https://github.com/bodrovis/lokalise_manager#common-config) to learn more).
19
18
 
20
19
  ### Installation
21
20
 
22
- Add the gem to your `Gemfile`:
21
+ Add the gem to your `Gemfile` (it can be added to the `development` group if you're not planning to import/export translations in production):
23
22
 
24
23
  ```ruby
25
24
  gem 'lokalise_rails'
@@ -165,7 +164,7 @@ end
165
164
 
166
165
  ## Running tests
167
166
 
168
- 1. Copypaste `.env.example` file as `.env`. Put your Lokalise API token and project ID inside. The `.env` file is excluded from version control so your data is safe. All in all, we use pre-recorded VCR cassettes, so the actual API requests wont be sent. However, providing at least some values is required.
167
+ 1. Copypaste `.env.example` file as `.env`. Put your Lokalise API token and project ID inside. The `.env` file is excluded from version control so your data is safe. All in all, we use stubbed requests, so the actual API requests won't be sent. However, providing at least some values is required.
169
168
  2. Run `rspec .`. Observe test results and code coverage.
170
169
 
171
170
  ## License
data/Rakefile CHANGED
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rake'
4
+ require 'rake/clean'
5
+ require 'rspec/core/rake_task'
6
+ require 'rubocop/rake_task'
4
7
 
5
8
  begin
6
9
  require 'bundler/setup'
@@ -9,13 +12,33 @@ rescue LoadError
9
12
  puts 'although not required, bundler is recommened for running the tests'
10
13
  end
11
14
 
12
- task default: :spec
13
-
14
- require 'rspec/core/rake_task'
15
15
  RSpec::Core::RakeTask.new(:spec)
16
16
 
17
- require 'rubocop/rake_task'
18
17
  RuboCop::RakeTask.new do |task|
19
18
  task.requires << 'rubocop-performance'
20
19
  task.requires << 'rubocop-rspec'
20
+ task.requires << 'rubocop-rake'
21
+ end
22
+
23
+ CLOBBER.include(FileList['./*.gem'])
24
+
25
+ namespace :lokalise do
26
+ desc 'Updates RubyGems, installs dependencies'
27
+ task :install do
28
+ puts 'Running bundle install'
29
+ sh 'gem update --system'
30
+ sh 'bundle'
31
+ end
32
+
33
+ desc 'Builds the gem'
34
+ task :build do
35
+ puts 'Building'
36
+ sh 'gem build lokalise_rails.gemspec'
37
+ end
21
38
  end
39
+
40
+ task rubospec: %w[rubocop spec]
41
+
42
+ task full_build: %w[clobber lokalise:install lokalise:build]
43
+
44
+ task default: :full_build
@@ -1,54 +1,56 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- LokaliseRails::GlobalConfig.config do |c|
4
- # These are mandatory options that you must set before running rake tasks:
5
- # c.api_token = ENV['LOKALISE_API_TOKEN']
6
- # c.project_id = ENV['LOKALISE_PROJECT_ID']
3
+ if defined?(LokaliseRails) && defined?(LokaliseRails::GlobalConfig)
4
+ LokaliseRails::GlobalConfig.config do |c|
5
+ # These are mandatory options that you must set before running rake tasks:
6
+ # c.api_token = ENV['LOKALISE_API_TOKEN']
7
+ # c.project_id = ENV['LOKALISE_PROJECT_ID']
7
8
 
8
- # Provide a custom path to the directory with your translation files:
9
- # c.locales_path = "#{Rails.root}/config/locales"
9
+ # Provide a custom path to the directory with your translation files:
10
+ # c.locales_path = "#{Rails.root}/config/locales"
10
11
 
11
- # Provide a Lokalise project branch to use:
12
- # c.branch = ''
12
+ # Provide a Lokalise project branch to use:
13
+ # c.branch = ''
13
14
 
14
- # Provide request timeouts for the Lokalise API client:
15
- # c.timeouts = {open_timeout: nil, timeout: nil}
15
+ # Provide request timeouts for the Lokalise API client:
16
+ # c.timeouts = {open_timeout: nil, timeout: nil}
16
17
 
17
- # Provide maximum number of retries for file exporting:
18
- # c.max_retries_export = 5
18
+ # Provide maximum number of retries for file exporting:
19
+ # c.max_retries_export = 5
19
20
 
20
- # Provide maximum number of retries for file importing:
21
- # c.max_retries_import = 5
21
+ # Provide maximum number of retries for file importing:
22
+ # c.max_retries_import = 5
22
23
 
23
- # Import options have the following defaults:
24
- # c.import_opts = {
25
- # format: 'ruby_yaml',
26
- # placeholder_format: :icu,
27
- # yaml_include_root: true,
28
- # original_filenames: true,
29
- # directory_prefix: '',
30
- # indentation: '2sp'
31
- # }
24
+ # Import options have the following defaults:
25
+ # c.import_opts = {
26
+ # format: 'ruby_yaml',
27
+ # placeholder_format: :icu,
28
+ # yaml_include_root: true,
29
+ # original_filenames: true,
30
+ # directory_prefix: '',
31
+ # indentation: '2sp'
32
+ # }
32
33
 
33
- # Safe mode for imports is disabled by default:
34
- # c.import_safe_mode = false
34
+ # Safe mode for imports is disabled by default:
35
+ # c.import_safe_mode = false
35
36
 
36
- # Additional export options (only filename, contents, and lang_iso params are provided by default)
37
- # c.export_opts = {}
37
+ # Additional export options (only filename, contents, and lang_iso params are provided by default)
38
+ # c.export_opts = {}
38
39
 
39
- # Provide additional file exclusion criteria for exports (by default, any file with the proper extension will be exported)
40
- # c.skip_file_export = ->(file) { file.split[1].to_s.include?('fr') }
40
+ # Provide additional file exclusion criteria for exports (by default, any file with the proper extension will be exported)
41
+ # c.skip_file_export = ->(file) { file.split[1].to_s.include?('fr') }
41
42
 
42
- # Set the options below if you would like to work with format other than YAML
43
- ## Regular expression to use when choosing the files to extract from the downloaded archive and upload to Lokalise
44
- ## c.file_ext_regexp = /\.ya?ml\z/i
43
+ # Set the options below if you would like to work with format other than YAML
44
+ ## Regular expression to use when choosing the files to extract from the downloaded archive and upload to Lokalise
45
+ ## c.file_ext_regexp = /\.ya?ml\z/i
45
46
 
46
- ## Load translations data and make sure they are valid:
47
- ## c.translations_loader = ->(raw_data) { YAML.safe_load raw_data }
47
+ ## Load translations data and make sure they are valid:
48
+ ## c.translations_loader = ->(raw_data) { YAML.safe_load raw_data }
48
49
 
49
- ## Convert translations data to a proper format:
50
- ## c.translations_converter = ->(raw_data) { YAML.dump(raw_data).gsub(/\\\\n/, '\n') }
50
+ ## Convert translations data to a proper format:
51
+ ## c.translations_converter = ->(raw_data) { YAML.dump(raw_data).gsub(/\\\\n/, '\n') }
51
52
 
52
- ## Infer language ISO code for the translation file:
53
- ## c.lang_iso_inferer = ->(data) { YAML.safe_load(data)&.keys&.first }
53
+ ## Infer language ISO code for the translation file:
54
+ ## c.lang_iso_inferer = ->(data) { YAML.safe_load(data)&.keys&.first }
55
+ end
54
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LokaliseRails
4
- VERSION = '5.1.0'
5
- end
4
+ VERSION = '5.2.0'
5
+ end
@@ -5,6 +5,7 @@ require 'lokalise_rails'
5
5
  require "#{LokaliseRails::Utils.root}/config/lokalise_rails"
6
6
 
7
7
  namespace :lokalise_rails do
8
+ desc 'Imports translation files from Lokalise to the current Rails project'
8
9
  task :import do
9
10
  importer = LokaliseManager.importer({}, LokaliseRails::GlobalConfig)
10
11
  importer.import!
@@ -12,6 +13,7 @@ namespace :lokalise_rails do
12
13
  abort e.inspect
13
14
  end
14
15
 
16
+ desc 'Exports translation files from the current Rails project to Lokalise'
15
17
  task :export do
16
18
  exporter = LokaliseManager.exporter({}, LokaliseRails::GlobalConfig)
17
19
  exporter.export!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lokalise_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Krukowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-26 00:00:00.000000000 Z
11
+ date: 2023-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lokalise_manager
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubygems_version: 3.3.21
87
+ rubygems_version: 3.4.5
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Lokalise integration for Ruby on Rails