web_translate_it 1.9.3 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/history.md CHANGED
@@ -1,8 +1,11 @@
1
+ ## Version 1.9.4 / 2012-01-10
2
+
3
+ * Bug fix: Prevent `wti` from crashing when pulling from a project having no files.
4
+
1
5
  ## Version 1.9.3 / 2011-12-21
2
6
 
3
7
  * Bug fix: the round(1) used in performance statistics wasn’t compatible with ruby < 1.9.
4
8
 
5
-
6
9
  ## Version 1.9.2 / 2011-12-21
7
10
 
8
11
  * Gem now includes library to connect to [String](http://docs.webtranslateit.com/api/string/) and [Translation](http://docs.webtranslateit.com/api/translation/) APIs, see #74 and #78. (@bray).
@@ -23,26 +23,30 @@ module WebTranslateIt
23
23
  fetch_locales_to_pull.each do |locale|
24
24
  files.concat configuration.files.find_all{ |file| file.locale == locale }
25
25
  end
26
- # Now actually pulling files
27
- time = Time.now
28
- threads = []
29
- n_threads = (files.count.to_f/3).ceil >= 20 ? 20 : (files.count.to_f/3).ceil
30
- puts "Using up to #{n_threads} threads"
31
- ArrayUtil.chunk(files, n_threads).each do |file_array|
32
- unless file_array.empty?
33
- threads << Thread.new(file_array) do |file_array|
34
- WebTranslateIt::Util.http_connection do |http|
35
- file_array.each do |file|
36
- file.fetch(http, command_options.force)
26
+ if files.count == 0
27
+ puts "No files to pull."
28
+ else
29
+ # Now actually pulling files
30
+ time = Time.now
31
+ threads = []
32
+ n_threads = (files.count.to_f/3).ceil >= 20 ? 20 : (files.count.to_f/3).ceil
33
+ puts "Using up to #{n_threads} threads"
34
+ ArrayUtil.chunk(files, n_threads).each do |file_array|
35
+ unless file_array.empty?
36
+ threads << Thread.new(file_array) do |file_array|
37
+ WebTranslateIt::Util.http_connection do |http|
38
+ file_array.each do |file|
39
+ file.fetch(http, command_options.force)
40
+ end
37
41
  end
38
42
  end
39
43
  end
40
44
  end
45
+ threads.each { |thread| thread.join }
46
+ time = Time.now - time
47
+ puts "Pulled #{files.count} files at #{(files.count/time).round} files/sec."
48
+ `#{configuration.after_pull}` if configuration.after_pull
41
49
  end
42
- threads.each { |thread| thread.join }
43
- time = Time.now - time
44
- puts "Pulled #{files.count} files at #{(files.count/time).round} files/sec."
45
- `#{configuration.after_pull}` if configuration.after_pull
46
50
  end
47
51
 
48
52
  def push
data/readme.md CHANGED
@@ -167,4 +167,4 @@ This feature was extracted out to a separate gem. See [web_translate_it_server](
167
167
 
168
168
  # License
169
169
 
170
- Copyright (c) 2009-2011 Atelier Convivialité, released under the MIT License.
170
+ Copyright (c) 2009-2012 Atelier Convivialité, released under the MIT License.
data/version.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  :major: 1
2
2
  :minor: 9
3
- :patch: 3
3
+ :patch: 4
4
4
 
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.9.3
4
+ version: 1.9.4
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: 2011-12-21 00:00:00.000000000 Z
12
+ date: 2012-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multipart-post
16
- requirement: &70339772597520 !ruby/object:Gem::Requirement
16
+ requirement: &70272624123660 !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: *70339772597520
24
+ version_requirements: *70272624123660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: trollop
27
- requirement: &70339772597020 !ruby/object:Gem::Requirement
27
+ requirement: &70272624123040 !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: *70339772597020
35
+ version_requirements: *70272624123040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70339772596560 !ruby/object:Gem::Requirement
38
+ requirement: &70272624122420 !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: *70339772596560
46
+ version_requirements: *70272624122420
47
47
  description:
48
48
  email: edouard@atelierconvivialite.com
49
49
  executables:
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 1.8.11
109
+ rubygems_version: 1.8.10
110
110
  signing_key:
111
111
  specification_version: 3
112
112
  summary: A CLI to sync locale files with webtranslateit.com.