muzzy 0.1.12 → 0.1.13

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/muzzy +9 -6
  3. data/lib/muzzy/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cb78304c4f64a469d72f3fc41d6482dbf0c3d78
4
- data.tar.gz: 5241fc24a5787b37fa3057317a8535c95901ad80
3
+ metadata.gz: 70311bea7d537c03c4f4a1980a3333701752c0db
4
+ data.tar.gz: 52a3d53769438167c321c5631cb7baa5e15da5b8
5
5
  SHA512:
6
- metadata.gz: 541b75bbfacee9521fdf96e9029d1a765f520771482862b662b1b77e37b09dd634f2371f7fae4597a725f0d4ed98b517730000b9ca152a9be129f59920d516c7
7
- data.tar.gz: b0efa731b1bbb93cfb5406bd2b2edb799831a9d5ea4f1f0e1fea8c5a95cc61a887259b1fdd3d79c8fa2e44fdb23290e89d5f899fec88b808ab17209db28c2e2b
6
+ metadata.gz: 86d2d36ca0fa3eb1cc41c8a3c604a5f910e9d8006ea941fe94f8a3c013fe41f18dbd2f1b764a7a708bdf04ccb0a54fe81ae6da4f1f8785c86c891ab82aa0739a
7
+ data.tar.gz: 4ba9b910287dbe31f566a6d396cfad67ff44828d87173e96ca85b95b079b407c04bd2343377bc45f0b9a0e1b9a19130f5d2d45918c871271738d6190a66340f0
data/exe/muzzy CHANGED
@@ -14,7 +14,7 @@ kakasi_path = File.absolute_path(File.expand_path('..', __FILE__) + "/../vendor/
14
14
  unless File.exists?(kakasi_path)
15
15
  $stderr.puts "cannot find kakasi. please check kakasi installation is successed."
16
16
  $stderr.puts "expect path: #{kakasi_path}"
17
- $stderr.puts "If you have not execute `muzzy_setup` yet, please run `muzzy_setup` first."
17
+ $stderr.puts "If you had not executed `muzzy_setup` yet, please run `muzzy_setup` first."
18
18
  exit 1
19
19
  end
20
20
  mysql_cmd = `which mysql`.to_s.chomp
@@ -79,7 +79,9 @@ ARGV.options do |opt|
79
79
  else
80
80
  opt.on('-f', '--file [FILEPATH]', 'path to target file') {|v| options[:file] = v }
81
81
  end
82
- check_file(options[:file])
82
+ if options[:file].to_s != ''
83
+ check_file(options[:file])
84
+ end
83
85
 
84
86
  opt.on('-v', '--version') {
85
87
  $stdout.puts opt.ver
@@ -134,14 +136,15 @@ if first_row_is_header == nil
134
136
  end
135
137
  end
136
138
 
137
-
139
+ # convert header row to compatible with database table columns
138
140
  if first_row_is_header
139
141
  first_row = first_row.map do |str|
140
142
  std_out = Open3.capture2('echo', str)[0]
141
143
  Open3.capture2(kakasi_path, '-Ja', '-Ha', '-Ka', '-Ea', '-i', 'utf8', '-o', 'utf8', stdin_data: std_out)[0]
142
- end.map(&:chomp).map do |x|
143
- # kakasi returns ko^do if 'コード' given so trimming
144
- x.gsub(/[\^]/, '')
144
+ end.map do |x|
145
+ # kakasi returns ko^do if 'コード' given so replace it to _
146
+ # space changes to _
147
+ x.chomp.strip.gsub(/[\^]/, '_').gsub(/\s/, '_')
145
148
  end
146
149
  end
147
150
 
data/lib/muzzy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Muzzy
2
- VERSION = "0.1.12"
2
+ VERSION = "0.1.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muzzy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - vimtaku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-05 00:00:00.000000000 Z
11
+ date: 2018-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler