Skip to content

Commit

Permalink
Merge pull request #132 from markcowl/dev
Browse files Browse the repository at this point in the history
Fix for Issue 131
  • Loading branch information
markcowl committed Feb 2, 2012
2 parents b653b00 + e1fbb05 commit 8fe4c2c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Expand Up @@ -37,10 +37,16 @@ public void CreateLocalPackageWithOneWebRoleTest()
string standardOutput;
string standardError;
AzureService service = new AzureService(files.RootPath, serviceName, null);
service.AddWebRole();
RoleInfo webRoleInfo = service.AddWebRole();
string logsDir = Path.Combine(service.Paths.RootPath, webRoleInfo.Name, "server.js.logs");
string logFile = Path.Combine(logsDir, "0.txt");
string targetLogsFile = Path.Combine(service.Paths.LocalPackage, "roles", webRoleInfo.Name, @"approot\server.js.logs\0.txt");
files.CreateDirectory(logsDir);
files.CreateEmptyFile(logFile);
service.CreatePackage(DevEnv.Local, out standardOutput, out standardError);

AzureAssert.ScaffoldingExists(Path.Combine(service.Paths.LocalPackage, @"roles\WebRole1\approot"), Path.Combine(Resources.NodeScaffolding, Resources.WebRole));
Assert.IsTrue(File.Exists(targetLogsFile));
}
}

Expand Down
Expand Up @@ -66,7 +66,7 @@ public void CreatePackage(ServiceDefinition definition, string rootPath, DevEnv
// Get the name and safe path for each role (i.e., if the
// role has files that shouldn't be packaged, it'll be
// copied to a temp location without those files)
.Select(name => GetOrCreateCleanPath(rootPath, name, tempDirectories))
.Select(name => GetOrCreateCleanPath(rootPath, name, tempDirectories, type))
// Format the role name and path as a role argument
.Select(nameAndPath => string.Format(Resources.RoleArgTemplate, nameAndPath.Key, nameAndPath.Value))
// Join all the role arguments together into one
Expand Down Expand Up @@ -137,13 +137,13 @@ public void CreatePackage(ServiceDefinition definition, string rootPath, DevEnv
/// <returns>
/// A pair containing the path to the role and the name of the role.
/// </returns>
private static KeyValuePair<string, string> GetOrCreateCleanPath(string root, string name, Dictionary<string, string> tempDirectories)
private static KeyValuePair<string, string> GetOrCreateCleanPath(string root, string name, Dictionary<string, string> tempDirectories, DevEnv type)
{
string path = Path.Combine(root, name);

// Check if the role has any "*.logs" directories that iisnode may
// have left during emulation
if (GetLogDirectories(path).Length == 0)
if (type == DevEnv.Local || GetLogDirectories(path).Length == 0)
{
return new KeyValuePair<string, string>(name, root);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -403,7 +403,7 @@
<value>Role type {0} doesn't exist</value>
</data>
<data name="RunInEmulatorArguments" xml:space="preserve">
<value>{0} {1} {2}</value>
<value>"{0}" "{1}" {2}</value>
</data>
<data name="ScaffoldXml" xml:space="preserve">
<value>scaffold.xml</value>
Expand Down

0 comments on commit 8fe4c2c

Please sign in to comment.