Skip to content

Instantly share code, notes, and snippets.

@jonforums
Created September 1, 2010 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonforums/561083 to your computer and use it in GitHub Desktop.
Save jonforums/561083 to your computer and use it in GitHub Desktop.
Overwrite the new missing DevKit convenience message gem override upon DK install
diff --git a/resources/devkit/dk.rb b/resources/devkit/dk.rb
index e04c1dd..b1bc04a 100644
--- a/resources/devkit/dk.rb
+++ b/resources/devkit/dk.rb
@@ -271,9 +271,15 @@ EOT
if File.exist?(target)
content = File.read(target)
- unless content.include?('DevKit')
+ case
+ when content !~ /^#.*DevKit/o
+ # handle original and new token-based comments
puts "[INFO] Updating existing gem override for '#{path}'"
File.open(target, 'a') { |f| f.write(gem_override) }
+ when content =~ /^# #{DEVKIT_START} missing DevKit/o
+ # replace missing DevKit/build tool convenience notice
+ puts "[INFO] Updating convenience notice gem override for '#{path}'"
+ update_gem_override(target)
else
puts "[INFO] Skipping existing gem override for '#{path}'" unless $options[:force]
@@ -282,6 +288,7 @@ EOT
update_gem_override(target)
end
end
+
else
puts "[INFO] Installing '#{target}'"
File.open(target, 'w') { |f| f.write(gem_override) }
diff --git a/resources/rubygems/operating_system.rb b/resources/rubygems/operating_system.rb
index cb2af70..4eae209 100755
--- a/resources/rubygems/operating_system.rb
+++ b/resources/rubygems/operating_system.rb
@@ -1,4 +1,4 @@
-# :DK-BEG:
+# :DK-BEG: missing DevKit/build tool convenience notice
Gem.pre_install do |gem_installer|
unless gem_installer.spec.extensions.empty?
have_tools = %w{gcc make sh}.all? do |t|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment