localeapp 0.9.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +5 -1
- data/CHANGELOG.md +10 -0
- data/README.md +2 -2
- data/bin/localeapp +6 -4
- data/features/add.feature +11 -12
- data/features/install.feature +28 -28
- data/features/mv.feature +2 -2
- data/features/pull.feature +8 -8
- data/features/push.feature +12 -12
- data/features/rm.feature +2 -2
- data/features/step_definitions/cli_steps.rb +2 -6
- data/features/support/env.rb +3 -5
- data/features/support/hooks.rb +3 -3
- data/features/update.feature +19 -19
- data/lib/localeapp/version.rb +1 -1
- data/localeapp.gemspec +4 -4
- data/spec/localeapp/api_call_spec.rb +2 -2
- data/spec/localeapp/api_caller_spec.rb +45 -43
- data/spec/localeapp/cli/add_spec.rb +14 -14
- data/spec/localeapp/cli/daemon_spec.rb +6 -6
- data/spec/localeapp/cli/install_spec.rb +53 -53
- data/spec/localeapp/cli/pull_spec.rb +5 -5
- data/spec/localeapp/cli/push_spec.rb +9 -9
- data/spec/localeapp/cli/rename_spec.rb +1 -1
- data/spec/localeapp/cli/update_spec.rb +9 -6
- data/spec/localeapp/configuration_spec.rb +29 -29
- data/spec/localeapp/default_value_handler_spec.rb +8 -8
- data/spec/localeapp/exception_handler_spec.rb +6 -6
- data/spec/localeapp/key_checker_spec.rb +2 -2
- data/spec/localeapp/missing_translations_spec.rb +18 -18
- data/spec/localeapp/poller_spec.rb +12 -12
- data/spec/localeapp/rails/controller_spec.rb +13 -13
- data/spec/localeapp/routes_spec.rb +34 -34
- data/spec/localeapp/sender_spec.rb +5 -5
- data/spec/localeapp/updater_spec.rb +14 -14
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjQ2MmQ4NGMzNzQ0ZGQwNzJjNzkwZTU0ZjU5MGU3MmU0YTI0Y2E5ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Mjg1ZGY4ZTdkNjdhZGQ2NjBmNThiOTE1NzExNjU0M2UyYzBkZGUyYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Zjg1OGEzMWMyMWI5Y2E3YzhiNWUxYTY4YjVjMTEyYmZlZDQ4MGVhZDM2NzIw
|
10
|
+
OWJhYzRkN2RlMGI2OTNlNTZhMWIzNDlkNWRmYjk3NDhjZGE1NjVmYjg0ZWYy
|
11
|
+
Yjc4ZjNiMjk2MmZmYzhlZmI0OWFlOTQ0ZTZkMTE1OTRlMmIzZTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGU5ZDBkOWQyZDE4ZGIxMTU4NTcyODg3MjBmNmYzYWM3NDczMTExNWQ1MDYy
|
14
|
+
NDhmMmY0YzNiOGUzNWYwNmVkZmQyYzVlNDY4NTgwYmY3NDU2ZDc1MTBjMTg3
|
15
|
+
Y2I5NGRiNDczNDFiNWI3ZDY1YmQxMmY0OGM0YmY2NTJiMjQzNGM=
|
data/.travis.yml
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
before_install:
|
2
|
+
- gem update bundler
|
1
3
|
rvm:
|
2
|
-
- 1.9.2
|
3
4
|
- 1.9.3
|
4
5
|
- 2.0.0
|
5
6
|
- 2.1.0
|
7
|
+
- 2.2.0
|
6
8
|
- jruby
|
7
9
|
- jruby-head
|
8
10
|
gemfile:
|
@@ -15,5 +17,7 @@ matrix:
|
|
15
17
|
gemfile: Gemfile.i18n_037
|
16
18
|
- rvm: 2.1.0
|
17
19
|
gemfile: Gemfile.i18n_037
|
20
|
+
- rvm: 2.2.0
|
21
|
+
gemfile: Gemfile.i18n_037
|
18
22
|
- rvm: jruby-head
|
19
23
|
gemfile: Gemfile.i18n_037
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# master
|
2
2
|
|
3
|
+
# Version 1.0
|
4
|
+
|
5
|
+
* Drop support for Ruby 1.9.2
|
6
|
+
* Adopt semantic versioning
|
7
|
+
* Upgrade test frameworks to RSpec 3 and Cucumber 2
|
8
|
+
|
9
|
+
# Version 0.9.3
|
10
|
+
|
11
|
+
* Support multilines translations content in `localeapp add`
|
12
|
+
|
3
13
|
# Version 0.9.2
|
4
14
|
|
5
15
|
* Refactor which monkeypatch/backported-bugfix is loaded for which Rails version
|
data/README.md
CHANGED
@@ -14,14 +14,14 @@ Though the i18n gem uses YAML as it's default file format it doesn't require ser
|
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
17
|
-
### Rails 3
|
17
|
+
### Rails 3+
|
18
18
|
|
19
19
|
Add the localeapp gem to your `Gemfile` and install it:
|
20
20
|
|
21
21
|
echo "gem 'localeapp'" >> Gemfile
|
22
22
|
bundle install
|
23
23
|
|
24
|
-
Create a project on localeapp.com and get the api key. Then run:
|
24
|
+
Create a project on [Locale](https://localeapp.com) and get the api key. Then run:
|
25
25
|
|
26
26
|
bundle exec localeapp install <YOUR_API_KEY>
|
27
27
|
|
data/bin/localeapp
CHANGED
@@ -5,12 +5,14 @@ require 'localeapp'
|
|
5
5
|
|
6
6
|
# Don't connect to the net if we're running under cucumber for testing
|
7
7
|
# Use FakeWeb to simulate api.localeapp.com
|
8
|
-
if ENV['FAKE_WEB_DURING_CUCUMBER_RUN']
|
8
|
+
if ENV['FAKE_WEB_DURING_CUCUMBER_RUN']
|
9
9
|
require 'fakeweb'
|
10
10
|
FakeWeb.allow_net_connect = false
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
if fake_data_as_json = ENV['FAKE_WEB_FAKES']
|
12
|
+
fakes = JSON.parse(fake_data_as_json)
|
13
|
+
fakes.each do |fake|
|
14
|
+
FakeWeb.register_uri fake['method'].to_sym, fake['uri'], { :body => fake['body'], :status => fake['status'] }.merge(fake['headers'])
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
data/features/add.feature
CHANGED
@@ -2,8 +2,8 @@ Feature: Adding a translation from the command line
|
|
2
2
|
|
3
3
|
Scenario: Running add
|
4
4
|
In order to add a key and translation content
|
5
|
-
|
6
|
-
|
5
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
6
|
+
And an initializer file
|
7
7
|
When I run `localeapp add foo.baz en:"test en content" es:"test es content"`
|
8
8
|
Then the output should contain:
|
9
9
|
"""
|
@@ -15,8 +15,8 @@ Feature: Adding a translation from the command line
|
|
15
15
|
|
16
16
|
Scenario: Running add with no arguments
|
17
17
|
In order to add a key and translation content
|
18
|
-
|
19
|
-
|
18
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
19
|
+
And an initializer file
|
20
20
|
When I run `localeapp add`
|
21
21
|
Then the output should contain:
|
22
22
|
"""
|
@@ -25,8 +25,8 @@ Feature: Adding a translation from the command line
|
|
25
25
|
|
26
26
|
Scenario: Running add with just a key name
|
27
27
|
In order to add a key and translation content
|
28
|
-
|
29
|
-
|
28
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
29
|
+
And an initializer file
|
30
30
|
When I run `localeapp add foo.bar`
|
31
31
|
Then the output should contain:
|
32
32
|
"""
|
@@ -35,7 +35,7 @@ Feature: Adding a translation from the command line
|
|
35
35
|
|
36
36
|
Scenario: Running add with no initializer file, passing the key on the command line
|
37
37
|
In order to add a key and translation content
|
38
|
-
|
38
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
39
39
|
When I run `localeapp -k MYAPIKEY add foo.baz en:"test en content"`
|
40
40
|
Then the output should contain:
|
41
41
|
"""
|
@@ -47,8 +47,8 @@ Feature: Adding a translation from the command line
|
|
47
47
|
|
48
48
|
Scenario: Running add with no initializer file, passing the key via an ENV variable
|
49
49
|
In order to add a key and translation content
|
50
|
-
|
51
|
-
|
50
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
51
|
+
And I have a LOCALEAPP_API_KEY env variable set to "MYAPIKEY"
|
52
52
|
When I run `localeapp add foo.baz en:"test en content"`
|
53
53
|
Then the output should contain:
|
54
54
|
"""
|
@@ -57,12 +57,11 @@ Feature: Adding a translation from the command line
|
|
57
57
|
Sending key: foo.baz
|
58
58
|
Success!
|
59
59
|
"""
|
60
|
-
Then I clear the LOCALEAPP_API_KEY env variable
|
61
60
|
|
62
61
|
Scenario: Running add with no initializer file, passing the key via a .env file
|
63
62
|
In order to add a key and translation content
|
64
|
-
|
65
|
-
|
63
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
64
|
+
And I have a .env file containing the api key "MYAPIKEY"
|
66
65
|
When I run `localeapp add foo.baz en:"test en content"`
|
67
66
|
Then the output should contain:
|
68
67
|
"""
|
data/features/install.feature
CHANGED
@@ -2,8 +2,8 @@ Feature: Installation
|
|
2
2
|
|
3
3
|
Scenario: Running Rails install
|
4
4
|
In order to configure my project and check my api key is correct
|
5
|
-
|
6
|
-
|
5
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
6
|
+
When I run `localeapp install MYAPIKEY`
|
7
7
|
Then the output should contain:
|
8
8
|
"""
|
9
9
|
Localeapp Install
|
@@ -13,14 +13,14 @@ Feature: Installation
|
|
13
13
|
Project: Test Project
|
14
14
|
Default Locale: en (English)
|
15
15
|
"""
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
And help should not be displayed
|
17
|
+
And a file named "config/initializers/localeapp.rb" should exist
|
18
|
+
And the exit status should be 0
|
19
19
|
|
20
20
|
Scenario: Running standalone install
|
21
21
|
In order to configure my non rails project and check my api key is correct
|
22
|
-
|
23
|
-
|
22
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
23
|
+
When I run `localeapp install --standalone MYAPIKEY`
|
24
24
|
Then the output should contain:
|
25
25
|
"""
|
26
26
|
Localeapp Install
|
@@ -32,14 +32,14 @@ Feature: Installation
|
|
32
32
|
Writing configuration file to .localeapp/config.rb
|
33
33
|
WARNING: please create the locales directory. Your translation data will be stored there.
|
34
34
|
"""
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
And help should not be displayed
|
36
|
+
And a file named ".localeapp/config.rb" should exist
|
37
|
+
And the exit status should be 0
|
38
38
|
|
39
39
|
Scenario: Running github install
|
40
40
|
In order to configure my public github project and check my api key is correct
|
41
|
-
|
42
|
-
|
41
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
42
|
+
When I run `localeapp install --github MYAPIKEY`
|
43
43
|
Then the output should contain:
|
44
44
|
"""
|
45
45
|
Localeapp Install
|
@@ -50,16 +50,16 @@ Feature: Installation
|
|
50
50
|
NOTICE: you probably want to add .localeapp to your .gitignore file
|
51
51
|
Writing configuration file to .localeapp/config.rb
|
52
52
|
"""
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
And help should not be displayed
|
54
|
+
And a file named ".localeapp/config.rb" should exist
|
55
|
+
And a file named ".gitignore" should exist
|
56
|
+
And a file named "README.md" should exist
|
57
|
+
And the exit status should be 0
|
58
58
|
|
59
59
|
Scenario: Running heroku install with no api key
|
60
60
|
In order to configure my project to use localeapp as a heroku addon
|
61
|
-
|
62
|
-
|
61
|
+
Given I have a valid heroku project
|
62
|
+
When I run `localeapp install --heroku`
|
63
63
|
Then the output should contain:
|
64
64
|
"""
|
65
65
|
Localeapp Install
|
@@ -73,15 +73,15 @@ Feature: Installation
|
|
73
73
|
Project: Test Project
|
74
74
|
Default Locale: en (English)
|
75
75
|
"""
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
And help should not be displayed
|
77
|
+
And a file named "config/initializers/localeapp.rb" should exist
|
78
|
+
And the file "config/initializers/localeapp.rb" should contain "config.api_key = ENV['LOCALEAPP_API_KEY']"
|
79
|
+
And the exit status should be 0
|
80
80
|
|
81
81
|
Scenario: Running install with bad api key
|
82
82
|
In order to configure my project and check my api key is correct
|
83
|
-
|
84
|
-
|
83
|
+
Given I have a valid project on localeapp.com but an incorrect api key "BADAPIKEY"
|
84
|
+
When I run `localeapp install BADAPIKEY`
|
85
85
|
Then the output should contain:
|
86
86
|
"""
|
87
87
|
Localeapp Install
|
@@ -89,6 +89,6 @@ Feature: Installation
|
|
89
89
|
Checking API key: BADAPIKEY
|
90
90
|
ERROR: Project not found
|
91
91
|
"""
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
And help should not be displayed
|
93
|
+
And a file named "config/initializers/localeapp.rb" should not exist
|
94
|
+
And the exit status should not be 0
|
data/features/mv.feature
CHANGED
@@ -2,8 +2,8 @@ Feature: Renaming a translation from the command line
|
|
2
2
|
|
3
3
|
Scenario: Running mv
|
4
4
|
In order to rename an existing key
|
5
|
-
|
6
|
-
|
5
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY" and the translation key "foo.bar"
|
6
|
+
And an initializer file
|
7
7
|
When I run `localeapp mv foo.bar foo.baz`
|
8
8
|
Then the output should contain:
|
9
9
|
"""
|
data/features/pull.feature
CHANGED
@@ -3,8 +3,8 @@ Feature: Pulling all translation
|
|
3
3
|
Scenario: Running pull
|
4
4
|
In order to retrieve my translations
|
5
5
|
Given I have a translations on localeapp.com for the project with api key "MYAPIKEY"
|
6
|
-
|
7
|
-
|
6
|
+
And an initializer file
|
7
|
+
And a directory named "config/locales"
|
8
8
|
When I run `localeapp pull`
|
9
9
|
Then the output should contain:
|
10
10
|
"""
|
@@ -15,13 +15,13 @@ Feature: Pulling all translation
|
|
15
15
|
Updating backend:
|
16
16
|
Success!
|
17
17
|
"""
|
18
|
-
|
19
|
-
|
18
|
+
And help should not be displayed
|
19
|
+
And a file named "config/locales/en.yml" should exist
|
20
20
|
|
21
21
|
Scenario: Running pull without having a locales dir
|
22
22
|
In order to retreive my translations
|
23
23
|
Given I have a translations on localeapp.com for the project with api key "MYAPIKEY"
|
24
|
-
|
24
|
+
And an initializer file
|
25
25
|
When I run `localeapp pull`
|
26
26
|
Then the output should contain:
|
27
27
|
"""
|
@@ -31,7 +31,7 @@ Feature: Pulling all translation
|
|
31
31
|
Scenario: Running pull with no initializer file, passing the key on the command line
|
32
32
|
In order to retrieve my translations
|
33
33
|
Given I have a translations on localeapp.com for the project with api key "MYAPIKEY"
|
34
|
-
|
34
|
+
And a directory named "config/locales"
|
35
35
|
When I run `localeapp -k MYAPIKEY pull`
|
36
36
|
Then the output should contain:
|
37
37
|
"""
|
@@ -42,5 +42,5 @@ Feature: Pulling all translation
|
|
42
42
|
Updating backend:
|
43
43
|
Success!
|
44
44
|
"""
|
45
|
-
|
46
|
-
|
45
|
+
And help should not be displayed
|
46
|
+
And a file named "config/locales/en.yml" should exist
|
data/features/push.feature
CHANGED
@@ -2,9 +2,9 @@ Feature: Pushing existing translation to localeapp
|
|
2
2
|
|
3
3
|
Scenario: Running push on a file
|
4
4
|
In order to send my translations
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
6
|
+
And an initializer file
|
7
|
+
And an empty file named "config/locales/en.yml"
|
8
8
|
When I run `localeapp push config/locales/en.yml`
|
9
9
|
Then the output should contain:
|
10
10
|
"""
|
@@ -15,14 +15,14 @@ Feature: Pushing existing translation to localeapp
|
|
15
15
|
|
16
16
|
config/locales/en.yml queued for processing.
|
17
17
|
"""
|
18
|
-
|
18
|
+
And help should not be displayed
|
19
19
|
|
20
20
|
Scenario: Running push on a directory
|
21
21
|
In order to send my translations
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
23
|
+
And an initializer file
|
24
|
+
And an empty file named "config/locales/en.yml"
|
25
|
+
And an empty file named "config/locales/es.yml"
|
26
26
|
When I run `localeapp push config/locales`
|
27
27
|
Then the output should contain:
|
28
28
|
"""
|
@@ -38,12 +38,12 @@ Feature: Pushing existing translation to localeapp
|
|
38
38
|
|
39
39
|
config/locales/es.yml queued for processing.
|
40
40
|
"""
|
41
|
-
|
41
|
+
And help should not be displayed
|
42
42
|
|
43
43
|
Scenario: Running push on a file with no initializer file, passing the key on the command line
|
44
44
|
In order to send my translations
|
45
|
-
|
46
|
-
|
45
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY"
|
46
|
+
And an empty file named "config/locales/en.yml"
|
47
47
|
When I run `localeapp -k MYAPIKEY push config/locales/en.yml`
|
48
48
|
Then the output should contain:
|
49
49
|
"""
|
@@ -54,4 +54,4 @@ Feature: Pushing existing translation to localeapp
|
|
54
54
|
|
55
55
|
config/locales/en.yml queued for processing.
|
56
56
|
"""
|
57
|
-
|
57
|
+
And help should not be displayed
|
data/features/rm.feature
CHANGED
@@ -2,8 +2,8 @@ Feature: Removing a translation from the command line
|
|
2
2
|
|
3
3
|
Scenario: Running rm
|
4
4
|
In order to remove an existing key
|
5
|
-
|
6
|
-
|
5
|
+
Given I have a valid project on localeapp.com with api key "MYAPIKEY" and the translation key "foo.bar"
|
6
|
+
And an initializer file
|
7
7
|
When I run `localeapp rm foo.bar`
|
8
8
|
Then the output should contain:
|
9
9
|
"""
|
@@ -13,7 +13,7 @@ When /^I have a valid heroku project/ do
|
|
13
13
|
uri = "https://api.localeapp.com/v1/projects/MYAPIKEY.json"
|
14
14
|
body = valid_project_data.to_json
|
15
15
|
add_fake_web_uri(:get, uri, ['200', 'OK'], body)
|
16
|
-
|
16
|
+
set_environment_variable 'CUCUMBER_HEROKU_TEST_API_KEY', 'MYAPIKEY'
|
17
17
|
end
|
18
18
|
|
19
19
|
When /^I have a valid project on localeapp\.com but an incorrect api key "([^"]*)"$/ do |bad_api_key|
|
@@ -47,11 +47,7 @@ When /^I have a valid project on localeapp\.com with api key "([^"]*)" and the t
|
|
47
47
|
end
|
48
48
|
|
49
49
|
When /^I have a LOCALEAPP_API_KEY env variable set to "(.*?)"$/ do |api_key|
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
Then /^I clear the LOCALEAPP_API_KEY env variable$/ do
|
54
|
-
ENV['LOCALEAPP_API_KEY'] = nil
|
50
|
+
set_environment_variable 'LOCALEAPP_API_KEY', api_key
|
55
51
|
end
|
56
52
|
|
57
53
|
When /^I have a \.env file containing the api key "(.*?)"$/ do |api_key|
|
data/features/support/env.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
require 'aruba/cucumber'
|
2
|
-
require 'aruba/jruby'
|
2
|
+
require 'aruba/config/jruby'
|
3
3
|
|
4
4
|
require File.expand_path(File.join(File.dirname(__FILE__), '../../spec/support/localeapp_integration_data'))
|
5
5
|
World(LocaleappIntegrationData)
|
6
6
|
|
7
|
-
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
8
|
-
|
9
7
|
module FakeWebHelper
|
10
8
|
def add_fake_web_uri(method, uri, status, body, headers = {})
|
11
|
-
fakes = JSON.parse(
|
9
|
+
fakes = JSON.parse(aruba.environment['FAKE_WEB_FAKES'] || '[]')
|
12
10
|
fakes << {
|
13
11
|
'method' => method,
|
14
12
|
'uri' => uri,
|
@@ -16,7 +14,7 @@ module FakeWebHelper
|
|
16
14
|
'body' => body,
|
17
15
|
'headers' => headers
|
18
16
|
}
|
19
|
-
|
17
|
+
set_environment_variable 'FAKE_WEB_FAKES', fakes.to_json
|
20
18
|
end
|
21
19
|
end
|
22
20
|
World(FakeWebHelper)
|
data/features/support/hooks.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Before do
|
2
|
-
|
2
|
+
set_environment_variable 'FAKE_WEB_DURING_CUCUMBER_RUN', '1'
|
3
3
|
@aruba_timeout_seconds = RUBY_PLATFORM == 'java' ? 60 : 15
|
4
4
|
end
|
5
5
|
|
6
6
|
# Globally @announce-cmd to track down slow cmd.
|
7
7
|
Aruba.configure do |config|
|
8
|
-
config.
|
9
|
-
puts "$
|
8
|
+
config.before :command do |cmd|
|
9
|
+
puts "$ #{cmd.commandline}"
|
10
10
|
end
|
11
11
|
end
|