web_translate_it 1.7.0.6 → 1.7.0.7.pre

Sign up to get free protection for your applications and to get access to all the features.
data/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 1.7.0.7.pre / 2010-10-12
2
+
3
+ * Fix so wti can connect through a proxy.
4
+
1
5
  ## Version 1.7.0.6 / 2010-09-23
2
6
 
3
7
  * Makes `wti server` load much faster for projects having a lot of files.
@@ -1,5 +1,9 @@
1
1
  # encoding: utf-8
2
2
  module WebTranslateIt
3
+ require 'net/http'
4
+ require 'net/https'
5
+ require 'uri'
6
+
3
7
  # A few useful functions
4
8
  class Util
5
9
 
@@ -19,14 +23,26 @@ module WebTranslateIt
19
23
  # response = http.request(request)
20
24
  # end
21
25
  #
26
+ # This method will try to connect through a proxy if `http_proxy` is set.
27
+ #
22
28
  def self.http_connection
23
- http = Net::HTTP.new('webtranslateit.com', 443)
29
+ proxy = Util.get_proxy
30
+ if proxy
31
+ http = Net::HTTP::Proxy(proxy.host, proxy.port).new('webtranslateit.com', 443)
32
+ else
33
+ http = Net::HTTP.new('webtranslateit.com', 443)
34
+ end
24
35
  http.use_ssl = true
25
36
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
26
- http.read_timeout = 20
37
+ http.open_timeout = http.read_timeout = 20
27
38
  yield http
28
39
  end
29
40
 
41
+ def self.get_proxy
42
+ http_proxy = ENV["http_proxy"]
43
+ URI.parse(http_proxy) rescue nil
44
+ end
45
+
30
46
  def self.calculate_percentage(processed, total)
31
47
  return 0 if total == 0
32
48
  ((processed*10)/total).to_f.ceil*10
data/version.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 1
3
3
  :minor: 7
4
4
  :tiny: 0
5
- :patch: 6
5
+ :patch: 7.pre
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
- hash: 107
5
- prerelease: false
4
+ hash: 961916152
5
+ prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
9
  - 0
10
- - 6
11
- version: 1.7.0.6
10
+ - 7
11
+ - pre
12
+ version: 1.7.0.7.pre
12
13
  platform: ruby
13
14
  authors:
14
15
  - "\xC3\x89douard Bri\xC3\xA8re"
@@ -16,7 +17,7 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-08-23 00:00:00 +02:00
20
+ date: 2010-10-12 00:00:00 +02:00
20
21
  default_executable: wti
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
@@ -145,12 +146,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
146
  required_rubygems_version: !ruby/object:Gem::Requirement
146
147
  none: false
147
148
  requirements:
148
- - - ">="
149
+ - - ">"
149
150
  - !ruby/object:Gem::Version
150
- hash: 3
151
+ hash: 25
151
152
  segments:
152
- - 0
153
- version: "0"
153
+ - 1
154
+ - 3
155
+ - 1
156
+ version: 1.3.1
154
157
  requirements: []
155
158
 
156
159
  rubyforge_project: