[DRE-commits] [librarian-puppet] 33/97: Cleaner output when no Puppetfile found. Before: `No such file or directory - /foo/bar/Puppetfile (Errno::ENOENT)` After: `Could not find Puppetfile in /foo/bar/`
Stig Sandbeck Mathisen
ssm at debian.org
Tue Mar 11 12:12:48 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository librarian-puppet.
commit abb697872478536ea0cb293b43f54b18af4674b9
Author: Peter Souter <p.morsou at gmail.com>
Date: Tue Nov 26 14:07:54 2013 +0000
Cleaner output when no Puppetfile found.
Before: `No such file or directory - /foo/bar/Puppetfile (Errno::ENOENT)`
After: `Could not find Puppetfile in /foo/bar/`
---
features/install.feature | 6 ++++++
features/support/env.rb | 4 ++++
lib/librarian/puppet/cli.rb | 6 ++++++
3 files changed, 16 insertions(+)
diff --git a/features/install.feature b/features/install.feature
index 2de891d..55b9be5 100644
--- a/features/install.feature
+++ b/features/install.feature
@@ -2,6 +2,12 @@ Feature: cli/install
In order to be worth anything
Puppet librarian needs to install modules properly
+ Scenario: Running install with no Puppetfile
+ Given there is no Puppetfile
+ When I run `librarian-puppet install`
+ Then the output should contain "Could not find Puppetfile"
+ And the exit status should be 1
+
@veryslow
Scenario: Installing a module and its dependencies
Given a file named "Puppetfile" with:
diff --git a/features/support/env.rb b/features/support/env.rb
index 2c1f622..b7368a5 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -19,3 +19,7 @@ end
Given /^PENDING/ do |x|
pending
end
+
+Given(/^there is no Puppetfile$/) do
+ fail if (File.exist?('Puppetfile'))
+end
diff --git a/lib/librarian/puppet/cli.rb b/lib/librarian/puppet/cli.rb
index 79a40a2..daeff77 100644
--- a/lib/librarian/puppet/cli.rb
+++ b/lib/librarian/puppet/cli.rb
@@ -45,6 +45,12 @@ module Librarian
option "destructive", :type => :boolean, :default => false
option "local", :type => :boolean, :default => false
def install
+
+ unless File.exist?('Puppetfile')
+ say "Could not find Puppetfile in #{Dir.pwd}", :red
+ exit 1
+ end
+
ensure!
clean! if options["clean"]
unless options["destructive"].nil?
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/librarian-puppet.git
More information about the Pkg-ruby-extras-commits
mailing list