diff --git a/bin/rougify b/bin/rougify index 1a7cc5be7d..13f2b10848 100755 --- a/bin/rougify +++ b/bin/rougify @@ -3,8 +3,8 @@ require 'pathname' ROOT_DIR = Pathname.new(__FILE__).dirname.parent -load ROOT_DIR.join('lib/rouge.rb') -load ROOT_DIR.join('lib/rouge/cli.rb') +Kernel::load ROOT_DIR.join('lib/rouge.rb') +Kernel::load ROOT_DIR.join('lib/rouge/cli.rb') Signal.trap('PIPE', 'SYSTEM_DEFAULT') if Signal.list.include? 'PIPE' begin diff --git a/lib/rouge.rb b/lib/rouge.rb index ad51242bf8..6f43a16ecb 100644 --- a/lib/rouge.rb +++ b/lib/rouge.rb @@ -12,8 +12,8 @@ module Rouge class << self def reload! - Object.send :remove_const, :Rouge - load __FILE__ + Object::send :remove_const, :Rouge + Kernel::load __FILE__ end # Highlight some text with a given lexer and formatter. @@ -40,7 +40,7 @@ def highlight(text, lexer, formatter, &b) # # @api private def load_file(path) - load File.join(LIB_DIR, "rouge/#{path}.rb") + Kernel::load File.join(LIB_DIR, "rouge/#{path}.rb") end # Load the lexers in the `lib/rouge/lexers` directory. diff --git a/lib/rouge/lexer.rb b/lib/rouge/lexer.rb index 8bcc17bf5e..c18cc408f7 100644 --- a/lib/rouge/lexer.rb +++ b/lib/rouge/lexer.rb @@ -511,7 +511,7 @@ module Lexers def self.load_lexer(relpath) return if @_loaded_lexers.key?(relpath) @_loaded_lexers[relpath] = true - load File.join(BASE_DIR, relpath) + Kernel::load File.join(BASE_DIR, relpath) end end end diff --git a/lib/rouge/lexers/apache.rb b/lib/rouge/lexers/apache.rb index aba506f5a0..a9de03c585 100644 --- a/lib/rouge/lexers/apache.rb +++ b/lib/rouge/lexers/apache.rb @@ -13,7 +13,7 @@ class Apache < RegexLexer # self-modifying method that loads the keywords file def self.keywords - load File.join(Lexers::BASE_DIR, 'apache/keywords.rb') + Kernel::load File.join(Lexers::BASE_DIR, 'apache/keywords.rb') keywords end diff --git a/lib/rouge/lexers/gherkin.rb b/lib/rouge/lexers/gherkin.rb index 81605527b5..0b655b093d 100644 --- a/lib/rouge/lexers/gherkin.rb +++ b/lib/rouge/lexers/gherkin.rb @@ -19,7 +19,7 @@ def self.detect?(text) # self-modifying method that loads the keywords file def self.keywords - load File.join(Lexers::BASE_DIR, 'gherkin/keywords.rb') + Kernel::load File.join(Lexers::BASE_DIR, 'gherkin/keywords.rb') keywords end diff --git a/lib/rouge/lexers/isbl.rb b/lib/rouge/lexers/isbl.rb index 216f395678..5c57d6d5ea 100644 --- a/lib/rouge/lexers/isbl.rb +++ b/lib/rouge/lexers/isbl.rb @@ -10,7 +10,7 @@ class ISBL < RegexLexer filenames '*.isbl' def self.builtins - load File.join(Lexers::BASE_DIR, 'isbl/builtins.rb') + Kernel::load File.join(Lexers::BASE_DIR, 'isbl/builtins.rb') self.builtins end diff --git a/lib/rouge/lexers/lasso.rb b/lib/rouge/lexers/lasso.rb index 0f9f2d9676..b7c537c65e 100644 --- a/lib/rouge/lexers/lasso.rb +++ b/lib/rouge/lexers/lasso.rb @@ -36,7 +36,7 @@ def start_inline? # self-modifying method that loads the keywords file def self.keywords - load File.join(Lexers::BASE_DIR, 'lasso/keywords.rb') + Kernel::load File.join(Lexers::BASE_DIR, 'lasso/keywords.rb') keywords end diff --git a/lib/rouge/lexers/lua.rb b/lib/rouge/lexers/lua.rb index 96541f8689..38d8955418 100644 --- a/lib/rouge/lexers/lua.rb +++ b/lib/rouge/lexers/lua.rb @@ -25,7 +25,7 @@ def self.detect?(text) end def self.builtins - load File.join(Lexers::BASE_DIR, 'lua/builtins.rb') + Kernel::load File.join(Lexers::BASE_DIR, 'lua/builtins.rb') self.builtins end diff --git a/lib/rouge/lexers/mathematica.rb b/lib/rouge/lexers/mathematica.rb index 305921c65a..cb59c22205 100644 --- a/lib/rouge/lexers/mathematica.rb +++ b/lib/rouge/lexers/mathematica.rb @@ -56,7 +56,7 @@ def self.keywords # The list of built-in symbols comes from a wolfram server and is created automatically by rake def self.builtins - load File.join(Lexers::BASE_DIR, 'mathematica/builtins.rb') + Kernel::load File.join(Lexers::BASE_DIR, 'mathematica/builtins.rb') self.builtins end diff --git a/lib/rouge/lexers/matlab.rb b/lib/rouge/lexers/matlab.rb index 46d9930126..c63458517b 100644 --- a/lib/rouge/lexers/matlab.rb +++ b/lib/rouge/lexers/matlab.rb @@ -20,7 +20,7 @@ def self.keywords # self-modifying method that loads the builtins file def self.builtins - load File.join(Lexers::BASE_DIR, 'matlab/builtins.rb') + Kernel::load File.join(Lexers::BASE_DIR, 'matlab/builtins.rb') builtins end diff --git a/lib/rouge/lexers/php.rb b/lib/rouge/lexers/php.rb index 2c3d344dea..4ce17f6afa 100644 --- a/lib/rouge/lexers/php.rb +++ b/lib/rouge/lexers/php.rb @@ -29,7 +29,7 @@ def initialize(*) end def self.builtins - load File.join(Lexers::BASE_DIR, 'php/builtins.rb') + Kernel::load File.join(Lexers::BASE_DIR, 'php/builtins.rb') self.builtins end diff --git a/lib/rouge/lexers/sqf.rb b/lib/rouge/lexers/sqf.rb index ef0294e384..417578c559 100644 --- a/lib/rouge/lexers/sqf.rb +++ b/lib/rouge/lexers/sqf.rb @@ -55,7 +55,7 @@ def self.diag_commands end def self.commands - load File.join(Lexers::BASE_DIR, "sqf/commands.rb") + Kernel::load File.join(Lexers::BASE_DIR, "sqf/commands.rb") @commands = self.commands end diff --git a/lib/rouge/lexers/viml.rb b/lib/rouge/lexers/viml.rb index ccab889676..161ce62646 100644 --- a/lib/rouge/lexers/viml.rb +++ b/lib/rouge/lexers/viml.rb @@ -14,7 +14,7 @@ class VimL < RegexLexer mimetypes 'text/x-vim' def self.keywords - load File.join(Lexers::BASE_DIR, 'viml/keywords.rb') + Kernel::load File.join(Lexers::BASE_DIR, 'viml/keywords.rb') self.keywords end diff --git a/spec/visual/app.rb b/spec/visual/app.rb index 7fd3cab313..a531b99891 100644 --- a/spec/visual/app.rb +++ b/spec/visual/app.rb @@ -18,8 +18,7 @@ class VisualTestApp < Sinatra::Application DEMOS = ROOT.join('lib/rouge/demos') def reload_source! - Object.send :remove_const, :Rouge - load ROUGE_LIB + Rouge.reload! end def query_string