Correct spelled from delimeter to delimiter

This commit is contained in:
Andrew Gaul 2012-06-13 09:48:51 -07:00 committed by Adrian Cole
parent 736554d049
commit 227dbf777a
7 changed files with 38 additions and 38 deletions

View File

@ -139,7 +139,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
public void testListRootUsesDelimiter() throws InterruptedException {
String containerName = getContainerName();
try {
String prefix = "rootdelimeter";
String prefix = "rootdelimiter";
addTenObjectsUnderPrefix(containerName, prefix);
add15UnderRoot(containerName);
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName);

View File

@ -119,7 +119,7 @@ public class RunScriptOnNodeAsInitScriptUsingSsh extends SudoAwareInitManager im
ssh.connect();
ssh.exec("rm " + initFile);
ssh.exec(Statements.appendFile(initFile, Splitter.on('\n').split(init.render(OsFamily.UNIX)),
AppendFile.DELIMETER + "_" + init.getInstanceName()).render(OsFamily.UNIX));
AppendFile.DELIMITER + "_" + init.getInstanceName()).render(OsFamily.UNIX));
}
ssh.exec("chmod 755 " + initFile);

View File

@ -37,7 +37,7 @@ import com.google.common.collect.Maps;
* @author Adrian Cole
*/
public class AppendFile implements Statement {
public static final String DELIMETER = "END_OF_JCLOUDS_FILE";
public static final String DELIMITER = "END_OF_JCLOUDS_FILE";
public static Builder builder() {
return new Builder();
@ -46,7 +46,7 @@ public class AppendFile implements Statement {
public static class Builder {
protected String path;
protected Iterable<String> lines = ImmutableSet.of();
protected String delimeter = DELIMETER;
protected String delimiter = DELIMITER;
protected boolean expandVariables;
/**
@ -66,10 +66,10 @@ public class AppendFile implements Statement {
}
/**
* @see AppendFile#getDelimeter()
* @see AppendFile#getDelimiter()
*/
public Builder delimeter(String delimeter) {
this.delimeter = delimeter;
public Builder delimiter(String delimiter) {
this.delimiter = delimiter;
return this;
}
@ -82,19 +82,19 @@ public class AppendFile implements Statement {
}
public AppendFile build() {
return new AppendFile(path, lines, delimeter, expandVariables);
return new AppendFile(path, lines, delimiter, expandVariables);
}
}
protected final String path;
protected final Iterable<String> lines;
protected final String delimeter;
protected final String delimiter;
protected final boolean expandVariables;
protected AppendFile(String path, Iterable<String> lines, String delimeter, boolean expandVariables) {
protected AppendFile(String path, Iterable<String> lines, String delimiter, boolean expandVariables) {
this.path = checkNotNull(path, "PATH");
this.lines = checkNotNull(lines, "lines");
this.delimeter = checkNotNull(delimeter, "delimeter");
this.delimiter = checkNotNull(delimiter, "delimiter");
checkState(Iterables.size(lines) > 0, "you must pass something to execute");
this.expandVariables = expandVariables;
}
@ -140,15 +140,15 @@ public class AppendFile implements Statement {
for (String line : lines) {
hereFile.append('\t').append(line).append("\n");
}
hereFile.append(delimeter).append("\n");
hereFile.append(delimiter).append("\n");
return hereFile.toString();
}
public StringBuilder startHereFile() {
StringBuilder hereFile = new StringBuilder().append("cat >> ").append(path);
if (expandVariables)
return hereFile.append(" <<-").append(delimeter).append("\n");
return hereFile.append(" <<-'").append(delimeter).append("'\n");
return hereFile.append(" <<-").append(delimiter).append("\n");
return hereFile.append(" <<-'").append(delimiter).append("'\n");
}
protected String appendLineToWindowsFile(String line, String path) {
@ -161,4 +161,4 @@ public class AppendFile implements Statement {
return String.format("echo %s%s%s >>%s{lf}", quote, line, quote, path);
}
}
}

View File

@ -42,8 +42,8 @@ public class CreateOrOverwriteFile extends AppendFile {
}
@Override
public Builder delimeter(String delimeter) {
return Builder.class.cast(super.delimeter(delimeter));
public Builder delimiter(String delimiter) {
return Builder.class.cast(super.delimiter(delimiter));
}
@Override
@ -53,13 +53,13 @@ public class CreateOrOverwriteFile extends AppendFile {
@Override
public CreateOrOverwriteFile build() {
return new CreateOrOverwriteFile(path, lines, delimeter, expandVariables);
return new CreateOrOverwriteFile(path, lines, delimiter, expandVariables);
}
}
protected CreateOrOverwriteFile(String path, Iterable<String> lines, String delimeter, boolean expandVariables) {
super(path, lines, delimeter, expandVariables);
protected CreateOrOverwriteFile(String path, Iterable<String> lines, String delimiter, boolean expandVariables) {
super(path, lines, delimiter, expandVariables);
}
@Override
@ -71,8 +71,8 @@ public class CreateOrOverwriteFile extends AppendFile {
public StringBuilder startHereFile() {
StringBuilder hereFile = new StringBuilder().append("cat > ").append(path);
if (expandVariables)
return hereFile.append(" <<-").append(delimeter).append("\n");
return hereFile.append(" <<-'").append(delimeter).append("'\n");
return hereFile.append(" <<-").append(delimiter).append("\n");
return hereFile.append(" <<-'").append(delimiter).append("'\n");
}
}
}

View File

@ -49,7 +49,7 @@ import com.google.common.collect.ImmutableList.Builder;
* @author Adrian Cole
*/
public class CreateRunScript extends StatementList {
public final static String DELIMETER = "END_OF_JCLOUDS_SCRIPT";
public final static String DELIMITER = "END_OF_JCLOUDS_SCRIPT";
final String instanceName;
final Iterable<String> exports;
final String pwd;
@ -123,7 +123,7 @@ public class CreateRunScript extends StatementList {
builder.append("# add runscript footer\n");
Iterable<String> endScript = Splitter.on(ShellToken.LF.to(OsFamily.UNIX)).split(
ShellToken.END_SCRIPT.to(OsFamily.UNIX));
builder.append(appendFile(runScript, endScript, DELIMETER).render(OsFamily.UNIX));
builder.append(appendFile(runScript, endScript, DELIMITER).render(OsFamily.UNIX));
}
private void addUnixRunScript(String runScript, StringBuilder builder) {
@ -138,7 +138,7 @@ public class CreateRunScript extends StatementList {
}
userCommands.addAll(Splitter.on('\n').split(statement.render(OsFamily.UNIX)));
}
builder.append(appendFile(runScript, userCommands.build(), DELIMETER).render(OsFamily.UNIX));
builder.append(appendFile(runScript, userCommands.build(), DELIMITER).render(OsFamily.UNIX));
}
private void addUnixRunScriptHeader(String runScript, StringBuilder builder) {
@ -150,10 +150,10 @@ public class CreateRunScript extends StatementList {
beginningOfFile.add(format("PROMPT_COMMAND='echo -ne \\\"\\033]0;%s\\007\\\"'", instanceName));
beginningOfFile.add(Utils.writeZeroPath(OsFamily.UNIX));
beginningOfFile.add(format("export INSTANCE_NAME='%s'", instanceName));
builder.append(createOrOverwriteFile(runScript, beginningOfFile.build(), DELIMETER).render(OsFamily.UNIX));
builder.append(createOrOverwriteFile(runScript, beginningOfFile.build(), DELIMITER).render(OsFamily.UNIX));
// expanding variables here.
builder.append(AppendFile.builder().path(runScript).delimeter(DELIMETER).expandVariables(true)
builder.append(AppendFile.builder().path(runScript).delimiter(DELIMITER).expandVariables(true)
.lines(Iterables.transform(exports, new Function<String, String>() {
@Override
@ -171,7 +171,7 @@ public class CreateRunScript extends StatementList {
if (functionsToWrite.size() > 1) {
StringBuilder functions = new StringBuilder();
ScriptBuilder.writeFunctions(functionsToWrite, OsFamily.UNIX, functions);
builder.append(appendFile(runScript, functions.toString(), DELIMETER).render(OsFamily.UNIX));
builder.append(appendFile(runScript, functions.toString(), DELIMITER).render(OsFamily.UNIX));
}
}
}
}

View File

@ -65,24 +65,24 @@ public class Statements {
return new Call(function, args);
}
public static Statement appendFile(String path, String line, String delimeter) {
return AppendFile.builder().path(path).lines(ImmutableSet.of(line)).delimeter(delimeter).build();
public static Statement appendFile(String path, String line, String delimiter) {
return AppendFile.builder().path(path).lines(ImmutableSet.of(line)).delimiter(delimiter).build();
}
public static Statement appendFile(String path, Iterable<String> lines) {
return AppendFile.builder().path(path).lines(lines).build();
}
public static Statement appendFile(String path, Iterable<String> lines, String delimeter) {
return AppendFile.builder().path(path).lines(lines).delimeter(delimeter).build();
public static Statement appendFile(String path, Iterable<String> lines, String delimiter) {
return AppendFile.builder().path(path).lines(lines).delimiter(delimiter).build();
}
public static Statement createOrOverwriteFile(String path, Iterable<String> lines) {
return CreateOrOverwriteFile.builder().path(path).lines(lines).build();
}
public static Statement createOrOverwriteFile(String path, Iterable<String> lines, String delimeter) {
return CreateOrOverwriteFile.builder().path(path).lines(lines).delimeter(delimeter).build();
public static Statement createOrOverwriteFile(String path, Iterable<String> lines, String delimiter) {
return CreateOrOverwriteFile.builder().path(path).lines(lines).delimiter(delimiter).build();
}
/**

View File

@ -94,11 +94,11 @@ public class SwitchArg implements Statement, AcceptsStatementVisitor {
if (shouldIndent)
actionBuilder.append(INDENT);
actionBuilder.append(line).append(ShellToken.LF.to(family));
if (line.indexOf(CreateRunScript.DELIMETER) != -1) {
if (line.indexOf(CreateRunScript.DELIMITER) != -1) {
inRunScript = inRunScript ? false : true;
}
if (line.indexOf(AppendFile.DELIMETER) != -1) {
if (line.indexOf(AppendFile.DELIMITER) != -1) {
inCreateFile = inCreateFile ? false : true;
}
shouldIndent = !inCreateFile && !inRunScript;