All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.sitebricks.cloud.mix.WebMix Maven / Gradle / Ivy

The newest version!
package com.google.sitebricks.cloud.mix;

import com.google.sitebricks.cloud.Cloud;

import java.util.Map;
import java.util.Set;

/**
 * @author [email protected] (Dhanji R. Prasanna)
 */
class WebMix implements Mix {
  @Override
  public void mix(Map properties, Set deps) throws Exception {
    deps.add(new MavenDependency("javax.servlet", "servlet-api", "2.5", null, "provided"));
    deps.add(new MavenDependency("com.google.sitebricks", "sitebricks", Cloud.SB_VERSION));

    // Are we on the bleeding edge?
    if (Cloud.SB_VERSION.contains("SNAPSHOT")) {
      deps.add(new MavenRepository("sonatype-google-snapshots",
          "http://oss.sonatype.org/content/repositories/google-snapshots/", false, true));
    }

    String packagePath = properties.get("packagePath").toString();

    // Write web.xml if missing.
    Cloud.mkdir("web");
    Cloud.mkdir("web/WEB-INF");
    Cloud.mkdir("web/js");
    Cloud.mkdir("web/images");
    Cloud.mkdir("web/css");
    Cloud.mkdir("src/" + packagePath + "/web");

    Cloud.writeTemplate("web.xml", "web/WEB-INF/web.xml", properties);

    Cloud.writeTemplate("AppConfig.java", "src/" + packagePath + "/AppConfig.java", properties);
    Cloud.writeTemplate("Main.java", "src/" + packagePath + "/Main.java", properties);

    // Now create a hello world for the start page.
    Cloud.writeTemplate("Start.java", "src/" + packagePath + "/web/Start.java", properties);
    Cloud.writeTemplate("main.css", "web/css/main.css", properties);
    Cloud.writeTemplate("Start.html", "web/Start.html", properties);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy