module GoldenChild
Constants
- BlockContentFilter
- VERSION
Public Class Methods
accept(*filenames)
click to toggle source
@param [Array<String, Pathname>] paths or shortcodes for files to accept
# File lib/golden_child.rb, line 34 def self.accept(*filenames) filenames.each do |fn| accept_file(fn) end end
accept_file(path_or_shortcode)
click to toggle source
# File lib/golden_child.rb, line 46 def self.accept_file(path_or_shortcode) path = resolve_path(path_or_shortcode) master_path = find_master_for(path) mkpath master_path.dirname cp path, master_path end
configuration()
click to toggle source
@return [GoldenChild::Configuration]
# File lib/golden_child.rb, line 24 def self.configuration @configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
@yield [GoldenChild::Configuration] the global configuration
# File lib/golden_child.rb, line 29 def self.configure yield configuration end
find_master_for(path)
click to toggle source
# File lib/golden_child.rb, line 71 def self.find_master_for(path) raise UserError, "No such file #{path}" unless path.exist? raise UserError, "Not a file: #{path}" unless path.file? rel_path = path.relative_path_from(actual_root) unless rel_path raise UserError, "File #{path} is not in #{actual_root}" end master_root + rel_path end
remove(*filenames)
click to toggle source
# File lib/golden_child.rb, line 40 def self.remove(*filenames) filenames.each do |fn| remove_master_file(fn) end end
remove_master_file(path_or_shortcode)
click to toggle source
# File lib/golden_child.rb, line 54 def self.remove_master_file(path_or_shortcode) path = resolve_path(path_or_shortcode) master_path = find_master_for(path) rm master_path end
resolve_path(path_or_shortcode)
click to toggle source
@return [Pathname]
# File lib/golden_child.rb, line 61 def self.resolve_path(path_or_shortcode) path = case path_or_shortcode when /^@\d+$/ get_path_for_shortcode(path_or_shortcode) else path_or_shortcode end Pathname(path) end