forked from langalex/couch_potato
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
97 lines (80 loc) · 2.9 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
require 'rake'
require 'spec/rake/spectask'
require 'rake/rdoctask'
def with_validatable(&block)
begin
require 'validatable'
ENV['VALIDATION_FRAMEWORK'] = 'validatable'
puts "Running task with Validatable validation framework."
yield block
rescue LoadError
STDERR.puts "WARNING: Validatable not available, skipping task."
end
end
def with_active_model(&block)
begin
require 'active_model'
ENV['VALIDATION_FRAMEWORK'] = 'active_model'
puts "Running task with ActiveModel validation framework."
yield block
rescue LoadError
STDERR.puts "WARNING: ActiveModel not available, skipping task."
end
end
task :default => :spec
task :spec_functional_validatable do
with_validatable { Rake::Task['spec_functional_default'].execute }
end
task :spec_functional_active_model do
with_active_model { Rake::Task['spec_functional_default'].execute }
end
task :spec_unit_validatable do
with_validatable { Rake::Task['spec_unit_default'].execute }
end
task :spec_unit_active_model do
with_active_model { Rake::Task['spec_unit_default'].execute }
end
desc "Run functional specs with default validation framework, override with VALIDATION_FRAMEWORK"
Spec::Rake::SpecTask.new(:spec_functional_default) do |t|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
t.spec_files = FileList['spec/*_spec.rb']
end
desc "Run unit specs with default validation framework, override with VALIDATION_FRAMEWORK"
Spec::Rake::SpecTask.new(:spec_unit_default) do |t|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
t.spec_files = FileList['spec/unit/*_spec.rb']
end
desc "Run functional specs with all validation frameworks"
task :spec_functional => [:spec_functional_validatable, :spec_functional_active_model] do
end
desc "Run unit specs with all validation frameworks"
task :spec_unit => [:spec_unit_validatable, :spec_unit_active_model] do
end
desc "Run all specs"
task :spec => [:spec_unit, :spec_functional] do
end
desc 'Generate documentation'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Couch Potato'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/couch_potato.rb')
rdoc.rdoc_files.include('lib/couch_potato/**/*.rb')
end
begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "couch_potato"
s.summary = %Q{Ruby persistence layer for CouchDB}
s.email = "[email protected]"
s.homepage = "http://github.com/langalex/couch_potato"
s.description = "Ruby persistence layer for CouchDB"
s.authors = ["Alexander Lang"]
s.files = FileList["[A-Z]*.*", "{lib,spec,rails}/**/*", "init.rb"]
s.add_dependency 'json'
s.add_dependency 'couchrest', '>=0.24'
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end