babelish 0.5.6 → 0.6.6

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -3
  3. data/lib/babelish.rb +1 -0
  4. data/lib/babelish/csv2android.rb +2 -1
  5. data/lib/babelish/google_doc.rb +8 -4
  6. data/lib/babelish/keys.rb +6 -0
  7. data/lib/babelish/version.rb +1 -1
  8. metadata +10 -65
  9. data/.babelish.sample +0 -35
  10. data/.gitignore +0 -31
  11. data/.hound.yml +0 -4
  12. data/.travis.yml +0 -15
  13. data/CONTRIBUTING.md +0 -12
  14. data/Dockerfile +0 -6
  15. data/Gemfile +0 -8
  16. data/Rakefile +0 -17
  17. data/babelish.gemspec +0 -42
  18. data/test/babelish/commands/test_command_android2csv.rb +0 -60
  19. data/test/babelish/commands/test_command_csv2android.rb +0 -35
  20. data/test/babelish/commands/test_command_csv2strings.rb +0 -139
  21. data/test/babelish/commands/test_command_strings2csv.rb +0 -110
  22. data/test/babelish/test_android2csv.rb +0 -53
  23. data/test/babelish/test_base2csv.rb +0 -43
  24. data/test/babelish/test_bins.rb +0 -32
  25. data/test/babelish/test_commandline.rb +0 -127
  26. data/test/babelish/test_csv2android.rb +0 -72
  27. data/test/babelish/test_csv2base.rb +0 -44
  28. data/test/babelish/test_csv2json.rb +0 -27
  29. data/test/babelish/test_csv2php.rb +0 -27
  30. data/test/babelish/test_csv2strings.rb +0 -154
  31. data/test/babelish/test_fastlane.rb +0 -19
  32. data/test/babelish/test_json2csv.rb +0 -34
  33. data/test/babelish/test_php2csv.rb +0 -73
  34. data/test/babelish/test_strings2csv.rb +0 -147
  35. data/test/babelish/test_xcode_macros.rb +0 -112
  36. data/test/data/android-en.xml +0 -9
  37. data/test/data/android-fr.xml +0 -9
  38. data/test/data/android.xml +0 -9
  39. data/test/data/android_special_chars.csv +0 -8
  40. data/test/data/android_special_chars.xml +0 -12
  41. data/test/data/android_special_chars_test_result.xml +0 -10
  42. data/test/data/genstrings.strings +0 -0
  43. data/test/data/json.json +0 -6
  44. data/test/data/php_lang.php +0 -8
  45. data/test/data/test_comments.strings +0 -2
  46. data/test/data/test_data.csv +0 -3
  47. data/test/data/test_data.strings +0 -2
  48. data/test/data/test_data_fr_with_comments.strings +0 -6
  49. data/test/data/test_data_fr_with_comments.xml +0 -9
  50. data/test/data/test_data_multiple_langs.csv +0 -3
  51. data/test/data/test_data_with_comments.csv +0 -3
  52. data/test/data/test_data_with_percent.csv +0 -3
  53. data/test/data/test_data_with_percent_space.csv +0 -4
  54. data/test/data/test_data_with_semicolon.csv +0 -3
  55. data/test/data/test_data_with_spaces.csv +0 -3
  56. data/test/data/test_en.strings +0 -2
  57. data/test/data/test_fr.strings +0 -2
  58. data/test/data/test_space.strings +0 -10
  59. data/test/data/test_utf16.strings +0 -0
  60. data/test/data/test_with_nil.csv +0 -3
  61. data/test/data/test_with_nil.strings +0 -4
  62. data/test/data/xcode_empty.strings +0 -7
  63. data/test/test_helper.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0c50bdc07265dcc37a15d445529ec631c08b9013433740d719dea55ea275c2b
4
- data.tar.gz: c7a1b60e9b5753e49883c82046d7897368250ee5b588be1f25751b25d2c73414
3
+ metadata.gz: 4e29a6b5c4418173054bb6389c04015ec122cca9d52df3b34858ccf21c49b12f
4
+ data.tar.gz: 7ed86a00497a37ba7ece64831bb8512184699d758a808dea5e971afb4f539963
5
5
  SHA512:
6
- metadata.gz: 8aae420d78d9f9cb11433ef203820cdaa39b1ab1b5a809bd8884b664b2136c333091a388ce4bde3e4af91de89b3d4ce985436ea6b39e81656596898c8b5563fb
7
- data.tar.gz: 5a9ceeef88575b111ce1c7b272d18e35c6b1456f6685f161951dc2c391eb6a35cdd6d49700aa028af3b8a2c344d6bfd84d0a0741d5045db859e7f285c147ff3e
6
+ metadata.gz: b0b507e6eeac632aa1b607304b4bfd1f04aac6c3d66dd7fb5fb265cf613b3b091137ef596c6fdac16c63f8cd1dc56fbff05b2e3171d4743a4f69bd82634be349
7
+ data.tar.gz: 7a24ef23ea07c01893c9b155efd317918632422d8e6049612994413b8ab3e5f1841ead0a7a35fb5793dc683a9dfab39f61a59cdcf6d48893dd226cacb36e565d
data/README.md CHANGED
@@ -18,11 +18,11 @@ It can also fetch the csv file from GoogleDrive.
18
18
 
19
19
  `gem install babelish`
20
20
 
21
- Requires Ruby 2.0.0 or above.
21
+ Requires Ruby 2.1.0 or above.
22
22
 
23
23
  Or download [Latest Release](https://github.com/netbe/Babelish/releases/latest).
24
24
 
25
- Or via docker: `docker run netbe/Babelish babelish help`
25
+ Or via docker: `docker run netbe/babelish babelish help`
26
26
 
27
27
  # Usage
28
28
 
@@ -57,7 +57,7 @@ See [.babelish.sample](.babelish.sample) file in the doc folder. as the possible
57
57
 
58
58
  **Note for docker:** In order to export the output of a conversion, you will need to pipe the result out of the container. An example would be
59
59
  ```
60
- › docker run netbe/Babelish babelish csv2json >> some_file.json
60
+ › docker run netbe/babelish babelish csv2json >> some_file.json
61
61
  ```
62
62
 
63
63
  **For more details, check the documentation:**
@@ -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)
data/lib/babelish.rb CHANGED
@@ -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
@@ -13,7 +13,8 @@ module Babelish
13
13
  require 'pathname'
14
14
  output_name = "strings.xml"
15
15
  output_name = "#{@output_basename}.xml" unless @output_basename.empty?
16
- filepath = Pathname.new(@file_path) + "values-#{language.code}" + output_name
16
+ region = language.region.to_s.empty? ? "" : "-r#{language.region}"
17
+ filepath = Pathname.new(@file_path) + "values-#{language.code}#{region}" + output_name
17
18
  return filepath ? [filepath] : []
18
19
  end
19
20
 
@@ -40,17 +40,21 @@ module Babelish
40
40
  puts "can't open requested file"
41
41
  end
42
42
  end
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
+ config = GoogleDrive::Config.new(".babelish.token")
47
+ config.client_id = Babelish::Keys::GOOGLE_DRIVE_CLIENT_ID
48
+ config.client_secret = Babelish::Keys::GOOGLE_DRIVE_CLIENT_SECRET
49
+ config.scope = ["https://www.googleapis.com/auth/drive.readonly"]
50
+ @session = GoogleDrive::Session.from_config(config)
47
51
  end
48
-
52
+
49
53
  def file_with_name(name)
50
54
  unless @session
51
55
  authenticate
52
56
  end
53
- @session.spreadsheet_by_title(name)
57
+ @session.file_by_title(name)
54
58
  end
55
59
  end
56
60
  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.5.6"
2
+ VERSION = "0.6.6"
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.5.6
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - François Benaiteau
@@ -9,36 +9,36 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-08-07 00:00:00.000000000 Z
12
+ date: 2021-02-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: 1.0.1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: 1.0.1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: google_drive
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '3.0'
34
+ version: 3.0.5
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.5
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
@@ -258,8 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
204
  - !ruby/object:Gem::Version
259
205
  version: '0'
260
206
  requirements: []
261
- rubyforge_project:
262
- rubygems_version: 2.7.7
207
+ rubygems_version: 3.0.8
263
208
  signing_key:
264
209
  specification_version: 4
265
210
  summary: CSV converter for localization files
data/.babelish.sample DELETED
@@ -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
data/.travis.yml DELETED
@@ -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
data/CONTRIBUTING.md DELETED
@@ -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
data/babelish.gemspec DELETED
@@ -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