Skip to content

Commit

Permalink
Change utills to utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrouR committed Dec 9, 2019
1 parent 6d2cd13 commit 15e301b
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
90 changes: 42 additions & 48 deletions src/main/java/org/web3j/console/project/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/web3j/console/project/ProjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 15e301b

Please sign in to comment.