lib/minke/rake/app.rake in minke-0.7.0 vs lib/minke/rake/app.rake in minke-0.8.0

- old
+ new

@@ -2,45 +2,42 @@ desc "run unit tests" task :test => ['config:set_docker_env', 'config:load_config', 'docker:fetch_images'] do p "Test application" config = Minke::Helpers.config - container = Minke::GoDocker.get_container config['docker'] begin # Get go packages - ret = container.exec(['go','get','-t','-v','./...']) { |stream, chunk| puts "#{stream}: #{chunk}" } - raise Exception, 'Error running command' unless ret[2] == 0 + puts "Go get" + container, ret = Minke::GoDocker.create_and_run_container config['docker'], ['go','get','-t','-v','./...'] + ensure + container.delete() + end + begin # Test application - ret = container.exec(['go','test','./...']) do |stream, chunk| - puts "#{stream}: #{chunk}" - end + puts "Go test" + container, ret = Minke::GoDocker.create_and_run_container config['docker'], ['go','test','./...'] - raise Exception, 'Error running command' unless ret[2] == 0 - ensure - container.delete(:force => true) + raise Exception, 'Error running command' unless ret == 0 + ensure + container.delete() end end desc "build and test application" task :build => [:test] do p "Build for Linux" config = Minke::Helpers.config - container = Minke::GoDocker.get_container config['docker'] begin # Build go server - ret = container.exec( - ['go','build','-a','-installsuffix','cgo','-ldflags','\'-s\'','-o', config['go']['application_name']] - ) do |stream, chunk| - puts "#{stream}: #{chunk}" - end + container, ret = Minke::GoDocker.create_and_run_container config['docker'], ['go','build','-a','-installsuffix','cgo','-ldflags','\'-s\'','-o', config['go']['application_name']] - raise Exception, 'Error running command' unless ret[2] == 0 - ensure - container.delete(:force => true) + raise Exception, 'Error running command' unless ret == 0 + ensure + container.delete() end end task :copy_assets do p "Copy assets"