forked from cucumber/aruba
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
109 lines (86 loc) · 2.83 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
$LOAD_PATH << File.expand_path('../', __FILE__)
require 'aruba/tasks/docker_helpers'
require 'aruba/platform'
require 'bundler'
Bundler.setup
task :default => :test
desc 'Run the whole test suite. Any failure will stop rake going on'
task :test => %w(lint:travis lint:coding_guidelines lint:licenses test:rspec test:cucumber test:cucumber_wip)
task :cucumber do
Aruba.platform.deprecated 'The use of task "cucumber" is deprecated. Please use "test:cucumber"'
Rake::Task['test:cucumber'].invoke
end
task :cucumber_wip do
Aruba.platform.deprecated 'The use of task "cucumber_wip" is deprecated. Please use "test:cucumber_wip"'
Rake::Task['test:cucumber_wip'].invoke
end
task :spec do
Aruba.platform.deprecated 'The use of task "spec" is deprecated. Please use "test:rspec"'
Rake::Task['test:rspec'].invoke
end
task :rubocop do
Aruba.platform.deprecated 'The use of task "rubocop" is deprecated. Please use "lint:coding_guidelines"'
Rake::Task['test:coding_guidelines'].invoke
end
namespace :test do
desc 'Run cucumber tests'
task :cucumber do
sh 'cucumber'
end
desc 'Run cucumber tests which are "WORK IN PROGRESS" and are allowed to fail'
task :cucumber_wip do
sh 'cucumber -p wip'
end
desc 'Run rspec tests'
task :rspec do
sh 'rspec'
end
end
namespace :lint do
desc 'Lint our .travis.yml'
task :travis do
begin
require 'travis/yaml'
puts 'Linting .travis.yml ... No output is good!'
Travis::Yaml.parse! File.read('.travis.yml')
rescue LoadError => e
$stderr.puts "You ruby is not supported for linting the .travis.yml: #{e.message}"
end
end
desc 'Lint our code with "rubocop"'
task :coding_guidelines do
sh 'rubocop --fail-level E'
end
desc 'Check for relevant licenses in project'
task :licenses do
sh 'license_finder'
end
end
namespace :rubygem do
Bundler::GemHelper.install_tasks
end
namespace :docker do
desc 'Build docker image'
task :build, :cache, :version do |_, args|
args.with_defaults(:version => 'latest')
args.with_defaults(:cache => true)
docker_compose_file = Aruba::DockerComposeFile.new(File.expand_path('../docker-compose.yml', __FILE__))
docker_run_instance = Aruba::DockerRunInstance.new(docker_compose_file, :base)
builder = Aruba::DockerBuildCommandLineBuilder.new(
docker_run_instance,
cache: args[:cache],
version: args[:version]
)
sh builder.to_cli
end
desc 'Run docker container'
task :run, :command do |_, args|
docker_compose_file = Aruba::DockerComposeFile.new(File.expand_path('../docker-compose.yml', __FILE__))
docker_run_instance = Aruba::DockerRunInstance.new(docker_compose_file, :base)
builder = Aruba::DockerRunCommandLineBuilder.new(
docker_run_instance,
command: args[:command] || docker_run_instance.command,
)
sh builder.to_cli
end
end