Class: YMDP::Configuration::Setter

Inherits:
Object
  • Object
show all
Defined in:
lib/ymdp/configuration/config.rb

Overview

Provides an interface to set global configuration variables inside a block.

Used by the YMDP::Base configure method.

Examples

In the following example, the config variable inside the block is an instance of YMDP::Configuration::Setter.

YMDP::Base.configure do |config|
  config.username = 'malreynolds'
  config.load_content_variables('content')
end

It is then up to YMDP::Base.configure to take the Setter instance and set all the appropriate options based on its settings.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSetter

:nodoc:



72
73
74
75
# File 'lib/ymdp/configuration/config.rb', line 72

def initialize #:nodoc:
  @paths = {}
  @content_variables = {}
end

Instance Attribute Details

#compressObject

Hash value containing settings which tell the application when to compress CSS and JavaScript.



45
46
47
# File 'lib/ymdp/configuration/config.rb', line 45

def compress
  @compress
end

#content_variablesObject

Hash value containing content variables which are made available to the views at build time.



54
55
56
# File 'lib/ymdp/configuration/config.rb', line 54

def content_variables
  @content_variables
end

#default_serverObject

String value containing the default_server name. Matches the related entry in the servers hash to define which server is the default for rake tasks such as deploy.



35
36
37
# File 'lib/ymdp/configuration/config.rb', line 35

def default_server
  @default_server
end

#external_assetsObject

Returns the value of attribute external_assets.



68
69
70
# File 'lib/ymdp/configuration/config.rb', line 68

def external_assets
  @external_assets
end

#growlObject

Boolean value which sets whether Growl notifications should be used when compiling and deploying the application.



42
43
44
# File 'lib/ymdp/configuration/config.rb', line 42

def growl
  @growl
end

#hostObject

Host name for the website backend of this application.



38
39
40
# File 'lib/ymdp/configuration/config.rb', line 38

def host
  @host
end

#javascript_libraryObject

Returns the value of attribute javascript_library.



70
71
72
# File 'lib/ymdp/configuration/config.rb', line 70

def javascript_library
  @javascript_library
end

#jslint_settingsObject

Configuration options for JSLint JavaScript validator. Should be maintained in jslint_settings.yml.



66
67
68
# File 'lib/ymdp/configuration/config.rb', line 66

def jslint_settings
  @jslint_settings
end

#passwordObject

String value containing the password used to communicate with the Yahoo! Mail Development Platform to deploy the application.



30
31
32
# File 'lib/ymdp/configuration/config.rb', line 30

def password
  @password
end

#pathsObject

Hash value containing paths used by the application to locate its files. This can be used to overwrite default settings.



61
62
63
# File 'lib/ymdp/configuration/config.rb', line 61

def paths
  @paths
end

#serversObject

Hash value containing application data about the servers, such as their asset and application IDs.



57
58
59
# File 'lib/ymdp/configuration/config.rb', line 57

def servers
  @servers
end

#usernameObject

String value containing the login used to communicate with the Yahoo! Mail Development Platform to deploy the application.



26
27
28
# File 'lib/ymdp/configuration/config.rb', line 26

def username
  @username
end

#validateObject

Hash value containing settings which tell the application when to validate HTML and JavaScript.



48
49
50
# File 'lib/ymdp/configuration/config.rb', line 48

def validate
  @validate
end

#verboseObject

Boolean value which sets whether to output verbose messages or not.



51
52
53
# File 'lib/ymdp/configuration/config.rb', line 51

def verbose
  @verbose
end

Instance Method Details

#add_content_variable(name, value) ⇒ Object

Adds an entry to the content_variables hash.



85
86
87
# File 'lib/ymdp/configuration/config.rb', line 85

def add_content_variable(name, value)
  @content_variables[name] = value
end

#add_path(name, value) ⇒ Object

Adds an entry to the paths hash.



79
80
81
# File 'lib/ymdp/configuration/config.rb', line 79

def add_path(name, value)
  @paths[name] = value
end

#jqueryObject



101
102
103
# File 'lib/ymdp/configuration/config.rb', line 101

def jquery
  @javascript_library = "jquery"
end

#load_content_variables(filename) ⇒ Object

Loads the content_variables hash from a Yaml file.



91
92
93
94
95
# File 'lib/ymdp/configuration/config.rb', line 91

def load_content_variables(filename)
  path = "#{CONFIG_PATH}/#{filename}".gsub(/\.yml$/, "")
  path = "#{path}.yml"
  @content_variables = YAML.load_file(path)
end

#prototypeObject



97
98
99
# File 'lib/ymdp/configuration/config.rb', line 97

def prototype
  @javascript_library = "prototype"
end