Skip to content

Commit

Permalink
Introduced LockOMotion.warn
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Engel committed Mar 3, 2013
1 parent 1147027 commit 1a0e25f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/lock-o-motion.rb
Expand Up @@ -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

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/lock-o-motion/app.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1a0e25f

Please sign in to comment.