web_translate_it 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9969f7e37be94cde92709918318f0ad3b86a68995a8ce1ad7c9fdc2892e85ef
|
4
|
+
data.tar.gz: 042af09e341242b03091379e767e0fef9fe72c45c8f0fd45f4564b1e1df9fd86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 633f0b4209397ee69babe0474ae675de9b2302092c8cf92f63df49b72e468802958be8b0486cc0810baeebfe2c461bd535f117d3b9e247ef7ea5f5c6704edd12
|
7
|
+
data.tar.gz: f959c59f956a59dd2fc0fcf33d53646f620350ce130584449ae8c9f8b0fd337a460d0329a1651812a06e8b995ecb1d8a9ca5b37a9e008329c1d555d9bb7b14c6
|
data/history.md
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_translate_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edouard Briere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -49,8 +49,6 @@ extra_rdoc_files:
|
|
49
49
|
files:
|
50
50
|
- bin/wti
|
51
51
|
- examples/locale.rb
|
52
|
-
- generators/webtranslateit/lib/insert_commands.rb
|
53
|
-
- generators/webtranslateit/webtranslateit_generator.rb
|
54
52
|
- history.md
|
55
53
|
- lib/web_translate_it.rb
|
56
54
|
- lib/web_translate_it/auto_fetch.rb
|
@@ -99,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
97
|
- !ruby/object:Gem::Version
|
100
98
|
version: '0'
|
101
99
|
requirements: []
|
102
|
-
rubygems_version: 3.5.
|
100
|
+
rubygems_version: 3.5.20
|
103
101
|
signing_key:
|
104
102
|
specification_version: 4
|
105
103
|
summary: A CLI tool to sync locale files with WebTranslateIt.com.
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master
|
4
|
-
|
5
|
-
Rails::Generator::Commands::Base.class_eval do
|
6
|
-
def file_contains?(relative_destination, line)
|
7
|
-
File.read(destination_path(relative_destination)).include?(line)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
Rails::Generator::Commands::Create.class_eval do
|
12
|
-
def append_to(file, line)
|
13
|
-
logger.insert "#{line} appended to #{file}"
|
14
|
-
return if options[:pretend] || file_contains?(file, line)
|
15
|
-
|
16
|
-
File.open(file, 'a') do |f|
|
17
|
-
f.puts
|
18
|
-
f.puts line
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Rails::Generator::Commands::Destroy.class_eval do
|
24
|
-
def append_to(file, line)
|
25
|
-
logger.remove "#{line} removed from #{file}"
|
26
|
-
gsub_file file, "\n#{line}", '' unless options[:pretend]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
Rails::Generator::Commands::List.class_eval do
|
31
|
-
def append_to(file, line)
|
32
|
-
logger.insert "#{line} appended to #{file}"
|
33
|
-
end
|
34
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require File.expand_path("#{File.dirname(__FILE__)}/lib/insert_commands.rb")
|
4
|
-
|
5
|
-
class WebtranslateitGenerator < Rails::Generator::Base
|
6
|
-
|
7
|
-
def add_options!(opt)
|
8
|
-
opt.on('-k', '--api-key=key', String, 'Your Web Translate It API key') { |v| options[:api_key] = v }
|
9
|
-
end
|
10
|
-
|
11
|
-
def manifest # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
|
12
|
-
if !api_key_configured? && !options[:api_key]
|
13
|
-
puts 'You must pass --api-key or create config/translations.yml'
|
14
|
-
exit
|
15
|
-
end
|
16
|
-
record do |m|
|
17
|
-
if options[:api_key]
|
18
|
-
project_details = YAML.safe_load WebTranslateIt::Project.fetch_info(options[:api_key])
|
19
|
-
m.template '.wti', '.wti',
|
20
|
-
assigns: {api_key: options[:api_key], project: project_details['project']}
|
21
|
-
m.append_to 'Rakefile', "require 'web_translate_it' rescue LoadError"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def api_key_configured?
|
27
|
-
File.exist?('config/translations.yml')
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|