translator_with_localeapp 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 787b142325f9c37a78279d612dcbf9c2907869da
4
- data.tar.gz: c02c9a17a1da150c276c8e8443d8fdb523d65cf2
3
+ metadata.gz: 125c26c160ea1d1f7b8442bc822580d19e3a50b1
4
+ data.tar.gz: 0488e7568c19cfe839b34cce0996770e4807d0c7
5
5
  SHA512:
6
- metadata.gz: 50f25f941e07140ebe6b68c4acbe3e3d0d0fe8e2a689f1ea54e95df83c162a42a63bc2faa2cd9e66b461e40455bd1997c84e55e98d1dabb6542fc396280c8c84
7
- data.tar.gz: eb32d162808540c111d63453d6b5dab8fee822bfd62fa532c530f24f3837a0ff687f562e5e5241739b594e6d747c4ec1f985c30fc3facf8c920f77f6862790c7
6
+ metadata.gz: 061145c7ee07caded3a7f430f6e2ab1282d8a7bfab117a6d1ecf1063a7c9bf78e85d59732906d145850a4813015827ba9fb2e20669f725f1b46f9ce3131de320
7
+ data.tar.gz: 15fa0dc7bc88a19d08d057f742665c49ef5784a09807957fe615faf4f70dc0760b9798709e4a1e0f739aa92957ff07cd1a955909c92509a342314f62ea21d187
data/README.md CHANGED
@@ -1,2 +1,114 @@
1
1
  Translator
2
2
  -------
3
+
4
+ It is an utility through which you can synchronize your locales with [Localapp](https://www.localeapp.com).
5
+
6
+ Installation
7
+ -------
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'translator_with_localeapp', '~> 1.0.1'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ ```shell
18
+ $ bundle install
19
+ ```
20
+
21
+ Or install it yourself as:
22
+
23
+ ```shell
24
+ $ gem install translator_with_localeapp
25
+ ```
26
+
27
+
28
+ Usage
29
+ -------
30
+ With _Redis_:
31
+
32
+ ```ruby
33
+ require 'redis'
34
+ require 'translator'
35
+
36
+
37
+ Translator.setup do |config|
38
+ # ==> Storage Configurations
39
+ # config.storage = :Redis
40
+ # config.storage_options = { host: 'localhost', port: 6379, db: 1 }
41
+
42
+ # ==> Output Configuration
43
+ # By default there is no logging, you can set it to any output
44
+ # stream which respond to `puts`.
45
+ # config.output_stream = nil
46
+
47
+ # ==> Localeapp Configuration
48
+ config.localeapp_api_key = ENV['LOCALEAPP_API_KEY']
49
+ # It is the directory where localeapp will sync all the locales files.
50
+ config.data_directory = Rails.root.join('config', 'locales')
51
+ end
52
+
53
+ file_paths = <paths of yml files>
54
+ Translator.load!(file_paths)
55
+
56
+ ```
57
+
58
+ ## Storage
59
+
60
+ Uses [moneta](https://github.com/minad/moneta) gem to wrap various Key/Value stores
61
+ Docs for moneta can be found [here](http://www.rubydoc.info/gems/moneta/frames)
62
+
63
+ Parameters:
64
+ - `name` (Symbol) — Name of adapter (See [Moneta::Adapters](http://www.rubydoc.info/gems/moneta/Moneta/Adapters))
65
+ - `options` (Hash) (defaults to: {})
66
+
67
+ Options Hash (options):
68
+ - `:expires` (Boolean/Integer) — Ensure that store supports expiration by inserting Expires if the underlying adapter doesn't support it natively and set default expiration time
69
+ - `:threadsafe` (Boolean) — default: false — Ensure that the store is thread safe by inserting Moneta::Lock
70
+ - `:logger` (Boolean/Hash) — default: false — Add logger to proxy stack (Hash is passed to logger as options)
71
+ - `:compress` (Boolean/Symbol) — default: false — If true, compress value with zlib, or specify custom compress, e.g. :quicklz
72
+ - `:serializer` (Symbol) — default: :marshal — Serializer used for key and value, disable with nil
73
+ - `:key_serializer` (Symbol) — default: options[:serializer] — Serializer used for key, disable with nil
74
+ - `:value_serializer` (Symbol) — default: options[:serializer] — Serializer used for value, disable with nil
75
+ - `:prefix` (String) — Key prefix used for namespacing (default none)
76
+
77
+ ### Redis
78
+
79
+ See [redis-db](https://github.com/redis/redis-rb) for options
80
+
81
+ #### Install Redis
82
+
83
+ `brew install redis`(Mac)
84
+
85
+ OR
86
+
87
+ `sudo apt-get install redis`(Ubuntu)
88
+
89
+ #### Start Redis
90
+
91
+ `redis-server`
92
+
93
+ Testing
94
+ -------
95
+
96
+ Ensure Redis server is installed and started.
97
+
98
+ ```shell
99
+ $ bundle install
100
+ $ bundle exec rspec spec
101
+ ```
102
+
103
+
104
+ Contributing
105
+ -------
106
+
107
+ ```
108
+ 1. Fork it ( https://github.com/kuldeepaggarwal/translator/fork ).
109
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
110
+ 3. Add test cases and verify all tests are green.
111
+ 4. Commit your changes (`git commit -am 'Add some feature'`).
112
+ 5. Push to the branch (`git push origin my-new-feature`).
113
+ 6. Create new Pull Request.
114
+ ```
@@ -12,7 +12,9 @@ module Translator
12
12
  @options = options # can be removed
13
13
  @storage = Moneta.new(type, options)
14
14
  end
15
- def_delegators :@storage, :key?, :clear
15
+ def_delegators :@storage, :key?, :clear, :adapter
16
+ def_delegators :adapter, :backend
17
+ def_delegators :backend, :keys
16
18
 
17
19
  def write(key, value)
18
20
  @storage[key] = value
@@ -1,5 +1,5 @@
1
1
  module Translator
2
2
  module Version
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.0.2'.freeze
4
4
  end
5
5
  end
@@ -57,4 +57,14 @@ describe Translator::Store do
57
57
  expect(store[:pa]).to eq(first_name: 'ਕੁਲਦੀਪ')
58
58
  end
59
59
  end
60
+
61
+ describe 'Delegations' do
62
+ it 'responds to key?, clear, adapter, backend, keys' do
63
+ expect(store).to respond_to(:key?)
64
+ expect(store).to respond_to(:clear)
65
+ expect(store).to respond_to(:adapter)
66
+ expect(store).to respond_to(:keys)
67
+ expect(store).to respond_to(:backend)
68
+ end
69
+ end
60
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translator_with_localeapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuldeep Aggarwal