Skip to content

Run test suite before release. Fixes #88 #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CASK = "cask"
task default: %w[test]

desc "Create a new release."
task 'release' do
task release: [:test] do
current_version = run('git tag').split(/\n/).last.strip[1..-1]
version = ask("What version do you want to release? (current: #{current_version}): ")
version_tag = "v%s" % version
Expand Down Expand Up @@ -41,7 +41,8 @@ task "test" do
process_info "Run test suite"
say ""
system "#{CASK} exec ert-runner"
say ""

exit_when_failed!("Test suite failed!\n")
end

def git_changes(version, version_tag)
Expand All @@ -55,6 +56,13 @@ def update_version(content, from, to)
content = content.gsub("Version: #{from}", "Version: #{to}")
end

def exit_when_failed!(message)
if $?.exitstatus != 0
warning(message)
exit(1)
end
end

def ansi
{
green: "\e[32m",
Expand Down Expand Up @@ -87,6 +95,10 @@ def info(message)
puts "#{ansi[:green]}#{ansi[:bold]}#{message}#{ansi[:ending]}#{ansi[:ending]}"
end

def warning(message)
puts "#{ansi[:red]}#{ansi[:bold]}#{message}#{ansi[:ending]}#{ansi[:ending]}"
end

def ask(question, type=:white)
say(question, type, false)
answer = STDIN.gets.chomp
Expand Down