phrase 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # phrase [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/phrase/phrase)
2
+ [![Build Status](https://secure.travis-ci.org/phrase/phrase.png)](http://travis-ci.org/phrase/phrase)
2
3
 
3
4
  Powerful in-place translation management for your web applications.
4
5
 
5
6
  ## More Information
6
7
 
7
- https://phraseapp.com
8
+ https://phraseapp.com
data/Rakefile CHANGED
@@ -1,2 +1,7 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
data/lib/phrase/api.rb CHANGED
@@ -2,5 +2,6 @@ module Phrase::Api
2
2
  end
3
3
 
4
4
  require 'phrase/api/client'
5
+ require 'phrase/api/query_params'
5
6
  require 'phrase/api/config'
6
- require 'phrase/api/exceptions'
7
+ require 'phrase/api/exceptions'
@@ -1,6 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- require 'addressable/uri'
4
3
  require 'cgi'
5
4
  require 'net/http'
6
5
  require 'net/https'
@@ -162,9 +161,7 @@ private
162
161
 
163
162
  def get_request(endpoint, params={})
164
163
  params.merge!('auth_token' => @auth_token)
165
- uri = Addressable::URI.new
166
- uri.query_values = params
167
- request = Net::HTTP::Get.new("#{api_path_for(endpoint)}?#{uri.query}")
164
+ request = Net::HTTP::Get.new("#{api_path_for(endpoint)}?#{query_for_params(params)}")
168
165
  request
169
166
  end
170
167
 
@@ -218,4 +215,8 @@ private
218
215
  def escaped(value)
219
216
  CGI::escape(value)
220
217
  end
218
+
219
+ def query_for_params(params)
220
+ Phrase::Api::QueryParams.encode(params)
221
+ end
221
222
  end
@@ -0,0 +1,22 @@
1
+ require "cgi"
2
+
3
+ class Phrase::Api::QueryParams
4
+ def self.encode(value, key=nil)
5
+ case value
6
+ when Array then value.map { |v| encode(v, "#{key}[]") }.join("&")
7
+ when Hash then value.map { |k,v| encode(v, append_key(key,k)) }.join("&")
8
+ when nil then ""
9
+ else
10
+ "#{key}=#{CGI.escape(value.to_s)}"
11
+ end
12
+ end
13
+
14
+ def self.append_key(root_key, key)
15
+ if root_key.nil?
16
+ key
17
+ else
18
+ "#{root_key}[#{key.to_s}]"
19
+ end
20
+ end
21
+ private_class_method :append_key
22
+ end
@@ -43,7 +43,7 @@ private
43
43
  begin
44
44
  FileUtils.mkpath(path)
45
45
  File.open(target, "w") do |file|
46
- file.write(content)
46
+ file.write(content.force_encoding("UTF-8"))
47
47
  end
48
48
  print_message "Saved to #{clean_path target}".green
49
49
  rescue
@@ -1,3 +1,3 @@
1
1
  module Phrase
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/phrase.gemspec CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |s|
21
21
  s.executables = %w(phrase)
22
22
  s.require_paths = ["lib"]
23
23
  s.add_dependency('activesupport', '~> 3.0')
24
- s.add_dependency('addressable', '~> 2.2.8')
25
24
  s.add_dependency('colorize')
26
25
  s.add_dependency('json')
26
+ s.add_development_dependency('rake')
27
27
  s.add_development_dependency('rspec')
28
28
  s.add_development_dependency('i18n')
29
29
  s.add_development_dependency('webmock')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phrase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.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: 2012-12-10 00:00:00.000000000 Z
12
+ date: 2013-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70288255847780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,31 +21,10 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: '3.0'
30
- - !ruby/object:Gem::Dependency
31
- name: addressable
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: 2.2.8
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 2.2.8
24
+ version_requirements: *70288255847780
46
25
  - !ruby/object:Gem::Dependency
47
26
  name: colorize
48
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &70288255847400 !ruby/object:Gem::Requirement
49
28
  none: false
50
29
  requirements:
51
30
  - - ! '>='
@@ -53,15 +32,10 @@ dependencies:
53
32
  version: '0'
54
33
  type: :runtime
55
34
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
35
+ version_requirements: *70288255847400
62
36
  - !ruby/object:Gem::Dependency
63
37
  name: json
64
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &70288255846940 !ruby/object:Gem::Requirement
65
39
  none: false
66
40
  requirements:
67
41
  - - ! '>='
@@ -69,15 +43,21 @@ dependencies:
69
43
  version: '0'
70
44
  type: :runtime
71
45
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
46
+ version_requirements: *70288255846940
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: &70288255846520 !ruby/object:Gem::Requirement
73
50
  none: false
74
51
  requirements:
75
52
  - - ! '>='
76
53
  - !ruby/object:Gem::Version
77
54
  version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70288255846520
78
58
  - !ruby/object:Gem::Dependency
79
59
  name: rspec
80
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &70288255846100 !ruby/object:Gem::Requirement
81
61
  none: false
82
62
  requirements:
83
63
  - - ! '>='
@@ -85,15 +65,10 @@ dependencies:
85
65
  version: '0'
86
66
  type: :development
87
67
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
68
+ version_requirements: *70288255846100
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: i18n
96
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &70288255845680 !ruby/object:Gem::Requirement
97
72
  none: false
98
73
  requirements:
99
74
  - - ! '>='
@@ -101,15 +76,10 @@ dependencies:
101
76
  version: '0'
102
77
  type: :development
103
78
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
79
+ version_requirements: *70288255845680
110
80
  - !ruby/object:Gem::Dependency
111
81
  name: webmock
112
- requirement: !ruby/object:Gem::Requirement
82
+ requirement: &70288255845260 !ruby/object:Gem::Requirement
113
83
  none: false
114
84
  requirements:
115
85
  - - ! '>='
@@ -117,15 +87,10 @@ dependencies:
117
87
  version: '0'
118
88
  type: :development
119
89
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
90
+ version_requirements: *70288255845260
126
91
  - !ruby/object:Gem::Dependency
127
92
  name: vcr
128
- requirement: !ruby/object:Gem::Requirement
93
+ requirement: &70288255844840 !ruby/object:Gem::Requirement
129
94
  none: false
130
95
  requirements:
131
96
  - - ! '>='
@@ -133,15 +98,10 @@ dependencies:
133
98
  version: '0'
134
99
  type: :development
135
100
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
101
+ version_requirements: *70288255844840
142
102
  - !ruby/object:Gem::Dependency
143
103
  name: timecop
144
- requirement: !ruby/object:Gem::Requirement
104
+ requirement: &70288255844420 !ruby/object:Gem::Requirement
145
105
  none: false
146
106
  requirements:
147
107
  - - ! '>='
@@ -149,12 +109,7 @@ dependencies:
149
109
  version: '0'
150
110
  type: :development
151
111
  prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: '0'
112
+ version_requirements: *70288255844420
158
113
  description: phrase allows you to edit translations in-place on the page itself. More
159
114
  information at phraseapp.com
160
115
  email:
@@ -165,6 +120,7 @@ extensions: []
165
120
  extra_rdoc_files: []
166
121
  files:
167
122
  - .gitignore
123
+ - .travis.yml
168
124
  - Gemfile
169
125
  - Gemfile.lock
170
126
  - Guardfile
@@ -180,6 +136,7 @@ files:
180
136
  - lib/phrase/api/client.rb
181
137
  - lib/phrase/api/config.rb
182
138
  - lib/phrase/api/exceptions.rb
139
+ - lib/phrase/api/query_params.rb
183
140
  - lib/phrase/backend.rb
184
141
  - lib/phrase/backend/base.rb
185
142
  - lib/phrase/backend/phrase_service.rb
@@ -243,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
200
  version: 1.3.6
244
201
  requirements: []
245
202
  rubyforge_project: phrase
246
- rubygems_version: 1.8.24
203
+ rubygems_version: 1.8.10
247
204
  signing_key:
248
205
  specification_version: 3
249
206
  summary: The best way to manage i18n.