forked from cucumber/aruba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
118 lines (93 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
$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
require 'cucumber/rake/task'
require 'rspec/core/rake_task'
namespace :test do
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = %w{--format progress}
end
Cucumber::Rake::Task.new(:cucumber_wip, 'Run Cucumber features '\
'which are "WORK IN PROGRESS" and '\
'are allowed to fail') do |t|
t.cucumber_opts = %w{--format progress}
t.profile = 'wip'
end
desc 'Run RSpec tests'
RSpec::Core::RakeTask.new(:rspec)
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 'bundle exec rubocop --fail-level E'
end
desc 'Check for relevant licenses in project'
task :licenses do
sh 'bundle exec license_finder'
end
begin
require 'yard-junk/rake'
YardJunk::Rake.define_task
rescue LoadError
warn 'yard-junk requires Ruby 2.3.0. Rake task lint:yard:junk not loaded.'
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