Update changelog for 0.20.
[tails-test.git] / features / step_definitions / build.rb
blob1c554563ce50b44800474edc868c94bf9f40c621
1 Given /^Tails ([[:alnum:].]+) has been released$/ do |version|
2   create_git unless git_exists?
4   fatal_system "git checkout --quiet stable"
5   old_entries = File.open('debian/changelog') { |f| f.read }
6   File.open('debian/changelog', 'w') do |changelog|
7     changelog.write(<<END_OF_CHANGELOG)
8 tails (#{version}) stable; urgency=low
10   * New upstream release.
12  -- Tails developers <tails@boum.org>  Tue, 31 Jan 2012 15:12:57 +0100
14 #{old_entries}
15 END_OF_CHANGELOG
16   end
17   fatal_system "git commit --quiet debian/changelog -m 'Release #{version}'"
18   fatal_system "git tag '#{version}'"
19 end
21 Given /^Tails ([[:alnum:].-]+) has been tagged$/ do |version|
22   fatal_system "git tag '#{version}'"
23 end
25 Given /^Tails ([[:alnum:].]+) has not been released yet$/ do |version|
26   !File.exists? ".git/refs/tags/#{version}"
27 end
29 Given /^last released version mentioned in debian\/changelog is ([[:alnum:]~.]+)$/ do |version|
30   last = `dpkg-parsechangelog | awk '/^Version: / { print $2 }'`.strip
31   raise StandardError.new('dpkg-parsechangelog failed.') if $? != 0
33   if last != version
34     fatal_system "debchange -v '#{version}' 'New upstream release'"
35   end
36 end
38 Given %r{I am working on the ([[:alnum:]./_-]+) branch$} do |branch|
39   create_git unless git_exists?
41   current_branch = `git branch | awk '/^\*/ { print $2 }'`.strip
42   raise StandardError.new('git-branch failed.') if $? != 0
44   if current_branch != branch
45     fatal_system "git checkout --quiet '#{branch}'"
46   end
47 end
49 Given %r{I am working on the ([[:alnum:]./_-]+) branch based on ([[:alnum:]./_-]+)$} do |branch, base|
50   create_git unless git_exists?
52   current_branch = `git branch | awk '/^\*/ { print $2 }'`.strip
53   raise StandardError.new('git-branch failed.') if $? != 0
55   if current_branch != branch
56     fatal_system "git checkout --quiet -b '#{branch}' '#{base}'"
57   end
58 end
60 When /^I run ([[:alnum:]-]+)$/ do |command|
61   @output = `#{File.expand_path("../../../auto/scripts/#{command}", __FILE__)}`
62   raise StandardError.new("#{command} failed. Exit code: #{$?}") if $? != 0
63 end
65 Then /^I should see the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite|
66   @output.should have_suite(suite)
67 end
69 Then /^I should not see ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite|
70   @output.should_not have_suite(suite)
71 end