one_sky 1.0.0 → 2.0.0
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.
- data/.rspec +2 -0
- data/Gemfile.lock +13 -13
- data/README.rdoc +51 -7
- data/Rakefile +17 -1
- data/lib/one_sky.rb +8 -9
- data/lib/one_sky/client.rb +80 -0
- data/lib/one_sky/platform.rb +36 -0
- data/lib/one_sky/project.rb +22 -114
- data/lib/one_sky/translation.rb +129 -0
- data/lib/one_sky/utility.rb +38 -0
- data/lib/one_sky/version.rb +1 -1
- data/one_sky.gemspec +4 -3
- data/spec/client_spec.rb +172 -0
- data/spec/files/example.po +2 -0
- data/spec/files/example.yml +5 -0
- data/spec/live_spec.rb +187 -0
- data/spec/platform_spec.rb +101 -0
- data/spec/project_spec.rb +67 -48
- data/spec/{helpers.rb → spec_helper.rb} +2 -2
- data/spec/translation_spec.rb +124 -0
- data/spec/utility_spec.rb +98 -0
- metadata +45 -21
- data/spec/data/en-us.po +0 -21
- data/spec/input_spec.rb +0 -64
- data/spec/output_spec.rb +0 -35
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: one_sky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -15,29 +15,29 @@ date: 2011-12-07 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: json
|
18
|
-
requirement: &
|
18
|
+
requirement: &70215713483240 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.4.
|
23
|
+
version: 1.4.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70215713483240
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rest-client
|
29
|
-
requirement: &
|
29
|
+
requirement: &70215713396900 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ! '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.4.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70215713396900
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rspec
|
40
|
-
requirement: &
|
40
|
+
requirement: &70215713808380 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
@@ -45,18 +45,29 @@ dependencies:
|
|
45
45
|
version: 2.2.0
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70215713808380
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: bundler
|
51
|
-
requirement: &
|
51
|
+
requirement: &70215713741580 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ! '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 1.0.0
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70215713741580
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: time_freeze
|
62
|
+
requirement: &70215713707880 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *70215713707880
|
60
71
|
description: OneSky is a community-powered translation service for web and mobile
|
61
72
|
apps. This gem is the core interface to the REST API and is used by other specialty
|
62
73
|
gems such the OneSky extension for I18n, i18n-one_sky.
|
@@ -69,6 +80,7 @@ extensions: []
|
|
69
80
|
extra_rdoc_files: []
|
70
81
|
files:
|
71
82
|
- .gitignore
|
83
|
+
- .rspec
|
72
84
|
- CHANGELOG
|
73
85
|
- CREDITS
|
74
86
|
- Gemfile
|
@@ -77,14 +89,22 @@ files:
|
|
77
89
|
- README.rdoc
|
78
90
|
- Rakefile
|
79
91
|
- lib/one_sky.rb
|
92
|
+
- lib/one_sky/client.rb
|
93
|
+
- lib/one_sky/platform.rb
|
80
94
|
- lib/one_sky/project.rb
|
95
|
+
- lib/one_sky/translation.rb
|
96
|
+
- lib/one_sky/utility.rb
|
81
97
|
- lib/one_sky/version.rb
|
82
98
|
- one_sky.gemspec
|
83
|
-
- spec/
|
84
|
-
- spec/
|
85
|
-
- spec/
|
86
|
-
- spec/
|
99
|
+
- spec/client_spec.rb
|
100
|
+
- spec/files/example.po
|
101
|
+
- spec/files/example.yml
|
102
|
+
- spec/live_spec.rb
|
103
|
+
- spec/platform_spec.rb
|
87
104
|
- spec/project_spec.rb
|
105
|
+
- spec/spec_helper.rb
|
106
|
+
- spec/translation_spec.rb
|
107
|
+
- spec/utility_spec.rb
|
88
108
|
homepage: http://rubygems.org/gems/one_sky
|
89
109
|
licenses: []
|
90
110
|
post_install_message:
|
@@ -110,9 +130,13 @@ signing_key:
|
|
110
130
|
specification_version: 3
|
111
131
|
summary: Ruby interface to the OneSky REST API
|
112
132
|
test_files:
|
113
|
-
- spec/
|
114
|
-
- spec/
|
115
|
-
- spec/
|
116
|
-
- spec/
|
133
|
+
- spec/client_spec.rb
|
134
|
+
- spec/files/example.po
|
135
|
+
- spec/files/example.yml
|
136
|
+
- spec/live_spec.rb
|
137
|
+
- spec/platform_spec.rb
|
117
138
|
- spec/project_spec.rb
|
139
|
+
- spec/spec_helper.rb
|
140
|
+
- spec/translation_spec.rb
|
141
|
+
- spec/utility_spec.rb
|
118
142
|
has_rdoc:
|
data/spec/data/en-us.po
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
msgid "This is the first line in the PO file."
|
2
|
-
msgstr ""
|
3
|
-
|
4
|
-
msgid "This is the second line in the PO file."
|
5
|
-
msgstr ""
|
6
|
-
|
7
|
-
msgid "And this is the last line in the PO file."
|
8
|
-
msgstr ""
|
9
|
-
|
10
|
-
msgid ""
|
11
|
-
"Project-Id-Version: rubysdkspec\n"
|
12
|
-
"POT-Creation-Date: 2010-12-16 19:29+0800\n"
|
13
|
-
"PO-Revision-Date: 2010-12-16 19:32+0800\n"
|
14
|
-
"Last-Translator: Junjun Olympia <romeo.olympia@gmail.com>\n"
|
15
|
-
"Language-Team: \n"
|
16
|
-
"MIME-Version: 1.0\n"
|
17
|
-
"Content-Type: text/plain; charset=UTF-8\n"
|
18
|
-
"Content-Transfer-Encoding: 8bit\n"
|
19
|
-
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
|
20
|
-
"X-Poedit-Basepath: .\n"
|
21
|
-
|
data/spec/input_spec.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require 'helpers'
|
3
|
-
|
4
|
-
describe "Project" do
|
5
|
-
include OneSkySpecHelpers
|
6
|
-
|
7
|
-
before do
|
8
|
-
@project = create_project
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#input" do
|
12
|
-
# We use the spec description as the string sent to OneSky for translation.
|
13
|
-
# ToDo: Make this DRY.
|
14
|
-
it "returns true for a normal translate request." do
|
15
|
-
@project.input("input returns true for a normal translate request.").should be_true
|
16
|
-
end
|
17
|
-
|
18
|
-
it "returns true when non-latin characters are passed (こんにちは世界)." do
|
19
|
-
@project.input("input returns true when non-latin characters are passed (こんにちは世界).").should be_true
|
20
|
-
end
|
21
|
-
|
22
|
-
it "returns true when optional parameters are passed." do
|
23
|
-
@project.input("input returns true when optional parameters are passed.",
|
24
|
-
:string_key => "string key", :string_context => "string context", :page => "page").should be_true
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "#input_bulk" do
|
29
|
-
it "returns true for a normal translate request." do
|
30
|
-
input = []
|
31
|
-
input << {:string => "input_bulk returns true for a normal translate request (A).", :string_key => "input_bulk.key.1.a", :context => "input_bulk.context.1.a"}
|
32
|
-
input << {:string => "input_bulk returns true for a normal translate request (B).", :string_key => "input_bulk.key.1.b", :context => "input_bulk.context.1.b"}
|
33
|
-
input << {:string => "input_bulk returns true for a normal translate request (C)." }
|
34
|
-
|
35
|
-
@project.input_bulk(input).should be_true
|
36
|
-
end
|
37
|
-
|
38
|
-
it "returns true when non-latin characters are passed (こんにちは世界)." do
|
39
|
-
input = []
|
40
|
-
input << {:string => "input_bulk returns true when non-latin characters are passed (こんにちは世界) (A).", :string_key => "input_bulk.key.2.a", :context => "input_bulk.context.2.a"}
|
41
|
-
input << {:string => "input_bulk returns true when non-latin characters are passed (こんにちは世界) (B).", :string_key => "input_bulk.key.2.b", :context => "input_bulk.context.2.b"}
|
42
|
-
input << {:string => "input_bulk returns true when non-latin characters are passed (こんにちは世界) (C)." }
|
43
|
-
|
44
|
-
@project.input_bulk(input).should be_true
|
45
|
-
end
|
46
|
-
|
47
|
-
it "returns true when optional parameters are passed." do
|
48
|
-
input = []
|
49
|
-
input << {:string => "input_bulk returns true when optional parameters are passed (A).", :string_key => "input_bulk.key.3.a", :context => "input_bulk.context.3.a"}
|
50
|
-
input << {:string => "input_bulk returns true when optional parameters are passed (B).", :string_key => "input_bulk.key.3.b", :context => "input_bulk.context.3.b"}
|
51
|
-
input << {:string => "input_bulk returns true when optional parameters are passed (C)." }
|
52
|
-
|
53
|
-
@project.input_bulk(input, {:page => "input_bulk.page.3"}).should be_true
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "#input_po" do
|
58
|
-
it "returns true after uploading a file." do
|
59
|
-
file_name = "#{File.dirname(__FILE__)}/data/en-us.po"
|
60
|
-
@project.input_po("en-us", file_name).should be_true
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
data/spec/output_spec.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require 'helpers'
|
3
|
-
|
4
|
-
describe "Project" do
|
5
|
-
include OneSkySpecHelpers
|
6
|
-
|
7
|
-
before do
|
8
|
-
@project = create_project
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#output" do
|
12
|
-
it "returns a hash with a parent key called 'Default'" do
|
13
|
-
@project.output.has_key?("Default").should be_true
|
14
|
-
end
|
15
|
-
|
16
|
-
it "returns a hash with a parent key called 'Default' when optional parameters are passed." do
|
17
|
-
@project.output({:context => "Default"}).has_key?("Default").should be_true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "#output_mo" do
|
22
|
-
it "creates a file." do
|
23
|
-
file_name = "#{File.dirname(__FILE__)}/data/output.mo"
|
24
|
-
@project.output_mo("en-us", file_name)
|
25
|
-
File.exists?(file_name).should be_true
|
26
|
-
File.delete(file_name)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "raises an error if an invalid language code is supplied." do
|
30
|
-
file_name = "#{File.dirname(__FILE__)}/data/output.2.mo"
|
31
|
-
lambda { @project.output_mo("en-xx", file_name) }.should raise_error
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|