Browse files

Re-re-bundle vendor/listen.

The mkrf_conf strategy didn't work; it caused considerable
installation pain for many users, especially those on Windows.

Closes #1163
  • Loading branch information...
1 parent bd8d8db commit ac6158528adac1298d2a7e30ab50b2796f632acb @nex3 nex3 committed with nex3 Jan 23, 2014
Showing with 43 additions and 30 deletions.
  1. +3 −0 .gitmodules
  2. +0 −27 ext/mkrf_conf.rb
  3. +39 −1 lib/sass/plugin/compiler.rb
  4. +0 −2 sass.gemspec
  5. +1 −0 vendor/listen
View
3 .gitmodules
@@ -0,0 +1,3 @@
+[submodule "vendor/listen"]
+ path = vendor/listen
+ url = git://github.com/guard/listen.git
View
27 ext/mkrf_conf.rb
@@ -1,27 +0,0 @@
-require 'rubygems'
-require 'rubygems/command.rb'
-require 'rubygems/dependency_installer.rb'
-
-require '../lib/sass'
-
-# 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.
-
-puts "Ensuring you have the right version of listen installed."
-
-Gem::Command.build_args = ARGV
-inst = Gem::DependencyInstaller.new
-if Sass::Util.version_geq(RUBY_VERSION, "1.9.3")
- puts "Installing listen >= 1.1.0, < 3.0.0"
- inst.install "listen", Gem::Requirement.new(">= 1.1.0", "< 3.0.0")
-else
- puts "Installing listen ~> 1.1.0"
- inst.install "listen", "~> 1.1.0"
-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
40 lib/sass/plugin/compiler.rb
@@ -313,7 +313,7 @@ def stylesheet_needs_update?(css_file, template_file)
private
def create_listener(*args, &block)
- require 'listen'
+ load_listen!
if Sass::Util.listen_geq_2?
Listen.to(*args, &block)
else
@@ -351,6 +351,44 @@ def remove_redundant_directories(directories)
dedupped
end
+ def load_listen!
+ if defined?(gem)
+ begin
+ gem 'listen', '>= 1.1.0', '< 3.0.0'
+ require 'listen'
+ rescue Gem::LoadError
+ dir = Sass::Util.scope("vendor/listen/lib")
+ $LOAD_PATH.unshift dir
+ begin
+ require 'listen'
+ rescue LoadError => e
+ if Sass::Util.version_geq(RUBY_VERSION, "1.9.3")
+ version_constraint = "~> 2.7"
+ else
+ version_constraint = "~> 1.1"
+ end
+ e.message << "\n" <<
+ "Run \"gem install listen --version '#{version_constraint}'\" to get it."
+ raise e
+ end
+ end
+ else
+ begin
+ require 'listen'
+ rescue LoadError => e
+ dir = Sass::Util.scope("vendor/listen/lib")
+ if $LOAD_PATH.include?(dir)
+ raise e unless File.exists?(scope(".git"))
+ e.message << "\n" <<
+ 'Run "git submodule update --init" to get the bundled version.'
+ else
+ $LOAD_PATH.unshift dir
+ retry
+ end
+ end
+ end
+ end
+
def update_stylesheet(filename, css, sourcemap)
dir = File.dirname(css)
unless File.exists?(dir)
View
2 sass.gemspec
@@ -19,10 +19,8 @@ SASS_GEMSPEC = Gem::Specification.new do |spec|
END
spec.required_ruby_version = '>= 1.8.7'
- spec.add_runtime_dependency 'rake'
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']
1 vendor/listen
@@ -0,0 +1 @@
+Subproject commit 27bae3a1c8b318954c9e798c3c16dafae4297e5a

0 comments on commit ac61585

Please sign in to comment.