Permalink
Browse files

Add an extension script to install listen along with Sass.

  • Loading branch information...
1 parent d1e0277 commit a81052ef7537a22760188f81ddb63ae302db522f @nex3 nex3 committed Jan 23, 2014
Showing with 29 additions and 2 deletions.
  1. +5 −2 doc-src/SASS_CHANGELOG.md
  2. +23 −0 ext/mkrf_conf.rb
  3. +1 −0 sass.gemspec
@@ -235,8 +235,11 @@ of all directives, but will preserve any CSS rules.
this isn't possible. `&` must still appear at the beginning of a
compound selector -- that is, `.foo-&` is still illegal.
-* [listen](http://github.com/guard/listen) versions through 2.4 are
- now supported on platforms other than Ruby 1.8.7.
+* [listen](http://github.com/guard/listen) is no longer bundled with
+ Sass, nor is it a standard RubyGems dependency. Instead, it's
+ automatically installed along with Sass in order to ensure that the
+ user ends up with a version of Listen that works with their local
+ Ruby version.
* Sass now has numerous functions for working with strings:
\{Sass::Script::Functions#str_length `str-length`} will return the length of a
View
@@ -0,0 +1,23 @@
+require 'rubygems'
+require 'rubygems/command.rb'
+require 'rubygems/dependency_installer.rb'
+
+# This script installs the correct version of listen. Listen versions
+# beyond 1.1 don't support Ruby 1.8, any RubyGems isn't clever enough
+# to install the most recent version that works, so we have to do it
+# manually.
+
+Gem::Command.build_args = ARGV
+inst = Gem::DependencyInstaller.new
+if RUBY_VERSION < "1.9"
+ puts "Installing listen ~> 1.1.0"
+ inst.install "listen", "~> 1.1.0"
+else
+ puts "Installing listen >= 1.1.0, < 2.5"
+ inst.install "listen", Gem::Requirement.new(">= 1.1.0", "< 2.5")
+end
+
+# Create a dummy rakefile to indicate success.
+f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
+f.write("task :default\n")
+f.close
View
@@ -21,6 +21,7 @@ SASS_GEMSPEC = Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 1.8.7'
spec.add_development_dependency 'yard', '>= 0.5.3'
spec.add_development_dependency 'maruku', '>= 0.5.9'
+ spec.extensions = 'ext/mkrf_conf.rb'
readmes = Dir['*'].reject{ |x| x =~ /(^|[^.a-z])[a-z]+/ || x == "TODO" }
spec.executables = ['sass', 'sass-convert', 'scss']

0 comments on commit a81052e

Please sign in to comment.