ymdp 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
YMDP_ROOT = BASE_PATH unless defined?(YMDP_ROOT)
|
|
2
|
-
TMP_DIR = TMP_PATH unless defined?(TMP_DIR)
|
|
3
|
-
|
|
4
1
|
CONFIG = YMDP::Configuration::Config.new unless defined?(CONFIG)
|
|
5
2
|
SERVERS = YMDP::Configuration::Servers.new unless defined?(SERVERS)
|
|
3
|
+
|
|
4
|
+
@content_variables = YAML.load_file("#{CONFIG_PATH}/content.yml")
|
|
5
|
+
|
|
6
|
+
YMDP::Base.configure do |config|
|
|
7
|
+
config.username = CONFIG["username"]
|
|
8
|
+
config.password = CONFIG["password"]
|
|
9
|
+
config.default_server = CONFIG["default_server"]
|
|
10
|
+
config.growl = CONFIG["growl"]
|
|
11
|
+
config.verbose = CONFIG["verbose"]
|
|
12
|
+
config.compress = CONFIG["compress"]
|
|
13
|
+
config.validate = CONFIG["validate"]
|
|
14
|
+
|
|
15
|
+
config.add_path(:base_path, BASE_PATH)
|
|
16
|
+
config.servers = SERVERS
|
|
17
|
+
|
|
18
|
+
config.content_variables = @content_variables
|
|
19
|
+
end
|
data/lib/ymdp/support/file.rb
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
module YMDP
|
|
2
|
+
# Some useful methods that make working with files easier.
|
|
3
|
+
#
|
|
2
4
|
module FileSupport
|
|
3
|
-
#
|
|
5
|
+
# Concatenates together the contents of all the files in the <tt>source_path</tt>
|
|
6
|
+
# into the <tt>destination_path</tt>.
|
|
4
7
|
#
|
|
5
|
-
def concat_files(
|
|
6
|
-
File.open(
|
|
7
|
-
Dir[
|
|
8
|
+
def concat_files(source_path, destination_path)
|
|
9
|
+
File.open(destination_path, "a") do |output|
|
|
10
|
+
Dir[source_path].each do |path|
|
|
8
11
|
File.open(path) do |f|
|
|
9
12
|
output.puts f.read
|
|
10
13
|
end
|
|
11
14
|
end
|
|
12
|
-
end
|
|
15
|
+
end
|
|
13
16
|
end
|
|
14
17
|
|
|
18
|
+
# If the file at <tt>path</tt> exists, prompt the user to overwrite it. If the file doesn't
|
|
19
|
+
# exist, return true.
|
|
20
|
+
#
|
|
15
21
|
def confirm_overwrite(path)
|
|
16
22
|
if File.exists?(path)
|
|
17
23
|
$stdout.puts "File exists: #{File.expand_path(path)}"
|
|
@@ -24,23 +30,29 @@ module YMDP
|
|
|
24
30
|
end
|
|
25
31
|
end
|
|
26
32
|
|
|
27
|
-
#
|
|
33
|
+
# Parses out the <tt>BASE_PATH</tt> constant from filenames to display them in a
|
|
34
|
+
# friendlier way.
|
|
35
|
+
#
|
|
36
|
+
# TODO: Refactor this so it doesn't use a constant.
|
|
37
|
+
#
|
|
28
38
|
def display_path(path)
|
|
29
39
|
path = File.expand_path(path)
|
|
30
40
|
path.gsub(BASE_PATH, "")
|
|
31
41
|
end
|
|
32
42
|
|
|
33
|
-
#
|
|
43
|
+
# Saves the <tt>output</tt> string to the <tt>destination_path</tt> given
|
|
34
44
|
#
|
|
35
|
-
def save_to_file(output,
|
|
36
|
-
unless File.exists?(
|
|
37
|
-
File.open(
|
|
45
|
+
def save_to_file(output, destination_path)
|
|
46
|
+
unless File.exists?(destination_path)
|
|
47
|
+
File.open(destination_path, "w") do |w|
|
|
38
48
|
w.write(output)
|
|
39
49
|
end
|
|
40
50
|
end
|
|
41
51
|
end
|
|
42
52
|
|
|
43
|
-
#
|
|
53
|
+
# Given a <tt>path</tt> and <tt>line_number</tt>, returns the line and two lines previous
|
|
54
|
+
#
|
|
55
|
+
# Used for displaying validation errors.
|
|
44
56
|
#
|
|
45
57
|
def get_line_from_file(path, line_number)
|
|
46
58
|
line_number = line_number.to_i
|
|
@@ -65,9 +77,15 @@ module YMDP
|
|
|
65
77
|
end
|
|
66
78
|
end
|
|
67
79
|
|
|
80
|
+
# Provide a wrapper around system calls so they can be mocked in tests.
|
|
81
|
+
#
|
|
68
82
|
class F
|
|
69
83
|
extend YMDP::FileSupport
|
|
70
84
|
|
|
85
|
+
# Execute a system command. If the parameter <tt>:return</tt> is true, execute the command
|
|
86
|
+
# with the backtick (`) command and return the results. Otherwise, just execute the command
|
|
87
|
+
# and let the output go to the screen.
|
|
88
|
+
#
|
|
71
89
|
def self.execute(command, params={})
|
|
72
90
|
if params[:return]
|
|
73
91
|
`#{command}`
|
data/lib/ymdp/tasks/keys.rake
CHANGED
|
@@ -5,7 +5,7 @@ require 'translator/base'
|
|
|
5
5
|
@key = ENV["key"] || ""
|
|
6
6
|
@key = @key.upcase
|
|
7
7
|
|
|
8
|
-
ASSETS_ROOT = "#{
|
|
8
|
+
ASSETS_ROOT = "#{BASE_PATH}/app/assets"
|
|
9
9
|
YRB_ROOT = "#{ASSETS_ROOT}/yrb"
|
|
10
10
|
|
|
11
11
|
namespace :keys do
|
|
@@ -35,7 +35,7 @@ namespace :keys do
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
task :combine do
|
|
38
|
-
system "rm #{
|
|
38
|
+
system "rm #{TMP_PATH}/*"
|
|
39
39
|
each_locale do |path|
|
|
40
40
|
puts path
|
|
41
41
|
filename = path.split("/").last
|
|
@@ -45,20 +45,20 @@ namespace :keys do
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
File.open(path, "r") do |f|
|
|
48
|
-
File.open("#{
|
|
48
|
+
File.open("#{TMP_PATH}/keys_#{lang}.pres", "a") do |tmp|
|
|
49
49
|
tmp.write(f.read)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
system "rm -rf #{YRB_ROOT}/*"
|
|
55
|
-
system "cp #{
|
|
55
|
+
system "cp #{TMP_PATH}/* #{YRB_ROOT}"
|
|
56
56
|
|
|
57
|
-
system "rm #{
|
|
57
|
+
system "rm #{TMP_PATH}/*"
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
task :destroy do
|
|
61
|
-
system "rm #{
|
|
61
|
+
system "rm #{TMP_PATH}/*"
|
|
62
62
|
|
|
63
63
|
raise "Must define a key with 'key='" if @key == ""
|
|
64
64
|
|
|
@@ -72,7 +72,7 @@ namespace :keys do
|
|
|
72
72
|
line
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
system "rm #{
|
|
75
|
+
system "rm #{TMP_PATH}/*"
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
desc "Translate any new keys into non-US languages"
|
|
@@ -81,7 +81,7 @@ namespace :keys do
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
task :rename do
|
|
84
|
-
system "rm #{
|
|
84
|
+
system "rm #{TMP_PATH}/*"
|
|
85
85
|
|
|
86
86
|
@to = ENV["to"] || ""
|
|
87
87
|
@to = @to.upcase
|
|
@@ -99,7 +99,7 @@ namespace :keys do
|
|
|
99
99
|
line
|
|
100
100
|
end
|
|
101
101
|
|
|
102
|
-
system "rm #{
|
|
102
|
+
system "rm #{TMP_PATH}/*"
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
# task :unused do
|
|
@@ -169,14 +169,14 @@ def change_keys
|
|
|
169
169
|
puts path
|
|
170
170
|
filename = path.split("/").last
|
|
171
171
|
File.open(path, "r") do |f|
|
|
172
|
-
File.open("#{
|
|
172
|
+
File.open("#{TMP_PATH}/#{filename}", "w") do |tmp|
|
|
173
173
|
f.readlines.each do |line|
|
|
174
174
|
new_line = yield line
|
|
175
175
|
tmp.write new_line
|
|
176
176
|
end
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
|
-
system "cp #{
|
|
179
|
+
system "cp #{TMP_PATH}/#{filename} #{path}"
|
|
180
180
|
end
|
|
181
181
|
end
|
|
182
182
|
|
|
@@ -189,14 +189,14 @@ def change_keys_with_lang
|
|
|
189
189
|
lang = $1
|
|
190
190
|
end
|
|
191
191
|
File.open(path, "r") do |f|
|
|
192
|
-
File.open("#{
|
|
192
|
+
File.open("#{TMP_PATH}/#{filename}", "w") do |tmp|
|
|
193
193
|
f.readlines.each do |line|
|
|
194
194
|
new_line = yield line, lang, filename
|
|
195
195
|
tmp.write new_line
|
|
196
196
|
end
|
|
197
197
|
end
|
|
198
198
|
end
|
|
199
|
-
system "cp #{
|
|
199
|
+
system "cp #{TMP_PATH}/#{filename} #{path}"
|
|
200
200
|
end
|
|
201
201
|
end
|
|
202
202
|
|
data/lib/ymdp/tasks/ymdp.rake
CHANGED
|
@@ -8,7 +8,7 @@ rescue
|
|
|
8
8
|
CATEGORIES = {} unless defined?(CATEGORIES)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
Dir.mkdir(
|
|
11
|
+
Dir.mkdir(TMP_PATH) rescue Errno::EEXIST
|
|
12
12
|
|
|
13
13
|
def set_application_variables(application)
|
|
14
14
|
@application = application
|
|
@@ -287,8 +287,8 @@ namespace :validate do
|
|
|
287
287
|
desc "Validates all HTML"
|
|
288
288
|
task :html do
|
|
289
289
|
puts "\nValidating HTML in #{@application}..."
|
|
290
|
-
`rm -rf #{
|
|
291
|
-
Dir.mkdir(
|
|
290
|
+
`rm -rf #{TMP_PATH}`
|
|
291
|
+
Dir.mkdir(TMP_PATH) rescue Errno::EEXIST
|
|
292
292
|
Dir["./servers/#{@application}/views/*"].each do |filename|
|
|
293
293
|
YMDP::Validator::HTML.validate(filename) if filename =~ /#{@path}/
|
|
294
294
|
end
|
|
@@ -491,7 +491,7 @@ def validated_embedded_js(path)
|
|
|
491
491
|
Hpricot(f)
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
-
js_fragment_path =
|
|
494
|
+
js_fragment_path = TMP_PATH + "/#{File.basename(path)}_js_fragment"
|
|
495
495
|
|
|
496
496
|
File.open(js_fragment_path,'w') do |f|
|
|
497
497
|
(doc / "script").each { |js| f.puts js.inner_html + "\n\n" }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
|
|
3
|
+
describe Application do
|
|
4
|
+
describe "set current view" do
|
|
5
|
+
it "should set current view" do
|
|
6
|
+
Application.current_view = "staging"
|
|
7
|
+
Application.current_view.should == "staging"
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe "current_view?" do
|
|
12
|
+
it "should be true" do
|
|
13
|
+
Application.current_view = "staging"
|
|
14
|
+
Application.current_view?("staging")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should be false" do
|
|
18
|
+
Application.current_view = "staging"
|
|
19
|
+
Application.current_view?("funk")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "return current view" do
|
|
24
|
+
it "should return current view" do
|
|
25
|
+
Application.current_view = "staging"
|
|
26
|
+
Application.current_view.should == "staging"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/spec/compiler_spec.rb
CHANGED
|
@@ -17,7 +17,7 @@ describe "Compiler" do
|
|
|
17
17
|
@git_hash = 'asdfh23rh2fas'
|
|
18
18
|
@base_path = "."
|
|
19
19
|
|
|
20
|
-
@compiler = YMDP::Compiler::Base.new(@domain, @git_hash, :base_path => @base_path)
|
|
20
|
+
@compiler = YMDP::Compiler::Base.new(@domain, @git_hash, :base_path => @base_path, :server => "staging")
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
describe "instantiation" do
|
|
@@ -36,7 +36,7 @@ describe "Compiler" do
|
|
|
36
36
|
|
|
37
37
|
describe "process" do
|
|
38
38
|
before(:each) do
|
|
39
|
-
YMDP::
|
|
39
|
+
YMDP::ApplicationView.stub!(:supported_languages).and_return([])
|
|
40
40
|
|
|
41
41
|
@view_template = mock('view_template').as_null_object
|
|
42
42
|
YMDP::Compiler::Template::View.stub!(:new).and_return(@view_template)
|
|
@@ -56,7 +56,7 @@ describe "Compiler" do
|
|
|
56
56
|
describe "translations" do
|
|
57
57
|
before(:each) do
|
|
58
58
|
@supported_languages = ["en-US", "de-DE"]
|
|
59
|
-
YMDP::
|
|
59
|
+
YMDP::ApplicationView.stub!(:supported_languages).and_return(@supported_languages)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
it "should act on the list of supported languages" do
|
|
@@ -6,62 +6,31 @@ require 'compiler/template'
|
|
|
6
6
|
|
|
7
7
|
describe "Compiler" do
|
|
8
8
|
before(:each) do
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Object.send(:remove_const, :CONFIG)
|
|
13
|
-
CONFIG = mock('config').as_null_object
|
|
9
|
+
reset_constant(:YMDP_ENV, "build")
|
|
10
|
+
reset_constant(:CONFIG, mock('config').as_null_object)
|
|
14
11
|
|
|
15
12
|
Application.stub!(:current_view=)
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
stub_file_io
|
|
19
|
-
stub_file_utils
|
|
20
|
-
stub_yaml
|
|
14
|
+
stub_io
|
|
21
15
|
end
|
|
22
16
|
|
|
23
17
|
describe "view" do
|
|
24
18
|
before(:each) do
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@params = {
|
|
31
|
-
:verbose => false,
|
|
32
|
-
:domain => @domain,
|
|
33
|
-
:file => @filename,
|
|
34
|
-
:git_hash => @git_hash,
|
|
35
|
-
:message => @message
|
|
36
|
-
}
|
|
37
|
-
@content_variables = {
|
|
38
|
-
"version" => "0.1.0",
|
|
39
|
-
"sprint_name" => "Gorgonzola"
|
|
40
|
-
}
|
|
41
|
-
YAML.stub!(:load_file).with(/content\.yml$/).and_return(@content_variables)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
@servers = {
|
|
46
|
-
"staging" => {
|
|
47
|
-
"server" => "staging",
|
|
48
|
-
"application_id" => "12345",
|
|
49
|
-
"assets_id" => "abcdefg_1"
|
|
50
|
-
},
|
|
19
|
+
@domain = "staging"
|
|
20
|
+
@filename = "filename.html.haml"
|
|
21
|
+
@git_hash = "asjkhfasjkfhjk"
|
|
22
|
+
@message = "This is a commit message."
|
|
51
23
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
YMDP::Compiler::Template::Base.base_path = @base_path
|
|
63
|
-
|
|
64
|
-
@view_template = YMDP::Compiler::Template::View.new(@params)
|
|
24
|
+
@params = {
|
|
25
|
+
:verbose => false,
|
|
26
|
+
:domain => @domain,
|
|
27
|
+
:file => @filename,
|
|
28
|
+
:git_hash => @git_hash,
|
|
29
|
+
:message => @message
|
|
30
|
+
}
|
|
31
|
+
stub_yrb_configuration
|
|
32
|
+
|
|
33
|
+
@view_template = YMDP::Compiler::Template::View.new(@params)
|
|
65
34
|
end
|
|
66
35
|
|
|
67
36
|
describe "instantiation" do
|
|
@@ -78,18 +47,13 @@ describe "Compiler" do
|
|
|
78
47
|
end
|
|
79
48
|
|
|
80
49
|
it "should set server" do
|
|
81
|
-
@view_template.server.should ==
|
|
50
|
+
@view_template.server.should == "staging"
|
|
82
51
|
end
|
|
83
52
|
|
|
84
53
|
it "should set file" do
|
|
85
54
|
@view_template.file.should == @filename
|
|
86
55
|
end
|
|
87
56
|
|
|
88
|
-
it "should get content variables from yml file" do
|
|
89
|
-
YAML.should_receive(:load_file).with(/content\.yml$/)
|
|
90
|
-
@view_template = YMDP::Compiler::Template::View.new(@params)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
57
|
it "should set content variables" do
|
|
94
58
|
@view_template.instance_variable_get("@version").should == @content_variables["version"]
|
|
95
59
|
@view_template.instance_variable_get("@sprint_name").should == @content_variables["sprint_name"]
|
|
@@ -100,5 +64,13 @@ describe "Compiler" do
|
|
|
100
64
|
@view_template = YMDP::Compiler::Template::View.new(@params)
|
|
101
65
|
end
|
|
102
66
|
end
|
|
67
|
+
|
|
68
|
+
describe "validation" do
|
|
69
|
+
it "should raise an error without a server" do
|
|
70
|
+
lambda {
|
|
71
|
+
@view_template = YMDP::Compiler::Template::View.new(@params.merge({:domain => "nowhere"}))
|
|
72
|
+
}.should raise_error
|
|
73
|
+
end
|
|
74
|
+
end
|
|
103
75
|
end
|
|
104
76
|
end
|
data/spec/data/config/config.yml
CHANGED
|
@@ -26,8 +26,6 @@ SORTED_LOCALES = LOCALES.sort do |a,b|
|
|
|
26
26
|
a[1] <=> b[1]
|
|
27
27
|
end unless defined?(SORTED_LOCALES)
|
|
28
28
|
|
|
29
|
-
YMDP_ROOT = "." unless defined?(YMDP_ROOT)
|
|
30
|
-
|
|
31
29
|
def file_not_found(filename)
|
|
32
30
|
puts
|
|
33
31
|
puts "Create #{filename} with the following command:\n\n ./script/config"
|
|
@@ -36,21 +34,19 @@ def file_not_found(filename)
|
|
|
36
34
|
raise "File not found: #{filename}"
|
|
37
35
|
end
|
|
38
36
|
|
|
39
|
-
servers = "#{
|
|
40
|
-
config = "#{
|
|
37
|
+
servers = "#{BASE_PATH}/config/servers.yml"
|
|
38
|
+
config = "#{BASE_PATH}/config/config.yml"
|
|
41
39
|
|
|
42
40
|
if File.exists?(servers)
|
|
43
|
-
# SERVERS = YAML.load_file("#{YMDP_ROOT}/config/servers.yml") unless defined?(SERVERS)
|
|
44
41
|
SERVERS = YMDP::Configuration::Servers.new
|
|
45
42
|
else
|
|
46
43
|
file_not_found(servers)
|
|
47
44
|
end
|
|
48
45
|
|
|
49
46
|
if File.exists?(config)
|
|
50
|
-
# CONFIG = YAML.load_file("#{YMDP_ROOT}/config/config.yml")["config"] unless defined?(CONFIG)
|
|
51
47
|
CONFIG = YMDP::Configuration::Config.new
|
|
52
48
|
else
|
|
53
49
|
file_not_found(config)
|
|
54
50
|
end
|
|
55
51
|
|
|
56
|
-
|
|
52
|
+
TMP_PATH = "./tmp" unless defined?(TMP_PATH)
|