rbbt-util 5.17.87 → 5.17.88

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7689fb8913a735ad844a7375011fadc522af2bd1
4
- data.tar.gz: 55d639ec2c1b722ae054c643fc53c19cca0677dc
3
+ metadata.gz: 86b82101fc67bc2487900d9724f87edcd80eb993
4
+ data.tar.gz: aae5819b0436ad15b426eb55ecb51ddffb24ce87
5
5
  SHA512:
6
- metadata.gz: 8fd8c83197f8a67d00129a27b3bf04a4d9518bb43cee0c20dad31e9cb1ae781466090ef1af0380219c98711ea2db8822427e40a4aa9dbb35b6faa23e77bc1f6f
7
- data.tar.gz: d455058547e7e3d111ea74a15a7b0e1b2e1196d7320169207f0199a1add2a91b9bcad0d1b4898b534dc8965f57486df83266c4ad81253a8ffd0af8e4eaaad5ad
6
+ metadata.gz: cdc2c960706e1d1c48b4145d7f693faa3a8da4c86584a38814bab2fef13b179d10f9654ccbcc6bb7b77bab04b015840114b9727ff1da7c8333ea236db34e91e4
7
+ data.tar.gz: e4afc4ba6bee4284eda09da1bd1f4523fdb40402e02cc867d8dd6b6f9d9798c667180f9e13ce2ec7fa895ef5ee6c82e5cd98164d37f37f92f6625055e4b03737
@@ -13,10 +13,14 @@ Entity.entity_property_cache = Rbbt.var.sinatra.find.entity_properties
13
13
  #{{{ Prepare REST entities
14
14
  Rbbt.etc.entities.read.split("\n").each do |name|
15
15
  next if name.empty?
16
- mod = Kernel.const_get name
17
- Log.debug("Including Entity::REST for #{ name }")
18
- mod.module_eval do
19
- include Entity::REST
16
+ begin
17
+ mod = Kernel.const_get name
18
+ Log.debug("Including Entity::REST for #{ name }")
19
+ mod.module_eval do
20
+ include Entity::REST
21
+ end
22
+ rescue
23
+ Log.warn "Could extend REST entity: #{ name }"
20
24
  end
21
25
  end if Rbbt.etc.entities.exists?
22
26
 
@@ -348,4 +348,20 @@ module Misc
348
348
  `curl -s --header "Authorization: Bearer #{key}" -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "#{event}", "body": "#{description}"}'`
349
349
  end
350
350
  end
351
+
352
+ def self.unzip_in_dir(file, dir)
353
+ raise "Target is not a directory: #{file}" if File.exists?(dir) and not File.directory?(dir)
354
+ if Open.remote? file
355
+ file = file.find if Path === file
356
+ Open.open(file) do |stream|
357
+ TmpFile.with_file(stream.read, true, :extension => 'zip') do |zip_file|
358
+ CMD.cmd("unzip '#{zip_file}' -d '#{dir}'")
359
+ end
360
+ end
361
+ else
362
+ file = file.find if Path === file
363
+ zip_file = file
364
+ CMD.cmd("unzip '#{zip_file}' -d '#{dir}'")
365
+ end
366
+ end
351
367
  end
@@ -27,7 +27,9 @@ field = options[:field] || '2'
27
27
  if field =~ /^\d+$/
28
28
  field_pos = field.to_i
29
29
  else
30
- field_pos = TSV.parse_header(file, options).all_fields.index(field) + 1
30
+ parser = TSV.parse_header(file, options)
31
+ field_pos = parser.all_fields.index(field) + 1
32
+ saved_line = parser.line
31
33
  end
32
34
 
33
35
  rest = ARGV.inject("-t\"\t\" -g -k#{field_pos}"){|acc,e| acc << " '#{e}'" }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.17.87
4
+ version: 5.17.88
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-13 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake