lokalise_rails 0.0.2.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'lokalise_rails'
4
-
5
- # These are mandatory options that you must set before running rake tasks:
6
- LokaliseRails.api_token = ENV['LOKALISE_API_TOKEN']
7
- LokaliseRails.project_id = ENV['LOKALISE_PROJECT_ID']
8
-
9
- # Import options have the following defaults:
10
- # LokaliseRails.import_opts = {
11
- # format: 'yaml',
12
- # placeholder_format: :icu,
13
- # yaml_include_root: true,
14
- # original_filenames: true,
15
- # directory_prefix: '',
16
- # indentation: '2sp'
17
- # }
18
-
19
- # Safe mode is disabled by default:
20
- # LokaliseRails.import_safe_mode = false
21
-
22
- # Provide a custom path to the directory with your translation files:
23
- # class LokaliseRails
24
- # class << self
25
- # def locales_path
26
- # "#{Rails.root}/config/locales"
27
- # end
28
- # end
29
- # end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe LokaliseRails::TaskDefinition::Importer do
4
- describe '.download_files' do
5
- it 'returns a proper download URL' do
6
- response = VCR.use_cassette('download_files') do
7
- described_class.download_files
8
- end
9
-
10
- expect(response['project_id']).to eq('189934715f57a162257d74.88352370')
11
- expect(response['bundle_url']).to include('s3-eu-west-1.amazonaws.com')
12
- end
13
- end
14
-
15
- describe '.import!' do
16
- it 'halts when the API key is not set' do
17
- expect(LokaliseRails).to receive(:api_token).and_return(nil)
18
- result = described_class.import!
19
- expect(result).to include('API token is not set')
20
- expect(count_translations).to eq(0)
21
- end
22
-
23
- it 'halts when the project_id is not set' do
24
- expect(LokaliseRails).to receive(:project_id).and_return(nil)
25
- result = described_class.import!
26
- expect(result).to include('Project ID is not set')
27
- expect(count_translations).to eq(0)
28
- end
29
- end
30
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module FileUtils
4
- def mkdir_locales
5
- FileUtils.mkdir_p(LokaliseRails.locales_path) unless File.directory?(LokaliseRails.locales_path)
6
- end
7
-
8
- def rm_translation_files
9
- FileUtils.rm_rf locales_dir
10
- end
11
-
12
- def locales_dir
13
- Dir["#{LokaliseRails.locales_path}/*"]
14
- end
15
-
16
- def count_translations
17
- locales_dir.count { |file| File.file?(file) }
18
- end
19
-
20
- def remove_config
21
- FileUtils.remove_file config_file if File.file?(config_file)
22
- end
23
-
24
- def config_file
25
- "#{Rails.root}/config/initializers/lokalise_rails.rb"
26
- end
27
- end