2010-09-06 19:59:51 +02:00
|
|
|
require 'fileutils'
|
|
|
|
|
2011-07-28 04:59:38 +02:00
|
|
|
Given /^a built app at "([^"]*)"$/ do |path|
|
|
|
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
|
|
|
target = File.join(root, "fixtures", path)
|
|
|
|
build_cmd = File.expand_path(File.join(root, "bin", "middleman build"))
|
2011-07-27 08:19:43 +02:00
|
|
|
`cd #{target} && #{build_cmd}`
|
2010-09-06 19:59:51 +02:00
|
|
|
end
|
|
|
|
|
2011-07-28 04:59:38 +02:00
|
|
|
Then /^cleanup built app at "([^"]*)"$/ do |path|
|
|
|
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
|
|
|
target = File.join(root, "fixtures", path, "build")
|
|
|
|
FileUtils.rm_rf(target)
|
|
|
|
end
|
|
|
|
|
2011-08-06 00:29:21 +02:00
|
|
|
Given /^a built app at "([^"]*)" with flags "([^"]*)"$/ do |path, flags|
|
|
|
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
|
|
|
target = File.join(root, "fixtures", path)
|
|
|
|
build_cmd = File.expand_path(File.join(root, "bin", "middleman build"))
|
2011-07-27 08:19:43 +02:00
|
|
|
`cd #{target} && #{build_cmd} #{flags}`
|
2011-04-19 23:24:21 +02:00
|
|
|
end
|
|
|
|
|
2011-07-28 04:59:38 +02:00
|
|
|
Then /^"([^"]*)" should exist at "([^"]*)"$/ do |target_file, path|
|
|
|
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
|
|
|
target = File.join(root, "fixtures", path, "build", target_file)
|
2011-07-22 20:43:00 +02:00
|
|
|
File.exists?(target).should be_true
|
|
|
|
end
|
|
|
|
|
2011-07-28 04:59:38 +02:00
|
|
|
Then /^"([^"]*)" should exist at "([^"]*)" and include "([^"]*)"$/ do |target_file, path, expected|
|
|
|
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
|
|
|
target = File.join(root, "fixtures", path, "build", target_file)
|
2010-09-06 19:59:51 +02:00
|
|
|
File.exists?(target).should be_true
|
|
|
|
File.read(target).should include(expected)
|
|
|
|
end
|
|
|
|
|
2011-07-28 04:59:38 +02:00
|
|
|
Then /^"([^"]*)" should not exist at "([^"]*)"$/ do |target_file, path|
|
|
|
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
|
|
|
target = File.join(root, "fixtures", path, "build", target_file)
|
2010-09-06 19:59:51 +02:00
|
|
|
File.exists?(target).should be_false
|
2011-05-31 07:33:11 +02:00
|
|
|
end
|