-
Notifications
You must be signed in to change notification settings - Fork 18
/
Rakefile
121 lines (95 loc) · 3.21 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher'
PKG_VERSION = "0.1.0"
PKG_NAME = "service_merchant"
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
PKG_FILES = FileList[
"recurring_billing/**/*", "subscription_management/**/*", "tracker/**/*", "[a-zA-Z]*"
].exclude(/\.svn$/)
task :default => 'dobuild'
task :install => [:package] do
`gem install pkg/#{PKG_FILE_NAME}.gem`
end
#TODO: use defaults in task
task :test => ["test:default"] do
puts 'All tests run is complete.'
end
task :dobuild => [:test, :gem] do
puts 'Build complete'
end
# Genereate the RDoc documentation
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "ServiceMerchant library"
rdoc.options << '--line-numbers' << '--inline-source' << '--main=README' << '--include=tracker/lib/'
rdoc.rdoc_files.include('README.txt')
rdoc.rdoc_files.include('recurring_billing/lib/**/*.rb')
rdoc.rdoc_files.include('subscription_management/lib/**/*.rb')
rdoc.rdoc_files.include('tracker/lib/**/*.rb')
end
desc "Delete tar.gz / zip / rdoc"
task :cleanup => [ :clobber_package ]
spec = Gem::Specification.new do |s|
s.name = PKG_NAME
s.version = PKG_VERSION
s.summary = "Provides UI and tools to add billing feature to web application"
s.has_rdoc = true
s.files = PKG_FILES
s.add_dependency('activemerchant', '= 1.3.2')
end
Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = true
p.need_zip = true
end
#######################################################################
require File.dirname(__FILE__)+'/tracker/tasks/schema'
require File.dirname(__FILE__)+'/subscription_management/tasks/schema'
desc "Create all tables"
task :create_all_tables => ["tracker:create_tables", "subscription:create_tables"]
desc "Drop all tables"
task :drop_all_tables => ["subscription:drop_tables", "tracker:drop_tables"]
# Run the tests
namespace :test do
Rake::TestTask.new(:unit_recurring) do |t|
t.pattern = 'recurring_billing/test/unit/**/*_test.rb'
t.ruby_opts << '-rubygems'
t.verbose = true
end
Rake::TestTask.new(:unit_tracker) do |t|
t.pattern = 'tracker/test/unit/**/*_test.rb'
t.ruby_opts << '-rubygems'
t.verbose = true
end
Rake::TestTask.new(:unit_subscription) do |t|
t.pattern = 'subscription_management/test/unit/**/*_test.rb'
t.ruby_opts << '-rubygems'
t.verbose = true
end
Rake::TestTask.new(:remote_recurring) do |t|
t.pattern = 'recurring_billing/test/remote/**/*_test.rb'
t.ruby_opts << '-rubygems'
t.verbose = true
end
Rake::TestTask.new(:remote_tracker) do |t|
t.pattern = 'tracker/test/remote/**/*_test.rb'
t.ruby_opts << '-rubygems'
t.verbose = true
end
Rake::TestTask.new(:remote_subscription) do |t|
t.pattern = 'subscription_management/test/remote/**/*_test.rb'
t.ruby_opts << '-rubygems'
t.verbose = true
end
desc "Run all unit tests"
task :unit => [:unit_recurring, :unit_tracker, :unit_subscription]
desc "Run all remote tests"
task :remote => [:remote_recurring, :remote_tracker, :remote_subscription]
desc "Run both unit and remote tests"
task :all => [:unit, :remote]
task :default => 'unit'
end