-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRakefile
More file actions
83 lines (63 loc) · 1.8 KB
/
Copy pathRakefile
File metadata and controls
83 lines (63 loc) · 1.8 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
require File.expand_path('../config', __FILE__)
def package(name)
desc "Clean #{name}"
task :clean do
command(name, 'rm -rf Gemfile.lock pkg .bundle')
end
desc "Gather dependencies for #{name}"
task :deps => :clean do
command(name, 'bundle install')
end
desc "Install #{name}"
task :install do
command(name, 'rake install')
end
desc "Prepare the CI box for the #{name} specs to run"
task :prepare_ci do
command(name, 'rake prepare_ci')
end
desc "Run the #{name} tests"
task :test do
command(name, 'bundle exec rspec')
end
desc "Install #{name} dependencies, run the tests, and install"
task :spec => [:deps, :test, :install]
task :remove_version_tag do
sh "git tag --delete v#{Hyperion::VERSION}" do |ok, res|
end
end
desc "Release #{name}"
task :release => :remove_version_tag do
command(name, 'rake release')
end
end
def dir_path(dir)
File.expand_path(File.join('..', dir), __FILE__)
end
def command(dir, command)
sh "cd #{dir_path(dir)} && #{command}"
end
CI_PROJECTS = [:api, :sql, :postgres, :mysql, :sqlite, :redis]
PROJECTS = CI_PROJECTS + [:riak]
PROJECTS.each do |project|
namespace project do
package(project.to_s)
end
end
def create_task_for_ci(task_name, project_task)
task task_name => CI_PROJECTS.map {|project| "#{project}:#{project_task}"}
end
def create_task_for_all(task_name)
task task_name => PROJECTS.map {|project| "#{project}:#{task_name}"}
end
desc 'Run the specs for Hyperion'
create_task_for_all(:spec)
desc 'Run the specs for Hyperion on CI'
create_task_for_ci(:ci_spec, :spec)
desc 'Install Hyperion'
create_task_for_all(:install)
desc 'Release all Hyperion gems'
create_task_for_all(:release)
desc 'Prepare the CI box for all Hyperion specs to run'
create_task_for_all(:prepare_ci)
task :default => :spec