Remove plugin InitStep Change-Id: Ideb75ca92cdca2730a5b3753c502179358071c40 Signed-off-by: Jorge Ruesga <j.ruesga.criado@gmail.com>
diff --git a/BUCK b/BUCK index 693eccc..677999b 100644 --- a/BUCK +++ b/BUCK
@@ -38,7 +38,6 @@ 'Gerrit-ApiType: plugin', 'Gerrit-ApiVersion: 2.14-SNAPSHOT', 'Gerrit-Module: com.ruesga.gerrit.plugins.fcm.ApiModule', - 'Gerrit-InitStep: com.ruesga.gerrit.plugins.fcm.InitStep', 'Implementation-Title: Firebase Cloud Notifications Plugin', 'Implementation-Vendor: Jorge Ruesga', 'Implementation-URL: https://gerrit.googlesource.com/plugins/cloud-notifications',
diff --git a/src/main/java/com/ruesga/gerrit/plugins/fcm/InitStep.java b/src/main/java/com/ruesga/gerrit/plugins/fcm/InitStep.java deleted file mode 100644 index f133a61..0000000 --- a/src/main/java/com/ruesga/gerrit/plugins/fcm/InitStep.java +++ /dev/null
@@ -1,82 +0,0 @@ -/* - * Copyright (C) 2016 Jorge Ruesga - * - * 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 com.ruesga.gerrit.plugins.fcm; - -import org.eclipse.jgit.lib.Config; - -import com.google.gerrit.extensions.annotations.PluginName; -import com.google.gerrit.pgm.init.api.AllProjectsConfig; -import com.google.gerrit.pgm.init.api.ConsoleUI; -import com.google.inject.Inject; - -public class InitStep implements com.google.gerrit.pgm.init.api.InitStep { - private final String pluginName; - private final ConsoleUI ui; - private final AllProjectsConfig allProjectsConfig; - - @Inject - public InitStep(@PluginName String pluginName, ConsoleUI ui, - AllProjectsConfig allProjectsConfig) { - this.pluginName = pluginName; - this.ui = ui; - this.allProjectsConfig = allProjectsConfig; - } - - @Override - public void run() throws Exception { - } - - @Override - public void postRun() throws Exception { - ui.message("\n"); - ui.header(pluginName + " Settings"); - Config cfg = allProjectsConfig.load().getConfig(); - - String serverUrl = ui.readString( - Configuration.DEFAULT_SERVER_URL, "Firebase Server Url"); - String serverToken = ui.readString("", "Firebase Server Token"); - String serverSenderId = ui.readString("", "Firebase Server Sender Id"); - String databasePath = ui.readString( - "", "Database path (leave empty for default)"); - - if (serverUrl != null && serverUrl.isEmpty()) { - serverUrl = Configuration.DEFAULT_SERVER_URL; - } - cfg.setString("plugin", pluginName, - Configuration.PROP_SERVER_URL, serverUrl); - if (serverToken != null && serverToken.isEmpty()) { - cfg.unset("plugin", pluginName, Configuration.PROP_SERVER_TOKEN); - } else { - cfg.setString("plugin", pluginName, - Configuration.PROP_SERVER_TOKEN, serverToken); - } - if (serverSenderId != null && serverSenderId.isEmpty()) { - cfg.unset("plugin", pluginName, Configuration.PROP_SERVER_SENDER_ID); - } else { - cfg.setString("plugin", pluginName, - Configuration.PROP_SERVER_SENDER_ID, serverSenderId); - } - if (databasePath != null && databasePath.isEmpty()) { - cfg.unset("plugin", pluginName, Configuration.PROP_DATABASE_PATH); - } else { - cfg.setString("plugin", pluginName, - Configuration.PROP_DATABASE_PATH, databasePath); - } - - allProjectsConfig.save(pluginName, pluginName + " initialized"); - } - -}