Class: WordpressDirectory

Inherits:
Struct
  • Object
show all
Defined in:
lib/wordmove/wordpress_directory.rb

Defined Under Namespace

Modules: PATH

Constant Summary collapse

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'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



1
2
3
# File 'lib/wordmove/wordpress_directory.rb', line 1

def options
  @options
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



1
2
3
# File 'lib/wordmove/wordpress_directory.rb', line 1

def type
  @type
end

Instance Method Details

#path(*args) ⇒ Object



19
20
21
# File 'lib/wordmove/wordpress_directory.rb', line 19

def path(*args)
  File.join(options[:wordpress_path], relative_path(*args))
end

#relative_path(*args) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/wordmove/wordpress_directory.rb', line 27

def relative_path(*args)
  path = if options[:paths] && options[:paths][type]
           options[:paths][type]
         else
           DEFAULT_PATHS[type]
         end
  File.join(path, *args)
end

#url(*args) ⇒ Object



23
24
25
# File 'lib/wordmove/wordpress_directory.rb', line 23

def url(*args)
  File.join(options[:vhost], relative_path(*args))
end