zedlocales 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -25,11 +25,14 @@ begin
25
25
  gem.summary = %Q{gem for localization support in Zedkit applications}
26
26
  gem.description = %Q{gem for localization support in Zedkit applications to generate locale files and load translations via the Zedkit API}
27
27
 
28
- gem.email = "ejw@zedkit.com"
29
- gem.homepage = "http://github.com/ejw/zedlocales"
30
- gem.authors = ["Eric Woodward"]
28
+ gem.email = "support@zedkit.com"
29
+ gem.homepage = "http://github.com/zedkit/zedlocales"
30
+ gem.authors = ["Zedkit"]
31
31
  gem.rubyforge_project = "zedlocales"
32
+
32
33
  gem.files = FileList['[A-Z]*', 'lib/**/*.rb', 'lib/tasks/*.rake', 'test/**/*.rb']
34
+ gem.executables = %w(zedlocales)
35
+ gem.default_executable = %q{zedlocales}
33
36
 
34
37
  gem.add_dependency 'zedkit', '>= 1.1.0'
35
38
  gem.add_dependency 'json', '>= 1.4.4'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 1.1.3
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ ##
3
+ # Copyright (c) Zedkit.
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
6
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
7
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
8
+ # Software is furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11
+ # Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
16
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ ##
18
+
19
+ require 'zedlocales'
20
+
21
+ Dir["#{File.dirname(__FILE__)}/../lib/cli/*.rb"].each {|ci| require ci }
22
+
23
+ Zedlocales::CLI::Runner.new.go!
@@ -0,0 +1,20 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ Zedkit.configure do |zk|
19
+ zk.exceptions = true
20
+ end
@@ -0,0 +1,33 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ module Zedlocales
19
+ module CLI
20
+ class Projects < Zedkit::CLI::Bottom
21
+ class << self
22
+ def list(opts = {})
23
+ puts "\n Still TBD\n\n"
24
+ end
25
+
26
+ def codes(opts = {})
27
+ puts "\n Still TBD\n\n"
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,37 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ module Zedlocales
19
+ module CLI
20
+ class Runner < Zedkit::CLI::Runner
21
+ SECTIONS = ['sections','scopes','content']
22
+
23
+ protected
24
+ def just_do_it
25
+ klass = Object.const_get('Zedlocales').const_get('CLI').const_get(section.capitalize)
26
+ klass.send command.to_sym, :user_key => user_key, :items => items_to_key_value_hash, :argv => ARGV
27
+ end
28
+ def map
29
+ "\n" \
30
+ << "== Project Commands\n\n" \
31
+ << "list <uuid> # List project content structure\n" \
32
+ << "codes # Outline applicable entity codes for ZedDB\n\n" \
33
+ << "==\n\n"
34
+ end
35
+ end
36
+ end
37
+ end
@@ -18,11 +18,5 @@
18
18
  namespace :zedlocales do
19
19
  desc "Generates the project's locale files with the latest content and translations"
20
20
  task :generate => :environment do
21
-
22
- # puts "Acquiring Locale for Simple Backend [#{locale}]..."
23
- # puts "DONE"
24
-
25
- Zedlocales::Client.get_locales
26
-
27
21
  end
28
22
  end
@@ -20,10 +20,12 @@ require 'zedkit'
20
20
 
21
21
  module Zedlocales
22
22
  class << self
23
- def entities(user_key)
24
- reshh = Zedkit::Client.get('v1/entities/zedlocales', user_key)
25
- yield(reshh) if (not reshh.nil?) && block_given?
26
- reshh
23
+ def entities
24
+ rs = Zedkit::Client.get('entities/zedlocales')
25
+ if rs && block_given?
26
+ rs.is_a?(Array) ? rs.each {|i| yield(i) } : yield(rs)
27
+ end
28
+ rs
27
29
  end
28
30
  end
29
31
  end
@@ -33,5 +35,6 @@ require 'zedlocales/content_sections'
33
35
  require 'zedlocales/content_scopes'
34
36
  require 'zedlocales/content'
35
37
  require 'zedlocales/translations'
38
+
36
39
  require 'zedlocales/simple'
37
40
  require 'zedlocales/railtie' if defined?(Rails::Railtie)
@@ -19,12 +19,8 @@ module Zedlocales
19
19
  class Content
20
20
  class Translations
21
21
  class << self
22
- def get(*args)
23
- zopts = args.extract_zedkit_options!
24
- reshh = Zedkit::Client.get("content/translations/#{zopts[:uuid]}", zopts[:user_key],
25
- zopts.zdelete_keys!(%w(user_key)))
26
- yield(reshh) if (not reshh.nil?) && block_given?
27
- reshh
22
+ def get(zks = {}, &block)
23
+ Zedkit::Client.crud(:get, "content/translations", zks, [], &block)
28
24
  end
29
25
  end
30
26
  end
@@ -67,34 +63,20 @@ module Zedlocales
67
63
  # end
68
64
  #
69
65
 
70
- def get(*args)
71
- zopts = args.extract_zedkit_options!
72
- reshh = Zedkit::Client.get("content/content/#{zopts[:uuid]}", zopts[:user_key],
73
- zopts.zdelete_keys!(%w(uuid user_key)))
74
- yield(reshh) if (not reshh.nil?) && block_given?
75
- reshh
66
+ def get(zks = {}, &block)
67
+ Zedkit::Client.crud(:get, "content/content/#{zks[:uuid]}", zks, [], &block)
76
68
  end
77
69
 
78
- def create(*args)
79
- zopts = args.extract_zedkit_options!
80
- reshh = Zedkit::Client.create('content/content', zopts[:user_key], zopts.zdelete_keys!(%w(user_key)))
81
- yield(reshh) if (not reshh.nil?) && block_given?
82
- reshh
70
+ def create(zks = {}, &block)
71
+ Zedkit::Client.crud(:create, 'content/content', zks, [], &block)
83
72
  end
84
73
 
85
- def update(*args)
86
- zopts = args.extract_zedkit_options!
87
- reshh = Zedkit::Client.update("content/content/#{zopts[:uuid]}", zopts[:user_key],
88
- zopts.zdelete_keys!(%w(uuid user_key)))
89
- yield(reshh) if (not reshh.nil?) && block_given?
90
- reshh
74
+ def update(zks = {}, &block)
75
+ Zedkit::Client.crud(:update, "content/content/#{zks[:uuid]}", zks, [], &block)
91
76
  end
92
77
 
93
- def delete(*args)
94
- zopts = args.extract_zedkit_options!
95
- reshh = Zedkit::Client.delete("content/content/#{zopts[:uuid]}", zopts[:user_key])
96
- yield(reshh) if (not reshh.nil?) && block_given?
97
- reshh
78
+ def delete(zks = {}, &block)
79
+ Zedkit::Client.crud(:delete, "content/content/#{zks[:uuid]}", zks, [], &block)
98
80
  end
99
81
  end
100
82
  end
@@ -19,15 +19,12 @@ module Zedlocales
19
19
  class ContentScopes
20
20
  class Content
21
21
  class << self
22
- def get(*args)
23
- zopts = args.extract_zedkit_options!
24
- reshh = Zedkit::Client.get('content/content', zopts[:user_key], zopts.zdelete_keys!(%w(user_key)))
25
- yield(reshh) if (not reshh.nil?) && block_given?
26
- reshh
22
+ def get(zks = {}, &block)
23
+ Zedkit::Client.crud(:get, "content/content", zks, [], &block)
27
24
  end
28
25
  end
29
26
  end
30
-
27
+
31
28
  class << self
32
29
  #
33
30
  # = Zedlocales Content Scopes
@@ -66,34 +63,20 @@ module Zedlocales
66
63
  # end
67
64
  #
68
65
 
69
- def get(*args)
70
- zopts = args.extract_zedkit_options!
71
- reshh = Zedkit::Client.get("content/scopes/#{zopts[:uuid]}", zopts[:user_key],
72
- zopts.zdelete_keys!(%w(uuid user_key)))
73
- yield(reshh) if (not reshh.nil?) && block_given?
74
- reshh
66
+ def get(zks = {}, &block)
67
+ Zedkit::Client.crud(:get, "content/scopes/#{zks[:uuid]}", zks, [], &block)
75
68
  end
76
69
 
77
- def create(*args)
78
- zopts = args.extract_zedkit_options!
79
- reshh = Zedkit::Client.create('content/scopes', zopts[:user_key], zopts.zdelete_keys!(%w(user_key)))
80
- yield(reshh) if (not reshh.nil?) && block_given?
81
- reshh
70
+ def create(zks = {}, &block)
71
+ Zedkit::Client.crud(:create, 'content/scopes', zks, [], &block)
82
72
  end
83
73
 
84
- def update(*args)
85
- zopts = args.extract_zedkit_options!
86
- reshh = Zedkit::Client.update("content/scopes/#{zopts[:uuid]}", zopts[:user_key],
87
- zopts.zdelete_keys!(%w(uuid user_key)))
88
- yield(reshh) if (not reshh.nil?) && block_given?
89
- reshh
74
+ def update(zks = {}, &block)
75
+ Zedkit::Client.crud(:update, "content/scopes/#{zks[:uuid]}", zks, [], &block)
90
76
  end
91
77
 
92
- def delete(*args)
93
- zopts = args.extract_zedkit_options!
94
- reshh = Zedkit::Client.delete("content/scopes/#{zopts[:uuid]}", zopts[:user_key])
95
- yield(reshh) if (not reshh.nil?) && block_given?
96
- reshh
78
+ def delete(zks = {}, &block)
79
+ Zedkit::Client.crud(:delete, "content/scopes/#{zks[:uuid]}", zks, [], &block)
97
80
  end
98
81
  end
99
82
  end
@@ -19,15 +19,12 @@ module Zedlocales
19
19
  class ContentSections
20
20
  class ContentScopes
21
21
  class << self
22
- def get(*args)
23
- zopts = args.extract_zedkit_options!
24
- reshh = Zedkit::Client.get('content/scopes', zopts[:user_key], zopts.zdelete_keys!(%w(user_key)))
25
- yield(reshh) if (not reshh.nil?) && block_given?
26
- reshh
22
+ def get(zks = {}, &block)
23
+ Zedkit::Client.crud(:get, "content/scopes", zks, [], &block)
27
24
  end
28
25
  end
29
26
  end
30
-
27
+
31
28
  class << self
32
29
  #
33
30
  # = Zedlocales Content Sections
@@ -66,34 +63,20 @@ module Zedlocales
66
63
  # end
67
64
  #
68
65
 
69
- def get(*args)
70
- zopts = args.extract_zedkit_options!
71
- reshh = Zedkit::Client.get("content/sections/#{zopts[:uuid]}", zopts[:user_key],
72
- zopts.zdelete_keys!(%w(uuid user_key)))
73
- yield(reshh) if (not reshh.nil?) && block_given?
74
- reshh
66
+ def get(zks = {}, &block)
67
+ Zedkit::Client.crud(:get, "content/sections/#{zks[:uuid]}", zks, [], &block)
75
68
  end
76
69
 
77
- def create(*args)
78
- zopts = args.extract_zedkit_options!
79
- reshh = Zedkit::Client.create('content/sections', zopts[:user_key], zopts.zdelete_keys!(%w(user_key)))
80
- yield(reshh) if (not reshh.nil?) && block_given?
81
- reshh
70
+ def create(zks = {}, &block)
71
+ Zedkit::Client.crud(:create, 'content/sections', zks, [], &block)
82
72
  end
83
73
 
84
- def update(*args)
85
- zopts = args.extract_zedkit_options!
86
- reshh = Zedkit::Client.update("content/sections/#{zopts[:uuid]}", zopts[:user_key],
87
- zopts.zdelete_keys!(%w(uuid user_key)))
88
- yield(reshh) if (not reshh.nil?) && block_given?
89
- reshh
74
+ def update(zks = {}, &block)
75
+ Zedkit::Client.crud(:update, "content/sections/#{zks[:uuid]}", zks, [], &block)
90
76
  end
91
77
 
92
- def delete(*args)
93
- zopts = args.extract_zedkit_options!
94
- reshh = Zedkit::Client.delete("content/sections/#{zopts[:uuid]}", zopts[:user_key])
95
- yield(reshh) if (not reshh.nil?) && block_given?
96
- reshh
78
+ def delete(zks = {}, &block)
79
+ Zedkit::Client.crud(:delete, "content/sections/#{zks[:uuid]}", zks, [], &block)
97
80
  end
98
81
  end
99
82
  end
@@ -19,46 +19,29 @@ module Zedkit
19
19
  class Projects
20
20
  class ContentSections
21
21
  class << self
22
- def get(*args)
23
- zopts = args.extract_zedkit_options!
24
- reshh = Zedkit::Client.get('content/sections', zopts[:user_key], zopts.zdelete_keys!(%w(user_key)))
25
- yield(reshh) if (not reshh.nil?) && block_given?
26
- reshh
22
+ def get(zks = {}, &block)
23
+ Zedkit::Client.crud(:get, "content/sections", zks, [], &block)
27
24
  end
28
25
  end
29
26
  end
30
27
 
31
28
  class Locales
32
29
  class << self
33
- def get(*args)
34
- zopts = args.extract_zedkit_options!
35
- reshh = Zedkit::Client.get("projects/#{zopts[:project][:uuid]}/locales", zopts[:user_key])
36
- yield(reshh) if (not reshh.nil?) && block_given?
37
- reshh
30
+ def get(zks = {}, &block)
31
+ Zedkit::Client.crud(:get, "projects/#{zks[:project][:uuid]}/locales", zks, %w(project), &block)
38
32
  end
39
33
 
40
- def create(*args)
41
- zopts = args.extract_zedkit_options!
42
- reshh = Zedkit::Client.create("projects/#{zopts[:project][:uuid]}/locales", zopts[:user_key],
43
- zopts.zdelete_keys!(%w(user_key project)))
44
- yield(reshh) if (not reshh.nil?) && block_given?
45
- reshh
34
+ def create(zks = {}, &block)
35
+ Zedkit::Client.crud(:create, "projects/#{zks[:project][:uuid]}/locales", zks, %w(project), &block)
46
36
  end
47
37
 
48
- def update(*args)
49
- zopts = args.extract_zedkit_options!
50
- reshh = Zedkit::Client.update("projects/#{zopts[:project][:uuid]}/locales/#{zopts[:locale][:code]}",
51
- zopts[:user_key], zopts.zdelete_keys!(%w(user_key project)))
52
- yield(reshh) if (not reshh.nil?) && block_given?
53
- reshh
38
+ def update(zks = {}, &block)
39
+ Zedkit::Client.crud(:update,
40
+ "projects/#{zks[:project][:uuid]}/locales/#{zks[:locale][:code]}", zks, %w(project), &block)
54
41
  end
55
42
 
56
- def delete(*args)
57
- zopts = args.extract_zedkit_options!
58
- reshh = Zedkit::Client.delete("projects/#{zopts[:project][:uuid]}/locales/#{zopts[:locale][:code]}",
59
- zopts[:user_key])
60
- yield(reshh) if (not reshh.nil?) && block_given?
61
- reshh
43
+ def delete(zks = {}, &block)
44
+ Zedkit::Client.crud(:delete, "projects/#{zks[:project][:uuid]}/locales/#{zks[:locale][:code]}", zks, [], &block)
62
45
  end
63
46
  end
64
47
  end
@@ -40,7 +40,8 @@ module Zedlocales
40
40
 
41
41
  private
42
42
  def locale_head
43
- tmps = "##\n"
43
+ tmps = "# encoding: UTF-8\n"
44
+ tmps << "##\n"
44
45
  tmps << "# DO NOT EDIT THIS FILE.\n"
45
46
  tmps << "# This locale file is auto-generated from the ZedAPI by the ZedLocales Ruby gem. Any manual updates to an rb\n"
46
47
  tmps << "# file will be lost when this file is regenerated, with this current file only versioned once, or discarded.\n"
@@ -18,35 +18,23 @@
18
18
  module Zedlocales
19
19
  class Translations
20
20
  class << self
21
- def get(*args)
22
- zopts = args.extract_zedkit_options!
23
- reshh = Zedkit::Client.get("content/translations/#{zopts[:uuid]}", zopts[:user_key],
24
- zopts.zdelete_keys!(%w(uuid user_key)))
25
- yield(reshh) if (not reshh.nil?) && block_given?
26
- reshh
21
+ def get(zks = {}, &block)
22
+ Zedkit::Client.crud(:get, "content/translations/#{zks[:uuid]}", zks, [], &block)
27
23
  end
28
24
 
29
- def create(*args)
30
- zopts = args.extract_zedkit_options!
31
- reshh = Zedkit::Client.create('content/translations', zopts[:user_key], zopts.zdelete_keys!(%w(user_key)))
32
- yield(reshh) if (not reshh.nil?) && block_given?
33
- reshh
25
+ def create(zks = {}, &block)
26
+ Zedkit::Client.crud(:create, 'content/translations', zks, [], &block)
34
27
  end
35
28
 
36
- def update(*args)
37
- zopts = args.extract_zedkit_options!
38
- reshh = Zedkit::Client.update("content/translations/#{zopts[:uuid]}", zopts[:user_key],
39
- zopts.zdelete_keys!(%w(uuid user_key)))
40
- yield(reshh) if (not reshh.nil?) && block_given?
41
- reshh
29
+ def update(zks = {}, &block)
30
+ Zedkit::Client.crud(:update, "content/translations/#{zks[:uuid]}", zks, [], &block)
42
31
  end
43
32
 
44
- def delete(*args)
45
- zopts = args.extract_zedkit_options!
46
- reshh = Zedkit::Client.delete("content/translations/#{zopts[:uuid]}", zopts[:user_key])
47
- yield(reshh) if (not reshh.nil?) && block_given?
48
- reshh
33
+ def delete(zks = {}, &block)
34
+ Zedkit::Client.crud(:delete, "content/translations/#{zks[:uuid]}", zks, [], &block)
49
35
  end
50
36
  end
51
37
  end
52
38
  end
39
+
40
+
@@ -24,14 +24,14 @@ class TestContent < Test::Unit::TestCase
24
24
  assert_equal 2, tt.length
25
25
  end
26
26
 
27
- def test_get_content
27
+ def test_get
28
28
  cs = Zedlocales::ContentScopes::Content.get(:user_key => @uu['user_key'], :scope => { :uuid => con_scopes[0]['uuid'] })
29
29
  cc = Zedlocales::Content.get(:user_key => @uu['user_key'], :uuid => cs[0]['uuid'])
30
30
  assert_equal 'whatever', cc['key']
31
31
  assert_equal cs[0]['uuid'], cc['uuid']
32
32
  end
33
33
 
34
- def test_create_content
34
+ def test_create
35
35
  cc = Zedlocales::Content.create(:user_key => @uu['user_key'], :scope => { :uuid => con_scopes[0]['uuid'] },
36
36
  :content => { :key => 'yo', :content => 'yo yo' })
37
37
  assert_equal 32, cc['uuid'].length
@@ -39,7 +39,7 @@ class TestContent < Test::Unit::TestCase
39
39
  assert_equal 'yo yo', cc['content']
40
40
  end
41
41
 
42
- def test_update_content
42
+ def test_update
43
43
  cs = Zedlocales::ContentScopes::Content.get(:user_key => @uu['user_key'], :scope => { :uuid => con_scopes[0]['uuid'] })
44
44
  cc = Zedlocales::Content.update(:user_key => @uu['user_key'], :uuid => cs[0]['uuid'], :content => { :content => 'yo' })
45
45
  assert_equal cs[0]['uuid'], cc['uuid']
@@ -47,9 +47,8 @@ class TestContent < Test::Unit::TestCase
47
47
  assert_equal 'yo', cc['content']
48
48
  end
49
49
 
50
- def test_destroy_content
50
+ def test_destroy
51
51
  cs = Zedlocales::ContentScopes::Content.get(:user_key => @uu['user_key'], :scope => { :uuid => con_scopes[0]['uuid'] })
52
- cc = Zedlocales::Content.delete(:user_key => @uu['user_key'], :uuid => cs[0]['uuid'])
53
- assert_equal cc, {}
52
+ assert_nil Zedlocales::Content.delete(:user_key => @uu['user_key'], :uuid => cs[0]['uuid'])
54
53
  end
55
54
  end
@@ -24,26 +24,25 @@ class TestContentScopes < Test::Unit::TestCase
24
24
  assert_equal 'whatever', cs[0]['key']
25
25
  end
26
26
 
27
- def test_get_content_scope
27
+ def test_get
28
28
  cs = Zedlocales::ContentScopes.get(:user_key => @uu['user_key'], :uuid => con_scopes[0]['uuid'])
29
29
  assert_equal 'whatever', cs['key']
30
30
  end
31
31
 
32
- def test_create_content_scope
32
+ def test_create
33
33
  cs = Zedlocales::ContentScopes.create(:user_key => @uu['user_key'],
34
34
  :section => { :uuid => con_sections[0]['uuid'] }, :scope => { :key => 'neww' })
35
35
  assert_equal 'neww', cs['key']
36
36
  assert_equal 32, cs['uuid'].length
37
37
  end
38
38
 
39
- def test_update_content_scope
39
+ def test_update
40
40
  cs = Zedlocales::ContentScopes.update(:user_key => @uu['user_key'],
41
41
  :uuid => con_scopes[0]['uuid'], :scope => { :key => "updated" })
42
42
  assert_equal 'updated', cs['key']
43
43
  end
44
44
 
45
- def test_delete_content_scope
46
- cs = Zedlocales::ContentScopes.delete(:user_key => @uu['user_key'], :uuid => con_scopes[0]['uuid'])
47
- assert_equal cs, {}
45
+ def test_delete
46
+ assert_nil Zedlocales::ContentScopes.delete(:user_key => @uu['user_key'], :uuid => con_scopes[0]['uuid'])
48
47
  end
49
48
  end
@@ -25,26 +25,26 @@ class TestContentSections < Test::Unit::TestCase
25
25
  assert_equal 'whatever', ss[0]['key']
26
26
  end
27
27
 
28
- def test_get_content_section
28
+ def test_get
29
29
  ss = Zedlocales::ContentSections.get(:user_key => @uu['user_key'], :uuid => con_sections[0]['uuid'])
30
30
  assert_equal 'whatever', ss['key']
31
31
  assert_equal 32, ss['uuid'].length
32
32
  end
33
33
 
34
- def test_create_content_section
34
+ def test_create
35
35
  ss = Zedlocales::ContentSections.create(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
36
36
  :section => { :key => 'newsection' })
37
37
  assert_equal 32, ss['uuid'].length
38
38
  assert_equal 'newsection', ss['key']
39
39
  end
40
40
 
41
- def test_update_content_section
41
+ def test_update
42
42
  ss = Zedlocales::ContentSections.update(:user_key => @uu['user_key'],
43
43
  :uuid => con_sections[0]['uuid'], :section => { :key => 'updatedsection' })
44
44
  assert_equal 'updatedsection', ss['key']
45
45
  end
46
46
 
47
- def test_delete_content_section
48
- assert_equal Zedlocales::ContentSections.delete(:user_key => @uu['user_key'], :uuid => con_sections[0]['uuid']), {}
47
+ def test_delete
48
+ assert_nil Zedlocales::ContentSections.delete(:user_key => @uu['user_key'], :uuid => con_sections[0]['uuid'])
49
49
  end
50
50
  end
@@ -50,9 +50,7 @@ class TestProjects < Test::Unit::TestCase
50
50
  end
51
51
 
52
52
  def test_delete_locale_connection
53
- pl = Zedkit::Projects::Locales.delete(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
54
- :locale => { :code => 'fr'})
55
- assert pl.is_a? Hash
56
- assert_equal pl, {}
53
+ assert_nil Zedkit::Projects::Locales.delete(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
54
+ :locale => { :code => 'fr'})
57
55
  end
58
56
  end
@@ -18,14 +18,14 @@
18
18
  require 'helper'
19
19
 
20
20
  class TestContent < Test::Unit::TestCase
21
- def test_get_translation
21
+ def test_get
22
22
  cs = Zedlocales::ContentScopes::Content.get(:user_key => @uu['user_key'], :scope => { :uuid => con_scopes[0]['uuid'] })
23
23
  cc = Zedlocales::Content::Translations.get(:user_key => @uu['user_key'], :content => { :uuid => cs[0]['uuid'] })
24
24
  tt = Zedlocales::Translations.get(:user_key => @uu['user_key'], :uuid => cc[0]['uuid'])
25
25
  assert_equal tt['content']['uuid'], cs[0]['uuid']
26
26
  end
27
27
 
28
- def test_create_translation
28
+ def test_create
29
29
  cs = Zedlocales::ContentScopes::Content.get(:user_key => @uu['user_key'], :scope => { :uuid => con_scopes[0]['uuid'] })
30
30
  tt = Zedlocales::Translations.create(:user_key => @uu['user_key'], :content => { :uuid => cs[0]['uuid'] },
31
31
  :translation => { :locale => 'de', :source => 'ZEDKIT', :translation => 'yo' })
@@ -33,7 +33,7 @@ class TestContent < Test::Unit::TestCase
33
33
  assert_equal 'yo', tt['translation']
34
34
  end
35
35
 
36
- def test_update_translation
36
+ def test_update
37
37
  cs = Zedlocales::ContentScopes::Content.get(:user_key => @uu['user_key'], :scope => { :uuid => con_scopes[0]['uuid'] })
38
38
  cc = Zedlocales::Content::Translations.get(:user_key => @uu['user_key'], :content => { :uuid => cs[0]['uuid'] })
39
39
  tt = Zedlocales::Translations.update(:user_key => @uu['user_key'],
@@ -43,10 +43,9 @@ class TestContent < Test::Unit::TestCase
43
43
  assert_equal 'yo', tt['translation']
44
44
  end
45
45
 
46
- def test_destroy_translation
46
+ def test_destroy
47
47
  cs = Zedlocales::ContentScopes::Content.get(:user_key => @uu['user_key'], :scope => { :uuid => con_scopes[0]['uuid'] })
48
48
  cc = Zedlocales::Content::Translations.get(:user_key => @uu['user_key'], :content => { :uuid => cs[0]['uuid'] })
49
- tt = Zedlocales::Translations.get(:user_key => @uu['user_key'], :uuid => cc[0]['uuid'])
50
- assert_equal tt['content']['uuid'], cs[0]['uuid']
49
+ assert_nil Zedlocales::Translations.delete(:user_key => @uu['user_key'], :uuid => cc[0]['uuid'])
51
50
  end
52
51
  end
metadata CHANGED
@@ -5,17 +5,17 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 2
9
- version: 1.1.2
8
+ - 3
9
+ version: 1.1.3
10
10
  platform: ruby
11
11
  authors:
12
- - Eric Woodward
12
+ - Zedkit
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-19 00:00:00 -08:00
18
- default_executable:
17
+ date: 2011-01-06 00:00:00 -08:00
18
+ default_executable: zedlocales
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: zedkit
@@ -61,9 +61,9 @@ dependencies:
61
61
  type: :runtime
62
62
  version_requirements: *id003
63
63
  description: gem for localization support in Zedkit applications to generate locale files and load translations via the Zedkit API
64
- email: ejw@zedkit.com
65
- executables: []
66
-
64
+ email: support@zedkit.com
65
+ executables:
66
+ - zedlocales
67
67
  extensions: []
68
68
 
69
69
  extra_rdoc_files:
@@ -74,6 +74,9 @@ files:
74
74
  - README.rdoc
75
75
  - Rakefile
76
76
  - VERSION
77
+ - lib/cli/config.rb
78
+ - lib/cli/projects.rb
79
+ - lib/cli/runner.rb
77
80
  - lib/tasks/generate.rake
78
81
  - lib/zedlocales.rb
79
82
  - lib/zedlocales/content.rb
@@ -91,8 +94,9 @@ files:
91
94
  - test/test_projects.rb
92
95
  - test/test_simple_backend.rb
93
96
  - test/test_translations.rb
97
+ - bin/zedlocales
94
98
  has_rdoc: true
95
- homepage: http://github.com/ejw/zedlocales
99
+ homepage: http://github.com/zedkit/zedlocales
96
100
  licenses: []
97
101
 
98
102
  post_install_message: