Skip to content

Commit

Permalink
Merge pull request #138 from elixir-lang/run-tests-before-release
Browse files Browse the repository at this point in the history
Run test suite before release. Fixes #88
  • Loading branch information
mattdeboard committed Oct 29, 2014
2 parents c4acd98 + ae15c4d commit e6ae3a5
Showing 1 changed file with 14 additions and 2 deletions.
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

0 comments on commit e6ae3a5

Please sign in to comment.