Class: YMDP::Configuration::Setter
- Inherits:
-
Object
- Object
- YMDP::Configuration::Setter
- 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
-
#compress ⇒ Object
Hash value containing settings which tell the application when to compress CSS and JavaScript.
-
#content_variables ⇒ Object
Hash value containing content variables which are made available to the views at build time.
-
#default_server ⇒ Object
String value containing the default_server name.
-
#external_assets ⇒ Object
Returns the value of attribute external_assets.
-
#growl ⇒ Object
Boolean value which sets whether Growl notifications should be used when compiling and deploying the application.
-
#host ⇒ Object
Host name for the website backend of this application.
-
#javascript_library ⇒ Object
Returns the value of attribute javascript_library.
-
#jslint_settings ⇒ Object
Configuration options for JSLint JavaScript validator.
-
#password ⇒ Object
String value containing the password used to communicate with the Yahoo! Mail Development Platform to deploy the application.
-
#paths ⇒ Object
Hash value containing paths used by the application to locate its files.
-
#servers ⇒ Object
Hash value containing application data about the servers, such as their asset and application IDs.
-
#username ⇒ Object
String value containing the login used to communicate with the Yahoo! Mail Development Platform to deploy the application.
-
#validate ⇒ Object
Hash value containing settings which tell the application when to validate HTML and JavaScript.
-
#verbose ⇒ Object
Boolean value which sets whether to output verbose messages or not.
Instance Method Summary collapse
-
#add_content_variable(name, value) ⇒ Object
Adds an entry to the
content_variables
hash. -
#add_path(name, value) ⇒ Object
Adds an entry to the
paths
hash. -
#initialize ⇒ Setter
constructor
:nodoc:.
- #jquery ⇒ Object
-
#load_content_variables(filename) ⇒ Object
Loads the
content_variables
hash from a Yaml file. - #prototype ⇒ Object
Constructor Details
#initialize ⇒ Setter
:nodoc:
72 73 74 75 |
# File 'lib/ymdp/configuration/config.rb', line 72 def initialize #:nodoc: @paths = {} @content_variables = {} end |
Instance Attribute Details
#compress ⇒ Object
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_variables ⇒ Object
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_server ⇒ Object
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_assets ⇒ Object
Returns the value of attribute external_assets.
68 69 70 |
# File 'lib/ymdp/configuration/config.rb', line 68 def external_assets @external_assets end |
#growl ⇒ Object
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 |
#host ⇒ Object
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_library ⇒ Object
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_settings ⇒ Object
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 |
#password ⇒ Object
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 |
#paths ⇒ Object
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 |
#servers ⇒ Object
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 |
#username ⇒ Object
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 |
#validate ⇒ Object
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 |
#verbose ⇒ Object
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 |
#jquery ⇒ Object
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 |
#prototype ⇒ Object
97 98 99 |
# File 'lib/ymdp/configuration/config.rb', line 97 def prototype @javascript_library = "prototype" end |