excel2local 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +9 -8
- data/Gemfile +7 -7
- data/LICENSE.txt +21 -21
- data/Rakefile +2 -2
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/example/Your_Rails_App/example.rb +1 -1
- data/excel2local-0.1.32.gem +0 -0
- data/excel2local.gemspec +38 -38
- data/lib/excel2local.rb +15 -11
- data/lib/excel2local/version.rb +1 -1
- metadata +6 -4
- data/excel2local-0.1.1.gem +0 -0
- data/excel2local-0.1.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03aa31760420b3220e402c21e38507650119fdddb6c978546df7e34b0b8aa22d
|
4
|
+
data.tar.gz: 5d9de48d8aaee53807375108a7d85fd3955d224ca67f664a81269a527ca86b9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/LICENSE.txt
CHANGED
@@ -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
|
data/bin/console
CHANGED
@@ -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
|
data/excel2local.gemspec
CHANGED
@@ -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
|
data/lib/excel2local.rb
CHANGED
@@ -4,7 +4,8 @@ require "roo"
|
|
4
4
|
module Excel2local
|
5
5
|
|
6
6
|
def self.localize_all! (locate)
|
7
|
-
|
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
|
-
|
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 " \
|
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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
data/lib/excel2local/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|
data/excel2local-0.1.1.gem
DELETED
Binary file
|
data/excel2local-0.1.2.gem
DELETED
Binary file
|