From 51680b6ebb645d37ebdfcd122ca163b3a638aefa Mon Sep 17 00:00:00 2001 From: Tails developers Date: Fri, 19 Dec 2014 00:40:08 +0100 Subject: files copied from https://git-tails.immerda.ch/tails - many thanks to the tails developers for their nice work and documentation of it - these files have been released under the GNU General Public License version 3 or (at your option) any later version features/images has been omitted --- features/step_definitions/build.rb | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 features/step_definitions/build.rb (limited to 'features/step_definitions/build.rb') diff --git a/features/step_definitions/build.rb b/features/step_definitions/build.rb new file mode 100644 index 00000000..2e597a4d --- /dev/null +++ b/features/step_definitions/build.rb @@ -0,0 +1,71 @@ +Given /^Tails ([[:alnum:].]+) has been released$/ do |version| + create_git unless git_exists? + + fatal_system "git checkout --quiet stable" + old_entries = File.open('debian/changelog') { |f| f.read } + File.open('debian/changelog', 'w') do |changelog| + changelog.write(< Tue, 31 Jan 2012 15:12:57 +0100 + +#{old_entries} +END_OF_CHANGELOG + end + fatal_system "git commit --quiet debian/changelog -m 'Release #{version}'" + fatal_system "git tag '#{version}'" +end + +Given /^Tails ([[:alnum:].-]+) has been tagged$/ do |version| + fatal_system "git tag '#{version}'" +end + +Given /^Tails ([[:alnum:].]+) has not been released yet$/ do |version| + !File.exists? ".git/refs/tags/#{version}" +end + +Given /^last released version mentioned in debian\/changelog is ([[:alnum:]~.]+)$/ do |version| + last = `dpkg-parsechangelog | awk '/^Version: / { print $2 }'`.strip + raise StandardError.new('dpkg-parsechangelog failed.') if $? != 0 + + if last != version + fatal_system "debchange -v '#{version}' 'New upstream release'" + end +end + +Given %r{I am working on the ([[:alnum:]./_-]+) branch$} do |branch| + create_git unless git_exists? + + current_branch = `git branch | awk '/^\*/ { print $2 }'`.strip + raise StandardError.new('git-branch failed.') if $? != 0 + + if current_branch != branch + fatal_system "git checkout --quiet '#{branch}'" + end +end + +Given %r{I am working on the ([[:alnum:]./_-]+) branch based on ([[:alnum:]./_-]+)$} do |branch, base| + create_git unless git_exists? + + current_branch = `git branch | awk '/^\*/ { print $2 }'`.strip + raise StandardError.new('git-branch failed.') if $? != 0 + + if current_branch != branch + fatal_system "git checkout --quiet -b '#{branch}' '#{base}'" + end +end + +When /^I run ([[:alnum:]-]+)$/ do |command| + @output = `#{File.expand_path("../../../auto/scripts/#{command}", __FILE__)}` + raise StandardError.new("#{command} failed. Exit code: #{$?}") if $? != 0 +end + +Then /^I should see the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite| + @output.should have_suite(suite) +end + +Then /^I should not see the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite| + @output.should_not have_suite(suite) +end -- cgit v1.2.3-70-g09d2