localeapp 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -2,6 +2,8 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
+ - jruby-18mode
6
+ - jruby-19mode
5
7
  gemfile:
6
8
  - Gemfile.i18n_037
7
9
  - Gemfile.i18n_050
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # Version 0.5.1
2
+
3
+ * Fix bug with encoding of response from http_client
4
+ * Test on Jruby
5
+ * Compatibility with gli 2.0.0
6
+
1
7
  # Version 0.5.0
2
8
 
3
9
  * Post translations with default values
data/Gemfile CHANGED
@@ -1,2 +1,6 @@
1
1
  source :rubyforge
2
2
  gemspec
3
+
4
+ platform :jruby do
5
+ gem 'jruby-openssl'
6
+ end
data/Gemfile.i18n_037 CHANGED
@@ -3,3 +3,7 @@ gemspec
3
3
 
4
4
  gem 'i18n', '0.3.7'
5
5
  gem 'activesupport', '2.3.14'
6
+
7
+ platform :jruby do
8
+ gem 'jruby-openssl'
9
+ end
data/Gemfile.i18n_050 CHANGED
@@ -2,3 +2,7 @@ source :rubyforge
2
2
  gemspec
3
3
 
4
4
  gem 'i18n', '0.5.0'
5
+
6
+ platform :jruby do
7
+ gem 'jruby-openssl'
8
+ end
data/Gemfile.i18n_060 CHANGED
@@ -2,3 +2,7 @@ source :rubyforge
2
2
  gemspec
3
3
 
4
4
  gem 'i18n', '~> 0.6.0'
5
+
6
+ platform :jruby do
7
+ gem 'jruby-openssl'
8
+ end
data/README.md CHANGED
@@ -191,4 +191,4 @@ See [this article on Ruby Inside][1] for some more details.
191
191
  ### Support and feedback
192
192
 
193
193
  You can contact us via the support link at the bottom of the page or emailing
194
- info@localeapp.com
194
+ support@localeapp.com
data/bin/localeapp CHANGED
@@ -22,7 +22,13 @@ def initialize_config
22
22
  end
23
23
 
24
24
  require 'gli'
25
- include GLI
25
+ gli2 = GLI::VERSION >= '2.0.0'
26
+
27
+ if gli2
28
+ include GLI::App
29
+ else
30
+ include GLI
31
+ end
26
32
 
27
33
  version Localeapp::VERSION
28
34
 
@@ -142,4 +148,8 @@ command :daemon do |c|
142
148
  end
143
149
  end
144
150
 
145
- exit GLI.run(ARGV)
151
+ if gli2
152
+ exit run(ARGV)
153
+ else
154
+ exit GLI.run(ARGV)
155
+ end
@@ -5,7 +5,7 @@ Feature: localeapp executable
5
5
  When I run `localeapp help`
6
6
  Then the output should contain:
7
7
  """
8
- usage: localeapp [global options] command [command options]
8
+ localeapp [global options] command [command options]
9
9
  """
10
10
 
11
11
  Scenario: Running a command that doesn't exist
@@ -13,7 +13,7 @@ Feature: localeapp executable
13
13
  When I run `localeapp foo`
14
14
  Then the output should contain:
15
15
  """
16
- error: Unknown command 'foo'. Use 'localeapp help' for a list of commands
16
+ error: Unknown command 'foo'
17
17
  """
18
18
 
19
19
  Scenario: Running Rails install
@@ -1,4 +1,4 @@
1
1
  Before do
2
2
  ENV['FAKE_WEB_DURING_CUCUMBER_RUN'] = '1'
3
- @aruba_timeout_seconds = 5
3
+ @aruba_timeout_seconds = 15
4
4
  end
data/lib/localeapp.rb CHANGED
@@ -125,8 +125,16 @@ module Localeapp
125
125
 
126
126
  private
127
127
 
128
+ def private_null_type(results)
129
+ return true if results.is_a?(YAML::PrivateType) && results.type_id == 'null'
130
+ if RUBY_PLATFORM == 'java'
131
+ return true if results.is_a?(YAML::Yecht::PrivateType) && results.type_id == 'null'
132
+ end
133
+ false
134
+ end
135
+
128
136
  def normalize_results(results)
129
- if results.is_a?(YAML::PrivateType) && results.type_id == 'null'
137
+ if private_null_type(results)
130
138
  nil
131
139
  elsif results.is_a?(Array)
132
140
  results.each_with_index do |value, i|
@@ -24,8 +24,12 @@ module Localeapp
24
24
  success = false
25
25
  while connection_attempts < max_connection_attempts
26
26
  sleep_if_retrying
27
+
27
28
  response = make_call(method, url)
28
29
  Localeapp.debug("RESPONSE: #{response.code}")
30
+
31
+ fix_encoding(response)
32
+
29
33
  valid_response_codes = (200..207).to_a
30
34
  if valid_response_codes.include?(response.code.to_i)
31
35
  if options[:success]
@@ -83,5 +87,13 @@ module Localeapp
83
87
  sleep time
84
88
  end
85
89
  end
90
+
91
+ def fix_encoding(response)
92
+ if response.respond_to?(:force_encoding)
93
+ if (charset = response.net_http_res.type_params['charset'])
94
+ response.force_encoding(charset)
95
+ end
96
+ end
97
+ end
86
98
  end
87
99
  end
@@ -35,7 +35,7 @@ module Localeapp
35
35
 
36
36
  def generate_yaml(translations)
37
37
  if defined? Psych
38
- Psych.dump(translations, :line_width => -1)[4..-1]
38
+ Psych.dump(translations, :line_width => -1)[4..-1].sub(/\.\.\.\n$/, '')
39
39
  else
40
40
  translations.ya2yaml[5..-1]
41
41
  end
@@ -1,3 +1,3 @@
1
1
  module Localeapp
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
data/localeapp.gemspec CHANGED
@@ -26,9 +26,9 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency('gli')
27
27
 
28
28
  s.add_development_dependency('rake')
29
- s.add_development_dependency('rspec', '2.5.0')
29
+ s.add_development_dependency('rspec', '2.11.0')
30
30
  s.add_development_dependency('yard', '0.6.7')
31
- s.add_development_dependency('RedCloth', '4.2.8')
32
- s.add_development_dependency('aruba', '0.3.6')
31
+ s.add_development_dependency('RedCloth', '4.2.9')
32
+ s.add_development_dependency('aruba', '0.4.11')
33
33
  s.add_development_dependency('fakeweb', '1.3.0')
34
34
  end
@@ -36,6 +36,22 @@ describe Localeapp::ApiCaller, "#call(object)" do
36
36
  @api_caller.call(self)
37
37
  end
38
38
 
39
+ if "".respond_to?(:force_encoding)
40
+ def success_check(response)
41
+ response.encoding.should == Encoding.find('UTF-8')
42
+ end
43
+
44
+ it "sets the response encoding based on the response charset" do
45
+ response = "string"
46
+ response.stub!(:code).and_return(200)
47
+ response.force_encoding('US-ASCII')
48
+ response.stub_chain(:net_http_res, :type_params).and_return('charset' => 'utf-8')
49
+ RestClient::Request.stub(:execute).and_return(response)
50
+ @api_caller.options[:success] = :success_check
51
+ @api_caller.call(self)
52
+ end
53
+ end
54
+
39
55
  context "Proxy" do
40
56
  before do
41
57
  RestClient::Request.stub!(:execute).and_return(double('response', :code => 200))
@@ -37,7 +37,20 @@ describe Localeapp::Updater, ".update(data)" do
37
37
 
38
38
  if defined? Psych
39
39
  if Psych::VERSION == '1.0.0'
40
- File.read(File.join(@yml_dir, 'en.yml')).should == <<-EN
40
+ if RUBY_ENGINE == 'jruby'
41
+ File.read(File.join(@yml_dir, 'en.yml')).should == <<-EN
42
+ en:
43
+ foo:
44
+ monkey: hello
45
+ night: the night
46
+ space:
47
+ blank: ''
48
+ tilde:
49
+ scalar1:
50
+ scalar2:
51
+ EN
52
+ else
53
+ File.read(File.join(@yml_dir, 'en.yml')).should == <<-EN
41
54
  en:
42
55
  foo:
43
56
  monkey: hello
@@ -48,6 +61,7 @@ en:
48
61
  scalar1: !!null
49
62
  scalar2: !!null
50
63
  EN
64
+ end
51
65
  else
52
66
  File.read(File.join(@yml_dir, 'en.yml')).should == <<-EN
53
67
  en:
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localeapp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christopher Dell
@@ -16,13 +16,12 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-07-04 00:00:00 Z
19
+ date: 2012-08-15 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: i18n
23
- type: :runtime
24
23
  prerelease: false
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
26
25
  none: false
27
26
  requirements:
28
27
  - - ">="
@@ -31,12 +30,12 @@ dependencies:
31
30
  segments:
32
31
  - 0
33
32
  version: "0"
34
- requirement: *id001
33
+ type: :runtime
34
+ version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: json
37
- type: :runtime
38
37
  prerelease: false
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ">="
@@ -45,12 +44,12 @@ dependencies:
45
44
  segments:
46
45
  - 0
47
46
  version: "0"
48
- requirement: *id002
47
+ type: :runtime
48
+ version_requirements: *id002
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rest-client
51
- type: :runtime
52
51
  prerelease: false
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ requirement: &id003 !ruby/object:Gem::Requirement
54
53
  none: false
55
54
  requirements:
56
55
  - - ">="
@@ -59,12 +58,12 @@ dependencies:
59
58
  segments:
60
59
  - 0
61
60
  version: "0"
62
- requirement: *id003
61
+ type: :runtime
62
+ version_requirements: *id003
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: ya2yaml
65
- type: :runtime
66
65
  prerelease: false
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
66
+ requirement: &id004 !ruby/object:Gem::Requirement
68
67
  none: false
69
68
  requirements:
70
69
  - - ">="
@@ -73,12 +72,12 @@ dependencies:
73
72
  segments:
74
73
  - 0
75
74
  version: "0"
76
- requirement: *id004
75
+ type: :runtime
76
+ version_requirements: *id004
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: gli
79
- type: :runtime
80
79
  prerelease: false
81
- version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ requirement: &id005 !ruby/object:Gem::Requirement
82
81
  none: false
83
82
  requirements:
84
83
  - - ">="
@@ -87,12 +86,12 @@ dependencies:
87
86
  segments:
88
87
  - 0
89
88
  version: "0"
90
- requirement: *id005
89
+ type: :runtime
90
+ version_requirements: *id005
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rake
93
- type: :development
94
93
  prerelease: false
95
- version_requirements: &id006 !ruby/object:Gem::Requirement
94
+ requirement: &id006 !ruby/object:Gem::Requirement
96
95
  none: false
97
96
  requirements:
98
97
  - - ">="
@@ -101,28 +100,28 @@ dependencies:
101
100
  segments:
102
101
  - 0
103
102
  version: "0"
104
- requirement: *id006
103
+ type: :development
104
+ version_requirements: *id006
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: rspec
107
- type: :development
108
107
  prerelease: false
109
- version_requirements: &id007 !ruby/object:Gem::Requirement
108
+ requirement: &id007 !ruby/object:Gem::Requirement
110
109
  none: false
111
110
  requirements:
112
111
  - - "="
113
112
  - !ruby/object:Gem::Version
114
- hash: 27
113
+ hash: 35
115
114
  segments:
116
115
  - 2
117
- - 5
116
+ - 11
118
117
  - 0
119
- version: 2.5.0
120
- requirement: *id007
118
+ version: 2.11.0
119
+ type: :development
120
+ version_requirements: *id007
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: yard
123
- type: :development
124
123
  prerelease: false
125
- version_requirements: &id008 !ruby/object:Gem::Requirement
124
+ requirement: &id008 !ruby/object:Gem::Requirement
126
125
  none: false
127
126
  requirements:
128
127
  - - "="
@@ -133,44 +132,44 @@ dependencies:
133
132
  - 6
134
133
  - 7
135
134
  version: 0.6.7
136
- requirement: *id008
135
+ type: :development
136
+ version_requirements: *id008
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: RedCloth
139
- type: :development
140
139
  prerelease: false
141
- version_requirements: &id009 !ruby/object:Gem::Requirement
140
+ requirement: &id009 !ruby/object:Gem::Requirement
142
141
  none: false
143
142
  requirements:
144
143
  - - "="
145
144
  - !ruby/object:Gem::Version
146
- hash: 39
145
+ hash: 37
147
146
  segments:
148
147
  - 4
149
148
  - 2
150
- - 8
151
- version: 4.2.8
152
- requirement: *id009
149
+ - 9
150
+ version: 4.2.9
151
+ type: :development
152
+ version_requirements: *id009
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: aruba
155
- type: :development
156
155
  prerelease: false
157
- version_requirements: &id010 !ruby/object:Gem::Requirement
156
+ requirement: &id010 !ruby/object:Gem::Requirement
158
157
  none: false
159
158
  requirements:
160
159
  - - "="
161
160
  - !ruby/object:Gem::Version
162
- hash: 31
161
+ hash: 25
163
162
  segments:
164
163
  - 0
165
- - 3
166
- - 6
167
- version: 0.3.6
168
- requirement: *id010
164
+ - 4
165
+ - 11
166
+ version: 0.4.11
167
+ type: :development
168
+ version_requirements: *id010
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: fakeweb
171
- type: :development
172
171
  prerelease: false
173
- version_requirements: &id011 !ruby/object:Gem::Requirement
172
+ requirement: &id011 !ruby/object:Gem::Requirement
174
173
  none: false
175
174
  requirements:
176
175
  - - "="
@@ -181,7 +180,8 @@ dependencies:
181
180
  - 3
182
181
  - 0
183
182
  version: 1.3.0
184
- requirement: *id011
183
+ type: :development
184
+ version_requirements: *id011
185
185
  description: Synchronizes i18n translation keys and content with localeapp.com so you don't have to manage translations by hand.
186
186
  email:
187
187
  - chris@tigrish.com
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
291
  requirements: []
292
292
 
293
293
  rubyforge_project: localeapp
294
- rubygems_version: 1.8.6
294
+ rubygems_version: 1.8.24
295
295
  signing_key:
296
296
  specification_version: 3
297
297
  summary: Easy i18n translation management with localeapp.com