web_translate_it 1.9.6 → 1.10.0
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.
- data/bin/wti +2 -1
- data/history.md +5 -0
- data/lib/web_translate_it/command_line.rb +1 -1
- data/lib/web_translate_it/translation_file.rb +16 -12
- data/version.yml +2 -2
- metadata +8 -8
data/bin/wti
CHANGED
@@ -53,6 +53,7 @@ Push master language file(s)
|
|
53
53
|
EOS
|
54
54
|
opt :locale, "ISO code of locale(s) to push", :type => :string
|
55
55
|
opt :all, "Upload all files"
|
56
|
+
opt :force, "Force push (bypass conditional requests to WTI)"
|
56
57
|
opt :low_priority, "WTI will process this file with a low priority"
|
57
58
|
opt :merge, "Force WTI to merge this file"
|
58
59
|
opt :ignore_missing, "Force WTI to not obsolete missing strings"
|
@@ -122,4 +123,4 @@ rescue Interrupt => e
|
|
122
123
|
puts StringUtil.failure("\nQuitting...")
|
123
124
|
exit 1
|
124
125
|
end
|
125
|
-
|
126
|
+
|
data/history.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## Version 1.10.0 / 2012-03-07
|
2
|
+
|
3
|
+
* New: `wti push` only push local files having a different checksum than the ones on WTI server.
|
4
|
+
* New: `wti push --force` lets you force push files.
|
5
|
+
|
1
6
|
## Version 1.9.6 / 2012-03-01
|
2
7
|
|
3
8
|
* Support for new `minor_changes` flag on File API. Use with `wti push --minor`.
|
@@ -56,7 +56,7 @@ module WebTranslateIt
|
|
56
56
|
WebTranslateIt::Util.http_connection do |http|
|
57
57
|
fetch_locales_to_push(configuration).each do |locale|
|
58
58
|
configuration.files.find_all{ |file| file.locale == locale }.sort{|a,b| a.file_path <=> b.file_path} .each do |file|
|
59
|
-
file.upload(http, command_options[:merge], command_options.ignore_missing, command_options.label, command_options.low_priority, command_options[:minor])
|
59
|
+
file.upload(http, command_options[:merge], command_options.ignore_missing, command_options.label, command_options.low_priority, command_options[:minor], command_options.force)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -75,24 +75,28 @@ module WebTranslateIt
|
|
75
75
|
#
|
76
76
|
# Note that the request might or might not eventually be acted upon, as it might be disallowed when processing
|
77
77
|
# actually takes place. This is due to the fact that language file imports are handled by background processing.
|
78
|
-
def upload(http_connection, merge=false, ignore_missing=false, label=nil, low_priority=false, minor_changes=false)
|
78
|
+
def upload(http_connection, merge=false, ignore_missing=false, label=nil, low_priority=false, minor_changes=false, force=false)
|
79
79
|
display = []
|
80
80
|
display.push(self.file_path)
|
81
81
|
display.push "#{StringUtil.checksumify(self.local_checksum.to_s)}..#{StringUtil.checksumify(self.remote_checksum.to_s)}"
|
82
82
|
if File.exists?(self.file_path)
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
83
|
+
if force or self.remote_checksum != self.local_checksum
|
84
|
+
File.open(self.file_path) do |file|
|
85
|
+
begin
|
86
|
+
request = Net::HTTP::Put::Multipart.new(api_url, {"file" => UploadIO.new(file, "text/plain", file.path), "merge" => merge, "ignore_missing" => ignore_missing, "label" => label, "low_priority" => low_priority, "minor_changes" => minor_changes })
|
87
|
+
request.add_field("X-Client-Name", "web_translate_it")
|
88
|
+
request.add_field("X-Client-Version", WebTranslateIt::Util.version)
|
89
|
+
display.push Util.handle_response(http_connection.request(request))
|
90
|
+
rescue Timeout::Error
|
91
|
+
puts StringUtil.failure("Request timeout. Will retry in 5 seconds.")
|
92
|
+
sleep(5)
|
93
|
+
retry
|
94
|
+
end
|
94
95
|
end
|
96
|
+
else
|
97
|
+
display.push StringUtil.success("Skipped")
|
95
98
|
end
|
99
|
+
puts ArrayUtil.to_columns(display)
|
96
100
|
else
|
97
101
|
puts StringUtil.failure("Can't push #{self.file_path}. File doesn't exist.")
|
98
102
|
end
|
data/version.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_translate_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multipart-post
|
16
|
-
requirement: &
|
16
|
+
requirement: &70226362190540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.1.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70226362190540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: trollop
|
27
|
-
requirement: &
|
27
|
+
requirement: &70226362189940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.16.2
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70226362189940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70226362189380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 2.6.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70226362189380
|
47
47
|
description:
|
48
48
|
email: edouard@atelierconvivialite.com
|
49
49
|
executables:
|