Sha256: f8210a6cde5fc8363ff9f059f192e7eb8596dda907b7cd769e3f36933a25fd4a
Contents?: true
Size: 973 Bytes
Versions: 5
Compression:
Stored size: 973 Bytes
Contents
class WordpressDirectory < Struct.new(:type, :options) module PATH WP_CONTENT = :wp_content WP_CONFIG = :wp_config PLUGINS = :plugins THEMES = :themes UPLOADS = :uploads LANGUAGES = :languages end DEFAULT_PATHS = { PATH::WP_CONTENT => 'wp-content', PATH::WP_CONFIG => 'wp-config.php', PATH::PLUGINS => 'wp-content/plugins', PATH::THEMES => 'wp-content/themes', PATH::UPLOADS => 'wp-content/uploads', PATH::LANGUAGES => 'wp-content/languages' } def self.default_path_for(sym) DEFAULT_PATHS[sym] end def path(*args) File.join(options[:wordpress_path], relative_path(*args)) end def url(*args) File.join(options[:vhost], relative_path(*args)) end def relative_path(*args) path = if options[:paths] && options[:paths][type] options[:paths][type] else DEFAULT_PATHS[type] end File.join(path, *args) end end
Version data entries
5 entries across 5 versions & 1 rubygems