module Locomotive::Wagon::CLI::CheckPath
Protected Instance Methods
check_path!(path = nil)
click to toggle source
Check if the path given in option (‘.’ by default) points to a Locomotive
site. It is also possible to pass a path other than the one from the options.
@param [ String ] path The optional path of the site instead of options
@return [ String ] The fullpath to the Locomotive
site or nil if it is not a valid site.
# File lib/locomotive/wagon/cli.rb, line 19 def check_path!(path = nil) path ||= options['path'] path = path == '.' ? Dir.pwd : File.expand_path(path) site_or_deploy_file = File.exists?(File.join(path, 'config', 'site.yml')) || File.exists?(File.join(path, 'config', 'deploy.yml')) (site_or_deploy_file ? path : nil).tap do |_path| if _path.nil? say 'The path does not point to a Locomotive site', :red end end end