darkhelmet-darkext 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.txt +4 -0
  2. data/VERSION.yml +1 -1
  3. data/lib/darkext/beagle.rb +8 -10
  4. metadata +1 -1
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.9.4 2009-2-27
2
+
3
+ * Speed up beagle a bit...
4
+
1
5
  == 0.9.3 2009-2-27
2
6
 
3
7
  * Download open/write any file if not HTTPOK
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 9
3
- :patch: 3
3
+ :patch: 4
4
4
  :major: 0
@@ -27,11 +27,13 @@ module Beagle
27
27
  system('beagle-shutdown')
28
28
  end
29
29
 
30
- def self.query(query, verbose = false)
30
+ def self.query(query, verbose = false, max_hits = 40)
31
31
  raise BeagleError, "Beagle.home (BEAGLE_HOME) not set!" if home.nil?
32
32
  args = Array.new
33
33
  args << 'beagle-query'
34
34
  args << '--verbose' if verbose
35
+ args << '--max-hits'
36
+ args << max_hits.to_s
35
37
  args << query
36
38
  output = DarkIO.capture_output(:stderr => false) { system(*args) }
37
39
  parser = verbose ? verbose_parser : regular_parser
@@ -53,12 +55,7 @@ private
53
55
 
54
56
  def self.verbose_parser
55
57
  lambda do |output|
56
- lines = output.split("\n")
57
- 2.times do
58
- lines.shift
59
- lines.pop
60
- end
61
- sections = lines.join("\n").strip.split("\n\n")
58
+ sections = output.strip.split("\n\n")
62
59
  results = sections.map do |section|
63
60
  section_lines = section.split("\n")
64
61
  section_hash = Hash.new
@@ -67,16 +64,17 @@ private
67
64
  parts = line.split(':')
68
65
  k = parts.shift
69
66
  v = parts.join(':')
70
- else
67
+ section_hash[k.strip] = v.strip
68
+ elsif line.include?('=')
71
69
  k,v = line.split('=')
72
70
  k = k.split(':').last
73
71
  v.gsub!("'",'')
72
+ section_hash[k.strip] = v.strip
74
73
  end
75
- section_hash[k.strip] = v.strip
76
74
  end
77
75
  section_hash
78
76
  end
79
- results.sort { |l,r| l['Score'] <=> r['Score'] }
77
+ results.sort { |l,r| l['Score'].to_f <=> r['Score'].to_f }
80
78
  end
81
79
  end
82
80
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darkhelmet-darkext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Huckstep