lokalise_rails 5.0.1 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/LICENSE +1 -1
- data/README.md +3 -3
- data/lib/generators/templates/lokalise_rails_config.rb +2 -2
- data/lib/lokalise_rails/version.rb +1 -3
- data/lokalise_rails.gemspec +2 -3
- metadata +7 -59
- data/spec/dummy/app/controllers/application_controller.rb +0 -4
- data/spec/dummy/app/helpers/application_helper.rb +0 -4
- data/spec/dummy/app/models/application_record.rb +0 -5
- data/spec/dummy/config/application.rb +0 -36
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/environment.rb +0 -7
- data/spec/dummy/config/environments/development.rb +0 -56
- data/spec/dummy/config/environments/production.rb +0 -100
- data/spec/dummy/config/environments/test.rb +0 -38
- data/spec/dummy/config/initializers/assets.rb +0 -14
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -7
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -6
- data/spec/dummy/config/lokalise_rails.rb +0 -5
- data/spec/dummy/config/puma.rb +0 -40
- data/spec/dummy/config/routes.rb +0 -5
- data/spec/dummy/db/seeds.rb +0 -8
- data/spec/lib/generators/lokalise_rails/install_generator_spec.rb +0 -19
- data/spec/lib/lokalise_rails/global_config_spec.rb +0 -117
- data/spec/lib/lokalise_rails/version_spec.rb +0 -7
- data/spec/lib/tasks/export_task_spec.rb +0 -51
- data/spec/lib/tasks/import_task_spec.rb +0 -58
- data/spec/lib/utils_spec.rb +0 -16
- data/spec/spec_helper.rb +0 -35
- data/spec/support/file_manager.rb +0 -86
- data/spec/support/spec_addons.rb +0 -16
- data/spec/support/vcr.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22e008938f4d8c056bd3ab42087a3ea5a996e32e0c5fc1eb5fbcaab978235c42
|
4
|
+
data.tar.gz: e2ca1a4c9a6888e357c660ec721c8d6cee37ce51297ed5afb3992b7cbaba6b64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56a4e4b06697bb5b1ddf40f43792e75b2321028665059833c7986d41821717f64cb3ea950b19a05fc9434854c8bfec61e4dd84f895172e0b53ac985265a4ccbd
|
7
|
+
data.tar.gz: 82c589564b69dbc2d2e6921e2f6e5164959bbcf08ea2a5dd9822de474fc6d11c27429f957a2d05128e3927b0ecbe9da5bcdc4d4a9de6081a6b5be42dce6841be
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -131,7 +131,7 @@ LokaliseRails::GlobalConfig.config do |c|
|
|
131
131
|
|
132
132
|
# Import options have the following defaults:
|
133
133
|
# c.import_opts = {
|
134
|
-
# format: '
|
134
|
+
# format: 'ruby_yaml',
|
135
135
|
# placeholder_format: :icu,
|
136
136
|
# yaml_include_root: true,
|
137
137
|
# original_filenames: true,
|
@@ -156,7 +156,7 @@ LokaliseRails::GlobalConfig.config do |c|
|
|
156
156
|
## c.translations_loader = ->(raw_data) { YAML.safe_load raw_data }
|
157
157
|
|
158
158
|
## Convert translations data to a proper format:
|
159
|
-
## c.translations_converter = ->(raw_data) { raw_data.
|
159
|
+
## c.translations_converter = ->(raw_data) { YAML.dump(raw_data).gsub(/\\\\n/, '\n') }
|
160
160
|
|
161
161
|
## Infer language ISO code for the translation file:
|
162
162
|
## c.lang_iso_inferer = ->(data) { YAML.safe_load(data)&.keys&.first }
|
@@ -170,4 +170,4 @@ end
|
|
170
170
|
|
171
171
|
## License
|
172
172
|
|
173
|
-
Copyright (c) [Lokalise team](http://lokalise.com), [Ilya
|
173
|
+
Copyright (c) [Lokalise team](http://lokalise.com), [Ilya Krukowski](http://bodrovis.tech). License type is [MIT](https://github.com/bodrovis/lokalise_rails/blob/master/LICENSE).
|
@@ -22,7 +22,7 @@ LokaliseRails::GlobalConfig.config do |c|
|
|
22
22
|
|
23
23
|
# Import options have the following defaults:
|
24
24
|
# c.import_opts = {
|
25
|
-
# format: '
|
25
|
+
# format: 'ruby_yaml',
|
26
26
|
# placeholder_format: :icu,
|
27
27
|
# yaml_include_root: true,
|
28
28
|
# original_filenames: true,
|
@@ -47,7 +47,7 @@ LokaliseRails::GlobalConfig.config do |c|
|
|
47
47
|
## c.translations_loader = ->(raw_data) { YAML.safe_load raw_data }
|
48
48
|
|
49
49
|
## Convert translations data to a proper format:
|
50
|
-
## c.translations_converter = ->(raw_data) { raw_data.
|
50
|
+
## c.translations_converter = ->(raw_data) { YAML.dump(raw_data).gsub(/\\\\n/, '\n') }
|
51
51
|
|
52
52
|
## Infer language ISO code for the translation file:
|
53
53
|
## c.lang_iso_inferer = ->(data) { YAML.safe_load(data)&.keys&.first }
|
data/lokalise_rails.gemspec
CHANGED
@@ -5,7 +5,7 @@ require File.expand_path('lib/lokalise_rails/version', __dir__)
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'lokalise_rails'
|
7
7
|
spec.version = LokaliseRails::VERSION
|
8
|
-
spec.authors = ['Ilya
|
8
|
+
spec.authors = ['Ilya Krukowski']
|
9
9
|
spec.email = ['golosizpru@gmail.com']
|
10
10
|
spec.summary = 'Lokalise integration for Ruby on Rails'
|
11
11
|
spec.description = 'This gem allows to exchange translation files between your Rails app and Lokalise TMS.'
|
@@ -19,11 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
'lib/**/*.rake',
|
20
20
|
'lokalise_rails.gemspec', '.github/*.md',
|
21
21
|
'Gemfile', 'Rakefile']
|
22
|
-
spec.test_files = Dir['spec/**/*.rb']
|
23
22
|
spec.extra_rdoc_files = ['README.md']
|
24
23
|
spec.require_paths = ['lib']
|
25
24
|
|
26
|
-
spec.add_dependency 'lokalise_manager', '~> 3.
|
25
|
+
spec.add_dependency 'lokalise_manager', '~> 3.2'
|
27
26
|
spec.add_dependency 'zeitwerk', '~> 2.4'
|
28
27
|
|
29
28
|
spec.metadata = {
|
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.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Ilya
|
7
|
+
- Ilya Krukowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lokalise_manager
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: zeitwerk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,32 +64,6 @@ files:
|
|
64
64
|
- lib/lokalise_rails/version.rb
|
65
65
|
- lib/tasks/lokalise_rails_tasks.rake
|
66
66
|
- lokalise_rails.gemspec
|
67
|
-
- spec/dummy/app/controllers/application_controller.rb
|
68
|
-
- spec/dummy/app/helpers/application_helper.rb
|
69
|
-
- spec/dummy/app/models/application_record.rb
|
70
|
-
- spec/dummy/config/application.rb
|
71
|
-
- spec/dummy/config/boot.rb
|
72
|
-
- spec/dummy/config/environment.rb
|
73
|
-
- spec/dummy/config/environments/development.rb
|
74
|
-
- spec/dummy/config/environments/production.rb
|
75
|
-
- spec/dummy/config/environments/test.rb
|
76
|
-
- spec/dummy/config/initializers/assets.rb
|
77
|
-
- spec/dummy/config/initializers/cookies_serializer.rb
|
78
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
79
|
-
- spec/dummy/config/lokalise_rails.rb
|
80
|
-
- spec/dummy/config/puma.rb
|
81
|
-
- spec/dummy/config/routes.rb
|
82
|
-
- spec/dummy/db/seeds.rb
|
83
|
-
- spec/lib/generators/lokalise_rails/install_generator_spec.rb
|
84
|
-
- spec/lib/lokalise_rails/global_config_spec.rb
|
85
|
-
- spec/lib/lokalise_rails/version_spec.rb
|
86
|
-
- spec/lib/tasks/export_task_spec.rb
|
87
|
-
- spec/lib/tasks/import_task_spec.rb
|
88
|
-
- spec/lib/utils_spec.rb
|
89
|
-
- spec/spec_helper.rb
|
90
|
-
- spec/support/file_manager.rb
|
91
|
-
- spec/support/spec_addons.rb
|
92
|
-
- spec/support/vcr.rb
|
93
67
|
homepage: https://github.com/bodrovis/lokalise_rails
|
94
68
|
licenses:
|
95
69
|
- MIT
|
@@ -110,34 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
84
|
- !ruby/object:Gem::Version
|
111
85
|
version: '0'
|
112
86
|
requirements: []
|
113
|
-
rubygems_version: 3.3.
|
87
|
+
rubygems_version: 3.3.21
|
114
88
|
signing_key:
|
115
89
|
specification_version: 4
|
116
90
|
summary: Lokalise integration for Ruby on Rails
|
117
|
-
test_files:
|
118
|
-
- spec/dummy/app/controllers/application_controller.rb
|
119
|
-
- spec/dummy/app/helpers/application_helper.rb
|
120
|
-
- spec/dummy/app/models/application_record.rb
|
121
|
-
- spec/dummy/config/application.rb
|
122
|
-
- spec/dummy/config/boot.rb
|
123
|
-
- spec/dummy/config/environment.rb
|
124
|
-
- spec/dummy/config/environments/development.rb
|
125
|
-
- spec/dummy/config/environments/production.rb
|
126
|
-
- spec/dummy/config/environments/test.rb
|
127
|
-
- spec/dummy/config/initializers/assets.rb
|
128
|
-
- spec/dummy/config/initializers/cookies_serializer.rb
|
129
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
130
|
-
- spec/dummy/config/lokalise_rails.rb
|
131
|
-
- spec/dummy/config/puma.rb
|
132
|
-
- spec/dummy/config/routes.rb
|
133
|
-
- spec/dummy/db/seeds.rb
|
134
|
-
- spec/lib/generators/lokalise_rails/install_generator_spec.rb
|
135
|
-
- spec/lib/lokalise_rails/global_config_spec.rb
|
136
|
-
- spec/lib/lokalise_rails/version_spec.rb
|
137
|
-
- spec/lib/tasks/export_task_spec.rb
|
138
|
-
- spec/lib/tasks/import_task_spec.rb
|
139
|
-
- spec/lib/utils_spec.rb
|
140
|
-
- spec/spec_helper.rb
|
141
|
-
- spec/support/file_manager.rb
|
142
|
-
- spec/support/spec_addons.rb
|
143
|
-
- spec/support/vcr.rb
|
91
|
+
test_files: []
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'boot'
|
4
|
-
|
5
|
-
require 'rails'
|
6
|
-
# Pick the frameworks you want:
|
7
|
-
# require 'active_model/railtie'
|
8
|
-
# require "active_job/railtie"
|
9
|
-
# require 'active_record/railtie'
|
10
|
-
# require "active_storage/engine"
|
11
|
-
require 'action_controller/railtie'
|
12
|
-
# require "action_mailer/railtie"
|
13
|
-
# require "action_mailbox/engine"
|
14
|
-
# require "action_text/engine"
|
15
|
-
require 'action_view/railtie'
|
16
|
-
# require "action_cable/engine"
|
17
|
-
require 'sprockets/railtie'
|
18
|
-
# require "rails/test_unit/railtie"
|
19
|
-
|
20
|
-
# Require the gems listed in Gemfile, including any gems
|
21
|
-
# you've limited to :test, :development, or :production.
|
22
|
-
Bundler.require(*Rails.groups)
|
23
|
-
|
24
|
-
require 'dotenv/load'
|
25
|
-
|
26
|
-
module Dummy
|
27
|
-
class Application < Rails::Application
|
28
|
-
# Settings in config/environments/* take precedence over those specified here.
|
29
|
-
# Application configuration can go into files in config/initializers
|
30
|
-
# -- all .rb files in that directory are automatically loaded after loading
|
31
|
-
# the framework and any gems in your application.
|
32
|
-
|
33
|
-
# Don't generate system test files.
|
34
|
-
config.generators.system_tests = nil
|
35
|
-
end
|
36
|
-
end
|
data/spec/dummy/config/boot.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Rails.application.configure do
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
-
|
6
|
-
# In the development environment your application's code is reloaded on
|
7
|
-
# every request. This slows down response time but is perfect for development
|
8
|
-
# since you don't have to restart the web server when you make code changes.
|
9
|
-
config.cache_classes = false
|
10
|
-
|
11
|
-
# Do not eager load code on boot.
|
12
|
-
config.eager_load = false
|
13
|
-
|
14
|
-
# Show full error reports.
|
15
|
-
config.consider_all_requests_local = true
|
16
|
-
|
17
|
-
# Enable/disable caching. By default caching is disabled.
|
18
|
-
# Run rails dev:cache to toggle caching.
|
19
|
-
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
20
|
-
config.action_controller.perform_caching = true
|
21
|
-
config.action_controller.enable_fragment_cache_logging = true
|
22
|
-
|
23
|
-
config.cache_store = :memory_store
|
24
|
-
config.public_file_server.headers = {
|
25
|
-
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
26
|
-
}
|
27
|
-
else
|
28
|
-
config.action_controller.perform_caching = false
|
29
|
-
|
30
|
-
config.cache_store = :null_store
|
31
|
-
end
|
32
|
-
|
33
|
-
# Print deprecation notices to the Rails logger.
|
34
|
-
config.active_support.deprecation = :log
|
35
|
-
|
36
|
-
# Raise an error on page load if there are pending migrations.
|
37
|
-
config.active_record.migration_error = :page_load
|
38
|
-
|
39
|
-
# Highlight code that triggered database queries in logs.
|
40
|
-
config.active_record.verbose_query_logs = true
|
41
|
-
|
42
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
43
|
-
# This option may cause significant delays in view rendering with a large
|
44
|
-
# number of complex assets.
|
45
|
-
config.assets.debug = true
|
46
|
-
|
47
|
-
# Suppress logger output for asset requests.
|
48
|
-
config.assets.quiet = true
|
49
|
-
|
50
|
-
# Raises error for missing translations.
|
51
|
-
# config.action_view.raise_on_missing_translations = true
|
52
|
-
|
53
|
-
# Use an evented file watcher to asynchronously detect changes in source code,
|
54
|
-
# routes, locales, etc. This feature depends on the listen gem.
|
55
|
-
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
56
|
-
end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Rails.application.configure do
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
-
|
6
|
-
# Code is not reloaded between requests.
|
7
|
-
config.cache_classes = true
|
8
|
-
|
9
|
-
# Eager load code on boot. This eager loads most of Rails and
|
10
|
-
# your application in memory, allowing both threaded web servers
|
11
|
-
# and those relying on copy on write to perform better.
|
12
|
-
# Rake tasks automatically ignore this option for performance.
|
13
|
-
config.eager_load = true
|
14
|
-
|
15
|
-
# Full error reports are disabled and caching is turned on.
|
16
|
-
config.consider_all_requests_local = false
|
17
|
-
config.action_controller.perform_caching = true
|
18
|
-
|
19
|
-
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
20
|
-
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
21
|
-
# config.require_master_key = true
|
22
|
-
|
23
|
-
# Disable serving static files from the `/public` folder by default since
|
24
|
-
# Apache or NGINX already handles this.
|
25
|
-
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
|
-
|
27
|
-
# Compress CSS using a preprocessor.
|
28
|
-
# config.assets.css_compressor = :sass
|
29
|
-
|
30
|
-
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
31
|
-
config.assets.compile = false
|
32
|
-
|
33
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
34
|
-
# config.action_controller.asset_host = 'http://assets.example.com'
|
35
|
-
|
36
|
-
# Specifies the header that your server uses for sending files.
|
37
|
-
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
38
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
39
|
-
|
40
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
41
|
-
# config.force_ssl = true
|
42
|
-
|
43
|
-
# Use the lowest log level to ensure availability of diagnostic information
|
44
|
-
# when problems arise.
|
45
|
-
config.log_level = :debug
|
46
|
-
|
47
|
-
# Prepend all log lines with the following tags.
|
48
|
-
config.log_tags = [:request_id]
|
49
|
-
|
50
|
-
# Use a different cache store in production.
|
51
|
-
# config.cache_store = :mem_cache_store
|
52
|
-
|
53
|
-
# Use a real queuing backend for Active Job (and separate queues per environment).
|
54
|
-
# config.active_job.queue_adapter = :resque
|
55
|
-
# config.active_job.queue_name_prefix = "dummy_production"
|
56
|
-
|
57
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
|
-
# the I18n.default_locale when a translation cannot be found).
|
59
|
-
config.i18n.fallbacks = true
|
60
|
-
|
61
|
-
# Send deprecation notices to registered listeners.
|
62
|
-
config.active_support.deprecation = :notify
|
63
|
-
|
64
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
65
|
-
config.log_formatter = ::Logger::Formatter.new
|
66
|
-
|
67
|
-
# Use a different logger for distributed setups.
|
68
|
-
# require 'syslog/logger'
|
69
|
-
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
70
|
-
|
71
|
-
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
72
|
-
logger = ActiveSupport::Logger.new($stdout)
|
73
|
-
logger.formatter = config.log_formatter
|
74
|
-
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
75
|
-
end
|
76
|
-
|
77
|
-
# Do not dump schema after migrations.
|
78
|
-
config.active_record.dump_schema_after_migration = false
|
79
|
-
|
80
|
-
# Inserts middleware to perform automatic connection switching.
|
81
|
-
# The `database_selector` hash is used to pass options to the DatabaseSelector
|
82
|
-
# middleware. The `delay` is used to determine how long to wait after a write
|
83
|
-
# to send a subsequent read to the primary.
|
84
|
-
#
|
85
|
-
# The `database_resolver` class is used by the middleware to determine which
|
86
|
-
# database is appropriate to use based on the time delay.
|
87
|
-
#
|
88
|
-
# The `database_resolver_context` class is used by the middleware to set
|
89
|
-
# timestamps for the last write to the primary. The resolver uses the context
|
90
|
-
# class timestamps to determine how long to wait before reading from the
|
91
|
-
# replica.
|
92
|
-
#
|
93
|
-
# By default Rails will store a last write timestamp in the session. The
|
94
|
-
# DatabaseSelector middleware is designed as such you can define your own
|
95
|
-
# strategy for connection switching and pass that into the middleware through
|
96
|
-
# these configuration options.
|
97
|
-
# config.active_record.database_selector = { delay: 2.seconds }
|
98
|
-
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
99
|
-
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
100
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# The test environment is used exclusively to run your application's
|
4
|
-
# test suite. You never need to work with it otherwise. Remember that
|
5
|
-
# your test database is "scratch space" for the test suite and is wiped
|
6
|
-
# and recreated between test runs. Don't rely on the data there!
|
7
|
-
|
8
|
-
Rails.application.configure do
|
9
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
10
|
-
|
11
|
-
config.cache_classes = true
|
12
|
-
|
13
|
-
# Do not eager load code on boot. This avoids loading your whole application
|
14
|
-
# just for the purpose of running a single test. If you are using a tool that
|
15
|
-
# preloads Rails for running tests, you may have to set it to true.
|
16
|
-
config.eager_load = false
|
17
|
-
|
18
|
-
# Configure public file server for tests with Cache-Control for performance.
|
19
|
-
config.public_file_server.enabled = true
|
20
|
-
config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
|
21
|
-
|
22
|
-
# Show full error reports and disable caching.
|
23
|
-
config.consider_all_requests_local = true
|
24
|
-
config.action_controller.perform_caching = false
|
25
|
-
config.cache_store = :null_store
|
26
|
-
|
27
|
-
# Raise exceptions instead of rendering exception templates.
|
28
|
-
config.action_dispatch.show_exceptions = false
|
29
|
-
|
30
|
-
# Disable request forgery protection in test environment.
|
31
|
-
config.action_controller.allow_forgery_protection = false
|
32
|
-
|
33
|
-
# Print deprecation notices to the stderr.
|
34
|
-
config.active_support.deprecation = :stderr
|
35
|
-
|
36
|
-
# Raises error for missing translations.
|
37
|
-
# config.action_view.raise_on_missing_translations = true
|
38
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Be sure to restart your server when you modify this file.
|
4
|
-
|
5
|
-
# Version of your assets, change this if you want to expire all your assets.
|
6
|
-
Rails.application.config.assets.version = '1.0'
|
7
|
-
|
8
|
-
# Add additional assets to the asset load path.
|
9
|
-
# Rails.application.config.assets.paths << Emoji.images_path
|
10
|
-
|
11
|
-
# Precompile additional assets.
|
12
|
-
# application.js, application.css, and all non-JS/CSS in the app/assets
|
13
|
-
# folder are already added.
|
14
|
-
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Be sure to restart your server when you modify this file.
|
4
|
-
|
5
|
-
# Specify a serializer for the signed and encrypted cookie jars.
|
6
|
-
# Valid options are :json, :marshal, and :hybrid.
|
7
|
-
Rails.application.config.action_dispatch.cookies_serializer = :json
|
data/spec/dummy/config/puma.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Puma can serve each request in a thread from an internal thread pool.
|
4
|
-
# The `threads` method setting takes two numbers: a minimum and maximum.
|
5
|
-
# Any libraries that use thread pools should be configured to match
|
6
|
-
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
7
|
-
# and maximum; this matches the default thread size of Active Record.
|
8
|
-
#
|
9
|
-
max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5)
|
10
|
-
min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
|
11
|
-
threads min_threads_count, max_threads_count
|
12
|
-
|
13
|
-
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
14
|
-
#
|
15
|
-
port ENV.fetch('PORT', 3000)
|
16
|
-
|
17
|
-
# Specifies the `environment` that Puma will run in.
|
18
|
-
#
|
19
|
-
environment ENV.fetch('RAILS_ENV', 'development')
|
20
|
-
|
21
|
-
# Specifies the `pidfile` that Puma will use.
|
22
|
-
pidfile ENV.fetch('PIDFILE', 'tmp/pids/server.pid')
|
23
|
-
|
24
|
-
# Specifies the number of `workers` to boot in clustered mode.
|
25
|
-
# Workers are forked web server processes. If using threads and workers together
|
26
|
-
# the concurrency of the application would be max `threads` * `workers`.
|
27
|
-
# Workers do not work on JRuby or Windows (both of which do not support
|
28
|
-
# processes).
|
29
|
-
#
|
30
|
-
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
31
|
-
|
32
|
-
# Use the `preload_app!` method when specifying a `workers` number.
|
33
|
-
# This directive tells Puma to first boot the application and load code
|
34
|
-
# before forking the application. This takes advantage of Copy On Write
|
35
|
-
# process behavior so workers use less memory.
|
36
|
-
#
|
37
|
-
# preload_app!
|
38
|
-
|
39
|
-
# Allow puma to be restarted by `rails restart` command.
|
40
|
-
plugin :tmp_restart
|
data/spec/dummy/config/routes.rb
DELETED
data/spec/dummy/db/seeds.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
3
|
-
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
4
|
-
#
|
5
|
-
# Examples:
|
6
|
-
#
|
7
|
-
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
8
|
-
# Character.create(name: 'Luke', movie: movies.first)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'generators/lokalise_rails/install_generator'
|
4
|
-
|
5
|
-
describe LokaliseRails::Generators::InstallGenerator do
|
6
|
-
before do
|
7
|
-
remove_config
|
8
|
-
end
|
9
|
-
|
10
|
-
after do
|
11
|
-
remove_config
|
12
|
-
add_config!
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'installs config file properly' do
|
16
|
-
described_class.start
|
17
|
-
expect(File.file?(config_file)).to be true
|
18
|
-
end
|
19
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe LokaliseRails::GlobalConfig do
|
4
|
-
let(:child_config) { Class.new(described_class) }
|
5
|
-
|
6
|
-
it 'is possible to provide config options' do
|
7
|
-
described_class.config do |c|
|
8
|
-
expect(c).to eq(described_class)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'can be redefined' do
|
13
|
-
child_config.config do |c|
|
14
|
-
c.api_token = ENV['LOKALISE_API_TOKEN']
|
15
|
-
c.project_id = ENV['LOKALISE_PROJECT_ID']
|
16
|
-
|
17
|
-
c.branch = 'develop'
|
18
|
-
end
|
19
|
-
|
20
|
-
expect(child_config.branch).to eq('develop')
|
21
|
-
importer = LokaliseManager::TaskDefinitions::Importer.new({}, child_config)
|
22
|
-
expect(importer.config.branch).to eq('develop')
|
23
|
-
expect(importer.config.api_token).to eq(ENV['LOKALISE_API_TOKEN'])
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'parameters' do
|
27
|
-
let(:fake_class) { class_double(described_class) }
|
28
|
-
|
29
|
-
it 'is possible to set project_id' do
|
30
|
-
allow(fake_class).to receive(:project_id=).with('123.abc')
|
31
|
-
fake_class.project_id = '123.abc'
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'is possible to set file_ext_regexp' do
|
35
|
-
allow(fake_class).to receive(:file_ext_regexp=).with(Regexp.new('.*'))
|
36
|
-
fake_class.file_ext_regexp = Regexp.new('.*')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'is possible to set import_opts' do
|
40
|
-
allow(fake_class).to receive(:import_opts=).with(duck_type(:each))
|
41
|
-
fake_class.import_opts = {
|
42
|
-
format: 'json',
|
43
|
-
indentation: '8sp'
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'is possible to set export_opts' do
|
48
|
-
allow(fake_class).to receive(:export_opts=).with(duck_type(:each))
|
49
|
-
fake_class.export_opts = {
|
50
|
-
convert_placeholders: true,
|
51
|
-
detect_icu_plurals: true
|
52
|
-
}
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'is possible to set branch' do
|
56
|
-
allow(fake_class).to receive(:branch=).with('custom')
|
57
|
-
fake_class.branch = 'custom'
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'is possible to set timeouts' do
|
61
|
-
allow(fake_class).to receive(:timeouts=).with(duck_type(:each))
|
62
|
-
fake_class.timeouts = {
|
63
|
-
open_timeout: 100,
|
64
|
-
timeout: 500
|
65
|
-
}
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'is possible to set import_safe_mode' do
|
69
|
-
allow(fake_class).to receive(:import_safe_mode=).with(true)
|
70
|
-
fake_class.import_safe_mode = true
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'is possible to set max_retries_export' do
|
74
|
-
allow(fake_class).to receive(:max_retries_export=).with(10)
|
75
|
-
fake_class.max_retries_export = 10
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'is possible to set max_retries_import' do
|
79
|
-
allow(fake_class).to receive(:max_retries_import=).with(10)
|
80
|
-
fake_class.max_retries_import = 10
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'is possible to set api_token' do
|
84
|
-
allow(fake_class).to receive(:api_token=).with('abc')
|
85
|
-
fake_class.api_token = 'abc'
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'is possible to override locales_path' do
|
89
|
-
allow(fake_class).to receive(:locales_path=).with('/demo/path')
|
90
|
-
fake_class.locales_path = '/demo/path'
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'is possible to set skip_file_export' do
|
94
|
-
cond = ->(f) { f.nil? }
|
95
|
-
allow(fake_class).to receive(:skip_file_export=).with(cond)
|
96
|
-
fake_class.skip_file_export = cond
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'is possible to set translations_loader' do
|
100
|
-
runner = ->(f) { f.to_json }
|
101
|
-
allow(fake_class).to receive(:translations_loader=).with(runner)
|
102
|
-
fake_class.translations_loader = runner
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'is possible to set translations_converter' do
|
106
|
-
runner = ->(f) { f.to_json }
|
107
|
-
allow(fake_class).to receive(:translations_converter=).with(runner)
|
108
|
-
fake_class.translations_converter = runner
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'is possible to set lang_iso_inferer' do
|
112
|
-
runner = ->(f) { f.to_json }
|
113
|
-
allow(fake_class).to receive(:lang_iso_inferer=).with(runner)
|
114
|
-
fake_class.lang_iso_inferer = runner
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe 'Export Rake task' do
|
4
|
-
let(:global_config) { LokaliseRails::GlobalConfig }
|
5
|
-
|
6
|
-
it 'halts when the API key is not set' do
|
7
|
-
allow(global_config).to receive(:api_token).and_return(nil)
|
8
|
-
|
9
|
-
expect { Rake::Task['lokalise_rails:export'].execute }.to raise_error(SystemExit, /API token is not set/i)
|
10
|
-
expect(global_config).to have_received(:api_token)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'halts when the project ID is not set' do
|
14
|
-
allow(global_config).to receive(:project_id).and_return(nil)
|
15
|
-
|
16
|
-
expect { Rake::Task['lokalise_rails:export'].execute }.to raise_error(SystemExit, /ID is not set/i)
|
17
|
-
|
18
|
-
expect(global_config).to have_received(:project_id)
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'with two translation files' do
|
22
|
-
let(:filename_ru) { 'ru.yml' }
|
23
|
-
let(:path_ru) { "#{Rails.root}/config/locales/#{filename_ru}" }
|
24
|
-
|
25
|
-
before do
|
26
|
-
add_translation_files! with_ru: true
|
27
|
-
end
|
28
|
-
|
29
|
-
after do
|
30
|
-
rm_translation_files
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'export' do
|
34
|
-
it 'is callable' do
|
35
|
-
allow_project_id global_config, ENV['LOKALISE_PROJECT_ID'] do
|
36
|
-
VCR.use_cassette('upload_files') do
|
37
|
-
expect { Rake::Task['lokalise_rails:export'].execute }.to output(/complete!/).to_stdout
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
it 're-raises export errors' do
|
43
|
-
allow_project_id global_config, '542886116159f798720dc4.94769464' do
|
44
|
-
VCR.use_cassette('upload_files_error') do
|
45
|
-
expect { Rake::Task['lokalise_rails:export'].execute }.to raise_error(SystemExit, /Unknown `lang_iso`/)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe 'Import Rake task' do
|
4
|
-
let(:global_config) { LokaliseRails::GlobalConfig }
|
5
|
-
let(:loc_path) { global_config.locales_path }
|
6
|
-
|
7
|
-
it 'halts when the API key is not set' do
|
8
|
-
allow(global_config).to receive(:api_token).and_return(nil)
|
9
|
-
|
10
|
-
expect { Rake::Task['lokalise_rails:import'].execute }.to raise_error(SystemExit, /API token is not set/i)
|
11
|
-
expect(global_config).to have_received(:api_token)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'halts when the project ID is not set' do
|
15
|
-
allow(global_config).to receive(:project_id).and_return(nil)
|
16
|
-
|
17
|
-
expect { Rake::Task['lokalise_rails:import'].execute }.to raise_error(SystemExit, /ID is not set/i)
|
18
|
-
|
19
|
-
expect(global_config).to have_received(:project_id)
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'when directory is empty' do
|
23
|
-
before do
|
24
|
-
mkdir_locales
|
25
|
-
rm_translation_files
|
26
|
-
end
|
27
|
-
|
28
|
-
after do
|
29
|
-
rm_translation_files
|
30
|
-
end
|
31
|
-
|
32
|
-
describe 'import' do
|
33
|
-
it 'is callable' do
|
34
|
-
allow_project_id global_config, ENV['LOKALISE_PROJECT_ID'] do
|
35
|
-
VCR.use_cassette('download_files') do
|
36
|
-
expect { Rake::Task['lokalise_rails:import'].execute }.to output(/complete!/).to_stdout
|
37
|
-
end
|
38
|
-
|
39
|
-
expect(count_translations).to eq(4)
|
40
|
-
|
41
|
-
expect_file_exist loc_path, 'en.yml'
|
42
|
-
expect_file_exist loc_path, 'ru.yml'
|
43
|
-
expect_file_exist loc_path, 'yo.yml'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
it 're-raises export errors' do
|
48
|
-
allow_project_id global_config, 'fake' do
|
49
|
-
VCR.use_cassette('download_files_error') do
|
50
|
-
expect do
|
51
|
-
Rake::Task['lokalise_rails:import'].execute
|
52
|
-
end.to raise_error(SystemExit, /Invalid `project_id` parameter/)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
data/spec/lib/utils_spec.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe LokaliseRails::Utils do
|
4
|
-
describe '.rails_root' do
|
5
|
-
it 'returns RAILS_ROOT if defined' do
|
6
|
-
allow(::Rails).to receive(:root).and_return(nil)
|
7
|
-
stub_const('RAILS_ROOT', '/stub')
|
8
|
-
expect(described_class.rails_root).to eq('/stub')
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'fallbacks if neither roots are present' do
|
12
|
-
allow(::Rails).to receive(:root).and_return(nil)
|
13
|
-
expect(described_class.rails_root).to be_nil
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'dotenv/load'
|
4
|
-
require 'simplecov'
|
5
|
-
|
6
|
-
SimpleCov.start 'rails' do
|
7
|
-
add_filter 'spec/'
|
8
|
-
add_filter '.github/'
|
9
|
-
add_filter 'lib/generators/templates/'
|
10
|
-
end
|
11
|
-
|
12
|
-
if ENV['CI'] == 'true'
|
13
|
-
require 'codecov'
|
14
|
-
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
15
|
-
end
|
16
|
-
|
17
|
-
# Support files
|
18
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
|
19
|
-
|
20
|
-
# Configure Rails Environment
|
21
|
-
ENV['RAILS_ENV'] = 'test'
|
22
|
-
require_relative '../spec/dummy/config/environment'
|
23
|
-
ENV['RAILS_ROOT'] ||= "#{File.dirname(__FILE__)}../../../spec/dummy"
|
24
|
-
|
25
|
-
RSpec.configure do |config|
|
26
|
-
config.include FileManager
|
27
|
-
config.include SpecAddons
|
28
|
-
end
|
29
|
-
|
30
|
-
# rubocop:disable Style/MixinUsage
|
31
|
-
include FileManager
|
32
|
-
# rubocop:enable Style/MixinUsage
|
33
|
-
|
34
|
-
add_config!
|
35
|
-
Rails.application.load_tasks
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module FileManager
|
6
|
-
def mkdir_locales
|
7
|
-
return if File.directory?(LokaliseRails::GlobalConfig.locales_path)
|
8
|
-
|
9
|
-
FileUtils.mkdir_p(LokaliseRails::GlobalConfig.locales_path)
|
10
|
-
end
|
11
|
-
|
12
|
-
def rm_translation_files
|
13
|
-
FileUtils.rm_rf locales_dir
|
14
|
-
end
|
15
|
-
|
16
|
-
def locales_dir
|
17
|
-
Dir["#{LokaliseRails::GlobalConfig.locales_path}/**/*"]
|
18
|
-
end
|
19
|
-
|
20
|
-
def count_translations
|
21
|
-
locales_dir.count { |file| File.file?(file) }
|
22
|
-
end
|
23
|
-
|
24
|
-
def add_translation_files!(with_ru: false, additional: nil)
|
25
|
-
FileUtils.mkdir_p "#{Rails.root}/config/locales/nested"
|
26
|
-
open_and_write('config/locales/nested/en.yml') { |f| f.write en_data }
|
27
|
-
|
28
|
-
return unless with_ru
|
29
|
-
|
30
|
-
open_and_write('config/locales/ru.yml') { |f| f.write ru_data }
|
31
|
-
|
32
|
-
return unless additional
|
33
|
-
|
34
|
-
additional.times do |i|
|
35
|
-
data = {'en' => {"key_#{i}" => "value #{i}"}}
|
36
|
-
|
37
|
-
open_and_write("config/locales/en_#{i}.yml") { |f| f.write data.to_yaml }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def add_config!(custom_text = '')
|
42
|
-
data = <<~DATA
|
43
|
-
LokaliseRails::GlobalConfig.config do |c|
|
44
|
-
c.api_token = ENV['LOKALISE_API_TOKEN']
|
45
|
-
c.project_id = ENV['LOKALISE_PROJECT_ID']
|
46
|
-
DATA
|
47
|
-
|
48
|
-
data += custom_text
|
49
|
-
data += "\nend"
|
50
|
-
open_and_write('config/lokalise_rails.rb') { |f| f.write data }
|
51
|
-
end
|
52
|
-
|
53
|
-
def open_and_write(rel_path, &block)
|
54
|
-
return unless block
|
55
|
-
|
56
|
-
File.open("#{Rails.root}/#{rel_path}", 'w+:UTF-8', &block)
|
57
|
-
end
|
58
|
-
|
59
|
-
def remove_config
|
60
|
-
FileUtils.remove_file config_file if File.file?(config_file)
|
61
|
-
end
|
62
|
-
|
63
|
-
def config_file
|
64
|
-
"#{Rails.root}/config/lokalise_rails.rb"
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
def en_data
|
70
|
-
<<~DATA
|
71
|
-
en:
|
72
|
-
my_key: "My value"
|
73
|
-
nested:
|
74
|
-
key: "Value 2"
|
75
|
-
DATA
|
76
|
-
end
|
77
|
-
|
78
|
-
def ru_data
|
79
|
-
<<~DATA
|
80
|
-
ru_RU:
|
81
|
-
my_key: "Моё значение"
|
82
|
-
nested:
|
83
|
-
key: "Значение 2"
|
84
|
-
DATA
|
85
|
-
end
|
86
|
-
end
|
data/spec/support/spec_addons.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SpecAddons
|
4
|
-
def expect_file_exist(path, file)
|
5
|
-
file_path = File.join path, file
|
6
|
-
expect(File.file?(file_path)).to be true
|
7
|
-
end
|
8
|
-
|
9
|
-
def allow_project_id(obj, value)
|
10
|
-
allow(obj).to receive(:project_id).and_return(value)
|
11
|
-
return unless block_given?
|
12
|
-
|
13
|
-
yield
|
14
|
-
expect(obj).to have_received(:project_id)
|
15
|
-
end
|
16
|
-
end
|
data/spec/support/vcr.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'vcr'
|
4
|
-
|
5
|
-
VCR.configure do |c|
|
6
|
-
c.ignore_hosts 'codeclimate.com'
|
7
|
-
c.hook_into :faraday
|
8
|
-
c.cassette_library_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'vcr_cassettes')
|
9
|
-
c.filter_sensitive_data('<LOKALISE_TOKEN>') { ENV.fetch('LOKALISE_API_TOKEN') }
|
10
|
-
c.configure_rspec_metadata!
|
11
|
-
end
|