Require relative to the load path instead of using the more convoluted approach of File.join(File.dirname(__FILE__), ...).
Also, don't ever muck with the load paths or rubygems without first trying to require the library without doing so.
This commit is contained in:
parent
60ad1e2425
commit
b13fd43a2e
3
Rakefile
3
Rakefile
@ -12,7 +12,8 @@ end
|
||||
|
||||
require 'rubygems'
|
||||
require 'rake'
|
||||
require 'lib/compass'
|
||||
$:.unshift File.join(File.dirname(__FILE__), 'lib')
|
||||
require 'compass'
|
||||
|
||||
# ----- Default: Testing ------
|
||||
|
||||
|
15
bin/compass
15
bin/compass
@ -1,8 +1,19 @@
|
||||
#!/usr/bin/env ruby
|
||||
# The compass command line utility
|
||||
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'compass'))
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'compass', 'exec'))
|
||||
begin
|
||||
retried = false
|
||||
require 'compass'
|
||||
require 'compass/exec'
|
||||
rescue LoadError
|
||||
if retried
|
||||
raise
|
||||
else
|
||||
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
retried = true
|
||||
retry
|
||||
end
|
||||
end
|
||||
|
||||
command = Compass::Exec::Compass.new(ARGV)
|
||||
exit command.run!
|
||||
|
@ -1,8 +1,8 @@
|
||||
module Compass
|
||||
end
|
||||
|
||||
['dependencies', 'sass_extensions', 'core_ext', 'version', 'errors'].each do |file|
|
||||
require File.join(File.dirname(__FILE__), 'compass', file)
|
||||
%w(dependencies sass_extensions core_ext version errors).each do |lib|
|
||||
require "compass/#{lib}"
|
||||
end
|
||||
|
||||
module Compass
|
||||
@ -16,6 +16,6 @@ module Compass
|
||||
module_function :base_directory, :lib_directory
|
||||
end
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'compass', 'configuration')
|
||||
require File.join(File.dirname(__FILE__), 'compass', 'frameworks')
|
||||
require File.join(File.dirname(__FILE__), 'compass', 'app_integration')
|
||||
%w(configuration frameworks app_integration).each do |lib|
|
||||
require "compass/#{lib}"
|
||||
end
|
||||
|
@ -1,3 +1,3 @@
|
||||
%w(stand_alone rails merb).each do |lib|
|
||||
require File.join(File.dirname(__FILE__), 'app_integration', lib)
|
||||
require "compass/app_integration/#{lib}"
|
||||
end
|
||||
|
@ -1 +1 @@
|
||||
require File.join(File.dirname(__FILE__), 'merb', 'runtime') if defined?(Merb::Plugins)
|
||||
require 'compass/app_integration/merb/runtime' if defined?(Merb::Plugins)
|
||||
|
@ -1,8 +1,8 @@
|
||||
%w(configuration_defaults installer).each do |lib|
|
||||
require File.join(File.dirname(__FILE__), 'rails', lib)
|
||||
require "compass/app_integration/rails/#{lib}"
|
||||
end
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'rails', 'runtime') if defined?(ActionController::Base)
|
||||
require 'compass/app_integration/rails/runtime' if defined?(ActionController::Base)
|
||||
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ unless defined?(Compass::RAILS_LOADED)
|
||||
Compass::RAILS_LOADED = true
|
||||
|
||||
%w(action_controller sass_plugin urls).each do |lib|
|
||||
require File.join(File.dirname(__FILE__), lib)
|
||||
require "compass/app_integration/rails/#{lib}"
|
||||
end
|
||||
|
||||
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
||||
|
@ -1,3 +1,3 @@
|
||||
['configuration_defaults', 'installer'].each do |lib|
|
||||
require File.join(File.dirname(__FILE__), 'stand_alone', lib)
|
||||
%w(configuration_defaults installer).each do |lib|
|
||||
require "compass/app_integration/stand_alone/#{lib}"
|
||||
end
|
@ -1,6 +1,5 @@
|
||||
require 'fileutils'
|
||||
require File.join(File.dirname(__FILE__), 'stamp_pattern')
|
||||
require File.join(File.dirname(__FILE__), 'update_project')
|
||||
require 'compass/commands/stamp_pattern'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
|
@ -1,6 +1,6 @@
|
||||
require File.join(File.dirname(__FILE__), 'project_base')
|
||||
require File.join(File.dirname(__FILE__), 'update_project')
|
||||
require File.join(File.dirname(__FILE__), '..', 'grid_builder')
|
||||
require 'compass/commands/project_base'
|
||||
require 'compass/commands/update_project'
|
||||
require 'compass/grid_builder'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
|
@ -1,4 +1,4 @@
|
||||
require File.join(Compass.lib_directory, 'compass', 'installers')
|
||||
require 'compass/installers'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
|
@ -1,7 +1,7 @@
|
||||
require 'fileutils'
|
||||
require 'pathname'
|
||||
require File.join(File.dirname(__FILE__), 'base')
|
||||
require File.join(File.dirname(__FILE__), 'installer_command')
|
||||
require 'compass/commands/base'
|
||||
require 'compass/commands/installer_command'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
|
@ -1,6 +1,6 @@
|
||||
require 'fileutils'
|
||||
require File.join(File.dirname(__FILE__), 'base')
|
||||
require File.join(File.dirname(__FILE__), 'update_project')
|
||||
require 'compass/commands/base'
|
||||
require 'compass/commands/update_project'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
|
@ -1,5 +1,5 @@
|
||||
require File.join(File.dirname(__FILE__), 'project_base')
|
||||
require File.join(Compass.lib_directory, 'compass', 'compiler')
|
||||
require 'compass/commands/project_base'
|
||||
require 'compass/compiler'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
|
@ -1,5 +1,5 @@
|
||||
require File.join(File.dirname(__FILE__), 'project_base')
|
||||
require File.join(File.dirname(__FILE__), 'update_project')
|
||||
require 'compass/commands/project_base'
|
||||
require 'compass/commands/update_project'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
@ -11,7 +11,7 @@ module Compass
|
||||
end
|
||||
|
||||
def perform
|
||||
require File.join(File.dirname(__FILE__), '..', 'validator')
|
||||
require 'compass/validator'
|
||||
UpdateProject.new(working_path, options).perform
|
||||
Validator.new(project_css_subdirectory).validate()
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
require 'fileutils'
|
||||
require 'pathname'
|
||||
require File.join(File.dirname(__FILE__), 'base')
|
||||
require File.join(File.dirname(__FILE__), 'update_project')
|
||||
require 'compass/commands/base'
|
||||
require 'compass/commands/update_project'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
@ -19,7 +19,12 @@ module Compass
|
||||
|
||||
puts ">>> Compass is watching for changes. Press Ctrl-C to Stop."
|
||||
|
||||
require File.join(Compass.lib_directory, 'vendor', 'fssm')
|
||||
begin
|
||||
require 'fssm'
|
||||
rescue LoadError
|
||||
$: << File.join(Compass.lib_directory, 'vendor')
|
||||
retry
|
||||
end
|
||||
|
||||
FSSM.monitor do |monitor|
|
||||
Compass.configuration.sass_load_paths.each do |load_path|
|
||||
|
@ -1,4 +1,4 @@
|
||||
require File.join(File.dirname(__FILE__), 'project_base')
|
||||
require 'compass/commands/project_base'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
|
@ -34,5 +34,5 @@ module Compass
|
||||
end
|
||||
|
||||
['adapters', 'comments', 'defaults', 'helpers', 'inheritance', 'serialization', 'data'].each do |lib|
|
||||
require File.join(File.dirname(__FILE__), 'configuration', lib)
|
||||
require "compass/configuration/#{lib}"
|
||||
end
|
||||
|
@ -1,8 +1,6 @@
|
||||
unless defined?(Sass)
|
||||
begin
|
||||
require 'sass'
|
||||
rescue LoadError
|
||||
require 'rubygems'
|
||||
require 'sass'
|
||||
end
|
||||
end
|
||||
begin
|
||||
require 'sass'
|
||||
rescue LoadError
|
||||
require 'rubygems'
|
||||
require 'sass'
|
||||
end
|
||||
|
@ -1,8 +1,8 @@
|
||||
require File.join(Compass.lib_directory, 'compass', 'dependencies')
|
||||
require 'compass/dependencies'
|
||||
require 'optparse'
|
||||
require File.join(Compass.lib_directory, 'compass', 'logger')
|
||||
require File.join(Compass.lib_directory, 'compass', 'errors')
|
||||
require File.join(Compass.lib_directory, 'compass', 'actions')
|
||||
require 'compass/logger'
|
||||
require 'compass/errors'
|
||||
require 'compass/actions'
|
||||
|
||||
module Compass
|
||||
module Exec
|
||||
@ -245,6 +245,8 @@ END
|
||||
end
|
||||
end
|
||||
|
||||
Dir.glob(File.join(File.dirname(__FILE__), 'commands', "*.rb")).each do |file|
|
||||
require file
|
||||
%w(base generate_grid_background list_frameworks project_base
|
||||
update_project watch_project create_project installer_command
|
||||
print_version stamp_pattern validate_project write_configuration).each do |lib|
|
||||
require "compass/commands/#{lib}"
|
||||
end
|
||||
|
@ -1,3 +1,3 @@
|
||||
%w(manifest template_context base).each do |f|
|
||||
require File.join(File.dirname(__FILE__), 'installers', f)
|
||||
require "compass/installers/#{f}"
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
module Compass::SassExtensions
|
||||
end
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'sass_extensions', 'functions')
|
||||
require File.join(File.dirname(__FILE__), 'sass_extensions', 'monkey_patches')
|
||||
require 'compass/sass_extensions/functions'
|
||||
require 'compass/sass_extensions/monkey_patches'
|
||||
|
@ -1,8 +1,8 @@
|
||||
module Compass::SassExtensions::Functions
|
||||
end
|
||||
|
||||
['selectors', 'enumerate', 'urls', 'display', 'inline_image'].each do |func|
|
||||
require File.join(File.dirname(__FILE__), 'functions', func)
|
||||
%w(selectors enumerate urls display inline_image).each do |func|
|
||||
require "compass/sass_extensions/functions/#{func}"
|
||||
end
|
||||
|
||||
module Sass::Script::Functions
|
||||
|
@ -1,3 +1,3 @@
|
||||
['stylesheet_updating'].each do |patch|
|
||||
require File.join(File.dirname(__FILE__), 'monkey_patches', patch)
|
||||
%w(stylesheet_updating).each do |patch|
|
||||
require "compass/sass_extensions/monkey_patches/#{patch}"
|
||||
end
|
2
lib/vendor/fssm.rb
vendored
2
lib/vendor/fssm.rb
vendored
@ -16,7 +16,6 @@ module FSSM
|
||||
end
|
||||
end
|
||||
|
||||
$:.unshift(File.dirname(__FILE__))
|
||||
require 'pathname'
|
||||
require 'fssm/ext'
|
||||
require 'fssm/support'
|
||||
@ -26,5 +25,4 @@ require 'fssm/monitor'
|
||||
|
||||
require "fssm/backends/#{FSSM::Support.backend.downcase}"
|
||||
FSSM::Backends::Default = FSSM::Backends.const_get(FSSM::Support.backend)
|
||||
$:.shift
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
need_gems = false
|
||||
|
||||
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
||||
$:.unshift(lib_dir) unless $:.include?(lib_dir)
|
||||
|
||||
# allows testing with edge Haml by creating a test/haml symlink
|
||||
linked_haml = File.dirname(__FILE__) + '/haml'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user