-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathRakefile
40 lines (32 loc) · 951 Bytes
/
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
require 'fileutils'
task :default do
system("rake -T")
end
def version
`git tag -l --sort=-v:refname 'v[0-9]*'`.each_line.first.chomp.sub('v','')
end
def next_version(type = :patch)
section = [:major,:minor,:patch].index type
n = version.split '.'
n[section] = n[section].to_i + 1
n.join '.'
end
desc "Build Docker image"
task 'docker' do
Dir.chdir('build') do
system("docker build --no-cache=true -t binford2k/puppet-validator:#{version} -t binford2k/puppet-validator:latest .")
end
puts
puts 'Start container with: docker run -p 9000:9000 binford2k/puppet-validator'
end
desc "Upload image to Docker Hub"
task 'docker:push' => ['docker'] do
system("docker push binford2k/puppet-validator:#{version}")
system("docker push binford2k/puppet-validator:latest")
end
begin
require 'mg'
MG.new("puppet-validator.gemspec")
rescue LoadError
puts "'gem install mg' to get helper gem publishing tasks. (optional)"
end