org.jclouds.scriptbuilder.domain.Statements.extractTargzAndFlattenIntoDirectory()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中org.jclouds.scriptbuilder.domain.Statements.extractTargzAndFlattenIntoDirectory()方法的一些代码示例,展示了Statements.extractTargzAndFlattenIntoDirectory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Statements.extractTargzAndFlattenIntoDirectory()方法的具体详情如下:
包路径:org.jclouds.scriptbuilder.domain.Statements
类名称:Statements
方法名:extractTargzAndFlattenIntoDirectory

Statements.extractTargzAndFlattenIntoDirectory介绍

[英]like #extractTargzIntoDirectory(URI,String) except that it flattens the first directory in the archive For example, apache-maven-3.0.4-bin.tar.gz normally extracts directories like ./apache-maven-3.0.4/bin. This command eliminates the intermediate directory, in the example ./apache-maven-3.0.4/
[中]与#extractTargetZintoDirectory(URI,String)类似,不同的是它会展平归档文件中的第一个目录,例如apache-maven-3.0.4-bin。焦油gz通常会提取如下目录/apache-maven-3.0.4/bin。在本例中,该命令消除了中间目录/apache-maven-3.0.4/

代码示例

代码示例来源:origin: jclouds/legacy-jclouds

@Override
public String render(OsFamily family) {
 if (family == OsFamily.WINDOWS) {
   throw new UnsupportedOperationException("windows not yet implemented");
 }
 URI rubygemsUri = URI.create(String.format(RUBYGEMS_URI_TEMPLATE, version.or(DEFAULT_RUBYGEMS_VERSION)));
 ImmutableList.Builder<Statement> statements = ImmutableList.builder();
 statements.add(exec("if ! hash gem 2>/dev/null; then"));
 statements.add(exec("("));
 statements.add(extractTargzAndFlattenIntoDirectory(rubygemsUri, "/tmp/rubygems"));
 statements.add(exec("{cd} /tmp/rubygems"));
 statements.add(exec("ruby setup.rb --no-format-executable"));
 statements.add(exec("{rm} -fr /tmp/rubygems"));
 statements.add(exec(")"));
 statements.add(exec("fi"));
 if (updateSystem) {
   statements.add(updateSystemVersion.isPresent() ? exec("gem update --system " + updateSystemVersion.get())
      : exec("gem update --system"));
 }
 if (updateExistingGems) {
   statements.add(exec("gem update --no-rdoc --no-ri"));
 }
 return new StatementList(statements.build()).render(family);
}

代码示例来源:origin: jclouds/legacy-jclouds

public void testExtractTargzAndFlattenIntoDirectoryUNIX() {
 Statement save = Statements
    .extractTargzAndFlattenIntoDirectory(
       URI.create("http://www.us.apache.org/dist/maven/binaries/apache-maven-3.0.4-bin.tar.gz"),
       "/usr/local/maven");
 assertEquals(
    save.render(OsFamily.UNIX),
    "mkdir /tmp/$$\n" +
    "curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -X GET  http://www.us.apache.org/dist/maven/binaries/apache-maven-3.0.4-bin.tar.gz |(mkdir -p /tmp/$$ &&cd /tmp/$$ &&tar -xpzf -)\n" +
    "mkdir -p /usr/local/maven\n" +
    "mv /tmp/$$/*/* /usr/local/maven\n" +
    "rm -rf /tmp/$$\n");
}

代码示例来源:origin: org.jclouds/jclouds-scriptbuilder

@Override
public String render(OsFamily family) {
 if (family == OsFamily.WINDOWS) {
   throw new UnsupportedOperationException("windows not yet implemented");
 }
 URI rubygemsUri = URI.create(String.format(RUBYGEMS_URI_TEMPLATE, version.or(DEFAULT_RUBYGEMS_VERSION)));
 ImmutableList.Builder<Statement> statements = ImmutableList.builder();
 statements.add(exec("if ! hash gem 2>/dev/null; then"));
 statements.add(exec("("));
 statements.add(extractTargzAndFlattenIntoDirectory(rubygemsUri, "/tmp/rubygems"));
 statements.add(exec("{cd} /tmp/rubygems"));
 statements.add(exec("ruby setup.rb --no-format-executable"));
 statements.add(exec("{rm} -fr /tmp/rubygems"));
 statements.add(exec(")"));
 statements.add(exec("fi"));
 if (updateSystem) {
   statements.add(updateSystemVersion.isPresent() ? exec("gem update --system " + updateSystemVersion.get())
      : exec("gem update --system"));
 }
 if (updateExistingGems) {
   statements.add(exec("gem update --no-rdoc --no-ri"));
 }
 return new StatementList(statements.build()).render(family);
}

代码示例来源:origin: com.amysta.jclouds/jclouds-scriptbuilder

@Override
public String render(OsFamily family) {
 if (family == OsFamily.WINDOWS) {
   throw new UnsupportedOperationException("windows not yet implemented");
 }
 URI rubygemsUri = URI.create(String.format(RUBYGEMS_URI_TEMPLATE, version.or(DEFAULT_RUBYGEMS_VERSION)));
 ImmutableList.Builder<Statement> statements = ImmutableList.builder();
 statements.add(exec("if ! hash gem 2>/dev/null; then"));
 statements.add(exec("("));
 statements.add(extractTargzAndFlattenIntoDirectory(rubygemsUri, "/tmp/rubygems"));
 statements.add(exec("{cd} /tmp/rubygems"));
 statements.add(exec("ruby setup.rb --no-format-executable"));
 statements.add(exec("{rm} -fr /tmp/rubygems"));
 statements.add(exec(")"));
 statements.add(exec("fi"));
 if (updateSystem) {
   statements.add(updateSystemVersion.isPresent() ? exec("gem update --system " + updateSystemVersion.get())
      : exec("gem update --system"));
 }
 if (updateExistingGems) {
   statements.add(exec("gem update --no-rdoc --no-ri"));
 }
 return new StatementList(statements.build()).render(family);
}

代码示例来源:origin: io.cloudsoft.jclouds/jclouds-scriptbuilder

@Override
public String render(OsFamily family) {
 if (family == OsFamily.WINDOWS) {
   throw new UnsupportedOperationException("windows not yet implemented");
 }
 URI rubygemsUri = URI.create(String.format(RUBYGEMS_URI_TEMPLATE, version.or(DEFAULT_RUBYGEMS_VERSION)));
 ImmutableList.Builder<Statement> statements = ImmutableList.builder();
 statements.add(exec("if ! hash gem 2>/dev/null; then"));
 statements.add(exec("("));
 statements.add(extractTargzAndFlattenIntoDirectory(rubygemsUri, "/tmp/rubygems"));
 statements.add(exec("{cd} /tmp/rubygems"));
 statements.add(exec("ruby setup.rb --no-format-executable"));
 statements.add(exec("{rm} -fr /tmp/rubygems"));
 statements.add(exec(")"));
 statements.add(exec("fi"));
 if (updateSystem) {
   statements.add(updateSystemVersion.isPresent() ? exec("gem update --system " + updateSystemVersion.get())
      : exec("gem update --system"));
 }
 if (updateExistingGems) {
   statements.add(exec("gem update --no-rdoc --no-ri"));
 }
 return new StatementList(statements.build()).render(family);
}

代码示例来源:origin: org.apache.jclouds/jclouds-scriptbuilder

@Override
public String render(OsFamily family) {
 if (family == OsFamily.WINDOWS) {
   throw new UnsupportedOperationException("windows not yet implemented");
 }
 URI rubygemsUri = URI.create(String.format(RUBYGEMS_URI_TEMPLATE, version.or(DEFAULT_RUBYGEMS_VERSION)));
 ImmutableList.Builder<Statement> statements = ImmutableList.builder();
 statements.add(exec("if ! hash gem 2>/dev/null; then"));
 statements.add(exec("("));
 statements.add(extractTargzAndFlattenIntoDirectory(rubygemsUri, "/tmp/rubygems"));
 statements.add(exec("{cd} /tmp/rubygems"));
 statements.add(exec("ruby setup.rb --no-format-executable"));
 statements.add(exec("{rm} -fr /tmp/rubygems"));
 statements.add(exec(")"));
 statements.add(exec("fi"));
 if (updateSystem) {
   statements.add(updateSystemVersion.isPresent() ? exec("gem update --system " + updateSystemVersion.get())
      : exec("gem update --system"));
 }
 if (updateExistingGems) {
   statements.add(exec("gem update --no-rdoc --no-ri"));
 }
 return new StatementList(statements.build()).render(family);
}

代码示例来源:origin: apache/jclouds

public void testExtractTargzAndFlattenIntoDirectoryUNIX() {
 Statement save = Statements
    .extractTargzAndFlattenIntoDirectory(
       URI.create("http://www.us.apache.org/dist/maven/binaries/apache-maven-3.0.4-bin.tar.gz"),
       "/usr/local/maven");
 assertEquals(
    save.render(OsFamily.UNIX),
    "export TAR_TEMP=\"$(mktemp -d)\"\n" +
    "curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -X GET  http://www.us.apache.org/dist/maven/binaries/apache-maven-3.0.4-bin.tar.gz |(mkdir -p \"${TAR_TEMP}\" &&cd \"${TAR_TEMP}\" &&tar -xpzf -)\n" +
    "mkdir -p /usr/local/maven\n" +
    "mv \"${TAR_TEMP}\"/*/* /usr/local/maven\n" +
    "rm -rf \"${TAR_TEMP}\"\n");
}

代码示例来源:origin: apache/jclouds

@Override
public String render(OsFamily family) {
 if (family == OsFamily.WINDOWS) {
   throw new UnsupportedOperationException("windows not yet implemented");
 }
 URI rubygemsUri = URI.create(String.format(RUBYGEMS_URI_TEMPLATE, version.or(DEFAULT_RUBYGEMS_VERSION)));
 ImmutableList.Builder<Statement> statements = ImmutableList.builder();
 statements.add(exec("if ! hash gem 2>/dev/null; then"));
 statements.add(exec("("));
 statements.add(extractTargzAndFlattenIntoDirectory(rubygemsUri, "/tmp/rubygems"));
 statements.add(exec("{cd} /tmp/rubygems"));
 statements.add(exec("ruby setup.rb --no-format-executable"));
 statements.add(exec("{rm} -fr /tmp/rubygems"));
 statements.add(exec(")"));
 statements.add(exec("fi"));
 if (updateSystem) {
   statements.add(updateSystemVersion.isPresent() ? exec("gem update --system " + updateSystemVersion.get())
      : exec("gem update --system"));
 }
 if (updateExistingGems) {
   statements.add(exec("gem update --no-rdoc --no-ri"));
 }
 return new StatementList(statements.build()).render(family);
}

代码示例来源:origin: jclouds/legacy-jclouds

public static Statement install() {
 return new StatementList(
    AdminAccess.builder().adminUsername("web").build(),
    InstallJDK.fromOpenJDK(),
    authorizePortInIpTables(),
    extractTargzAndFlattenIntoDirectory(JETTY_URL, JETTY_HOME),
    exec("chown -R web " + JETTY_HOME));
}

代码示例来源:origin: apache/jclouds

public static Statement install() {
 return new StatementList(
    AdminAccess.builder().adminUsername("web").build(),
    InstallJDK.fromOpenJDK(),
    authorizePortInIpTables(),
    extractTargzAndFlattenIntoDirectory(JETTY_URL, JETTY_HOME),
    exec("chown -R web " + JETTY_HOME));
}

相关文章