mac-spotlight 0.0.2 → 0.0.3

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.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rubygems'
5
5
  require 'echoe'
6
6
  require 'rake/extensiontask'
7
7
 
8
- Echoe.new('mac-spotlight', '0.0.2') do |p|
8
+ Echoe.new('mac-spotlight', '0.0.3') do |p|
9
9
  p.description = "Spotlight - Ruby interface to Mac OSX Spotlight"
10
10
  p.url = "https://github.com/xli/spotlight"
11
11
  p.author = "Li Xiao"
@@ -1,20 +1,21 @@
1
1
  require 'spotlight/spotlight'
2
2
 
3
3
  module Spotlight
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
 
6
6
  def self.search(query_string, *scope_directories)
7
7
  Intern.search(query_string, scope_directories).collect {|path| MDItem.new(path)}
8
8
  end
9
9
 
10
10
  class MDItem
11
- VALID_ATTRIBUTE_VALUE_TYPE = [String, Time, Fixnum, Bignum, Float, Array, NilClass]
11
+ VALID_ATTRIBUTE_VALUE_TYPE = [String, Time, Fixnum, Bignum, Float, Array, NilClass, TrueClass, FalseClass]
12
12
 
13
13
  class InvalidAttributeValueTypeError < StandardError
14
14
  end
15
15
 
16
16
  attr_reader :path
17
17
  def initialize(path)
18
+ raise ArgumentError, 'Path is nil' if path.nil?
18
19
  @path = path
19
20
  end
20
21
  def attributes
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{mac-spotlight}
5
- s.version = "0.0.2"
5
+ s.version = "0.0.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Li Xiao"]
9
- s.date = %q{2010-05-09}
9
+ s.date = %q{2010-05-14}
10
10
  s.description = %q{Spotlight - Ruby interface to Mac OSX Spotlight}
11
11
  s.email = %q{iam@li-xiao.com}
12
12
  s.extensions = ["ext/spotlight/extconf.rb"]
@@ -49,6 +49,8 @@ class TestSpotlight < Test::Unit::TestCase
49
49
 
50
50
  def test_set_attribute
51
51
  assert_attribute_set('kMDItemTestNilType', nil)
52
+ assert_attribute_set('kMDItemTestTrueType', true)
53
+ assert_attribute_set('kMDItemTestFalseType', false)
52
54
  assert_attribute_set('kMDItemTestStringType', "Time.now: #{Time.now}")
53
55
  assert_attribute_set('kMDItemTestLongType', Time.now.to_i)
54
56
  assert_attribute_set('kMDItemTestIntType', Time.now.to_i.to_s[-3..-1].to_i)
@@ -69,8 +71,20 @@ class TestSpotlight < Test::Unit::TestCase
69
71
  assert_attribute_set('kMDItemTestDateType', Time.now)
70
72
  end
71
73
 
74
+ def test_should_raise_error_when_path_is_nil_for_mditem
75
+ assert_raise ArgumentError do
76
+ Spotlight::MDItem.new(nil)
77
+ end
78
+ end
79
+
72
80
  def assert_attribute_set(name, value)
73
81
  @item[name] = value
82
+ if value == true
83
+ value = 1
84
+ end
85
+ if value == false
86
+ value = 0
87
+ end
74
88
  assert_equal value, @item.reload[name]
75
89
  end
76
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mac-spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Li Xiao
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-09 00:00:00 -07:00
12
+ date: 2010-05-14 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency