Sha256: aa6a758bbf907c6d80ed6f4b1617b6a0ade93c572d180ff81ecd78944c67a043

Contents?: true

Size: 841 Bytes

Versions: 13

Compression:

Stored size: 841 Bytes

Contents

class WordpressDirectory < Struct.new(:type, :options)

  module PATH
    WP_CONTENT = :wp_content
    PLUGINS    = :plugins
    THEMES     = :themes
    UPLOADS    = :uploads
    LANGUAGES  = :languages
  end

  DEFAULT_PATHS = {
    PATH::WP_CONTENT => 'wp-content',
    PATH::PLUGINS    => 'wp-content/plugins',
    PATH::THEMES     => 'wp-content/themes',
    PATH::UPLOADS    => 'wp-content/uploads',
    PATH::LANGUAGES  => 'wp-content/languages'
  }

  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

13 entries across 13 versions & 1 rubygems

Version Path
wordmove-1.0.19 lib/wordmove/wordpress_directory.rb
wordmove-1.0.18 lib/wordmove/wordpress_directory.rb
wordmove-1.0.17 lib/wordmove/wordpress_directory.rb
wordmove-1.0.16 lib/wordmove/wordpress_directory.rb
wordmove-1.0.15 lib/wordmove/wordpress_directory.rb
wordmove-1.0.14 lib/wordmove/wordpress_directory.rb
wordmove-1.0.13 lib/wordmove/wordpress_directory.rb
wordmove-1.0.12 lib/wordmove/wordpress_directory.rb
wordmove-1.0.11 lib/wordmove/wordpress_directory.rb
wordmove-1.0.10 lib/wordmove/wordpress_directory.rb
wordmove-1.0.9 lib/wordmove/wordpress_directory.rb
wordmove-1.0.8 lib/wordmove/wordpress_directory.rb
wordmove-1.0.7 lib/wordmove/wordpress_directory.rb