forked from betterplace/acts_as_account
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
executable file
·52 lines (47 loc) · 1.81 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
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
Bundler.require(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "acts_as_account"
gem.summary = %Q{acts_as_account implements double entry accounting for Rails models}
gem.description = %Q{acts_as_account implements double entry accounting for Rails models. Your models get accounts and you can do consistent transactions between them. Since the documentation is sparse, see the transfer.feature for usage examples.}
gem.email = "[email protected]"
gem.homepage = "http://github.com/betterplace/acts_as_account"
gem.authors = ["Thies C. Arntzen, Norman Timmler, Matthias Frick, Phillip Oertel"]
gem.license = 'Apache-2.0'
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
def connect_database
require 'rubygems'
require 'active_record'
access_data = YAML.load_file(File.dirname(__FILE__) + '/db/database.yml')['acts_as_account']
ActiveRecord::Base.establish_connection(Hash[access_data.select { |k, v| k != 'database'}]).connection
end
namespace :features do
desc "create test database out of db/schema.rb"
task :create_database do
conn = connect_database
conn.execute('DROP DATABASE IF EXISTS acts_as_account')
conn.execute('CREATE DATABASE acts_as_account')
conn.execute('USE acts_as_account')
load(File.dirname(__FILE__) + '/db/schema.rb')
end
end
desc "Run features"
task :features => :'features:create_database' do
ruby '-S', 'cucumber'
end
task :default => :features