lib/faastruby/cli/commands/function/build.rb in faastruby-0.3.1 vs lib/faastruby/cli/commands/function/build.rb in faastruby-0.3.2
- old
+ new
@@ -19,10 +19,11 @@
@options['source'] ||= '.'
@options['output_file'] ||= "#{@function_name}.zip"
end
def run
+ FaaStRuby::CLI.error('Please fix the problems above and try again') unless bundle_install
tests_passed = run_tests
FaaStRuby::CLI.error("Build aborted because tests failed and you have 'abort_build_when_tests_fail: true' in 'faastruby.yml'") unless tests_passed || !@abort_when_tests_fail
puts "Warning: Ignoring failed tests because you have 'abort_build_when_tests_fail: false' in 'faastruby.yml'".yellow if !tests_passed && !@abort_when_tests_fail
build(@options['source'], @options['output_file'])
end
@@ -37,9 +38,15 @@
private
def build(source, output_file)
self.class.build(source, output_file)
+ end
+
+ def bundle_install
+ puts '[build] Verifying dependencies'
+ return true unless File.file?('Gemfile')
+ system('bundle check') || system('bundle install')
end
def run_tests
FaaStRuby::Command::Function::Test.new(true).run(do_not_exit: true)
end