forked from voxpupuli/librarian-puppet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
39 lines (34 loc) · 1.26 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
require 'bundler/setup'
require 'cucumber/rake/task'
require 'rspec/core/rake_task'
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rake/clean'
CLEAN.include('pkg/', 'tmp/')
CLOBBER.include('Gemfile.lock')
RSpec::Core::RakeTask.new
Cucumber::Rake::Task.new(:features) do |t|
require 'puppet'
puppet_version = Puppet::version.gsub("~>","").split(".").first.to_i
tags = (2..5).select {|i| i != puppet_version}.map{|i| "--tags '@puppet#{puppet_version} and not @puppet#{i}'"}
# don't run githubtarball scenarios in Travis, they easily fail with rate limit exceeded
tags << "--tags 'not @github'" if ENV['TRAVIS']=='true'
t.cucumber_opts = tags.join(" ")
end
Rake::TestTask.new do |test|
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
task :default => [:test, :spec, :features]
desc "Bump version to the next minor"
task :bump do
path = 'lib/librarian/puppet/version.rb'
version_file = File.read(path)
version = version_file.match(/VERSION = "(.*)"/)[1]
v = Gem::Version.new("#{version}.0")
new_version = v.bump.to_s
version_file = version_file.gsub(/VERSION = ".*"/, "VERSION = \"#{new_version}\"")
File.open(path, "w") {|file| file.puts version_file}
sh "git add #{path}"
sh "git commit -m \"Bump version to #{new_version}\""
end