ymdp 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/ymdp/application.rb +22 -0
- data/lib/ymdp/application_view.rb +312 -0
- data/lib/ymdp/base.rb +119 -0
- data/lib/ymdp/commands/build.rb +0 -6
- data/lib/ymdp/compiler/base.rb +12 -10
- data/lib/ymdp/compiler/domains.rb +8 -34
- data/lib/ymdp/compiler/template.rb +58 -85
- data/lib/ymdp/configuration/config.rb +70 -28
- data/lib/ymdp/configuration/constants.rb +17 -3
- data/lib/ymdp/processor/form_post.rb +5 -1
- data/lib/ymdp/support/file.rb +29 -11
- data/lib/ymdp/tasks/keys.rake +13 -13
- data/lib/ymdp/tasks/ymdp.rake +4 -4
- data/spec/application_spec.rb +29 -0
- data/spec/application_view_spec.rb +5 -0
- data/spec/compiler_spec.rb +3 -3
- data/spec/compiler_template_spec.rb +26 -54
- data/spec/data/app/views/layouts/application.html.haml +2 -0
- data/spec/data/config/config.yml +1 -0
- data/spec/data/config/constants.rb +3 -7
- data/spec/data/script/destroy +2 -2
- data/spec/data/script/langs +1 -3
- data/spec/default_settings.rb +42 -0
- data/spec/domains_spec.rb +3 -22
- data/spec/spec_helper.rb +3 -0
- data/spec/stubs.rb +11 -0
- data/spec/ymdp_base_spec.rb +125 -0
- data/test.rb +46 -0
- data/ymdp.gemspec +15 -65
- metadata +14 -64
- data/lib/new_application/.base +0 -11
- data/lib/new_application/Gemfile +0 -13
- data/lib/new_application/Rakefile +0 -3
- data/lib/new_application/app/.gitignore +0 -1
- data/lib/new_application/app/assets/images/lightbox/lightbox_bg.png +0 -0
- data/lib/new_application/app/assets/javascripts/OpenMailIntl.js +0 -291
- data/lib/new_application/app/assets/javascripts/controls.js +0 -965
- data/lib/new_application/app/assets/javascripts/date.js +0 -104
- data/lib/new_application/app/assets/javascripts/dragdrop.js +0 -974
- data/lib/new_application/app/assets/javascripts/effects.js +0 -1123
- data/lib/new_application/app/assets/javascripts/lowpro.js +0 -320
- data/lib/new_application/app/assets/javascripts/prototype.js +0 -4874
- data/lib/new_application/app/assets/javascripts/scriptaculous.js +0 -68
- data/lib/new_application/app/assets/yrb/en-US/application_en-US.pres +0 -7
- data/lib/new_application/app/helpers/application_helper.rb +0 -3
- data/lib/new_application/app/javascripts/application.js +0 -580
- data/lib/new_application/app/javascripts/debug.js +0 -138
- data/lib/new_application/app/javascripts/flash.js +0 -96
- data/lib/new_application/app/javascripts/header.js +0 -13
- data/lib/new_application/app/javascripts/help.js +0 -76
- data/lib/new_application/app/javascripts/i18n.js +0 -235
- data/lib/new_application/app/javascripts/launcher.js +0 -159
- data/lib/new_application/app/javascripts/logger.js +0 -61
- data/lib/new_application/app/javascripts/tag_helper.js +0 -178
- data/lib/new_application/app/stylesheets/application.css +0 -0
- data/lib/new_application/app/stylesheets/ie.css +0 -0
- data/lib/new_application/app/stylesheets/ie6.css +0 -0
- data/lib/new_application/app/stylesheets/ie7.css +0 -0
- data/lib/new_application/app/stylesheets/ie8.css +0 -0
- data/lib/new_application/app/stylesheets/lightbox.css +0 -30
- data/lib/new_application/app/stylesheets/non_ie.css +0 -0
- data/lib/new_application/app/views/layouts/application.html.haml +0 -35
- data/lib/new_application/app/views/shared/_error.html.haml +0 -8
- data/lib/new_application/app/views/shared/_flash.html.haml +0 -2
- data/lib/new_application/app/views/shared/_javascripts.html.haml +0 -22
- data/lib/new_application/app/views/shared/_loading.html.haml +0 -13
- data/lib/new_application/app/views/shared/_stylesheets.html.haml +0 -23
- data/lib/new_application/config/categories.yml +0 -6
- data/lib/new_application/config/config.yml.example +0 -30
- data/lib/new_application/config/constants.rb +0 -54
- data/lib/new_application/config/servers.yml.example +0 -9
- data/lib/new_application/lib/init.rb +0 -13
- data/lib/new_application/lib/tasks/environment.rake +0 -4
- data/lib/new_application/lib/tasks/keys.rake +0 -3
- data/lib/new_application/lib/tasks/setup.rake +0 -13
- data/lib/new_application/lib/tasks/ymdp.rake +0 -4
- data/lib/new_application/script/build +0 -9
- data/lib/new_application/script/config +0 -13
- data/lib/new_application/script/destroy +0 -18
- data/lib/new_application/script/generate +0 -4
- data/lib/new_application/script/gitrm +0 -17
- data/lib/new_application/script/growl +0 -6
- data/lib/new_application/script/images +0 -48
- data/lib/new_application/script/jslint.js +0 -5072
- data/lib/new_application/script/langs +0 -31
- data/lib/new_application/script/translate +0 -5
- data/lib/new_application/script/ymdt +0 -1895
- data/lib/new_application/script/ymdt.old +0 -1890
- data/lib/new_application/script/yuicompressor-2.4.2.jar +0 -0
- data/lib/new_application/ymdp +0 -8
- data/lib/ymdp/processor/processor.rb +0 -132
- data/lib/ymdp/ymdp.rb +0 -208
data/lib/ymdp/commands/build.rb
CHANGED
@@ -3,12 +3,6 @@ YMDP_ENV = "build"
|
|
3
3
|
require 'compiler/options'
|
4
4
|
require 'compiler/domains'
|
5
5
|
|
6
|
-
YMDP::Compiler::Template::Base.base_path = BASE_PATH
|
7
|
-
YMDP::Compiler::Template::Base.servers = SERVERS
|
8
|
-
|
9
|
-
YMDP::Compiler::Domains.base_path = BASE_PATH
|
10
|
-
YMDP::Compiler::Domains.servers = SERVERS
|
11
|
-
|
12
6
|
@options = YMDP::Compiler::Options.parse
|
13
7
|
YMDP::Compiler::Domains.new(@options).compile
|
14
8
|
|
data/lib/ymdp/compiler/base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Compiles the source code for an individual domain.
|
2
2
|
#
|
3
|
-
#
|
3
|
+
# ==== Examples
|
4
4
|
#
|
5
5
|
# @compiler = YMDP::Compiler::Base.new('staging', 'asdfh23rh2fas', :base_path => ".", :server => {
|
6
6
|
# "server" => "staging", "application_id" => "12345", "assets_id" => "abcdefg_1" })
|
@@ -10,8 +10,8 @@
|
|
10
10
|
# @compiler.build
|
11
11
|
#
|
12
12
|
module YMDP
|
13
|
-
module Compiler
|
14
|
-
class Base
|
13
|
+
module Compiler #:nodoc:
|
14
|
+
class Base
|
15
15
|
attr_accessor :domain, :git_hash, :options, :base_path, :server
|
16
16
|
|
17
17
|
# A TemplateCompiler instance covers a single domain, handling all the processing necessary to
|
@@ -24,6 +24,9 @@ module YMDP
|
|
24
24
|
@base_path = options[:base_path]
|
25
25
|
@server = options[:server]
|
26
26
|
|
27
|
+
raise ArgumentError.new("domain is required") unless @domain
|
28
|
+
raise ArgumentError.new("server is required") unless @server
|
29
|
+
|
27
30
|
raise ArgumentError.new("base_path is required") unless @base_path
|
28
31
|
end
|
29
32
|
|
@@ -43,7 +46,6 @@ module YMDP
|
|
43
46
|
|
44
47
|
# Do all the processing necessary to convert all the application source code from the given path
|
45
48
|
# into usable destination files ready for upload to the server:
|
46
|
-
#
|
47
49
|
# - create server directory if necessary,
|
48
50
|
# - for each file in the source path, build the file, and
|
49
51
|
# - copy the images from the source to the destination directory.
|
@@ -62,8 +64,8 @@ module YMDP
|
|
62
64
|
end
|
63
65
|
|
64
66
|
# Build this file if it's either:
|
65
|
-
#
|
66
|
-
#
|
67
|
+
# - a view, but not a partial or layout, or
|
68
|
+
# - a JavaScript file.
|
67
69
|
#
|
68
70
|
def build_file(file)
|
69
71
|
params = {
|
@@ -88,7 +90,7 @@ module YMDP
|
|
88
90
|
#
|
89
91
|
def process_all_translations
|
90
92
|
$stdout.puts "Processing ./app/assets/yrb/ for #{domain}"
|
91
|
-
YMDP::
|
93
|
+
YMDP::ApplicationView.supported_languages.each do |lang|
|
92
94
|
process_each_yrb(lang)
|
93
95
|
end
|
94
96
|
end
|
@@ -96,7 +98,7 @@ module YMDP
|
|
96
98
|
# Convert the YRB translation files of a single language for this domain into a single JSON file.
|
97
99
|
#
|
98
100
|
def process_each_yrb(lang)
|
99
|
-
tmp_file = "#{
|
101
|
+
tmp_file = "#{TMP_PATH}/keys_#{lang}.pres"
|
100
102
|
|
101
103
|
# Concatenate together all the YRB ".pres" files for this language into one file in the tmp dir.
|
102
104
|
#
|
@@ -117,8 +119,8 @@ module YMDP
|
|
117
119
|
FileUtils.rm_rf("#{dir}/assets/javascripts")
|
118
120
|
FileUtils.rm_rf("#{dir}/assets/stylesheets")
|
119
121
|
FileUtils.rm_rf("#{dir}/assets/yrb")
|
120
|
-
FileUtils.rm_rf("#{
|
121
|
-
FileUtils.mkdir_p(
|
122
|
+
FileUtils.rm_rf("#{TMP_PATH}/")
|
123
|
+
FileUtils.mkdir_p(TMP_PATH)
|
122
124
|
end
|
123
125
|
|
124
126
|
# Format text in a standard way for output to the screen.
|
@@ -14,7 +14,7 @@ module YMDP
|
|
14
14
|
module Compiler
|
15
15
|
# Covers all the domains and the actions that are taken on all domains at once.
|
16
16
|
#
|
17
|
-
class Domains
|
17
|
+
class Domains < YMDP::Base
|
18
18
|
attr_accessor :git, :git_hash, :message, :domains, :options
|
19
19
|
|
20
20
|
def initialize(options=nil)
|
@@ -26,35 +26,7 @@ module YMDP
|
|
26
26
|
|
27
27
|
commit if @options[:commit]
|
28
28
|
end
|
29
|
-
|
30
|
-
# Class Methods to handle global stuff like base path and server settings
|
31
|
-
|
32
|
-
def self.base_path= base_path
|
33
|
-
@@base_path = base_path
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.base_path
|
37
|
-
@@base_path
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.servers= servers
|
41
|
-
@@servers = servers
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.servers
|
45
|
-
@@servers
|
46
|
-
end
|
47
|
-
|
48
|
-
# Instance Methods to access global stuff like base path and server settings
|
49
|
-
|
50
|
-
def servers
|
51
|
-
@@servers
|
52
|
-
end
|
53
|
-
|
54
|
-
def base_path
|
55
|
-
@@base_path
|
56
|
-
end
|
57
|
-
|
29
|
+
|
58
30
|
# Compile the source code for all domains into their usable destination files.
|
59
31
|
#
|
60
32
|
def compile
|
@@ -83,6 +55,8 @@ module YMDP
|
|
83
55
|
#
|
84
56
|
def process_domains
|
85
57
|
domains.each do |domain|
|
58
|
+
params = options
|
59
|
+
params[:server] = servers[domain]["server"]
|
86
60
|
compiler = YMDP::Compiler::Base.new(domain, git_hash, options)
|
87
61
|
|
88
62
|
compiler.process_all
|
@@ -92,11 +66,11 @@ module YMDP
|
|
92
66
|
# Perform a block, starting with a clean 'tmp' directory and ending with one.
|
93
67
|
#
|
94
68
|
def clean_tmp_dir
|
95
|
-
system "rm -rf #{
|
96
|
-
system "mkdir #{
|
69
|
+
system "rm -rf #{TMP_PATH}"
|
70
|
+
system "mkdir #{TMP_PATH}"
|
97
71
|
yield
|
98
|
-
system "rm -rf #{
|
99
|
-
system "mkdir #{
|
72
|
+
system "rm -rf #{TMP_PATH}"
|
73
|
+
system "mkdir #{TMP_PATH}"
|
100
74
|
end
|
101
75
|
end
|
102
76
|
end
|
@@ -1,36 +1,30 @@
|
|
1
|
-
# Process source files into usable code.
|
2
|
-
#
|
3
|
-
# Source files can be HTML, Haml, ERB, JavaScript, or CSS files.
|
4
|
-
#
|
5
|
-
# Files with an extension of ".haml" will be processed with Haml, all others will
|
6
|
-
# use ERB.
|
7
|
-
#
|
8
|
-
# Usage:
|
9
|
-
#
|
10
|
-
# YMDP::Compiler::Template::View.new(params).build
|
11
|
-
# YMDP::Compiler::Template::JavaScript.new(params).build
|
12
|
-
#
|
13
|
-
# See YMDP::Compiler::Template::Base#initialize for details on params.
|
14
|
-
#
|
15
1
|
module YMDP
|
16
|
-
module Compiler
|
17
|
-
module Template
|
18
|
-
#
|
19
|
-
# it into usable destination files in the 'servers' directory.
|
2
|
+
module Compiler #:nodoc:
|
3
|
+
module Template #:nodoc:
|
4
|
+
# Process source files into usable code.
|
20
5
|
#
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
6
|
+
# Source files can be HTML, Haml, ERB, JavaScript, or CSS files.
|
7
|
+
#
|
8
|
+
# Files with an extension of ".haml" will be processed with Haml, all others will
|
9
|
+
# use ERB.
|
10
|
+
#
|
11
|
+
# ==== Examples
|
12
|
+
#
|
13
|
+
# YMDP::Compiler::Template::View.new(params).build
|
14
|
+
#
|
15
|
+
# YMDP::Compiler::Template::JavaScript.new(params).build
|
16
|
+
#
|
17
|
+
# @template = YMDP::Compiler::Template::Base.new(params)
|
18
|
+
#
|
19
|
+
# ==== Options
|
20
|
+
#
|
21
|
+
# verbose: boolean value, output verbose notices,
|
22
|
+
# domain: string, indicates which domain the template is compiling to,
|
23
|
+
# file: filename of the template in question,
|
24
|
+
# hash: git hash of the latest commit,
|
25
|
+
# message: commit message of the latest commit.
|
26
|
+
#
|
27
|
+
class Base < YMDP::Base
|
34
28
|
attr_accessor :domain, :server, :file, :assets_directory, :hash, :message
|
35
29
|
|
36
30
|
def initialize(params)
|
@@ -41,9 +35,18 @@ module YMDP
|
|
41
35
|
@assets_directory = "/om/assets/#{servers[@domain]['assets_id']}"
|
42
36
|
@hash = params[:git_hash]
|
43
37
|
@message = params[:message]
|
44
|
-
|
38
|
+
|
39
|
+
server_settings = servers[@domain]
|
40
|
+
if server_settings
|
41
|
+
@server = server_settings["server"]
|
42
|
+
else
|
43
|
+
raise StandardError.new("server name is required")
|
44
|
+
end
|
45
|
+
|
46
|
+
raise StandardError.new("server name is required") unless @server
|
47
|
+
|
45
48
|
set_content_variables
|
46
|
-
|
49
|
+
|
47
50
|
@view = base_filename(@file.split("/").last)
|
48
51
|
Application.current_view = @view
|
49
52
|
end
|
@@ -58,17 +61,19 @@ module YMDP
|
|
58
61
|
# an instance variable, so they will be available inside the template.
|
59
62
|
#
|
60
63
|
def set_content_variables
|
61
|
-
|
62
|
-
content.each do |key, value|
|
64
|
+
content_variables.each do |key, value|
|
63
65
|
attribute = "@#{key}"
|
64
66
|
instance_variable_set(attribute, value) unless instance_variable_defined?(attribute)
|
67
|
+
class_eval %(
|
68
|
+
attr_accessor :#{key}
|
69
|
+
)
|
65
70
|
end
|
66
71
|
end
|
67
72
|
|
68
73
|
# If the filename begins with a _ it's a partial.
|
69
74
|
#
|
70
75
|
def partial?
|
71
|
-
@file =~ /#{base_path}\/app\/views\/_/
|
76
|
+
@file =~ /#{paths[:base_path]}\/app\/views\/_/
|
72
77
|
end
|
73
78
|
|
74
79
|
# Compile this view unless it is a partial.
|
@@ -103,10 +108,15 @@ module YMDP
|
|
103
108
|
# Produces the destination path of this template, in the servers directory for
|
104
109
|
# the given domain.
|
105
110
|
#
|
106
|
-
#
|
111
|
+
# ==== Examples
|
112
|
+
#
|
113
|
+
# If the source file is:
|
114
|
+
#
|
115
|
+
# app/views/authorize.html.haml
|
116
|
+
#
|
117
|
+
# The destination file will be:
|
107
118
|
#
|
108
|
-
#
|
109
|
-
# destination: servers/staging/views/authorize.html.haml
|
119
|
+
# servers/staging/views/authorize.html.haml
|
110
120
|
#
|
111
121
|
def destination_path
|
112
122
|
# just the file, with no directory
|
@@ -119,7 +129,7 @@ module YMDP
|
|
119
129
|
directory = File.dirname(@file)
|
120
130
|
|
121
131
|
# replace the app directory with the server directory
|
122
|
-
relative_directory = directory.gsub!("#{base_path}/app", server_path)
|
132
|
+
relative_directory = directory.gsub!("#{paths[:base_path]}/app", server_path)
|
123
133
|
|
124
134
|
# make the directory if it doesn't exist
|
125
135
|
FileUtils.mkdir_p(relative_directory)
|
@@ -127,10 +137,7 @@ module YMDP
|
|
127
137
|
"#{relative_directory}/#{filename}"
|
128
138
|
end
|
129
139
|
|
130
|
-
# Path to the servers directory for the current domain
|
131
|
-
#
|
132
|
-
# - "./servers/staging"
|
133
|
-
# - "./servers/alpha"
|
140
|
+
# Path to the servers directory for the current domain.
|
134
141
|
#
|
135
142
|
def server_path
|
136
143
|
"#{servers_path}/#{@domain}"
|
@@ -160,7 +167,7 @@ module YMDP
|
|
160
167
|
#
|
161
168
|
def write_template_with_layout(result)
|
162
169
|
@content = result
|
163
|
-
application_layout = "#{base_path}\/app\/views\/layouts\/application.html"
|
170
|
+
application_layout = "#{paths[:base_path]}\/app\/views\/layouts\/application.html"
|
164
171
|
haml_layout = application_layout + ".haml"
|
165
172
|
erb_layout = application_layout + ".erb"
|
166
173
|
|
@@ -181,54 +188,20 @@ module YMDP
|
|
181
188
|
|
182
189
|
# Write this processed template to its destination file.
|
183
190
|
#
|
184
|
-
# Overwrite in child class to define whether the class
|
191
|
+
# Overwrite this method in child class to define whether the class
|
192
|
+
# uses a template or not.
|
185
193
|
#
|
186
194
|
def write_template(result)
|
187
195
|
write_template_with_layout(result)
|
188
196
|
end
|
189
197
|
|
190
198
|
def servers_path
|
191
|
-
"#{base_path}/servers"
|
199
|
+
"#{paths[:base_path]}/servers"
|
192
200
|
end
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
# Class Methods to handle global stuff like base path and server settings
|
199
|
-
|
200
|
-
def self.base_path= base_path
|
201
|
-
@@base_path = base_path
|
202
|
-
end
|
203
|
-
|
204
|
-
def self.base_path
|
205
|
-
@@base_path
|
206
|
-
end
|
207
|
-
|
208
|
-
def self.servers= servers
|
209
|
-
@@servers = servers
|
210
|
-
end
|
211
|
-
|
212
|
-
def self.servers
|
213
|
-
@@servers
|
214
|
-
end
|
215
|
-
|
216
|
-
# Instance Methods to access global stuff like base path and server settings
|
217
|
-
|
218
|
-
def servers
|
219
|
-
@@servers
|
220
|
-
end
|
221
|
-
|
222
|
-
def base_path
|
223
|
-
@@base_path
|
224
|
-
end
|
225
|
-
|
226
|
-
|
227
|
-
|
228
201
|
end
|
229
202
|
|
230
203
|
class View < Base
|
231
|
-
# TODO: Refactor this. Right now it includes all the YMDP::
|
204
|
+
# TODO: Refactor this. Right now it includes all the YMDP::ApplicationView and other helper files
|
232
205
|
# into the same namespace where we're processing the templates. It does this so it can
|
233
206
|
# send its 'binding' into the ERB or Haml template and the template will be able to
|
234
207
|
# process methods like "render :partial => 'sidebar'" and so on.
|
@@ -243,7 +216,7 @@ module YMDP
|
|
243
216
|
rescue NameError
|
244
217
|
end
|
245
218
|
|
246
|
-
include YMDP::
|
219
|
+
include YMDP::ApplicationView
|
247
220
|
include YMDP::AssetTagHelper
|
248
221
|
include YMDP::FormTagHelper
|
249
222
|
include YMDP::LinkTagHelper
|
@@ -322,7 +295,7 @@ module YMDP
|
|
322
295
|
# Base directory for translations for this domain.
|
323
296
|
#
|
324
297
|
def directory
|
325
|
-
directory = "#{base_path}/servers/#{@domain}/assets/yrb"
|
298
|
+
directory = "#{paths[:base_path]}/servers/#{@domain}/assets/yrb"
|
326
299
|
FileUtils.mkdir_p(directory)
|
327
300
|
directory
|
328
301
|
end
|
@@ -1,43 +1,85 @@
|
|
1
1
|
require 'serenity'
|
2
|
+
require 'yaml'
|
2
3
|
|
3
4
|
module YMDP
|
4
|
-
module Configuration
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
module Configuration #:nodoc:
|
6
|
+
# Provides an interface to set global configuration variables inside a block.
|
7
|
+
#
|
8
|
+
# Used by the YMDP::Base <tt>configure</tt> method.
|
9
|
+
#
|
10
|
+
# == Examples
|
11
|
+
#
|
12
|
+
# In the following example, the <tt>config</tt> variable inside the block is an
|
13
|
+
# instance of YMDP::Configuration::Setter.
|
14
|
+
#
|
15
|
+
# YMDP::Base.configure do |config|
|
16
|
+
# config.username = 'malreynolds'
|
17
|
+
# config.load_content_variables('content')
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# It is then up to YMDP::Base.configure to take the Setter instance and set all the
|
21
|
+
# appropriate options based on its settings.
|
22
|
+
#
|
23
|
+
class Setter
|
24
|
+
# String value containing the login used to communicate with the Yahoo! Mail Development
|
25
|
+
# Platform to deploy the application.
|
26
|
+
attr_accessor :username
|
10
27
|
|
11
|
-
|
12
|
-
|
28
|
+
# String value containing the password used to communicate with the Yahoo! Mail Development
|
29
|
+
# Platform to deploy the application.
|
30
|
+
attr_accessor :password
|
13
31
|
|
14
|
-
|
15
|
-
|
16
|
-
|
32
|
+
# String value containing the default_server name. Matches the related entry in the
|
33
|
+
# <tt>servers</tt> hash to define which server is the default for rake tasks such as
|
34
|
+
# <tt>deploy</tt>.
|
35
|
+
attr_accessor :default_server
|
17
36
|
|
18
|
-
|
19
|
-
|
20
|
-
|
37
|
+
# Boolean value which sets whether Growl notifications should be used when compiling
|
38
|
+
# and deploying the application.
|
39
|
+
attr_accessor :growl
|
21
40
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
41
|
+
# Hash value containing settings which tell the application when to compress CSS and JavaScript.
|
42
|
+
attr_accessor :compress
|
25
43
|
|
26
|
-
|
27
|
-
|
28
|
-
|
44
|
+
# Hash value containing settings which tell the application when to validate HTML and JavaScript.
|
45
|
+
attr_accessor :validate
|
46
|
+
|
47
|
+
# Boolean value which sets whether to output verbose messages or not.
|
48
|
+
attr_accessor :verbose
|
49
|
+
|
50
|
+
# Hash value containing content variables which are made available to the views at build time.
|
51
|
+
attr_accessor :content_variables
|
52
|
+
|
53
|
+
# Hash value containing application data about the servers, such as their asset and application IDs.
|
54
|
+
attr_accessor :servers
|
55
|
+
|
56
|
+
# Hash value containing paths used by the application to locate its files. This can be used to
|
57
|
+
# overwrite default settings.
|
58
|
+
attr_accessor :paths
|
59
|
+
|
60
|
+
def initialize #:nodoc:
|
61
|
+
@paths = {}
|
62
|
+
@content_variables = {}
|
29
63
|
end
|
30
64
|
|
31
|
-
|
32
|
-
|
65
|
+
# Adds an entry to the <tt>paths</tt> hash.
|
66
|
+
#
|
67
|
+
def add_path(name, value)
|
68
|
+
@paths[name] = value
|
69
|
+
end
|
33
70
|
|
34
|
-
|
35
|
-
|
36
|
-
|
71
|
+
# Adds an entry to the <tt>content_variables</tt> hash.
|
72
|
+
#
|
73
|
+
def add_content_variable(name, value)
|
74
|
+
@content_variables[name] = value
|
75
|
+
end
|
37
76
|
|
38
|
-
|
39
|
-
|
40
|
-
|
77
|
+
# Loads the <tt>content_variables</tt> hash from a Yaml file.
|
78
|
+
#
|
79
|
+
def load_content_variables(filename)
|
80
|
+
path = "#{CONFIG_PATH}/#{filename}".gsub(/\.yml$/, "")
|
81
|
+
path = "#{path}.yml"
|
82
|
+
@content_variables = YAML.load_file(path)
|
41
83
|
end
|
42
84
|
end
|
43
85
|
|