Prints a deprecation warning using the logger. The message states that the given method is being deprecated. An optional message can be give to — somthing nice and fuzzy about a new method or why this one has to go away; sniff, we‘ll miss you little buddy.
# File lib/webby.rb, line 112 def self.deprecated( method, message = nil ) msg = "'#{method}' has been deprecated" msg << "\n\t#{message}" unless message.nil? Logging::Logger['Webby'].warn msg end
call-seq
Webby.exclude => regexp
Returns a regular expression used to exclude resources from the content directory from being processed by Webby. This same regular expression is also used to exclude layouts.
# File lib/webby.rb, line 42 def self.exclude @exclude ||= Regexp.new(site.exclude.join('|')) end
Calls the editor set in the Sitefile or in the environment variables WEBBY_EDITOR or EDITOR (in that order). This method will do nothing if the editor has not been set.
# File lib/webby.rb, line 53 def self.exec_editor( *args ) unless defined? @editor @editor = (site.editor.nil? or site.editor.empty?) ? nil : site.editor @editor = @editor.split if @editor end return if @editor.nil? args = [@editor, args].flatten exec(*args) end
Scan the layouts/ folder and the content/ folder and create a new Resource object for each file found there.
# File lib/webby.rb, line 121 def self.load_files ::Find.find(site.layout_dir, site.content_dir) do |path| next unless test ?f, path next if path =~ ::Webby.exclude Resources.new path end end
Utility method used to rquire all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.
# File lib/webby.rb, line 99 def self.require_all_libs_relative_to( fname, dir = nil ) dir ||= ::File.basename(fname, '.*') search_me = ::File.expand_path( ::File.join(::File.dirname(fname), dir, '*.rb')) Dir.glob(search_me).sort.each {|rb| require rb} end