transync 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49efb85a09f9890df8eba832d04c506230170c66
4
- data.tar.gz: 7c49b7c23956526668d1dac41e33bc4fae6f5054
3
+ metadata.gz: 647b64b23ca0721de88a1eb3c1a54d01bc160c15
4
+ data.tar.gz: c2bc0d637d30f40596ea723ff9a491176c5bf7a7
5
5
  SHA512:
6
- metadata.gz: 5414c79018b18062005a39dbd9c439189fdc86e5c0870b8d5c2e6023e61379cfea363c50de03e0df1a7520c69c557fdaba91163be43cf8062ec0281768cfdb76
7
- data.tar.gz: 6f3aa8575a1905f67f8597169d8d66c160c490c1038da9fbc5cd006e7895a33a419b4e4c35af1c5856ac9f57f8d8f50c90887d94ca7f28f582077d389db12e22
6
+ metadata.gz: 08088c48019733e556e0f76597d98cb719f02c76db0cbe30aa07224af74ee839bb56e505d67404f7c1d073a313456c3194f895a673a6db4cb515284cd32247be
7
+ data.tar.gz: fdfccdc6cb294bd2de3077e4325c44d8363b92d19153f4fd0555071f4ddb68cdcce51eea99a77cb2cb5c6369d3c5c0550463ee58314f4ea9429c0ca9d2a19c13
data/README.md CHANGED
@@ -7,6 +7,12 @@ gem install transync
7
7
  You need settings file to be named `transync.yml` and to be in same directory from which we are running `transync` command.
8
8
  For example see `transync.SAMPLE.yml`.
9
9
 
10
+ ## Google Drive OAuth
11
+
12
+ You'll need to create an API project for Google Drive. Good instructions are written
13
+ [here](https://github.com/google/google-api-ruby-client-samples/tree/master/drive#enable-the-drive-api).
14
+ Just copy and paste `client_id` and `client_secret` into `transync.yml` file.
15
+
10
16
  ## Assumptions
11
17
 
12
18
  You have xliff files in one directory (I suggest `app/Resources/translations`), named like: `common.en.xliff` where `common`
@@ -15,7 +21,7 @@ first row is `key`, `language 1`, `language 2`, ...
15
21
 
16
22
  ## How does it work?
17
23
 
18
- Updating GDoc from our xliff files. It won't delete any key, it will only add new or change existing ones. Same
24
+ Updating GDoc from our xliff files. It won't delete any key, it will only add new or change existing ones. Same
19
25
  for direction from GDoc to xliff.
20
26
 
21
27
  ### Process
@@ -53,4 +59,3 @@ ruby update_spec.rb
53
59
  - use ruby's 2.0 named parameters (more clear method calls)
54
60
  - better tests (move out network dependency -> maybe try VCR, run all tests with RAKE)
55
61
  - add to travis / code climate
56
- - don't allow empty keys?
@@ -1,5 +1,7 @@
1
1
  require 'yaml'
2
+ require 'google/api_client'
2
3
  require 'google_drive'
4
+ require 'transync/version'
3
5
 
4
6
  module TransyncConfig
5
7
  # Result of WORKSHEET_COLUMNS should be something like this
@@ -12,7 +14,27 @@ module TransyncConfig
12
14
  @worksheets = nil
13
15
 
14
16
  def self.init_spreadsheet
15
- session = GoogleDrive.login(CONFIG['GDOC']['email'], CONFIG['GDOC']['password'])
17
+ # Authorizes with OAuth and gets an access token.
18
+ client = Google::APIClient.new(
19
+ application_name: 'Transync',
20
+ application_version: Transync::VERSION
21
+ )
22
+ auth = client.authorization
23
+ auth.client_id = CONFIG['GDOC']['client_id'] # "YOUR CLIENT ID"
24
+ auth.client_secret = CONFIG['GDOC']['client_secret'] # "YOUR CLIENT SECRET"
25
+ auth.scope = [
26
+ 'https://www.googleapis.com/auth/drive',
27
+ 'https://spreadsheets.google.com/feeds/'
28
+ ]
29
+ auth.redirect_uri = 'urn:ietf:wg:oauth:2.0:oob'
30
+ print("1. Open this page:\n%s\n\n" % auth.authorization_uri)
31
+ print('2. Enter the authorization code shown in the page: ')
32
+ auth.code = $stdin.gets.chomp
33
+ auth.fetch_access_token!
34
+ access_token = auth.access_token
35
+
36
+ # session = GoogleDrive.login_with_oauth(CONFIG['GDOC']['email'], CONFIG['GDOC']['password'])
37
+ session = GoogleDrive.login_with_oauth(access_token)
16
38
  spreadsheet = session.spreadsheet_by_key(CONFIG['GDOC']['key'])
17
39
  worksheets = spreadsheet.worksheets
18
40
 
@@ -1,3 +1,3 @@
1
1
  module Transync
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
@@ -2,8 +2,8 @@
2
2
  # GDOC key from URL is 2fKTnCh1uSzBjXX5ZFBCLPx7JCMlMY8V7nbzSVbVyw56
3
3
  GDOC:
4
4
  key: "2fKTnCh1uSzBjXX5ZFBCLPx7JCMlMY8V7nbzSVbVyw56"
5
- email: "user@example.com"
6
- password: "secret"
5
+ client_id: "<your-client-id>"
6
+ client_secret: "<your-client-secret>"
7
7
 
8
8
  MISSING_TRANSLATION_TEXT: "#MISSING-TRANS#"
9
9
  XLIFF_FILES_PATH: test/fixtures
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_runtime_dependency 'google_drive'
21
+ spec.add_runtime_dependency 'google_drive', '~> 1.0.1'
22
22
  spec.add_runtime_dependency 'builder'
23
23
  spec.add_runtime_dependency 'colorize'
24
24
 
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - zigomir
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2015-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google_drive
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '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: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Synchronize XLIFF translations with Google Drive document
@@ -88,8 +88,7 @@ executables:
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - .gitignore
92
- - .ruby-version
91
+ - ".gitignore"
93
92
  - Gemfile
94
93
  - LICENSE.txt
95
94
  - README.md
@@ -128,17 +127,17 @@ require_paths:
128
127
  - lib
129
128
  required_ruby_version: !ruby/object:Gem::Requirement
130
129
  requirements:
131
- - - '>='
130
+ - - ">="
132
131
  - !ruby/object:Gem::Version
133
132
  version: '0'
134
133
  required_rubygems_version: !ruby/object:Gem::Requirement
135
134
  requirements:
136
- - - '>='
135
+ - - ">="
137
136
  - !ruby/object:Gem::Version
138
137
  version: '0'
139
138
  requirements: []
140
139
  rubyforge_project:
141
- rubygems_version: 2.1.1
140
+ rubygems_version: 2.4.5
142
141
  signing_key:
143
142
  specification_version: 4
144
143
  summary: Synchronize XLIFF translations with Google Drive document
@@ -152,4 +151,3 @@ test_files:
152
151
  - test/g2x_spec.rb
153
152
  - test/update_spec.rb
154
153
  - test/x2g_spec.rb
155
- has_rdoc:
@@ -1 +0,0 @@
1
- 2.0.0-p247