aperture 0.3.1 → 0.3.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
data/aperture.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aperture}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kyle Burckhard"]
@@ -80,7 +80,12 @@ module Aperture
80
80
  return hash
81
81
  end
82
82
 
83
- # def find_photos_by_keyword
83
+ # Returns a new PhotoSet where the photos match the passed keyword
84
+ def find_by_keyword(keyword)
85
+ versions = map {|p| p.versions }.flatten
86
+ matching = versions.select {|v| v.attributes['keywords'] && v.attributes['keywords'].include?(keyword) }
87
+ return PhotoSet.new(matching.map{|v| v.photo}.uniq)
88
+ end
84
89
 
85
90
  # def find_photos_by_rating
86
91
 
data/lib/aperture.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # = Overview
2
2
  # To use this libray check the Aperture::Library documentation and Library#parse
3
3
  module Aperture
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.2"
5
5
  end
6
6
 
7
7
 
data/test/helper.rb CHANGED
@@ -1,5 +1,5 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
1
+ # $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ # $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
 
4
4
  require 'rubygems'
5
5
  require 'test/unit'
@@ -29,24 +29,6 @@ class TestPhotoSet < Test::Unit::TestCase
29
29
  end
30
30
  end
31
31
 
32
- # context "each" do
33
- # setup do
34
- # @photoset = PhotoSet.new()
35
- # @photo = Photo.new(SAMPLE_PHOTO_PATH)
36
- # end
37
- #
38
- # should "iterate over all the photos" do
39
- # versions = 0
40
- # @photoset.each {|p| versions += p.versions.size}
41
- # assert_equal versions, 12
42
- # end
43
- #
44
- # should "give us access to inject" do
45
- # versions = @photoset.map {|p| p.versions.size }
46
- # assert_equal versions, [2]*6
47
- # end
48
- # end
49
-
50
32
  context "photo_count" do
51
33
  setup do
52
34
  @library = SAMPLE_LIBRARY
@@ -89,4 +71,16 @@ class TestPhotoSet < Test::Unit::TestCase
89
71
  end
90
72
  end
91
73
 
74
+ context "find_by_keyword" do
75
+ setup do
76
+ @library = SAMPLE_LIBRARY
77
+ end
78
+
79
+ should "should find 9 'Racing' photos" do
80
+ assert_instance_of(Aperture::PhotoSet, @library.photos.find_by_keyword('Racing'))
81
+ assert_equal @library.photos.find_by_keyword('Racing').size, 9
82
+ end
83
+ end
84
+
85
+
92
86
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aperture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Burckhard