eee-c / eee-code

source code for the couchdb based version of eeecooks.com

This URL has Read+Write access

commit  0bf5e34774586633ffa5971b15d60084d74e8d95
tree    6e39350fe3a88f05c453df5fd399e8a8167610c6
parent  f385ecdf4096715d66468217a8b61faaa6c5c799
eee-code / Rakefile
100644 69 lines (53 sloc) 1.503 kb
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
begin
  require "vlad"
  $: << "#{File.dirname(__FILE__)}/lib"
  Vlad.load(:web => nil, :app => :god, :scm => :git)
rescue LoadError
  # do nothing
end
 
task :default => [:test]
 
desc "Run all tests"
task :test => [:app_specs, :helper_specs, :view_specs]
 
desc "Run the sinatra app specs"
task :app_specs do
  $stderr.puts "\n==\nSinatra app spec"
  system("spec", "./spec/eee_spec.rb")
end
 
desc "Run the helper specs"
task :helper_specs do
  $stderr.puts "\n==\nHelper specs"
  system("spec", "./spec/eee_helpers_spec.rb")
end
 
desc "Run the view specs"
task :view_specs do
  $stderr.puts "\n==\nView specs"
  system("spec ./spec/views/*.haml_spec.rb")
end
 
 
DB = "http://localhost:5984/eee"
require 'rubygems'
require 'rest_client'
 
namespace :couchdb do
 
  desc "Drop and re-create the CouchDB database, loading the design documents after creation"
  task :reset => [:drop, :create, :load_design_docs]
 
  desc "Create a new version of the CouchDB database"
  task :create do
    RestClient.put DB, { }
  end
 
  desc "Delete the current the CouchDB database"
  task :drop do
    RestClient.delete DB
  end
 
  require 'couch_docs'
 
  desc "Load (replacing any existing) all design documents"
  task :load_design_docs do
    CouchDocs.upload_dir(DB, "couch")
  end
 
  desc "Dump seed data from the database"
  task :dump_docs do
    CouchDocs.dump(DB, "couch/seed")
  end
end
 
namespace :db do
  desc "Migrate the DB by reloading all design documents"
  task :migrate => "couchdb:load_design_docs"
end