kaki-utils 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kaki/utils.rb +8 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81f03f7dddfeb7e6a8a1bcb0a57ae9aff06223a1e4eb296500a75dfa8918c467
4
- data.tar.gz: cb7bccdddb87cf1864c1b0ecad7d47e869759f5f945f0fa1336d7fa11866be74
3
+ metadata.gz: 16fea2419ebb00da4bc378e0cd9c3705779de1e4eec1d45405ec267b7ec636fb
4
+ data.tar.gz: 3d546ec7c87375c76ef64d92144256b7beb53804c98555deea7e2e98892e8234
5
5
  SHA512:
6
- metadata.gz: 97ec306405102bbd7d6362ea78a2a76a1870c583041754d0bda295d0f0a5819b1a625d92f8e679f71274c907d32bb8394718071e1c4e4983a21a58a9b048af6a
7
- data.tar.gz: 2ed2cedd1d6711f44050f1bf6dc74c9f8f5ccef5f46ee0abcc14c2316139c29cc78494b13282f3d32e776ffcfe323c4790024a0cc41a68683db2cf2750be0863
6
+ metadata.gz: 1d3b4ec15bd9e862941ba42c697649660115fb7fd6962eff6cd6f9619d03ae70b7a2e0cec2a80567685170baf72ecb35a0e5eacf2471492ecaf48ee5222d8156
7
+ data.tar.gz: ad26e0231664d5a83530496c98ebc206f37b6e1c66df7d26675dea19d996aa19fa3c42f8e38f10ce6cf2b1dfe1f1b2fa1a0bf94a7b539b32b2c89e5dd1b5551e
data/lib/kaki/utils.rb CHANGED
@@ -168,13 +168,18 @@ module Utils
168
168
  def modify_serial_numbers(dir = Dir.pwd)
169
169
  Dir.chdir(dir)
170
170
  files = Dir.glob("*").select {|fn| File.file?(fn)}
171
+ data1 = []
171
172
  data = files.map do |fn|
172
173
  m = /^(.*?\D*?)(\d+)(\..+)$/.match(fn)
173
- next unless m
174
- [fn, m[1], m[2].to_i, m[3]]
174
+ if m
175
+ [fn, m[1], m[2].to_i, m[3]]
176
+ else
177
+ data1 << [fn, fn]
178
+ nil
179
+ end
175
180
  end.compact
176
181
  num_length = data.map {|d| d[2].to_s.length}.max
177
- data1 = data.map {|d| [d[0], d[1] + ("%0#{num_length}d" % d[2]) + d[3]]}
182
+ data1 += data.map {|d| [d[0], d[1] + ("%0#{num_length}d" % d[2]) + d[3]]}
178
183
 
179
184
  Dir.mkdir("new_folder")
180
185
  data1.each {|be, af| FileUtils.cp(be, "new_folder/#{af}")}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaki-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - obelisk