lib/nanoc/cli/error_handler.rb in nanoc-3.5.0 vs lib/nanoc/cli/error_handler.rb in nanoc-3.6.0
- old
+ new
@@ -206,10 +206,11 @@
'listen' => 'listen',
'markaby' => 'markaby',
'maruku' => 'maruku',
'mime/types' => 'mime-types',
'nokogiri' => 'nokogiri',
+ 'pry' => 'pry',
'rack' => 'rack',
'rack/cache' => 'rack-cache',
'rainpress' => 'rainpress',
'rdiscount' => 'rdiscount',
'redcarpet' => 'redcarpet',
@@ -234,11 +235,15 @@
return nil if matches.nil?
gem_name = GEM_NAMES[matches[2]]
# Build message
if gem_name
- "Try installing the '#{gem_name}' gem (`gem install #{gem_name}`) and then re-running the command."
+ if self.using_bundler?
+ "Make sure the gem is added to Gemfile and run `bundle up`."
+ else
+ "Install the '#{gem_name}' gem using `gem install #{gem_name}`."
+ end
end
when RuntimeError
if error.message =~ /^can't modify frozen/
"You attempted to modify immutable data. Some data, such as " \
"item/layout attributes and raw item/layout content, can not " \
@@ -247,10 +252,14 @@
"disabled in 3.2.x in order to allow compiler optimisations.)"
end
end
end
+ def using_bundler?
+ defined?(Bundler) && Bundler::SharedHelpers.in_bundle?
+ end
+
def write_section_header(stream, title, params={})
stream.puts
if params[:verbose]
stream.puts '===== ' + title.upcase + ':'
else
@@ -296,10 +305,10 @@
end
def write_issue_link(stream, params={})
stream.puts
stream.puts "If you believe this is a bug in nanoc, please do report it at"
- stream.puts "-> https://github.com/ddfreyne/nanoc/issues/new <-"
+ stream.puts "-> https://github.com/nanoc/nanoc/issues/new <-"
stream.puts
stream.puts "A detailed crash log has been written to ./crash.log."
end
def write_version_information(stream, params={})