babelish 0.6.0 → 0.6.3

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/lib/babelish.rb +1 -0
  4. data/lib/babelish/google_doc.rb +5 -2
  5. data/lib/babelish/keys.rb +6 -0
  6. data/lib/babelish/version.rb +1 -1
  7. metadata +5 -59
  8. data/.babelish.sample +0 -35
  9. data/.gitignore +0 -31
  10. data/.hound.yml +0 -4
  11. data/.travis.yml +0 -15
  12. data/CONTRIBUTING.md +0 -12
  13. data/Dockerfile +0 -6
  14. data/Gemfile +0 -8
  15. data/Rakefile +0 -17
  16. data/babelish.gemspec +0 -42
  17. data/test/babelish/commands/test_command_android2csv.rb +0 -60
  18. data/test/babelish/commands/test_command_csv2android.rb +0 -50
  19. data/test/babelish/commands/test_command_csv2strings.rb +0 -139
  20. data/test/babelish/commands/test_command_strings2csv.rb +0 -110
  21. data/test/babelish/test_android2csv.rb +0 -53
  22. data/test/babelish/test_base2csv.rb +0 -43
  23. data/test/babelish/test_bins.rb +0 -32
  24. data/test/babelish/test_commandline.rb +0 -127
  25. data/test/babelish/test_csv2android.rb +0 -72
  26. data/test/babelish/test_csv2base.rb +0 -44
  27. data/test/babelish/test_csv2json.rb +0 -27
  28. data/test/babelish/test_csv2php.rb +0 -27
  29. data/test/babelish/test_csv2strings.rb +0 -154
  30. data/test/babelish/test_fastlane.rb +0 -19
  31. data/test/babelish/test_json2csv.rb +0 -34
  32. data/test/babelish/test_php2csv.rb +0 -73
  33. data/test/babelish/test_strings2csv.rb +0 -147
  34. data/test/babelish/test_xcode_macros.rb +0 -112
  35. data/test/data/android-en.xml +0 -9
  36. data/test/data/android-fr.xml +0 -9
  37. data/test/data/android.xml +0 -9
  38. data/test/data/android_special_chars.csv +0 -8
  39. data/test/data/android_special_chars.xml +0 -12
  40. data/test/data/android_special_chars_test_result.xml +0 -10
  41. data/test/data/genstrings.strings +0 -0
  42. data/test/data/json.json +0 -6
  43. data/test/data/php_lang.php +0 -8
  44. data/test/data/test_comments.strings +0 -2
  45. data/test/data/test_data.csv +0 -3
  46. data/test/data/test_data.strings +0 -2
  47. data/test/data/test_data_fr_with_comments.strings +0 -6
  48. data/test/data/test_data_fr_with_comments.xml +0 -9
  49. data/test/data/test_data_multiple_langs.csv +0 -3
  50. data/test/data/test_data_with_comments.csv +0 -3
  51. data/test/data/test_data_with_percent.csv +0 -3
  52. data/test/data/test_data_with_percent_space.csv +0 -4
  53. data/test/data/test_data_with_semicolon.csv +0 -3
  54. data/test/data/test_data_with_spaces.csv +0 -3
  55. data/test/data/test_en.strings +0 -2
  56. data/test/data/test_fr.strings +0 -2
  57. data/test/data/test_space.strings +0 -10
  58. data/test/data/test_utf16.strings +0 -0
  59. data/test/data/test_with_nil.csv +0 -3
  60. data/test/data/test_with_nil.strings +0 -4
  61. data/test/data/xcode_empty.strings +0 -7
  62. data/test/test_helper.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9709d366bbd01ef995912d9aaf6d13a06ba75d19f029ce1c79f37a7dec0ceb6
4
- data.tar.gz: 3bafcb6946230ab029073b559347b13ad834cff2d53666a31681e4dad5b64496
3
+ metadata.gz: 860bb202fa9b40c71a14e8182471b4b5eba33f7c38cfea1840e25781c22119dd
4
+ data.tar.gz: 7603ad25960a827f2689d9dc2c284b4fa1dd08cdaa8d777b7bd32b694f3df5f1
5
5
  SHA512:
6
- metadata.gz: 47046a32499286a83df69f7adb3d220b565e347343ce69edad1285cb275f527b22406ae4fb78c5670451c4a608359814ad0618cdbfa86f80e6c4c0547256eb38
7
- data.tar.gz: c80caaa09dd010f95c9562cf9eff090ee64d5f8d1fd1b2123982ec84a716c1def4d04afe0c20aea60dd1f9119bfaebd1d806a22500e79c01faae4372133020e4
6
+ metadata.gz: 47bc840b613d58cd1720e29841ecccbda9d7bc7ae7ad4c56167322a4a7b2c03019ee73ffdca3bbdbfca4f15f534924c8ec2ce29dc6201d38046402580acc7ab4
7
+ data.tar.gz: 5d747bde970418a27a5b1abc3259843b96d916d57d7cafbcc15e3ed48b46072e161ce69e93aa2da96e24502077b3ac1c1f091b9b837fcd3b6c9ace5dd80f9968
data/README.md CHANGED
@@ -71,3 +71,7 @@ Run `bundle install` to install all the dependencies. Tests are done with `Test:
71
71
  # Todo & Known issues
72
72
 
73
73
  See GitHub issues
74
+
75
+ # Privacy Policy
76
+
77
+ See [related infos](privacy-policy.md)
@@ -24,6 +24,7 @@ require "babelish/json2csv"
24
24
 
25
25
  # General
26
26
  require "babelish/language"
27
+ require "babelish/keys"
27
28
  require "babelish/google_doc"
28
29
 
29
30
  # iOS specific
@@ -43,14 +43,17 @@ module Babelish
43
43
 
44
44
  def authenticate
45
45
  # will try to get token and store in file below
46
- @session = GoogleDrive.saved_session ".babelish.token"
46
+ @session = GoogleDrive.saved_session(".babelish.token",
47
+ nil,
48
+ Babelish::Keys::GOOGLE_DRIVE_CLIENT_ID,
49
+ Babelish::Keys::GOOGLE_DRIVE_CLIENT_SECRET)
47
50
  end
48
51
 
49
52
  def file_with_name(name)
50
53
  unless @session
51
54
  authenticate
52
55
  end
53
- @session.spreadsheet_by_title(name)
56
+ @session.file_by_title(name)
54
57
  end
55
58
  end
56
59
  end
@@ -0,0 +1,6 @@
1
+ module Babelish
2
+ module Keys
3
+ GOOGLE_DRIVE_CLIENT_SECRET = "e48n2RU6tjimMBRo6Ru4RIHs"
4
+ GOOGLE_DRIVE_CLIENT_ID = "1055694645196-j74lpcu8riev3m4fdrjnh4s7salcskc7.apps.googleusercontent.com"
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Babelish
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: babelish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - François Benaiteau
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-11-15 00:00:00.000000000 Z
12
+ date: 2020-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '3.0'
34
+ version: 3.0.3
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '3.0'
41
+ version: 3.0.3
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: nokogiri
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -165,17 +165,8 @@ executables:
165
165
  extensions: []
166
166
  extra_rdoc_files: []
167
167
  files:
168
- - ".babelish.sample"
169
- - ".gitignore"
170
- - ".hound.yml"
171
- - ".travis.yml"
172
- - CONTRIBUTING.md
173
- - Dockerfile
174
- - Gemfile
175
168
  - LICENSE.txt
176
169
  - README.md
177
- - Rakefile
178
- - babelish.gemspec
179
170
  - bin/babelish
180
171
  - lib/babelish.rb
181
172
  - lib/babelish/android2csv.rb
@@ -188,57 +179,12 @@ files:
188
179
  - lib/babelish/csv2strings.rb
189
180
  - lib/babelish/google_doc.rb
190
181
  - lib/babelish/json2csv.rb
182
+ - lib/babelish/keys.rb
191
183
  - lib/babelish/language.rb
192
184
  - lib/babelish/php2csv.rb
193
185
  - lib/babelish/strings2csv.rb
194
186
  - lib/babelish/version.rb
195
187
  - lib/babelish/xcode_macros.rb
196
- - test/babelish/commands/test_command_android2csv.rb
197
- - test/babelish/commands/test_command_csv2android.rb
198
- - test/babelish/commands/test_command_csv2strings.rb
199
- - test/babelish/commands/test_command_strings2csv.rb
200
- - test/babelish/test_android2csv.rb
201
- - test/babelish/test_base2csv.rb
202
- - test/babelish/test_bins.rb
203
- - test/babelish/test_commandline.rb
204
- - test/babelish/test_csv2android.rb
205
- - test/babelish/test_csv2base.rb
206
- - test/babelish/test_csv2json.rb
207
- - test/babelish/test_csv2php.rb
208
- - test/babelish/test_csv2strings.rb
209
- - test/babelish/test_fastlane.rb
210
- - test/babelish/test_json2csv.rb
211
- - test/babelish/test_php2csv.rb
212
- - test/babelish/test_strings2csv.rb
213
- - test/babelish/test_xcode_macros.rb
214
- - test/data/android-en.xml
215
- - test/data/android-fr.xml
216
- - test/data/android.xml
217
- - test/data/android_special_chars.csv
218
- - test/data/android_special_chars.xml
219
- - test/data/android_special_chars_test_result.xml
220
- - test/data/genstrings.strings
221
- - test/data/json.json
222
- - test/data/php_lang.php
223
- - test/data/test_comments.strings
224
- - test/data/test_data.csv
225
- - test/data/test_data.strings
226
- - test/data/test_data_fr_with_comments.strings
227
- - test/data/test_data_fr_with_comments.xml
228
- - test/data/test_data_multiple_langs.csv
229
- - test/data/test_data_with_comments.csv
230
- - test/data/test_data_with_percent.csv
231
- - test/data/test_data_with_percent_space.csv
232
- - test/data/test_data_with_semicolon.csv
233
- - test/data/test_data_with_spaces.csv
234
- - test/data/test_en.strings
235
- - test/data/test_fr.strings
236
- - test/data/test_space.strings
237
- - test/data/test_utf16.strings
238
- - test/data/test_with_nil.csv
239
- - test/data/test_with_nil.strings
240
- - test/data/xcode_empty.strings
241
- - test/test_helper.rb
242
188
  homepage: http://netbe.github.io/Babelish/
243
189
  licenses:
244
190
  - MIT
@@ -1,35 +0,0 @@
1
- # This is a sample configuration file
2
-
3
- ###################################### Base2CSV ######################################
4
-
5
- ## required, location of strings files (FILENAMES)
6
- filenames: ["test/data/test_en.strings", "test/data/test_fr.strings"]
7
-
8
- ## optional
9
- # headers: ["Constants", "English", "French"] # override headers of columns, default is name of input files and 'Variables' for reference
10
- # csv_filename: "testconfig.csv" # location of output file
11
- # dryrun: true # prints out content of hash without writing file
12
-
13
- ###################################### CSV2Base ######################################
14
-
15
- ## required
16
- filename: test/data/test_data.csv # CSV file (CSV_FILENAME) to convert from or name of file in Google Drive
17
- langs: # Languages to convert. i.e. English:en
18
- English: "en"
19
-
20
- ## optional
21
- # fetch: true # set to true to get file(filename) from google drive
22
- # excluded_states: ["Images", "Xib"] # Exclude rows with given state
23
- # comments_column: 4 # Position of column for comments if any
24
- # state_column: 3 # Position of column for state if any
25
- # keys_column: 0 # Position of column for keys
26
- # default_lang: "English" # Header name of column containing fallback value if value is empty
27
- # output_dir: "resources/" # Path of output files
28
- # output_basenames: # Basename of output files
29
- # - Localizable
30
- # - info
31
- # ignore_lang_path: true # does not care about lang component path. i.e: en.lproj/
32
- # sheet: 0 # Index of worksheet to download. First index is 0.
33
- # macros_filename: Babelish.h # File to output the defines of localized strings
34
- # stripping: false # Strips values inside the spreadsheet
35
- # csv_separator: ',' # CSV column separator character, uses ',' by default
data/.gitignore DELETED
@@ -1,31 +0,0 @@
1
- # Generated files
2
- /*.csv
3
- /*.strings
4
- *.lproj
5
- *.gem
6
- *~
7
- *#
8
- #*#
9
-
10
- # Config file
11
- .babelish
12
- .babelish.token
13
-
14
- # SimpleCov
15
- coverage
16
-
17
- # ignore Gemfile.lock as http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
18
- # this should solve the fastercsv issue
19
- Gemfile.lock
20
-
21
- # Ruby package manager files
22
- .ruby-version
23
- .rbenv-version
24
- .rvmrc
25
-
26
- # Sublime Text
27
- *.sublime-workspace
28
- *.sublime-project
29
-
30
- doc
31
- .yardoc
data/.hound.yml DELETED
@@ -1,4 +0,0 @@
1
- HashSyntax:
2
- Enabled: false
3
- LineLength:
4
- Enabled: false
@@ -1,15 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- rvm:
4
- - 2.1.0
5
- - 2.2
6
- - 2.3.1
7
- deploy:
8
- provider: rubygems
9
- api_key:
10
- secure: Xjq+v+jEU6wK4BtyfnV1elegNcxK6Ah/O99Sn9c2IlkCmJ1wxLBouqzEiSorSJ4IOMa5H2y3gwo5GXOr6Y7d8huyGrPuBeCSGqAmH77wNCIv7G+jnLiYb1sRZbtKcPW2QaN6JF81qDIelwyspMfo6/ug1qN1x323UaxZl7f7nUE=
11
- gem: babelish
12
- on:
13
- tags: true
14
- repo: netbe/Babelish
15
- all_branches: true
@@ -1,12 +0,0 @@
1
- # Contributing
2
-
3
- Want to add another support for a new format or/and usage? Add a new feature? Fix a bug?
4
-
5
- 1. Create a pull request with a branch like `feature/<nameofbranch>` or `hotfix/<nameofbranch>`.
6
- 2. Don't forget to explain the issue or the benefits of the feature you want to be merged.
7
- 3. Write unit tests covering the feature and/or fix the ones the feature/issue breaks.
8
-
9
- And in any case feel free to ask for help in any of those steps.
10
-
11
-
12
-
data/Dockerfile DELETED
@@ -1,6 +0,0 @@
1
- FROM ruby:2.2-alpine
2
- RUN apk add --no-cache git build-base
3
- COPY . /code
4
-
5
- WORKDIR /code
6
- RUN bundle install
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in teachmehowtomakearubygem.gemspec
4
- gemspec
5
-
6
- group :test do
7
- gem 'coveralls', :require => false, :platforms => [:ruby_19, :ruby_20]
8
- end
data/Rakefile DELETED
@@ -1,17 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require 'rake/testtask'
3
- require 'yard'
4
-
5
- Rake::TestTask.new do |t|
6
- t.libs << "test"
7
- t.test_files = FileList['test/babelish/**/test_*.rb']
8
- # t.warning = true
9
- t.verbose = true
10
- end
11
-
12
- YARD::Rake::YardocTask.new do |t|
13
- t.files = ['lib/**/*.rb']
14
- # t.options = ['--any', '--extra', '--opts']
15
- end
16
-
17
- task :default => :test
@@ -1,42 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'babelish/version'
5
-
6
- Gem::Specification.new do |s|
7
- s.name = 'babelish'
8
- s.version = Babelish::VERSION
9
- s.date = Time.now.strftime("%Y-%m-%d")
10
- s.summary = "CSV converter for localization files"
11
- s.description = "This set of commands converts a CSV file to the following formats:
12
- - .strings (iOS)
13
- - .xml (Android)
14
- - .json
15
- - .php"
16
- s.authors = ["François Benaiteau", "Markus Paeschke"]
17
- s.email = ['francois.benaiteau@gmail.com', 'markus.paeschke@gmail.com']
18
- s.homepage = 'http://netbe.github.io/Babelish/'
19
- s.license = 'MIT'
20
-
21
- s.add_dependency "thor"
22
-
23
- s.add_dependency "google_drive", "~> 3.0"
24
- s.add_dependency "nokogiri"
25
- # google_drive dependency to ask for mail and password
26
- s.add_dependency "highline"
27
-
28
- # specify version of rack so works on ruby <2.2.2
29
- s.add_dependency "rack", ">= 1.6.11"
30
- # json support
31
- s.add_dependency "json"
32
-
33
- s.add_development_dependency "rake"
34
- s.add_development_dependency "test-unit"
35
- s.add_development_dependency "simplecov"
36
- s.add_development_dependency "yard"
37
-
38
- s.files = `git ls-files`.split("\n")
39
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
40
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
41
- s.require_path = 'lib'
42
- end
@@ -1,60 +0,0 @@
1
- require 'test_helper'
2
- class TestAndroid2CSVCommand < Test::Unit::TestCase
3
- def test_android2csv
4
- options = {:filenames => ["test/data/android.xml"]}
5
- Commandline.new([], options).android2csv
6
-
7
- assert File.exist?("translations.csv")
8
-
9
- # clean up
10
- system("rm -f translations.csv")
11
- end
12
-
13
- def test_android2csv_with_dryrun_option
14
- options = {:filenames => ["test/data/android.xml"], :dryrun => true}
15
- Commandline.new([], options).android2csv
16
-
17
- assert !File.exist?("translations.csv")
18
-
19
- # clean up
20
- system("rm -f translations.csv")
21
- end
22
-
23
- def test_android2csv_with_output_file
24
- options = {:filenames => ["test/data/android.xml"], :csv_filename => "myfile.csv"}
25
- # -i, -o
26
- Commandline.new([], options).android2csv
27
-
28
- assert File.exist?("myfile.csv")
29
-
30
- # clean up
31
- system("rm -f myfile.csv")
32
- end
33
-
34
- def test_android2csv_with_headers
35
- options = {:filenames => ["test/data/android.xml"], :headers => ["constants", "english"]}
36
- # -i, -h
37
- Commandline.new([], options).android2csv
38
-
39
- #TODO assertion or move test on at lib level
40
-
41
- # clean up
42
- system("rm -f translations.csv")
43
- end
44
-
45
- def test_android2csv_with_two_files
46
- options = {
47
- :filenames => ["test/data/android-en.xml", "test/data/android-fr.xml"],
48
- :headers => %w{Constants English French},
49
- :csv_filename => "enfr.csv"
50
- }
51
- # --filenames, --headers, -o
52
- Commandline.new([], options).android2csv
53
-
54
- #TODO assertion
55
-
56
- # clean up
57
- system("rm -f enfr.csv")
58
- end
59
-
60
- end
@@ -1,50 +0,0 @@
1
- require 'test_helper'
2
- class TestCSV2AndroidCommand < Test::Unit::TestCase
3
-
4
- def test_csv2android_with_multiple_2_languages
5
- options = {
6
- :filename => "test/data/test_data_multiple_langs.csv",
7
- :langs => {"English" => "en", "French" => "fr"}
8
- }
9
- Commandline.new([], options).csv2android
10
-
11
- assert File.exist?("./values-en/strings.xml")
12
- assert File.exist?("./values-fr/strings.xml")
13
-
14
- # clean up
15
- system("rm -rf ./values-en/")
16
- system("rm -rf ./values-fr/")
17
- end
18
-
19
- def test_csv2android_with_multiple_2_languages_with_region
20
- options = {
21
- :filename => "test/data/test_data_multiple_langs.csv",
22
- :langs => {"English" => "en-US", "French" => "fr"}
23
- }
24
- Commandline.new([], options).csv2android
25
-
26
- assert File.exist?("./values-en-rUS/strings.xml")
27
- assert File.exist?("./values-fr/strings.xml")
28
-
29
- # clean up
30
- system("rm -rf ./values-en-rUS/")
31
- system("rm -rf ./values-fr/")
32
- end
33
-
34
- def test_csv2android_with_output_dir
35
- options = {
36
- :filename => "test/data/test_data_multiple_langs.csv",
37
- :langs => {"English" => "en", "French" => "fr"},
38
- :output_dir => "mynewlocation"
39
- }
40
-
41
- Commandline.new([], options).csv2android
42
- # testing
43
- assert File.exist?("./mynewlocation/values-en/strings.xml"), "can't find output file for English"
44
- assert File.exist?("./mynewlocation/values-fr/strings.xml"), "can't find output file for French"
45
-
46
- # clean up
47
- system("rm -rf ./mynewlocation")
48
- end
49
-
50
- end