class YMDP::Base

Defines the global configuration options for all YMDP classes. This is the class that knows about local settings such as server names, server application_ids, and configuration options such as when compression or validation is required on a view.

Configuration

Set configuration options as a block with the configure command.

YMDP::Base.configure do |config|
  config.username = "malreynolds"
  config.password = "firefly2591"
  config.default_server = "staging"
  config.host = "host"
  config.production_server = "www"
  config.growl = true
  config.verbose = false
  config.compress = @compress
  config.validate = @validate

  config.add_path(:base_path, @base_path)
  config.servers = @servers

  config.load_content_variables('content')
end

These options are still evolving.

Public Class Methods

base_path() click to toggle source
# File lib/ymdp/base.rb, line 67
def self.base_path
  configuration.paths[:base_path]
end
configuration() click to toggle source
# File lib/ymdp/base.rb, line 34
def self.configuration
  @@configuration ||= YMDP::Configuration::Setter.new
end
configure() { |configuration| ... } click to toggle source

Configures global YMDP settings. Sends a YMDP::Configuration::Setter instance to the block, which is used to define global settings.

# File lib/ymdp/base.rb, line 49
def self.configure
  yield configuration
end
display_path(path) click to toggle source

Parses out the base_path setting from a path to display it in a less verbose way.

# File lib/ymdp/base.rb, line 78
def self.display_path(path)
  path = File.expand_path(path)
  path.gsub(base_path.to_s, "")
end

Public Instance Methods

base_path() click to toggle source
# File lib/ymdp/base.rb, line 71
def base_path
  self.class.base_path
end
configuration() click to toggle source
# File lib/ymdp/base.rb, line 42
def configuration
  @@configuration
end
content_variables() click to toggle source
# File lib/ymdp/base.rb, line 38
def content_variables
  configuration.content_variables
end
display_path(path) click to toggle source
# File lib/ymdp/base.rb, line 83
def display_path(path)
  self.class.display_path(path)
end
paths() click to toggle source

Returns the paths definition hash as an instance variable, making it available to instances of any class derived from YMDP::Base.

# File lib/ymdp/base.rb, line 63
def paths
  configuration.paths
end
servers() click to toggle source

Returns the server definition hash as an instance variable, making it available to instances of any class derived from YMDP::Base.

# File lib/ymdp/base.rb, line 56
def servers
  configuration.servers
end