Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Introduced LockOMotion.warn

  • Loading branch information...
commit 1a0e25f4f2a3fb8d3d709f822587fe0f5dbfc722 1 parent 1147027
Paul Engel authored
Showing with 7 additions and 3 deletions.
  1. +5 −1 lib/lock-o-motion.rb
  2. +2 −2 lib/lock-o-motion/app.rb
View
6 lib/lock-o-motion.rb
@@ -53,7 +53,7 @@ def add_mocks_dir(dir)
def skip?(path)
!!%w(openssl pry).detect{|x| path.match %r{\b#{x}\b}}.tap do |file|
- puts " Warning Skipped '#{file}' requirement".yellow if file
+ warn "Skipped '#{file}' requirement" if file
end
end
@@ -69,6 +69,10 @@ def mock_path(path)
nil
end
+ def warn(message, color = :yellow)
+ puts " Warning #{message.gsub("\n", "\n ")}".send(color)
+ end
+
end
unless defined?(Lotion)
View
4 lib/lock-o-motion/app.rb
@@ -33,7 +33,7 @@ def dependency(call, path, internal = false)
register_dependency call, absolute_path
$:.unshift load_path unless $:.include?(load_path)
else
- puts " Warning #{call}\n requires #{absolute_path}".red
+ LockOMotion.warn "#{call}\nrequires #{absolute_path}", :red
end
return
end
@@ -42,7 +42,7 @@ def dependency(call, path, internal = false)
if path.match(/^\//) && File.exists?(path)
register_dependency call, path
else
- puts " Warning Could not resolve dependency \"#{path}\"".red
+ LockOMotion.warn "Could not resolve dependency \"#{path}\"\nrequired from #{call}", :red
raise LoadError, "cannot load such file -- #{path}"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.