web_translate_it 2.3.3 → 2.3.4

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
  SHA1:
3
- metadata.gz: 36c98373d97df56859652e3f1d5ba04bb386810d
4
- data.tar.gz: 75769ac8c90e6f6f9a5aa5c4c801e4f6d430e944
3
+ metadata.gz: f110c5129a30e8130fd658a1f3c743baac52a893
4
+ data.tar.gz: 21dc480ee25d20e4cab9a304ba552296438ec080
5
5
  SHA512:
6
- metadata.gz: 94ab9805f7ffa30090f15b72e989b203683ace67711611158f2645a7033f441d83bd5b85c34176dcb357026f79a1693506aae20eb3b5c4776922399258ac68c3
7
- data.tar.gz: 360e96fceb853641ba4cd4200c1121dc2f4aad2847910fa2d4340c0c24c27ca35027a961b5975249ba05e6f5a5331add69aa5a9e45078a3ed005c713ac99eb7f
6
+ metadata.gz: c646530ef9792216c95ec1d7b1a067339ac88bb0df60a54e0c77ff8f28173870ea2b94b83c69f7571b610d761a53bb23ee462e3bff4d506a0a6607e9c5210606
7
+ data.tar.gz: 40f7ea3fa226a9e0fd5d67886f30d871b03f513a20d5c097a7f6725252f3b97b4b6ac930012b9c681dd996cbdcaa51798c9297a877a22c252f8a06477d09d656
data/bin/wti CHANGED
@@ -43,6 +43,7 @@ EOS
43
43
  opt :all, "Pull all files"
44
44
  opt :force, "Force pull (bypass conditional requests to WTI)"
45
45
  opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
46
+ opt :debug, "Display debug information"
46
47
  end
47
48
  when "push"
48
49
  Trollop::options do
@@ -60,42 +61,50 @@ EOS
60
61
  opt :label, "Apply a label to the changes", :type => :string
61
62
  opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
62
63
  opt :all, "DEPRECATED -- See `wti push --target` instead"
64
+ opt :debug, "Display debug information"
63
65
  end
64
66
  when "add"
65
67
  Trollop::options do
66
68
  banner "wti add filename - Create and push a new master language file"
67
69
  opt :low_priority, "WTI will process this file with a low priority"
68
70
  opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
71
+ opt :debug, "Display debug information"
69
72
  end
70
73
  when "rm"
71
74
  Trollop::options do
72
75
  banner "wti rm filename - Delete a master language file"
73
76
  opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
77
+ opt :debug, "Display debug information"
74
78
  end
75
79
  when "addlocale"
76
80
  Trollop::options do
77
81
  banner "wti addlocale localename - Add a new locale to the project"
78
82
  opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
83
+ opt :debug, "Display debug information"
79
84
  end
80
85
  when "rmlocale"
81
86
  Trollop::options do
82
87
  banner "wti rmlocale localename Delete a locale from the project"
83
88
  opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
89
+ opt :debug, "Display debug information"
84
90
  end
85
91
  when "status"
86
92
  Trollop::options do
87
93
  banner "wti status - Fetch and display project statistics"
88
94
  opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
95
+ opt :debug, "Display debug information"
89
96
  end
90
97
  when "init"
91
98
  Trollop::options do
92
99
  banner "wti init [api_token] - Configure your project to sync"
93
100
  opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
101
+ opt :debug, "Display debug information"
94
102
  end
95
103
  when "match"
96
104
  Trollop::options do
97
105
  banner "wti match - Display matching of local files with File Manager"
98
106
  opt :config, "Path to a configuration file", :short => "-c", :default => ".wti"
107
+ opt :debug, "Display debug information"
99
108
  end
100
109
  else
101
110
  if command.nil?
@@ -107,6 +116,7 @@ EOS
107
116
  end
108
117
 
109
118
  begin
119
+ WebTranslateIt::Connection.turn_debug_on if command_options.debug
110
120
  WebTranslateIt::CommandLine.new(command, command_options, global_options, ARGV, File.expand_path("."))
111
121
  rescue Interrupt => e
112
122
  puts StringUtil.failure("\nQuitting...")
data/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 2.3.4 / 2014-05-23
2
+
3
+ * Add `--debug` option to turn on debug output.
4
+
1
5
  ## Version 2.3.3 / 2014-05-22
2
6
 
3
7
  * Use longer timeout.
@@ -9,6 +9,7 @@ module WebTranslateIt
9
9
 
10
10
  @@api_key = nil
11
11
  @@http_connection = nil
12
+ @@debug = false
12
13
 
13
14
  #
14
15
  # Initialize and yield a HTTPS Keep-Alive connection to WebTranslateIt.com
@@ -31,6 +32,7 @@ module WebTranslateIt
31
32
  http = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password).new('webtranslateit.com', 443)
32
33
  http.use_ssl = true
33
34
  http.open_timeout = http.read_timeout = 60
35
+ http.set_debug_output($stderr) if @@debug
34
36
  begin
35
37
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
36
38
  if File.exists?('/etc/ssl/certs') # Ubuntu
@@ -43,17 +45,24 @@ module WebTranslateIt
43
45
  rescue OpenSSL::SSL::SSLError
44
46
  puts "Unable to verify SSL certificate."
45
47
  http = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password).new('webtranslateit.com', 443)
48
+ http.set_debug_output($stderr) if @@debug
46
49
  http.use_ssl = true
47
50
  http.open_timeout = http.read_timeout = 60
48
51
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
49
52
  @@http_connection = http.start
50
53
  yield @@http_connection if block_given?
54
+ rescue
55
+ puts $!
51
56
  end
52
57
  end
53
58
 
54
59
  def self.http_connection
55
60
  @@http_connection
56
61
  end
62
+
63
+ def self.turn_debug_on
64
+ @@debug = true
65
+ end
57
66
 
58
67
  def self.api_key
59
68
  @@api_key
@@ -21,6 +21,8 @@ module WebTranslateIt
21
21
  puts "The request timed out. The service may be overloaded. We will retry in 5 seconds."
22
22
  sleep(5)
23
23
  retry
24
+ rescue
25
+ puts $!.inspect
24
26
  end
25
27
  end
26
28
 
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: 2.3.3
4
+ version: 2.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Briere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-22 00:00:00.000000000 Z
11
+ date: 2014-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post