private static void loadConfigFromFile(final Project rootProject, File shipkitFile, ShipkitConfiguration conf) { if (!shipkitFile.exists()) { // sets some defaults so that they can't be used to run any task (except for bootstrap ones) // but also configuration doesn't fail when running Shipkit for the first time // and configuration files are not created yet conf.getGitHub().setRepository("unspecified"); conf.getGitHub().setReadOnlyAuthToken("unspecified"); LOG.lifecycle(" Configuration file '{}' does not exist. '{}' task can be used to bootstrap Shipkit.\n" + " Getting Started Guide: https://github.com/mockito/shipkit/blob/master/docs/getting-started.md", shipkitFile.getName(), InitPlugin.INIT_SHIPKIT_TASK); } else { // apply configuration properties from config file rootProject.apply(new Action<ObjectConfigurationAction>() { @Override public void execute(ObjectConfigurationAction action) { action.from(getShipkitFile(rootProject)); } }); } }
public ObjectConfigurationAction from(final Object script) { actions.add(new Runnable() { public void run() { applyScript(script); } }); return this; }
public ObjectConfigurationAction plugin(final Class<? extends Plugin> pluginClass) { actions.add(new Runnable() { public void run() { applyPlugin(pluginClass); } }); return this; }
public ObjectConfigurationAction plugin(final String pluginId) { actions.add(new Runnable() { public void run() { applyType(pluginId); } }); return this; }
public ObjectConfigurationAction type(final Class<?> pluginClass) { actions.add(new Runnable() { public void run() { applyType(pluginClass); } }); return this; }
public ObjectConfigurationAction plugin(final String pluginId) { actions.add(new Runnable() { public void run() { applyPlugin(pluginId); } }); return this; }
public void apply(Action<? super ObjectConfigurationAction> action) { DefaultObjectConfigurationAction configAction = createObjectConfigurationAction(); action.execute(configAction); configAction.execute(); }
public ObjectConfigurationAction to(Object... targets) { GUtil.flatten(targets, this.targets); return this; }