Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'wraith info' command #484

Merged
merged 1 commit into from
Nov 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/wraith/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ def latest(config)
end
end

desc "info", "Show various info about your system"
def info
list_debug_information
end

desc "version", "Show the version of Wraith"
map ["--version", "-version", "-v"] => "version"
def version
Expand Down
28 changes: 28 additions & 0 deletions lib/wraith/helpers/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,31 @@ def convert_to_absolute(filepath)
"#{Dir.pwd}/#{filepath}"
end
end

def list_debug_information
wraith_version = Wraith::VERSION
command_run = ARGV.join ' '
ruby_version = run_command_safely("ruby -v") || "Ruby not installed"
phantomjs_version = run_command_safely("phantomjs --version") || "PhantomJS not installed"
casperjs_version = run_command_safely("casperjs --version") || "CasperJS not installed"
imagemagick_version = run_command_safely("convert -version") || "ImageMagick not installed"

logger.debug "#################################################"
logger.debug " Command run: #{command_run}"
logger.debug " Wraith version: #{wraith_version}"
logger.debug " Ruby version: #{ruby_version}"
logger.debug " ImageMagick: #{imagemagick_version}"
logger.debug " PhantomJS version: #{phantomjs_version}"
logger.debug " CasperJS version: #{casperjs_version}"
# @TODO - add a SlimerJS equivalent
logger.debug "#################################################"
end

def run_command_safely(command)
begin
output = `#{command}`
rescue StandardError
return false
end
output.lines.first.chomp
end
29 changes: 0 additions & 29 deletions lib/wraith/validate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,33 +65,4 @@ def validate_base_shots_exist
def docs_prompt
"See the docs at http://bbc-news.github.io/wraith/"
end

def list_debug_information
wraith_version = Wraith::VERSION
command_run = ARGV.join ' '
ruby_version = run_command_safely("ruby -v") || "Ruby not installed"
phantomjs_version = run_command_safely("phantomjs --version") || "PhantomJS not installed"
casperjs_version = run_command_safely("casperjs --version") || "CasperJS not installed"
imagemagick_version = run_command_safely("convert -version") || "ImageMagick not installed"

logger.debug "#################################################"
logger.debug " Command run: #{command_run}"
logger.debug " Wraith version: #{wraith_version}"
logger.debug " Ruby version: #{ruby_version}"
logger.debug " ImageMagick: #{imagemagick_version}"
logger.debug " PhantomJS version: #{phantomjs_version}"
logger.debug " CasperJS version: #{casperjs_version}"
# @TODO - add a SlimerJS equivalent
logger.debug "#################################################"
logger.debug ""
end

def run_command_safely(command)
begin
output = `#{command}`
rescue StandardError
return false
end
output.lines.first
end
end