babelish 0.5.5 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) 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 +6 -60
  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_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: 27135639207a54ebe5e1204789c75b5ef5dd99c497040700b49812bf786ff90d
4
- data.tar.gz: 7fe0272fde4cdc50506130b41396a968c633afa312641e340c8c3baa71cd246e
3
+ metadata.gz: c4041b9c55230d8483e31f89c7f8754bd6971913fca6632d951dffcffe6c8b83
4
+ data.tar.gz: 7efc492d2b6cef31325cf7d3e017cc261b4db5d661322eb3640bf60eca8becb1
5
5
  SHA512:
6
- metadata.gz: 57ab2a1fe83efeab7265d755f898d9eda5676a915d1c03620d6364334d5d37ec0d08207dccc611d9b72b3d3f9c866fafb44c529a7c8319d058e0d60343e06572
7
- data.tar.gz: 503f4bb65bca2d140d7e6bf710aeb469655b673abdf589f443ae5a7bda21986b36c092cfa162e2e341f5e868d7f9e8552256fe1b92319219d9a1426df9e281b5
6
+ metadata.gz: afcaec01e481dcb9ef949c1953122d8b073d375a958575e2de97c182f59d47a8deb3b1563d6f1b4c2c9c984fd640f556560a3669057ecdce22fce9f2ec95773b
7
+ data.tar.gz: 5c5e5100a6628c658a6974aff2a9527409f8d9f23f3e4a0c341536a77bd64d7963fa6214a695a8eaf6011913a3d672053ae14a0b8cdaa1fd48c397743a771dda
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)
@@ -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.5"
2
+ VERSION = "0.6.5"
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.5
4
+ version: 0.6.5
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-08-02 00:00:00.000000000 Z
12
+ date: 2020-09-25 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: 2.1.12
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: 2.1.12
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,56 +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_json2csv.rb
210
- - test/babelish/test_php2csv.rb
211
- - test/babelish/test_strings2csv.rb
212
- - test/babelish/test_xcode_macros.rb
213
- - test/data/android-en.xml
214
- - test/data/android-fr.xml
215
- - test/data/android.xml
216
- - test/data/android_special_chars.csv
217
- - test/data/android_special_chars.xml
218
- - test/data/android_special_chars_test_result.xml
219
- - test/data/genstrings.strings
220
- - test/data/json.json
221
- - test/data/php_lang.php
222
- - test/data/test_comments.strings
223
- - test/data/test_data.csv
224
- - test/data/test_data.strings
225
- - test/data/test_data_fr_with_comments.strings
226
- - test/data/test_data_fr_with_comments.xml
227
- - test/data/test_data_multiple_langs.csv
228
- - test/data/test_data_with_comments.csv
229
- - test/data/test_data_with_percent.csv
230
- - test/data/test_data_with_percent_space.csv
231
- - test/data/test_data_with_semicolon.csv
232
- - test/data/test_data_with_spaces.csv
233
- - test/data/test_en.strings
234
- - test/data/test_fr.strings
235
- - test/data/test_space.strings
236
- - test/data/test_utf16.strings
237
- - test/data/test_with_nil.csv
238
- - test/data/test_with_nil.strings
239
- - test/data/xcode_empty.strings
240
- - test/test_helper.rb
241
188
  homepage: http://netbe.github.io/Babelish/
242
189
  licenses:
243
190
  - MIT
@@ -257,8 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
204
  - !ruby/object:Gem::Version
258
205
  version: '0'
259
206
  requirements: []
260
- rubyforge_project:
261
- rubygems_version: 2.7.7
207
+ rubygems_version: 3.0.8
262
208
  signing_key:
263
209
  specification_version: 4
264
210
  summary: CSV converter for localization files
@@ -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", "~> 2.1.12"
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