excel2local 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbe5ef4d13e102175023bfc553066627b68860c61fe27c70efcea83c73007243
4
- data.tar.gz: 98c3ed0a27538be8129c664adbb17836eed0585cab36e9a39986ff9b8f0bc494
3
+ metadata.gz: 03aa31760420b3220e402c21e38507650119fdddb6c978546df7e34b0b8aa22d
4
+ data.tar.gz: 5d9de48d8aaee53807375108a7d85fd3955d224ca67f664a81269a527ca86b9b
5
5
  SHA512:
6
- metadata.gz: e2f8fcd5099e65ac9be893756e1ace9dd9451f3dd53679d6b15381be1ebf0795e5a210960b95359ebfa2e803a4f63a109945e0c6b48307c9c4a5d779196c40bf
7
- data.tar.gz: 2af551413539260f0668055f8645e3ed8adf1b0486e079e9fe64de08fa2334b2e75015739af6af923dd6f186b5b04772cbc583eb5b6687ebf20897d240e0e5ce
6
+ metadata.gz: 696f3778e2983d1b07cdb6d216b788948eae3b049f779bc49fa77b1a6ae3fae8efc97f2591a9e482381ac49fcb8c1f6c76196c11f02f0d701e6ce09aed0b3f3c
7
+ data.tar.gz: 2477a2b3286e6204481a2231244181e5972e22afb9ae0be08143fdec4ff1ab085adecf788fcbcc647520fe0582a4351fca137fa6d6fb66ee8dfc2cb87d39fa3f
data/.gitignore CHANGED
@@ -1,8 +1,9 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.DS_Store
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
- source "https://rubygems.org"
2
-
3
- #git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in excel2local.gemspec
6
- gemspec
7
-
1
+ source "https://rubygems.org"
2
+
3
+ #git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in excel2local.gemspec
6
+ gemspec
7
+
8
8
  gem 'roo', '~> 2.7.0' # nice gem for work with excel XLSX
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 eliseevTech
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 eliseevTech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "excel2local"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "excel2local"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -2,7 +2,7 @@
2
2
 
3
3
  # add gem to the gemfile
4
4
  # gem "excel2local", '~> 0.1.3' to
5
- require "excel2local"
5
+ require "./excel2local"
6
6
 
7
7
  # add next for localize only one file './config/locales/locales.xlsx' to './config/locales'
8
8
  #Excel2local::localize! './config/locales/locales.xlsx','./config/locales'
Binary file
@@ -1,38 +1,38 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "excel2local/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "excel2local"
8
- spec.version = Excel2local::VERSION
9
- spec.authors = ["Eliseev_EV"]
10
- spec.email = ["eliseevmail@ya.ru"]
11
-
12
- spec.summary = "From excel to locales. Simply and easily!"
13
- spec.description = "Make i18n locales for rails(and other) by a excel file. Send translate to outsourcing? easy!"
14
- spec.homepage = "https://github.com/eliseevTech/excel2local"
15
- spec.license = "MIT"
16
-
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- #if spec.respond_to?(:metadata)
20
- # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
- #else
22
- # raise "RubyGems 2.0 or newer is required to protect against " \
23
- # "public gem pushes."
24
- #end
25
-
26
- # Specify which files should be added to the gem when it is released.
27
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
29
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
- end
31
- spec.bindir = "exe"
32
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
- spec.require_paths = ["lib"]
34
-
35
- spec.add_development_dependency "bundler", "~> 1.16"
36
- spec.add_development_dependency "rake", "~> 10.0"
37
- spec.add_runtime_dependency "roo", "~> 2.7" , '>= 2.7.0'
38
- end
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "excel2local/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "excel2local"
8
+ spec.version = Excel2local::VERSION
9
+ spec.authors = ["Eliseev_EV"]
10
+ spec.email = ["eliseevmail@ya.ru"]
11
+
12
+ spec.summary = "From excel to locales. Simply and easily!"
13
+ spec.description = "Make i18n locales for rails(and other) by a excel file. Send translate to outsourcing? easy!"
14
+ spec.homepage = "https://github.com/eliseevTech/excel2local"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ #if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+ #else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ #end
25
+
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
29
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ end
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ spec.add_development_dependency "bundler", "~> 1.16"
36
+ spec.add_development_dependency "rake", "~> 10.0"
37
+ spec.add_runtime_dependency "roo", "~> 2.7" , '>= 2.7.0'
38
+ end
@@ -4,7 +4,8 @@ require "roo"
4
4
  module Excel2local
5
5
 
6
6
  def self.localize_all! (locate)
7
- Dir["#{locate}/*.xlsx"].each { |file|
7
+ backup_all! locate # делаем бекапп
8
+ Dir["#{locate}/*.xlsx"].each { |file|
8
9
  localize! "#{file}","#{locate}"
9
10
  }
10
11
  end
@@ -24,8 +25,7 @@ module Excel2local
24
25
  else
25
26
  row.each_with_index { |col, col_index| #если не первая строка
26
27
  @simbol = col if col_index == 0 #если
27
- #break if #
28
- if (col_index != 0) and (@simbol != nil ) and (col != nil)
28
+ if (col_index != 0) and (@simbol != nil ) and (col != nil)
29
29
  @simbol.to_s.split(".").each_with_index { | simbol, index |
30
30
  simbol = "\'" + simbol + "\'" if [ "true", "false", "on", "off", "yes", "no" ].member?(simbol)
31
31
  if simbol != simbol_memory[col_index][index] then
@@ -35,7 +35,7 @@ module Excel2local
35
35
  end
36
36
  simbol_memory[col_index][index] = simbol
37
37
  }
38
- File.open("#{save_place}/#{File.basename(excel_file, ".xlsx")}_#{yml_file[col_index]}.yml", "a") { |file| file.puts " \'#{col}\'" } # пишем сам символ
38
+ File.open("#{save_place}/#{File.basename(excel_file, ".xlsx")}_#{yml_file[col_index]}.yml", "a") { |file| file.puts " \"#{col}\"" } # пишем сам символ
39
39
  end
40
40
  }
41
41
  end
@@ -43,12 +43,16 @@ module Excel2local
43
43
  end
44
44
 
45
45
  def self.backup_all! (locate)
46
- print "Excel2local::backup_all! to #{locate}/backups .. "
47
- Dir.mkdir("#{locate}/backups") if File.directory?("#{locate}/backups") == false
48
- Dir.mkdir(dir_name = "#{locate}/backups/#{Time.now.to_i}")
49
- Dir["#{locate}/*.yml"].each { |file|
50
- FileUtils.cp(file, dir_name)
51
- }
52
- puts "Done!"
46
+ if (Dir["#{locate}/*.yml"][0] != nil) then # проверяем есть ла файлы для бекапа
47
+ print "Excel2local::backup_all! to #{locate}/backups .. "
48
+ Dir.mkdir("#{locate}/backups") if File.directory?("#{locate}/backups") == false # проверяем есть папка бекап, если нет создаем
49
+ Dir.mkdir(dir_name = "#{locate}/backups/#{Time.now.to_i}") # создаем папку для конкретного бекапа
50
+ Dir["#{locate}/*.yml"].each { |file|
51
+ FileUtils.cp(file, dir_name) #копируем файл
52
+ }
53
+ puts "Done!"
54
+ else
55
+ puts "nothing to backup"
56
+ end
53
57
  end
54
58
  end
@@ -1,3 +1,3 @@
1
1
  module Excel2local
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excel2local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eliseev_EV
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-24 00:00:00.000000000 Z
11
+ date: 2018-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,7 @@ executables: []
66
66
  extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
+ - ".DS_Store"
69
70
  - ".gitignore"
70
71
  - Gemfile
71
72
  - LICENSE.txt
@@ -73,15 +74,16 @@ files:
73
74
  - Rakefile
74
75
  - bin/console
75
76
  - bin/setup
77
+ - example/.DS_Store
76
78
  - example/Your_Rails_App/.DS_Store
77
79
  - example/Your_Rails_App/config/.DS_Store
78
80
  - example/Your_Rails_App/config/locales/.DS_Store
79
81
  - example/Your_Rails_App/config/locales/locales.xlsx
80
82
  - example/Your_Rails_App/example.rb
81
83
  - example/locales.xlsx
82
- - excel2local-0.1.1.gem
83
- - excel2local-0.1.2.gem
84
+ - excel2local-0.1.32.gem
84
85
  - excel2local.gemspec
86
+ - lib/.DS_Store
85
87
  - lib/excel2local.rb
86
88
  - lib/excel2local/version.rb
87
89
  homepage: https://github.com/eliseevTech/excel2local
Binary file
Binary file