Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2013 Andrey Chaschev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package bear.plugins;
import bear.context.Fun;
import bear.core.GlobalContext;
import bear.core.SessionContext;
import bear.plugins.java.JavaPlugin;
import bear.plugins.sh.CommandLine;
import bear.plugins.sh.Script;
import bear.plugins.sh.SystemEnvironmentPlugin;
import bear.session.DynamicVariable;
import bear.task.*;
import bear.vcs.CommandLineResult;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import org.slf4j.LoggerFactory;
import static bear.session.Variables.*;
import static chaschev.lang.Predicates2.contains;
import static com.google.common.base.Predicates.or;
import static com.google.common.base.Splitter.on;
import static com.google.common.collect.Iterables.find;
/**
* User: chaschev
* Date: 8/30/13
*/
/**
* A class that simplifies operations (i.e. installation) of tools like Maven, Grails, Play, Tomcat, etc
*/
public class ZippedToolPlugin extends Plugin>> {
public final DynamicVariable
version = dynamic("version of the tool, a string which is return by a tool identifying it's version"),
toolname = dynamic("this will be the name of home folder, i.e. maven, jdk"),
toolDistrName = strVar("i.e. apache-tomcat").setEqualTo(toolname),
versionName = concat(toolDistrName, "-", version).desc("i.e. apache-maven-3.0.5"),
distrFilename = concat(versionName, ".tar.gz"),
homeParentPath = concat(bear.toolsInstallDirPath, "/", toolname),
homePath = concat(homeParentPath, "/", version).desc("Tool root dir"),
// homeVersionPath = equalTo(homePath),
currentVersionPath = concat(homeParentPath, "/current"),
myDirPath,
buildPath,
distrWwwAddress = dynamic("distribution download address");
public ZippedToolPlugin(GlobalContext global) {
super(global);
myDirPath = concat(bear.toolsSharedDirPath, "/", toolname).desc("a path in a shared dir, i.e. /var/lib//shared/maven");
buildPath = concat(myDirPath, "/build");
}
protected class ZippedToolTaskDef extends InstallationTaskDef {
public ZippedToolTaskDef(SingleTaskSupplier singleTaskSupplier) {
super(singleTaskSupplier);
}
}
public static class SystemDependencyPlugin extends Plugin>> {
public SystemDependencyPlugin(GlobalContext global) {
super(global);
}
@Override
public InstallationTaskDef extends InstallationTask> getInstall() {
return new InstallationTaskDef(new NamedSupplier