Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed tasks folder

* Only contained a fixture that uses pre-DM 0.9 compatible code
  • Loading branch information...
commit 063a6b52e098c1aef2a6277c4715c85f9fa32e5e 1 parent 157e96f
Dan Kubb authored

Showing 1 changed file with 0 additions and 49 deletions. Show diff stats Hide diff stats

  1. +0 49 tasks/fixtures.rb
49 tasks/fixtures.rb
... ... @@ -1,49 +0,0 @@
1   -namespace :dm do
2   - namespace :fixtures do
3   - require 'yaml'
4   -
5   - def fixtures_path
6   - @fixture_path ||= if ENV['FIXTURE_PATH']
7   - Pathname(ENV['FIXTURE_PATH'])
8   - else
9   - Pathname.glob("#{DM_APP_ROOT}/{db,dev,schema,spec}/fixtures").first || raise('Fixtures path not found.')
10   - end
11   - end
12   -
13   - task :dm_app_root do
14   - p DM_APP_ROOT
15   - end
16   -
17   - desc 'Dump database fixtures'
18   - task :dump do
19   - ENV['AUTO_MIGRATE'] = 'false'
20   - Rake::Task['environment'].invoke
21   - fixtures_path.mkpath
22   - DataMapper::Base.subclasses.each do |klass|
23   - table = repository.table(klass)
24   - puts "Dumping #{table}"
25   - (fixtures_path + "#{table}.yaml").open('w+') do |file|
26   - file.write YAML::dump(klass.all)
27   - end
28   - end
29   - end
30   -
31   - desc 'Load database fixtures'
32   - task :load do
33   - Rake::Task['environment'].invoke
34   - fixtures_path.mkpath
35   - DataMapper::Base.subclasses.each do |klass|
36   - table = repository.table(klass)
37   - file_name = fixtures_path + "#{table}.yaml"
38   - next unless file_name.file?
39   - puts "Loading #{table}"
40   - klass.delete_all
41   - file_name.open('r') do |file|
42   - YAML::load(file).each do |attributes|
43   - klass.create(attributes)
44   - end
45   - end
46   - end
47   - end
48   - end
49   -end

0 comments on commit 063a6b5

Please sign in to comment.
Something went wrong with that request. Please try again.