Skip to content

Commit

Permalink
Move broken rubygems detection to ext/sass/cli.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed May 7, 2024
1 parent a14ed0e commit 2369cf8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 17 additions & 0 deletions ext/sass/Rakefile
Expand Up @@ -53,6 +53,23 @@ file 'cli.rb' => %w[dart-sass] do |t|
File.write(t.name, <<~CLI_RB)
# 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
module Sass
module CLI
COMMAND = [#{command}].freeze
Expand Down
17 changes: 0 additions & 17 deletions lib/sass-embedded.rb
@@ -1,21 +1,4 @@
#!/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 2369cf8

Please sign in to comment.