Skip to content

Commit

Permalink
Detect broken rubygems (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed May 7, 2024
1 parent 216d86f commit 3b196eb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/sass-embedded.rb
@@ -1,4 +1,21 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

spec = Gem.loaded_specs['sass-embedded']
platform = spec&.platform
if platform.is_a?(Gem::Platform) && platform.os == 'linux' && platform.version.nil?
update = if Gem.disable_system_update_message
'updating Ruby to version 3.2 or later'
else
"running 'gem update --system' to update RubyGems"
end
install = if defined?(Bundler)
"running 'rm -f Gemfile.lock && bundle install'"
else
"running 'gem install sass-embedded'"
end
raise LoadError, "The gemspec for #{spec.name} at #{spec.loaded_from} was broken. " \
"Try #{update}, and then try #{install} to reinstall."
end

require_relative 'sass/embedded'

0 comments on commit 3b196eb

Please sign in to comment.