localeapp 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -7
- data/Gemfile.github_project.rb +2 -2
- data/bin/localeapp +18 -51
- data/features/add.feature +46 -0
- data/features/bad_command.feature +8 -0
- data/features/help.feature +9 -0
- data/features/install.feature +70 -0
- data/features/pull.feature +46 -0
- data/features/push.feature +57 -0
- data/features/update.feature +44 -0
- data/lib/localeapp/cli/add.rb +1 -5
- data/lib/localeapp/cli/command.rb +34 -0
- data/lib/localeapp/cli/daemon.rb +54 -0
- data/lib/localeapp/cli/install.rb +16 -15
- data/lib/localeapp/cli/pull.rb +1 -5
- data/lib/localeapp/cli/push.rb +1 -5
- data/lib/localeapp/cli/update.rb +1 -5
- data/lib/localeapp/configuration.rb +23 -63
- data/lib/localeapp/default_value_handler.rb +1 -9
- data/lib/localeapp/version.rb +1 -1
- data/lib/localeapp.rb +12 -15
- data/spec/localeapp/cli/add_spec.rb +1 -1
- data/spec/localeapp/cli/daemon_spec.rb +38 -0
- data/spec/localeapp/cli/install_spec.rb +10 -10
- data/spec/localeapp/cli/pull_spec.rb +2 -2
- data/spec/localeapp/cli/push_spec.rb +2 -2
- data/spec/localeapp/cli/update_spec.rb +1 -1
- data/spec/localeapp/configuration_spec.rb +39 -186
- data/spec/localeapp/default_value_handler_spec.rb +4 -13
- data/spec/localeapp/sender_spec.rb +0 -21
- metadata +57 -41
- data/features/localeapp_binary.feature +0 -210
@@ -26,27 +26,6 @@ describe Localeapp::Sender, "#post_translation(locale, key, options, value = nil
|
|
26
26
|
:method => :post)).and_return(double('response', :code => 200))
|
27
27
|
@sender.post_translation('en', 'test.key', { 'foo' => 'foo', 'bar' => 'bar', :default => 'default', :scope => 'scope' }, 'test content')
|
28
28
|
end
|
29
|
-
|
30
|
-
it "posts default translation data to the backend" do
|
31
|
-
data = {
|
32
|
-
:translation => {
|
33
|
-
:key => 'absolutely.missing',
|
34
|
-
:locale => 'en',
|
35
|
-
:substitutions => ['bar', 'foo'],
|
36
|
-
:description => 'a sensible default'
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
RestClient::Request.should_receive(:execute).with(hash_including(
|
41
|
-
:url => @sender.translations_url,
|
42
|
-
:payload => data.to_json,
|
43
|
-
:headers => {
|
44
|
-
:x_localeapp_gem_version => Localeapp::VERSION,
|
45
|
-
:content_type => :json },
|
46
|
-
:method => :post)).and_return(double('response', :code => 200))
|
47
|
-
|
48
|
-
I18n.t('absolutely.missing', { 'foo' => 'foo', 'bar' => 'bar', :default => 'a sensible default' })
|
49
|
-
end
|
50
29
|
end
|
51
30
|
|
52
31
|
describe Localeapp::Sender, "#post_missing_translations" do
|
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:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 0.6.0
|
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-
|
19
|
+
date: 2012-10-08 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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
96
95
|
none: false
|
97
96
|
requirements:
|
98
97
|
- - ">="
|
@@ -101,12 +100,12 @@ dependencies:
|
|
101
100
|
segments:
|
102
101
|
- 0
|
103
102
|
version: "0"
|
104
|
-
|
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
|
-
|
108
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
110
109
|
none: false
|
111
110
|
requirements:
|
112
111
|
- - "="
|
@@ -117,12 +116,12 @@ dependencies:
|
|
117
116
|
- 11
|
118
117
|
- 0
|
119
118
|
version: 2.11.0
|
120
|
-
|
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
|
-
|
124
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
126
125
|
none: false
|
127
126
|
requirements:
|
128
127
|
- - "="
|
@@ -133,12 +132,12 @@ dependencies:
|
|
133
132
|
- 6
|
134
133
|
- 7
|
135
134
|
version: 0.6.7
|
136
|
-
|
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
|
-
|
140
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
142
141
|
none: false
|
143
142
|
requirements:
|
144
143
|
- - "="
|
@@ -149,12 +148,12 @@ dependencies:
|
|
149
148
|
- 2
|
150
149
|
- 9
|
151
150
|
version: 4.2.9
|
152
|
-
|
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
|
-
|
156
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
158
157
|
none: false
|
159
158
|
requirements:
|
160
159
|
- - "="
|
@@ -165,12 +164,12 @@ dependencies:
|
|
165
164
|
- 4
|
166
165
|
- 11
|
167
166
|
version: 0.4.11
|
168
|
-
|
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
|
-
|
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
|
-
|
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
|
@@ -208,15 +208,23 @@ files:
|
|
208
208
|
- Rakefile
|
209
209
|
- bin/localeapp
|
210
210
|
- cucumber.yml
|
211
|
-
- features/
|
211
|
+
- features/add.feature
|
212
|
+
- features/bad_command.feature
|
213
|
+
- features/help.feature
|
214
|
+
- features/install.feature
|
215
|
+
- features/pull.feature
|
216
|
+
- features/push.feature
|
212
217
|
- features/step_definitions/cli_steps.rb
|
213
218
|
- features/support/env.rb
|
214
219
|
- features/support/hooks.rb
|
220
|
+
- features/update.feature
|
215
221
|
- init.rb
|
216
222
|
- lib/localeapp.rb
|
217
223
|
- lib/localeapp/api_call.rb
|
218
224
|
- lib/localeapp/api_caller.rb
|
219
225
|
- lib/localeapp/cli/add.rb
|
226
|
+
- lib/localeapp/cli/command.rb
|
227
|
+
- lib/localeapp/cli/daemon.rb
|
220
228
|
- lib/localeapp/cli/install.rb
|
221
229
|
- lib/localeapp/cli/pull.rb
|
222
230
|
- lib/localeapp/cli/push.rb
|
@@ -244,6 +252,7 @@ files:
|
|
244
252
|
- spec/localeapp/api_call_spec.rb
|
245
253
|
- spec/localeapp/api_caller_spec.rb
|
246
254
|
- spec/localeapp/cli/add_spec.rb
|
255
|
+
- spec/localeapp/cli/daemon_spec.rb
|
247
256
|
- spec/localeapp/cli/install_spec.rb
|
248
257
|
- spec/localeapp/cli/pull_spec.rb
|
249
258
|
- spec/localeapp/cli/push_spec.rb
|
@@ -291,21 +300,28 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
300
|
requirements: []
|
292
301
|
|
293
302
|
rubyforge_project: localeapp
|
294
|
-
rubygems_version: 1.8.
|
303
|
+
rubygems_version: 1.8.24
|
295
304
|
signing_key:
|
296
305
|
specification_version: 3
|
297
306
|
summary: Easy i18n translation management with localeapp.com
|
298
307
|
test_files:
|
299
|
-
- features/
|
308
|
+
- features/add.feature
|
309
|
+
- features/bad_command.feature
|
310
|
+
- features/help.feature
|
311
|
+
- features/install.feature
|
312
|
+
- features/pull.feature
|
313
|
+
- features/push.feature
|
300
314
|
- features/step_definitions/cli_steps.rb
|
301
315
|
- features/support/env.rb
|
302
316
|
- features/support/hooks.rb
|
317
|
+
- features/update.feature
|
303
318
|
- spec/fixtures/empty_log.yml
|
304
319
|
- spec/fixtures/en.yml
|
305
320
|
- spec/fixtures/es.yml
|
306
321
|
- spec/localeapp/api_call_spec.rb
|
307
322
|
- spec/localeapp/api_caller_spec.rb
|
308
323
|
- spec/localeapp/cli/add_spec.rb
|
324
|
+
- spec/localeapp/cli/daemon_spec.rb
|
309
325
|
- spec/localeapp/cli/install_spec.rb
|
310
326
|
- spec/localeapp/cli/pull_spec.rb
|
311
327
|
- spec/localeapp/cli/push_spec.rb
|
@@ -1,210 +0,0 @@
|
|
1
|
-
Feature: localeapp executable
|
2
|
-
|
3
|
-
Scenario: Viewing help
|
4
|
-
In order to see what options I have
|
5
|
-
When I run `localeapp help`
|
6
|
-
Then the output should contain:
|
7
|
-
"""
|
8
|
-
localeapp [global options] command [command options]
|
9
|
-
"""
|
10
|
-
|
11
|
-
Scenario: Running a command that doesn't exist
|
12
|
-
In order to warn of a bad command
|
13
|
-
When I run `localeapp foo`
|
14
|
-
Then the output should contain:
|
15
|
-
"""
|
16
|
-
error: Unknown command 'foo'
|
17
|
-
"""
|
18
|
-
|
19
|
-
Scenario: Running Rails install
|
20
|
-
In order to configure my project and check my api key is correct
|
21
|
-
When I have a valid project on localeapp.com with api key "MYAPIKEY"
|
22
|
-
And I run `localeapp install MYAPIKEY`
|
23
|
-
Then the output should contain:
|
24
|
-
"""
|
25
|
-
Localeapp Install
|
26
|
-
|
27
|
-
Checking API key: MYAPIKEY
|
28
|
-
Success!
|
29
|
-
Project: Test Project
|
30
|
-
Default Locale: en (English)
|
31
|
-
"""
|
32
|
-
And help should not be displayed
|
33
|
-
And a file named "config/initializers/localeapp.rb" should exist
|
34
|
-
And the exit status should be 0
|
35
|
-
|
36
|
-
Scenario: Running standalone install
|
37
|
-
In order to configure my non rails project and check my api key is correct
|
38
|
-
When I have a valid project on localeapp.com with api key "MYAPIKEY"
|
39
|
-
And I run `localeapp install --standalone MYAPIKEY`
|
40
|
-
Then the output should contain:
|
41
|
-
"""
|
42
|
-
Localeapp Install
|
43
|
-
|
44
|
-
Checking API key: MYAPIKEY
|
45
|
-
Success!
|
46
|
-
Project: Test Project
|
47
|
-
Default Locale: en (English)
|
48
|
-
"""
|
49
|
-
And help should not be displayed
|
50
|
-
And a file named ".localeapp/config.rb" should exist
|
51
|
-
And the exit status should be 0
|
52
|
-
|
53
|
-
Scenario: Running github install
|
54
|
-
In order to configure my public github project and check my api key is correct
|
55
|
-
When I have a valid project on localeapp.com with api key "MYAPIKEY"
|
56
|
-
And I run `localeapp install --github MYAPIKEY`
|
57
|
-
Then the output should contain:
|
58
|
-
"""
|
59
|
-
Localeapp Install
|
60
|
-
|
61
|
-
Checking API key: MYAPIKEY
|
62
|
-
Success!
|
63
|
-
Project: Test Project
|
64
|
-
Default Locale: en (English)
|
65
|
-
"""
|
66
|
-
And help should not be displayed
|
67
|
-
And a file named ".localeapp/config.rb" should exist
|
68
|
-
And a file named ".gitignore" should exist
|
69
|
-
And a file named "README.md" should exist
|
70
|
-
And the exit status should be 0
|
71
|
-
|
72
|
-
|
73
|
-
Scenario: Running install with bad api key
|
74
|
-
In order to configure my project and check my api key is correct
|
75
|
-
When I have a valid project on localeapp.com but an incorrect api key "BADAPIKEY"
|
76
|
-
And I run `localeapp install BADAPIKEY`
|
77
|
-
Then the output should contain:
|
78
|
-
"""
|
79
|
-
Localeapp Install
|
80
|
-
|
81
|
-
Checking API key: BADAPIKEY
|
82
|
-
ERROR: Project not found
|
83
|
-
"""
|
84
|
-
And help should not be displayed
|
85
|
-
And a file named "config/initializers/localeapp.rb" should not exist
|
86
|
-
And the exit status should not be 0
|
87
|
-
|
88
|
-
Scenario: Running add
|
89
|
-
In order to add a key and translation content
|
90
|
-
When I have a valid project on localeapp.com with api key "MYAPIKEY"
|
91
|
-
And an initializer file
|
92
|
-
When I run `localeapp add foo.baz en:"test en content" es:"test es content"`
|
93
|
-
Then the output should contain:
|
94
|
-
"""
|
95
|
-
Localeapp Add
|
96
|
-
|
97
|
-
Sending key: foo.baz
|
98
|
-
Success!
|
99
|
-
"""
|
100
|
-
|
101
|
-
Scenario: Running add with no arguments
|
102
|
-
In order to add a key and translation content
|
103
|
-
When I have a valid project on localeapp.com with api key "MYAPIKEY"
|
104
|
-
And an initializer file
|
105
|
-
When I run `localeapp add`
|
106
|
-
Then the output should contain:
|
107
|
-
"""
|
108
|
-
localeapp add requires a key name and at least one translation
|
109
|
-
"""
|
110
|
-
|
111
|
-
Scenario: Running add with just a key name
|
112
|
-
In order to add a key and translation content
|
113
|
-
When I have a valid project on localeapp.com with api key "MYAPIKEY"
|
114
|
-
And an initializer file
|
115
|
-
When I run `localeapp add foo.bar`
|
116
|
-
Then the output should contain:
|
117
|
-
"""
|
118
|
-
localeapp add requires a key name and at least one translation
|
119
|
-
"""
|
120
|
-
|
121
|
-
Scenario: Running pull
|
122
|
-
In order to retreive my translations
|
123
|
-
Given I have a translations on localeapp.com for the project with api key "MYAPIKEY"
|
124
|
-
And an initializer file
|
125
|
-
And a directory named "config/locales"
|
126
|
-
When I run `localeapp pull`
|
127
|
-
Then the output should contain:
|
128
|
-
"""
|
129
|
-
Localeapp Pull
|
130
|
-
|
131
|
-
Fetching translations:
|
132
|
-
Success!
|
133
|
-
Updating backend:
|
134
|
-
Success!
|
135
|
-
"""
|
136
|
-
And help should not be displayed
|
137
|
-
And a file named "config/locales/en.yml" should exist
|
138
|
-
|
139
|
-
Scenario: Running pull without having a locales dir
|
140
|
-
In order to retreive my translations
|
141
|
-
Given I have a translations on localeapp.com for the project with api key "MYAPIKEY"
|
142
|
-
And an initializer file
|
143
|
-
When I run `localeapp pull`
|
144
|
-
Then the output should contain:
|
145
|
-
"""
|
146
|
-
Could not write locale file, please make sure that config/locales exists and is writeable
|
147
|
-
"""
|
148
|
-
|
149
|
-
Scenario: Running push on a file
|
150
|
-
In order to send my translations
|
151
|
-
When I have a valid project on localeapp.com with api key "MYAPIKEY"
|
152
|
-
And an initializer file
|
153
|
-
And an empty file named "config/locales/en.yml"
|
154
|
-
When I run `localeapp push config/locales/en.yml`
|
155
|
-
Then the output should contain:
|
156
|
-
"""
|
157
|
-
Localeapp Push
|
158
|
-
|
159
|
-
Pushing file en.yml:
|
160
|
-
Success!
|
161
|
-
|
162
|
-
config/locales/en.yml queued for processing.
|
163
|
-
"""
|
164
|
-
And help should not be displayed
|
165
|
-
|
166
|
-
Scenario: Running push on a directory
|
167
|
-
In order to send my translations
|
168
|
-
When I have a valid project on localeapp.com with api key "MYAPIKEY"
|
169
|
-
And an initializer file
|
170
|
-
And an empty file named "config/locales/en.yml"
|
171
|
-
And an empty file named "config/locales/es.yml"
|
172
|
-
When I run `localeapp push config/locales`
|
173
|
-
Then the output should contain:
|
174
|
-
"""
|
175
|
-
Localeapp Push
|
176
|
-
|
177
|
-
Pushing file en.yml:
|
178
|
-
Success!
|
179
|
-
|
180
|
-
config/locales/en.yml queued for processing.
|
181
|
-
|
182
|
-
Pushing file es.yml:
|
183
|
-
Success!
|
184
|
-
|
185
|
-
config/locales/es.yml queued for processing.
|
186
|
-
"""
|
187
|
-
And help should not be displayed
|
188
|
-
|
189
|
-
Scenario: Running update
|
190
|
-
In order to receive the translations that have been updated since the last check
|
191
|
-
When I have a valid project on localeapp.com with api key "MYAPIKEY"
|
192
|
-
And an initializer file
|
193
|
-
And a file named "log/localeapp.yml" with:
|
194
|
-
"""
|
195
|
-
---
|
196
|
-
:updated_at: 120
|
197
|
-
:polled_at: 130
|
198
|
-
"""
|
199
|
-
And new translations for the api key "MYAPIKEY" since "120" with time "140"
|
200
|
-
And a directory named "config/locales"
|
201
|
-
When I run `localeapp update`
|
202
|
-
Then the output should contain:
|
203
|
-
"""
|
204
|
-
Localeapp update: checking for translations since 120
|
205
|
-
Found and updated new translations
|
206
|
-
"""
|
207
|
-
And help should not be displayed
|
208
|
-
And a file named "config/locales/en.yml" should exist
|
209
|
-
# check the content here
|
210
|
-
# and the localeapp.yml file
|