-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
71 lines (61 loc) · 2.35 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require 'rubygems'
require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "aperture"
gem.summary = %Q{Statistical analysis library for Aperture Photo Libraries}
gem.description = %Q{Parses out the files from a Aperture Photo Library to give useful figures and check consistancy of the Library itself.}
gem.email = "[email protected]"
gem.homepage = "http://github.com/talaris/aperture"
gem.authors = ["Kyle Burckhard"]
gem.add_development_dependency "shoulda", ">= 2.10.0"
gem.add_dependency('plist', '>= 3.0.0')
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
test.libs << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end
rescue LoadError
task :rcov do
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
end
end
task :test => :check_dependencies
task :default => :test
require 'fileutils'
require 'find'
namespace "library" do
desc "Copies key directories and metadata files from an Aperture library into 'test/data'. Defaults to cloning your entire Aperture Library."
task :clone, [:library_path, :test_path] do |t, args|
args.with_defaults(
:library_path => File.join(ENV['HOME'], 'Pictures', 'Aperture Library.aplibrary'),
:test_path => File.join(File.dirname(__FILE__), 'test', 'data')
)
library_path, test_path = args[:library_path], args[:test_path]
raise ArgumentError, "Requires valid directory path" unless File.directory?(library_path)
FileUtils.mkdir_p(test_path)
Find.find(library_path) do |path|
clone_path = File.join(test_path, path.partition(library_path)[2])
Find.prune if path =~ /Thumbnails|Previews/
FileUtils.mkdir_p(clone_path) if File.directory?(path)
if path =~ /\.apfolder|\.implicitAlbum|\.apsmartalbum|\.apmaster|\.apversion|\.apfile|\.apalbum/
FileUtils.cp(path, clone_path)
end
end
end
end