From 15e301b2593e9d196692fc0c2479d0c18ebc5538 Mon Sep 17 00:00:00 2001 From: AlexandrouR Date: Mon, 9 Dec 2019 10:57:15 +0000 Subject: [PATCH] Change utills to utils. --- .../console/project/InteractiveOptions.java | 4 +- .../org/web3j/console/project/Project.java | 90 +++++++++---------- .../web3j/console/project/ProjectCreator.java | 2 +- .../project/ProjectCreatorCLIRunner.java | 11 ++- .../project/ProjectImporterCLIRunner.java | 11 ++- .../{utills => utils}/InputVerifier.java | 2 +- .../{utills => utils}/ProgressCounter.java | 2 +- .../{utills => utils}/ProjectUtils.java | 2 +- .../console/project/ProjectCreatorTest.java | 2 +- .../console/project/ProjectImporterTest.java | 2 +- .../web3j/console/project/ProjectTest.java | 2 +- .../console/project/UnitTestCreatorTest.java | 2 +- .../{utills => utils}/ClassExecutor.java | 2 +- .../{utills => utils}/InputVerifierTest.java | 2 +- 14 files changed, 68 insertions(+), 68 deletions(-) rename src/main/java/org/web3j/console/project/{utills => utils}/InputVerifier.java (98%) rename src/main/java/org/web3j/console/project/{utills => utils}/ProgressCounter.java (97%) rename src/main/java/org/web3j/console/project/{utills => utils}/ProjectUtils.java (97%) rename src/test/java/org/web3j/console/project/{utills => utils}/ClassExecutor.java (97%) rename src/test/java/org/web3j/console/project/{utills => utils}/InputVerifierTest.java (98%) diff --git a/src/main/java/org/web3j/console/project/InteractiveOptions.java b/src/main/java/org/web3j/console/project/InteractiveOptions.java index 4ebe75f..4e2b6ed 100644 --- a/src/main/java/org/web3j/console/project/InteractiveOptions.java +++ b/src/main/java/org/web3j/console/project/InteractiveOptions.java @@ -17,11 +17,11 @@ import java.util.Optional; import java.util.Scanner; -import org.web3j.console.project.utills.InputVerifier; +import org.web3j.console.project.utils.InputVerifier; import static java.io.File.separator; import static org.web3j.codegen.Console.exitError; -import static org.web3j.console.project.utills.ProjectUtils.deleteFolder; +import static org.web3j.console.project.utils.ProjectUtils.deleteFolder; class InteractiveOptions { static Scanner scanner = new Scanner(System.in); diff --git a/src/main/java/org/web3j/console/project/Project.java b/src/main/java/org/web3j/console/project/Project.java index 9e27857..7779659 100644 --- a/src/main/java/org/web3j/console/project/Project.java +++ b/src/main/java/org/web3j/console/project/Project.java @@ -14,12 +14,9 @@ import java.io.File; import java.io.IOException; -import java.util.Arrays; -import org.web3j.console.project.utills.InputVerifier; -import org.web3j.console.project.utills.ProgressCounter; - -import static org.web3j.codegen.Console.exitError; +import org.web3j.console.project.utils.InputVerifier; +import org.web3j.console.project.utils.ProgressCounter; public class Project { @@ -88,51 +85,48 @@ private void executeCommand(final File workingDir, final String[] command) .waitFor(); } - public Project build() { - try { - projectStructure.createDirectoryStructure(); - final ProjectWriter projectWriter = new ProjectWriter(); - projectWriter.writeResourceFile( - templateProvider.getMainJavaClass(), - InputVerifier.capitalizeFirstLetter( - projectStructure.getProjectName() + ".java"), - projectStructure.getMainPath()); - projectWriter.writeResourceFile( - templateProvider.getGradleBuild(), - File.separator + "build.gradle", - projectStructure.getProjectRoot()); - projectWriter.writeResourceFile( - templateProvider.getGradleSettings(), - File.separator + "settings.gradle", - projectStructure.getProjectRoot()); - if (solidityImportPath == null) { - projectWriter.writeResourceFile( - templateProvider.getSolidityProject(), - "HelloWorld.sol", - projectStructure.getSolidityPath()); - } else { - projectWriter.importSolidityProject( - solidityImportPath, projectStructure.getSolidityPath()); - } + public Project build() throws IOException, InterruptedException { + projectStructure.createDirectoryStructure(); + final ProjectWriter projectWriter = new ProjectWriter(); + projectWriter.writeResourceFile( + templateProvider.getMainJavaClass(), + InputVerifier.capitalizeFirstLetter( + projectStructure.getProjectName() + ".java"), + projectStructure.getMainPath()); + projectWriter.writeResourceFile( + templateProvider.getGradleBuild(), + File.separator + "build.gradle", + projectStructure.getProjectRoot()); + projectWriter.writeResourceFile( + templateProvider.getGradleSettings(), + File.separator + "settings.gradle", + projectStructure.getProjectRoot()); + if (solidityImportPath == null) { projectWriter.writeResourceFile( - templateProvider.getGradlewWrapperSettings(), - File.separator + "gradle-wrapper.properties", - projectStructure.getWrapperPath()); - projectWriter.writeResourceFile( - templateProvider.getGradlewScript(), - File.separator + "gradlew", - projectStructure.getProjectRoot()); - projectWriter.writeResourceFile( - templateProvider.getGradlewBatScript(), - File.separator + "gradlew.bat", - projectStructure.getProjectRoot()); - projectWriter.copyResourceFile( - templateProvider.getGradlewJar(), - projectStructure.getWrapperPath() + File.separator + "gradle-wrapper.jar"); - buildGradleProject(projectStructure.getProjectRoot()); - } catch (final IOException | InterruptedException e) { - exitError("Looks like an error occurred: " + Arrays.toString(e.getStackTrace())); + templateProvider.getSolidityProject(), + "HelloWorld.sol", + projectStructure.getSolidityPath()); + } else { + projectWriter.importSolidityProject( + solidityImportPath, projectStructure.getSolidityPath()); } + projectWriter.writeResourceFile( + templateProvider.getGradlewWrapperSettings(), + File.separator + "gradle-wrapper.properties", + projectStructure.getWrapperPath()); + projectWriter.writeResourceFile( + templateProvider.getGradlewScript(), + File.separator + "gradlew", + projectStructure.getProjectRoot()); + projectWriter.writeResourceFile( + templateProvider.getGradlewBatScript(), + File.separator + "gradlew.bat", + projectStructure.getProjectRoot()); + projectWriter.copyResourceFile( + templateProvider.getGradlewJar(), + projectStructure.getWrapperPath() + File.separator + "gradle-wrapper.jar"); + buildGradleProject(projectStructure.getProjectRoot()); + return new Project(this); } } diff --git a/src/main/java/org/web3j/console/project/ProjectCreator.java b/src/main/java/org/web3j/console/project/ProjectCreator.java index ca87082..4dd40bf 100644 --- a/src/main/java/org/web3j/console/project/ProjectCreator.java +++ b/src/main/java/org/web3j/console/project/ProjectCreator.java @@ -20,7 +20,7 @@ import picocli.CommandLine; -import org.web3j.console.project.utills.InputVerifier; +import org.web3j.console.project.utils.InputVerifier; import static java.io.File.separator; import static org.web3j.codegen.Console.exitError; diff --git a/src/main/java/org/web3j/console/project/ProjectCreatorCLIRunner.java b/src/main/java/org/web3j/console/project/ProjectCreatorCLIRunner.java index bf1bef8..3f9cec7 100644 --- a/src/main/java/org/web3j/console/project/ProjectCreatorCLIRunner.java +++ b/src/main/java/org/web3j/console/project/ProjectCreatorCLIRunner.java @@ -14,17 +14,18 @@ import java.io.File; import java.io.IOException; -import java.util.Arrays; +import java.io.PrintWriter; +import java.io.StringWriter; import picocli.CommandLine.Command; import picocli.CommandLine.Option; -import org.web3j.console.project.utills.InputVerifier; +import org.web3j.console.project.utils.InputVerifier; import static org.web3j.codegen.Console.exitError; import static org.web3j.console.project.InteractiveOptions.overrideExistingProject; import static org.web3j.console.project.ProjectCreator.COMMAND_NEW; -import static org.web3j.console.project.utills.ProjectUtils.deleteFolder; +import static org.web3j.console.project.utils.ProjectUtils.deleteFolder; import static picocli.CommandLine.Help.Visibility.ALWAYS; @Command(name = COMMAND_NEW, mixinStandardHelpOptions = true, version = "4.0", sortOptions = false) @@ -68,7 +69,9 @@ private void createProject() { try { new ProjectCreator(outputDir, packageName, projectName).generate(); } catch (final IOException e) { - exitError("Could not generate project reason:" + Arrays.toString(e.getStackTrace())); + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + exitError("Could not generate project reason:" + sw.toString()); } } diff --git a/src/main/java/org/web3j/console/project/ProjectImporterCLIRunner.java b/src/main/java/org/web3j/console/project/ProjectImporterCLIRunner.java index 8244c62..75febfc 100644 --- a/src/main/java/org/web3j/console/project/ProjectImporterCLIRunner.java +++ b/src/main/java/org/web3j/console/project/ProjectImporterCLIRunner.java @@ -13,17 +13,18 @@ package org.web3j.console.project; import java.io.File; -import java.util.Arrays; +import java.io.PrintWriter; +import java.io.StringWriter; import picocli.CommandLine.Command; import picocli.CommandLine.Option; -import org.web3j.console.project.utills.InputVerifier; +import org.web3j.console.project.utils.InputVerifier; import static org.web3j.codegen.Console.exitError; import static org.web3j.console.project.InteractiveOptions.overrideExistingProject; import static org.web3j.console.project.ProjectImporter.COMMAND_IMPORT; -import static org.web3j.console.project.utills.ProjectUtils.*; +import static org.web3j.console.project.utils.ProjectUtils.*; import static picocli.CommandLine.Help.Visibility.ALWAYS; @Command(name = COMMAND_IMPORT) @@ -64,7 +65,9 @@ private void createProject() { new ProjectImporter(outputDir, packageName, projectName, solidityImportPath); projectImporter.generate(generateTests); } catch (final Exception e) { - exitError("Could not generate project reason:" + Arrays.toString(e.getStackTrace())); + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + exitError("Could not generate project reason:" + sw.toString()); } } } diff --git a/src/main/java/org/web3j/console/project/utills/InputVerifier.java b/src/main/java/org/web3j/console/project/utils/InputVerifier.java similarity index 98% rename from src/main/java/org/web3j/console/project/utills/InputVerifier.java rename to src/main/java/org/web3j/console/project/utils/InputVerifier.java index f7103f7..7ca9715 100644 --- a/src/main/java/org/web3j/console/project/utills/InputVerifier.java +++ b/src/main/java/org/web3j/console/project/utils/InputVerifier.java @@ -10,7 +10,7 @@ * 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 org.web3j.console.project.utills; +package org.web3j.console.project.utils; import java.io.File; import javax.lang.model.SourceVersion; diff --git a/src/main/java/org/web3j/console/project/utills/ProgressCounter.java b/src/main/java/org/web3j/console/project/utils/ProgressCounter.java similarity index 97% rename from src/main/java/org/web3j/console/project/utills/ProgressCounter.java rename to src/main/java/org/web3j/console/project/utils/ProgressCounter.java index 25ead21..3f1b22f 100644 --- a/src/main/java/org/web3j/console/project/utills/ProgressCounter.java +++ b/src/main/java/org/web3j/console/project/utils/ProgressCounter.java @@ -10,7 +10,7 @@ * 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 org.web3j.console.project.utills; +package org.web3j.console.project.utils; import java.io.IOException; diff --git a/src/main/java/org/web3j/console/project/utills/ProjectUtils.java b/src/main/java/org/web3j/console/project/utils/ProjectUtils.java similarity index 97% rename from src/main/java/org/web3j/console/project/utills/ProjectUtils.java rename to src/main/java/org/web3j/console/project/utils/ProjectUtils.java index ea824e6..cefcfdf 100644 --- a/src/main/java/org/web3j/console/project/utills/ProjectUtils.java +++ b/src/main/java/org/web3j/console/project/utils/ProjectUtils.java @@ -10,7 +10,7 @@ * 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 org.web3j.console.project.utills; +package org.web3j.console.project.utils; import java.io.File; import java.io.IOException; diff --git a/src/test/java/org/web3j/console/project/ProjectCreatorTest.java b/src/test/java/org/web3j/console/project/ProjectCreatorTest.java index 9d3f60f..732333a 100644 --- a/src/test/java/org/web3j/console/project/ProjectCreatorTest.java +++ b/src/test/java/org/web3j/console/project/ProjectCreatorTest.java @@ -28,7 +28,7 @@ import org.junit.jupiter.api.io.TempDir; import picocli.CommandLine; -import org.web3j.console.project.utills.ClassExecutor; +import org.web3j.console.project.utils.ClassExecutor; import static java.io.File.separator; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/org/web3j/console/project/ProjectImporterTest.java b/src/test/java/org/web3j/console/project/ProjectImporterTest.java index 667026e..aa2c7e5 100644 --- a/src/test/java/org/web3j/console/project/ProjectImporterTest.java +++ b/src/test/java/org/web3j/console/project/ProjectImporterTest.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.io.TempDir; import picocli.CommandLine; -import org.web3j.console.project.utills.ClassExecutor; +import org.web3j.console.project.utils.ClassExecutor; import static java.io.File.separator; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/org/web3j/console/project/ProjectTest.java b/src/test/java/org/web3j/console/project/ProjectTest.java index a98d045..93d6935 100644 --- a/src/test/java/org/web3j/console/project/ProjectTest.java +++ b/src/test/java/org/web3j/console/project/ProjectTest.java @@ -19,7 +19,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.web3j.console.project.utills.InputVerifier; +import org.web3j.console.project.utils.InputVerifier; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/src/test/java/org/web3j/console/project/UnitTestCreatorTest.java b/src/test/java/org/web3j/console/project/UnitTestCreatorTest.java index 66418b9..b3327d9 100644 --- a/src/test/java/org/web3j/console/project/UnitTestCreatorTest.java +++ b/src/test/java/org/web3j/console/project/UnitTestCreatorTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.io.TempDir; import picocli.CommandLine; -import org.web3j.console.project.utills.ClassExecutor; +import org.web3j.console.project.utils.ClassExecutor; import static java.io.File.separator; diff --git a/src/test/java/org/web3j/console/project/utills/ClassExecutor.java b/src/test/java/org/web3j/console/project/utils/ClassExecutor.java similarity index 97% rename from src/test/java/org/web3j/console/project/utills/ClassExecutor.java rename to src/test/java/org/web3j/console/project/utils/ClassExecutor.java index 16524a6..bfc5a73 100644 --- a/src/test/java/org/web3j/console/project/utills/ClassExecutor.java +++ b/src/test/java/org/web3j/console/project/utils/ClassExecutor.java @@ -10,7 +10,7 @@ * 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 org.web3j.console.project.utills; +package org.web3j.console.project.utils; import java.io.File; import java.util.Collection; diff --git a/src/test/java/org/web3j/console/project/utills/InputVerifierTest.java b/src/test/java/org/web3j/console/project/utils/InputVerifierTest.java similarity index 98% rename from src/test/java/org/web3j/console/project/utills/InputVerifierTest.java rename to src/test/java/org/web3j/console/project/utils/InputVerifierTest.java index 7a530e2..ed6cc51 100644 --- a/src/test/java/org/web3j/console/project/utills/InputVerifierTest.java +++ b/src/test/java/org/web3j/console/project/utils/InputVerifierTest.java @@ -10,7 +10,7 @@ * 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 org.web3j.console.project.utills; +package org.web3j.console.project.utils; import org.junit.jupiter.api.Test;