txdb 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +100 -4
  3. data/lib/txdb/version.rb +1 -1
  4. data/txdb.gemspec +1 -1
  5. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26654801172fbb542a042bcb6a0449b76ed7b5e7
4
- data.tar.gz: deca843a00c592d7f8170c6616e40978b43c99a0
3
+ metadata.gz: c39d7cc267503be406ceb9aea841669d0734fab7
4
+ data.tar.gz: 56f4f9eb4af42d20367931b2848b38f9e9702010
5
5
  SHA512:
6
- metadata.gz: a788e05c2df484b71aa34676f91717d54a53b467f58f0c2c3845b93a5913bddc8afc1291daf21e6d92a9f3922e3a848f6d37d48b48106035a7cf43e12adb611c
7
- data.tar.gz: 2436f1495010364e154322a7896fd1cccf37ca1f6e2534bd182ef72e0e15692da64ec231011c13b51578eb13bf40d62b01246edfe05a5094169537a09dc70e05
6
+ metadata.gz: 4fc62d35484b27195e8e03a6ab378da42efb361eeb2a2442175a89be9d884cfd9d7f2eee05414b41c2d0d4e90e87617f3a7be7f2f726664a26043d624aff49d9
7
+ data.tar.gz: 4442273c412a2bc1d289e39a80d06ecdb0c15592dbfb4ad8a3eac92807da24c6ec1b965fd18c4e063a42700b7ad2e5205746a3594b0532836ca7af8a7d16948e
data/README.md CHANGED
@@ -5,13 +5,109 @@ Txdb
5
5
 
6
6
  Txdb, a mashup of "Transifex" and "database", is an automation tool that facilitates translating database content with Transifex, a popular translation management system.
7
7
 
8
- ### Configuration
8
+ Configuration
9
+ ---
10
+
11
+ Configuration is done in the YAML file format. Here's an example:
12
+
13
+ ```yaml
14
+ databases:
15
+ - adapter: mysql2
16
+ backend: globalize
17
+ username: txdb_user
18
+ password: passpasspass
19
+ host: my-host.com
20
+ port: 3306
21
+ name: mydb_production
22
+ pool: 10
23
+ locales:
24
+ - de
25
+ - es
26
+ - fr
27
+ - pt
28
+ - ja
29
+ - ko
30
+ source_locale: en
31
+ transifex:
32
+ organization: my-org
33
+ project_slug: my-project
34
+ username: txgh.user
35
+ password: passpasspass
36
+ webhook_secret: secretsecretsecret
37
+ tables:
38
+ - name: product_translations
39
+ columns:
40
+ - name
41
+ - description
42
+ ```
43
+
44
+ The root of the config hierarchy is an array of databases. Each one specifies how to connect to a specific database, which backend to use (see below), what Transifex project it's associated with, and which tables and columns to sync. Txdb will upload a new resource for each table.
45
+
46
+ ### Using Configuration
47
+
48
+ Txdb supports two different ways of accessing configuration, raw text and a file path. In both cases, config is passed via the `TXDB_CONFIG` environment variable. Prefix the raw text or file path with the appropriate scheme, `raw://` or `file://`, to indicate which strategy Txgh should use.
49
+
50
+ #### Raw Config
51
+
52
+ Passing raw config to Txdb can be done like this:
53
+
54
+ ```bash
55
+ export TXDB_CONFIG="raw://big_yaml_string_here"
56
+ ```
57
+
58
+ When Txdb starts up, it will use the YAML payload that starts after `raw://`.
59
+
60
+ #### File Config
61
+
62
+ It might make more sense to store all your config in a file. Pass the path to Txdb like this:
63
+
64
+ ```bash
65
+ export TXDB_CONFIG="file://path/to/config.yml"
66
+ ```
67
+
68
+ When Txdb runs, it will read and parse the file at the path that comes after `file://`.
69
+
70
+ Of course, in both the file and the raw cases, environment variables can be specified via `export` or inline when starting Txdb.
71
+
72
+ Backends
73
+ ---
74
+
75
+ Backends provide different strategies for syncing content between Transifex and your database. They are made up of a reader and a writer. Currently the only supported backend is the Globalize backend, which understands the database translation strategy used by the [Globalize](https://github.com/globalize/globalize) gem. Adding additional backends is straightforward. Use the Globalize backend as a model to create the reader, writer, and backend classes, then register your new backend:
76
+
77
+ ```ruby
78
+ Txdb::Backends.register(
79
+ 'my-cool-backend', MyModule::MyBackendClass
80
+ )
81
+ ```
82
+
83
+ Usage
84
+ ---
85
+
86
+ Txdb contains a number of HTTP endpoints for triggering uploads and downloads to and from Transifex. However, they're largely untested as of this writing. We suggest you write small scripts instead. The endpoints may be improved later, but right now it's not a priority.
87
+
88
+ ### Downloading
89
+
90
+ ```ruby
91
+ require 'txdb'
92
+
93
+ Txdb::Config.databases.each do |database|
94
+ Txdb::Downloader.download_all(database)
95
+ end
96
+ ```
97
+
98
+ When running this script, make sure you set the `TXDB_CONFIG` environment variable.
99
+
100
+ ### Uploading
9
101
 
10
- Coming soon.
102
+ ```ruby
103
+ require 'txdb'
11
104
 
12
- ### Usage
105
+ Txdb::Config.databases.each do |database|
106
+ Txdb::Uploader.upload(database)
107
+ end
108
+ ```
13
109
 
14
- Coming soon.
110
+ When running this script, make sure you set the `TXDB_CONFIG` environment variable.
15
111
 
16
112
  Running Tests
17
113
  ---
data/lib/txdb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Txdb
2
- VERSION = '4.0.0'
2
+ VERSION = '4.1.0'
3
3
  end
data/txdb.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.add_dependency 'activesupport', '~> 4.0'
17
17
  s.add_dependency 'sequel', '~> 4.0'
18
- s.add_dependency 'txgh', '~> 2.0'
18
+ s.add_dependency 'txgh', '>= 2.0'
19
19
 
20
20
  s.require_path = 'lib'
21
21
  s.files = Dir['{lib,spec}/**/*', 'README.md', 'txdb.gemspec', 'LICENSE']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: txdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-01 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: txgh
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
55
  description: An automation tool for translating database content with Transifex.
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.2.3
135
+ rubygems_version: 2.6.6
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: An automation tool for translating database content with Transifex.