├── dist └── ply │ ├── version │ ├── repo │ ├── org.hamcrest │ │ └── hamcrest-core │ │ │ └── 1.1 │ │ │ ├── dependencies.properties │ │ │ └── hamcrest-core-1.1.jar │ ├── junit │ │ └── junit │ │ │ └── 4.10 │ │ │ ├── dependencies.properties │ │ │ └── junit-4.10.jar │ └── net.java.dev.jna │ │ └── jna │ │ └── 3.3.0 │ │ ├── dependencies.properties │ │ └── jna-3.3.0.jar │ ├── lib │ ├── ply-1.0.jar │ ├── asm-5.0.2.jar │ ├── jna-3.3.0.jar │ ├── jasypt-1.9.0.jar │ ├── ply-jna-1.0.jar │ ├── ply-util-1.0.jar │ ├── ply-jvm-primer-1.0.jar │ ├── jackson-core-asl-1.9.9.jar │ └── jackson-mapper-asl-1.9.9.jar │ ├── config │ ├── aliases.test.properties │ ├── repositories.properties │ ├── resources.properties │ ├── depmngr.properties │ ├── scripts-clj.properties │ ├── deploy.properties │ ├── scripts-sh.properties │ ├── compiler.test.properties │ ├── ply.properties │ ├── project.test.properties │ ├── package.properties │ ├── aliases.properties │ ├── compiler.properties │ └── project.properties │ └── scripts │ ├── ply-clean-1.0.jar │ ├── ply-exec-1.0.jar │ ├── ply-compiler-1.0.jar │ ├── ply-intellij-1.0.jar │ ├── ply-package-1.0.jar │ ├── ply-filter-file-1.0.jar │ ├── ply-resources-1.0.jar │ ├── ply-test-junit-1.0.jar │ ├── ply-file-changed-1.0.jar │ ├── ply-repo-install-1.0.jar │ ├── ply-repo-manager-1.0.jar │ ├── ply-dependency-copy-1.0.jar │ ├── ply-print-classpath-1.0.jar │ └── ply-dependency-manager-1.0.jar ├── src ├── test │ ├── resources │ │ ├── scripts │ │ │ ├── mock-clean.jar │ │ │ └── mock-compile.jar │ │ ├── update-instr-test-empty-1 │ │ ├── update-instr-test-1 │ │ ├── update-instr-test-fail-1 │ │ ├── child-1 │ │ │ └── .ply │ │ │ │ └── config │ │ │ │ ├── dependencies.properties │ │ │ │ └── project.properties │ │ ├── update-ply-home │ │ │ └── holder.txt │ │ ├── child-2 │ │ │ └── .ply │ │ │ │ └── config │ │ │ │ ├── dependencies.properties │ │ │ │ └── project.properties │ │ ├── child-3 │ │ │ └── .ply │ │ │ │ └── config │ │ │ │ ├── dependencies.properties │ │ │ │ └── project.properties │ │ ├── update-config │ │ │ └── aliases.properties │ │ ├── dot-ply │ │ │ └── config │ │ │ │ ├── aliases.properties │ │ │ │ ├── project.properties │ │ │ │ └── submodules.properties │ │ ├── update-instr-test-3 │ │ └── update-instr-test-2 │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── submodules │ │ └── SubmodulesTest.java └── main │ └── java │ └── net │ └── ocheyedan │ └── ply │ ├── cmd │ ├── config │ │ ├── Prepend.java │ │ ├── Config.java │ │ ├── GetAll.java │ │ ├── Remove.java │ │ ├── Set.java │ │ └── Append.java │ ├── Args.java │ ├── Version.java │ ├── build │ │ └── ShellScript.java │ ├── Usage.java │ ├── Command.java │ └── CommandLineParser.java │ ├── ShutdownHandler.java │ ├── OutputExt.java │ ├── Ply.java │ ├── submodules │ └── Submodule.java │ └── exec │ └── StdinProcessPipe.java ├── java-scripts ├── ply-repo-manager │ ├── .ply │ │ └── config │ │ │ ├── repomngr.properties │ │ │ ├── repositories.properties │ │ │ ├── package.properties │ │ │ ├── project.properties │ │ │ ├── compiler.properties │ │ │ └── dependencies.properties │ └── src │ │ └── main │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── script │ │ └── github │ │ ├── App.java │ │ └── Authorization.java ├── ply-exec │ └── .ply │ │ └── config │ │ ├── dependencies.properties │ │ ├── compiler.properties │ │ ├── package.properties │ │ └── project.properties ├── ply-compiler │ ├── .ply │ │ └── config │ │ │ ├── ply.properties │ │ │ ├── compiler.properties │ │ │ ├── dependencies.properties │ │ │ ├── dependencies.test.properties │ │ │ ├── package.properties │ │ │ └── project.properties │ └── src │ │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── javax.annotation.processing.Processor │ │ └── java │ │ │ └── net │ │ │ └── ocheyedan │ │ │ └── ply │ │ │ └── script │ │ │ ├── DependencyGraphVisitor.java │ │ │ └── DependencyGraphProcessor.java │ │ └── test │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── script │ │ └── FormattedDiagnosticListenerTest.java ├── ply-file-changed │ ├── .ply │ │ └── config │ │ │ ├── dependencies.test.properties │ │ │ ├── ply.properties │ │ │ ├── compiler.properties │ │ │ ├── dependencies.properties │ │ │ ├── package.properties │ │ │ └── project.properties │ └── src │ │ └── test │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── script │ │ └── CompilableFilesTest.java ├── ply-clean │ ├── .ply │ │ └── config │ │ │ ├── compiler.properties │ │ │ ├── package.properties │ │ │ └── project.properties │ └── src │ │ └── main │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── script │ │ └── Clean.java ├── ply-dependency-copy │ ├── .ply │ │ └── config │ │ │ ├── dependencies.properties │ │ │ ├── compiler.properties │ │ │ ├── package.properties │ │ │ └── project.properties │ └── src │ │ └── main │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── script │ │ └── DependencyCopy.java ├── ply-dependency-manager │ └── .ply │ │ └── config │ │ ├── dependencies.properties │ │ ├── compiler.properties │ │ ├── package.properties │ │ └── project.properties ├── ply-intellij │ ├── .ply │ │ └── config │ │ │ ├── compiler.properties │ │ │ ├── dependencies.properties │ │ │ ├── package.properties │ │ │ └── project.properties │ └── src │ │ └── main │ │ ├── resources │ │ └── etc │ │ │ └── ply-intellij │ │ │ └── templates │ │ │ └── module.xml │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── script │ │ └── WorkspaceUtil.java ├── ply-package │ ├── .ply │ │ └── config │ │ │ ├── compiler.properties │ │ │ ├── dependencies.properties │ │ │ ├── package.properties │ │ │ └── project.properties │ └── src │ │ └── main │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── script │ │ ├── PackagingScript.java │ │ ├── PackageScript.java │ │ └── ZipFiles.java ├── ply-resources │ ├── .ply │ │ └── config │ │ │ ├── compiler.properties │ │ │ ├── dependencies.properties │ │ │ ├── package.properties │ │ │ └── project.properties │ └── src │ │ └── main │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── script │ │ └── ResourcesScript.java ├── ply-filter-file │ └── .ply │ │ └── config │ │ ├── compiler.properties │ │ ├── dependencies.properties │ │ ├── package.properties │ │ └── project.properties ├── ply-repo-install │ └── .ply │ │ └── config │ │ ├── compiler.properties │ │ ├── dependencies.properties │ │ ├── package.properties │ │ └── project.properties ├── ply-print-classpath │ ├── .ply │ │ └── config │ │ │ ├── compiler.properties │ │ │ ├── dependencies.properties │ │ │ ├── package.properties │ │ │ └── project.properties │ └── src │ │ └── main │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ └── script │ │ └── PrintClasspathScript.java └── ply-test-junit │ ├── .ply │ └── config │ │ ├── compiler.properties │ │ ├── dependencies.properties │ │ ├── package.properties │ │ └── project.properties │ └── src │ └── main │ └── java │ └── net │ └── ocheyedan │ └── ply │ └── script │ ├── print │ ├── PrivilegedOutput.java │ └── PrivilegedPrintStream.java │ ├── UnionFilter.java │ ├── AllFilterCollectPad.java │ └── DescriptionMatcher.java ├── .ply └── config │ ├── compiler.properties │ ├── dependencies.properties │ ├── dependencies.test.properties │ ├── package.properties │ ├── project.properties │ ├── aliases.properties │ └── submodules.intellij.properties ├── ply-util ├── src │ ├── test │ │ ├── resources │ │ │ ├── mock-prop-files │ │ │ │ ├── mock-invalid-2.properties │ │ │ │ ├── mock-invalid-1.properties │ │ │ │ ├── mock-invalid-3.properties │ │ │ │ ├── mock-invalid-4.properties │ │ │ │ └── mock-1.properties │ │ │ ├── mock-mvn-repo │ │ │ │ ├── stax │ │ │ │ │ └── stax-api │ │ │ │ │ │ └── 1.0.1 │ │ │ │ │ │ ├── dependencies.properties │ │ │ │ │ │ └── stax-api-1.0.1.pom │ │ │ │ ├── javax │ │ │ │ │ ├── servlet │ │ │ │ │ │ └── servlet-api │ │ │ │ │ │ │ └── 2.3 │ │ │ │ │ │ │ ├── dependencies.properties │ │ │ │ │ │ │ └── servlet-api-2.3.pom │ │ │ │ │ ├── mail │ │ │ │ │ │ └── mail │ │ │ │ │ │ │ └── maven-metadata.xml │ │ │ │ │ └── activation │ │ │ │ │ │ └── activation │ │ │ │ │ │ └── 1.1 │ │ │ │ │ │ └── activation-1.1.pom │ │ │ │ ├── org │ │ │ │ │ ├── slf4j │ │ │ │ │ │ ├── slf4j-jdk14 │ │ │ │ │ │ │ └── 1.5.11 │ │ │ │ │ │ │ │ ├── dependencies.properties │ │ │ │ │ │ │ │ └── slf4j-jdk14-1.5.11.pom │ │ │ │ │ │ ├── slf4j-jcl │ │ │ │ │ │ │ └── 1.5.11 │ │ │ │ │ │ │ │ └── slf4j-jcl-1.5.11.pom │ │ │ │ │ │ └── slf4j-api │ │ │ │ │ │ │ └── 1.5.11 │ │ │ │ │ │ │ └── slf4j-api-1.5.11.pom │ │ │ │ │ ├── apache │ │ │ │ │ │ ├── geronimo │ │ │ │ │ │ │ └── specs │ │ │ │ │ │ │ │ └── geronimo-jms_1.1_spec │ │ │ │ │ │ │ │ └── 1.0 │ │ │ │ │ │ │ │ └── geronimo-jms_1.1_spec-1.0.pom │ │ │ │ │ │ └── httpcomponents │ │ │ │ │ │ │ └── httpclient │ │ │ │ │ │ │ └── maven-metadata.xml │ │ │ │ │ └── codehaus │ │ │ │ │ │ └── jackson │ │ │ │ │ │ └── jackson-core-asl │ │ │ │ │ │ ├── 1.9.2 │ │ │ │ │ │ └── jackson-core-asl-1.9.2.pom │ │ │ │ │ │ └── maven-metadata.xml │ │ │ │ ├── logkit │ │ │ │ │ └── logkit │ │ │ │ │ │ └── 1.0.1 │ │ │ │ │ │ └── logkit-1.0.1.pom │ │ │ │ ├── spy │ │ │ │ │ └── spymemcached │ │ │ │ │ │ └── 2.6 │ │ │ │ │ │ └── spymemcached-2.6.pom │ │ │ │ ├── avalon-framework │ │ │ │ │ └── avalon-framework │ │ │ │ │ │ └── 4.1.3 │ │ │ │ │ │ └── avalon-framework-4.1.3.pom │ │ │ │ ├── log4j │ │ │ │ │ └── log4j │ │ │ │ │ │ └── maven-metadata.xml │ │ │ │ ├── commons-logging │ │ │ │ │ └── commons-logging │ │ │ │ │ │ └── maven-metadata.xml │ │ │ │ └── com │ │ │ │ │ └── amazonaws │ │ │ │ │ └── aws-java-sdk │ │ │ │ │ └── maven-metadata.xml │ │ │ └── mock-prop-loader-files │ │ │ │ ├── loader.properties │ │ │ │ └── loader.test.properties │ │ └── java │ │ │ └── net │ │ │ └── ocheyedan │ │ │ └── ply │ │ │ ├── BitUtilTest.java │ │ │ ├── dep │ │ │ └── ReposTest.java │ │ │ ├── AntStyleWildcardUtilTest.java │ │ │ ├── mvn │ │ │ └── MavenMetadataParserTest.java │ │ │ ├── props │ │ │ ├── PrefixedPropsTest.java │ │ │ ├── PropFileWriterTest.java │ │ │ └── PropFilesTest.java │ │ │ └── input │ │ │ └── ResourcesTest.java │ └── main │ │ └── java │ │ └── net │ │ └── ocheyedan │ │ └── ply │ │ ├── dep │ │ ├── ConflictingVersionVisitor.java │ │ ├── visitors │ │ │ ├── DependencyFieldVisitor.java │ │ │ ├── DependencyAnnotationVisitor.java │ │ │ ├── DependencySignatureVisitor.java │ │ │ └── DependencyVisitors.java │ │ ├── Dep.java │ │ ├── RepositoryRegistry.java │ │ └── Auth.java │ │ ├── BitUtil.java │ │ ├── SystemExit.java │ │ ├── input │ │ ├── Resource.java │ │ ├── Resources.java │ │ ├── ClasspathResource.java │ │ ├── FileResource.java │ │ └── UrlResource.java │ │ ├── AntStyleWildcardUtil.java │ │ ├── props │ │ └── Context.java │ │ ├── graph │ │ ├── Graphs.java │ │ └── Vertex.java │ │ ├── mvn │ │ └── MavenPom.java │ │ ├── EmptyConcurrentMap.java │ │ └── Iter.java └── .ply │ └── config │ ├── dependencies.properties │ ├── dependencies.test.properties │ ├── compiler.properties │ └── project.properties ├── ply-jvm-primer ├── .ply │ └── config │ │ ├── compiler.properties │ │ ├── project.properties │ │ └── aliases.ply.properties └── src │ └── main │ └── java │ └── net │ └── ocheyedan │ └── ply │ └── JvmPrimer.java ├── docs ├── imgs │ ├── ply-dep-guava.png │ ├── ply-dep-tree.png │ ├── ply-util-test.png │ ├── project-setup.png │ ├── building-compile.png │ ├── building-install.png │ ├── ply-test-failure.png │ ├── ply-test-success.png │ ├── ply-tests-class-select.png │ └── ply-tests-multiple-fail.png ├── Submodules.md ├── Logging.md ├── BuildingProject.md ├── DependenciesTutorial.md ├── ProjectSetup.md ├── IncludedScripts.md ├── Aliases.md ├── Dependencies.md └── Scripts.md ├── ply-jna ├── .ply │ └── config │ │ ├── dependencies.properties │ │ └── project.properties └── src │ └── main │ └── java │ └── net │ └── ocheyedan │ └── ply │ └── jna │ ├── lib │ └── CUnixLibrary.java │ ├── JnaAccessor.java │ └── JnaUtil.java ├── .travis.yml └── .gitignore /dist/ply/version: -------------------------------------------------------------------------------- 1 | 1.0_100 2 | -------------------------------------------------------------------------------- /src/test/resources/scripts/mock-clean.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/scripts/mock-compile.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/update-instr-test-empty-1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/update-instr-test-1: -------------------------------------------------------------------------------- 1 | VERSION=1.0_1 -------------------------------------------------------------------------------- /src/test/resources/update-instr-test-fail-1: -------------------------------------------------------------------------------- 1 | invalid format! -------------------------------------------------------------------------------- /java-scripts/ply-repo-manager/.ply/config/repomngr.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/ply/repo/org.hamcrest/hamcrest-core/1.1/dependencies.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.source=1.6 2 | java.target=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-exec/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | ply-util\:ply-util=1.0 -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-prop-files/mock-invalid-2.properties: -------------------------------------------------------------------------------- 1 | invalid_key -------------------------------------------------------------------------------- /java-scripts/ply-compiler/.ply/config/ply.properties: -------------------------------------------------------------------------------- 1 | #Fri Sep 23 20:13:17 EDT 2011 2 | -------------------------------------------------------------------------------- /java-scripts/ply-file-changed/.ply/config/dependencies.test.properties: -------------------------------------------------------------------------------- 1 | junit:junit=4.10 -------------------------------------------------------------------------------- /ply-jvm-primer/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/stax/stax-api/1.0.1/dependencies.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/child-1/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | ply-util\:ply-util=1.0 -------------------------------------------------------------------------------- /src/test/resources/update-ply-home/holder.txt: -------------------------------------------------------------------------------- 1 | something to be contained in this directory -------------------------------------------------------------------------------- /.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 02 17:16:56 EDT 2011 2 | ply-util\:ply-util=1.0 -------------------------------------------------------------------------------- /dist/ply/repo/junit/junit/4.10/dependencies.properties: -------------------------------------------------------------------------------- 1 | org.hamcrest:hamcrest-core=1.1 2 | -------------------------------------------------------------------------------- /java-scripts/ply-exec/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-file-changed/.ply/config/ply.properties: -------------------------------------------------------------------------------- 1 | #Sat Sep 24 16:51:24 EDT 2011 2 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-prop-files/mock-invalid-1.properties: -------------------------------------------------------------------------------- 1 | key=value 2 | =value -------------------------------------------------------------------------------- /src/test/resources/child-2/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | ply\:ply-unit-test-child-1=1.0 -------------------------------------------------------------------------------- /src/test/resources/child-3/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | ply\:ply-unit-test-child-2=1.0 -------------------------------------------------------------------------------- /.ply/config/dependencies.test.properties: -------------------------------------------------------------------------------- 1 | #Thu Oct 13 11:15:20 EDT 2011 2 | junit\:junit=4.10 3 | -------------------------------------------------------------------------------- /dist/ply/lib/ply-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/lib/ply-1.0.jar -------------------------------------------------------------------------------- /dist/ply/repo/net.java.dev.jna/jna/3.3.0/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Wed Nov 16 19:28:16 EST 2011 2 | -------------------------------------------------------------------------------- /java-scripts/ply-clean/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.source=1.6 2 | java.target=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-compiler/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.source=1.6 2 | java.target=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-dependency-copy/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | ply-util:ply-util=1.0 2 | -------------------------------------------------------------------------------- /java-scripts/ply-dependency-manager/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | ply-util:ply-util=1.0 2 | -------------------------------------------------------------------------------- /java-scripts/ply-intellij/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-package/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-resources/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /ply-util/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | org.jasypt:jasypt=1.9.0 2 | org.ow2.asm:asm=5.0.2 3 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/javax/servlet/servlet-api/2.3/dependencies.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-prop-files/mock-invalid-3.properties: -------------------------------------------------------------------------------- 1 | key=value 2 | key=samekey -------------------------------------------------------------------------------- /dist/ply/config/aliases.test.properties: -------------------------------------------------------------------------------- 1 | # do not repo-install test packages 2 | install=compile package -------------------------------------------------------------------------------- /dist/ply/config/repositories.properties: -------------------------------------------------------------------------------- 1 | http\://repo1.maven.org/maven2/=maven 2 | ~/.m2/repository=maven -------------------------------------------------------------------------------- /dist/ply/lib/asm-5.0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/lib/asm-5.0.2.jar -------------------------------------------------------------------------------- /dist/ply/lib/jna-3.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/lib/jna-3.3.0.jar -------------------------------------------------------------------------------- /docs/imgs/ply-dep-guava.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/ply-dep-guava.png -------------------------------------------------------------------------------- /docs/imgs/ply-dep-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/ply-dep-tree.png -------------------------------------------------------------------------------- /docs/imgs/ply-util-test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/ply-util-test.png -------------------------------------------------------------------------------- /docs/imgs/project-setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/project-setup.png -------------------------------------------------------------------------------- /java-scripts/ply-compiler/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /java-scripts/ply-file-changed/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-filter-file/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-repo-install/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.source=1.6 2 | java.target=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-repo-manager/.ply/config/repositories.properties: -------------------------------------------------------------------------------- 1 | /Users/blangel/.ply_home/repo=ply 2 | -------------------------------------------------------------------------------- /dist/ply/lib/jasypt-1.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/lib/jasypt-1.9.0.jar -------------------------------------------------------------------------------- /dist/ply/lib/ply-jna-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/lib/ply-jna-1.0.jar -------------------------------------------------------------------------------- /dist/ply/lib/ply-util-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/lib/ply-util-1.0.jar -------------------------------------------------------------------------------- /docs/imgs/building-compile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/building-compile.png -------------------------------------------------------------------------------- /docs/imgs/building-install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/building-install.png -------------------------------------------------------------------------------- /docs/imgs/ply-test-failure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/ply-test-failure.png -------------------------------------------------------------------------------- /docs/imgs/ply-test-success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/ply-test-success.png -------------------------------------------------------------------------------- /java-scripts/ply-dependency-copy/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-dependency-manager/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /java-scripts/ply-exec/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | manifest.mainClass=net.ocheyedan.ply.script.ExecScript -------------------------------------------------------------------------------- /java-scripts/ply-print-classpath/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | -------------------------------------------------------------------------------- /ply-util/.ply/config/dependencies.test.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 21 16:14:33 EDT 2011 2 | junit\:junit=4.10 3 | -------------------------------------------------------------------------------- /.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Sat Sep 24 16:53:50 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.Ply 3 | -------------------------------------------------------------------------------- /.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 30 12:14:56 EDT 2011 2 | version=1.0 3 | name=ply 4 | namespace=ply 5 | -------------------------------------------------------------------------------- /ply-jna/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Tue Nov 08 19:06:09 EST 2011 2 | net.java.dev.jna\:jna=3.3.0 3 | -------------------------------------------------------------------------------- /ply-util/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.source=1.6 2 | java.target=1.6 3 | java.warningsLevel=-rawtypes 4 | -------------------------------------------------------------------------------- /dist/ply/lib/ply-jvm-primer-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/lib/ply-jvm-primer-1.0.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-clean-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-clean-1.0.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-exec-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-exec-1.0.jar -------------------------------------------------------------------------------- /java-scripts/ply-repo-manager/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | manifest.mainClass=net.ocheyedan.ply.script.RepoManager -------------------------------------------------------------------------------- /ply-jvm-primer/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | namespace=ply-jvm-primer 2 | name=ply-jvm-primer 3 | version=1.0 4 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-prop-files/mock-invalid-4.properties: -------------------------------------------------------------------------------- 1 | key=value\ 2 | more\ 3 | another_key=value -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-prop-loader-files/loader.properties: -------------------------------------------------------------------------------- 1 | mock_key=mock_value 2 | mock_key_2=mock_value_2 -------------------------------------------------------------------------------- /src/test/resources/update-config/aliases.properties: -------------------------------------------------------------------------------- 1 | update=ply-update-1.0.jar 2 | user.modified=something-else 3 | -------------------------------------------------------------------------------- /dist/ply/config/resources.properties: -------------------------------------------------------------------------------- 1 | # the default exclusions when copying files/dirs for resources 2 | exclude=.svn,CVS -------------------------------------------------------------------------------- /dist/ply/scripts/ply-compiler-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-compiler-1.0.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-intellij-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-intellij-1.0.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-package-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-package-1.0.jar -------------------------------------------------------------------------------- /docs/imgs/ply-tests-class-select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/ply-tests-class-select.png -------------------------------------------------------------------------------- /docs/imgs/ply-tests-multiple-fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/docs/imgs/ply-tests-multiple-fail.png -------------------------------------------------------------------------------- /java-scripts/ply-compiler/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Mon Oct 03 21:23:56 EDT 2011 2 | ply-util\:ply-util=1.0 3 | -------------------------------------------------------------------------------- /java-scripts/ply-compiler/.ply/config/dependencies.test.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 21 17:20:55 EDT 2011 2 | junit\:junit=4.10 3 | -------------------------------------------------------------------------------- /java-scripts/ply-dependency-copy/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | manifest.mainClass=net.ocheyedan.ply.script.DependencyCopy -------------------------------------------------------------------------------- /java-scripts/ply-resources/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 14 14:46:57 EDT 2011 2 | ply-util\:ply-util=1.0 3 | -------------------------------------------------------------------------------- /src/test/resources/dot-ply/config/aliases.properties: -------------------------------------------------------------------------------- 1 | clean=mock-clean.jar 2 | compile=mock-compile.jar 3 | run=clean compile -------------------------------------------------------------------------------- /dist/ply/lib/jackson-core-asl-1.9.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/lib/jackson-core-asl-1.9.9.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-filter-file-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-filter-file-1.0.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-resources-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-resources-1.0.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-test-junit-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-test-junit-1.0.jar -------------------------------------------------------------------------------- /java-scripts/ply-file-changed/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Mon Oct 03 21:35:26 EDT 2011 2 | ply-util\:ply-util=1.0 3 | -------------------------------------------------------------------------------- /java-scripts/ply-filter-file/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Sat Oct 15 10:55:59 EDT 2011 2 | ply-util\:ply-util=1.0 3 | -------------------------------------------------------------------------------- /java-scripts/ply-repo-install/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Mon Oct 03 22:05:02 EDT 2011 2 | ply-util\:ply-util=1.0 3 | -------------------------------------------------------------------------------- /ply-jna/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Tue Nov 08 19:04:38 EST 2011 2 | version=1.0 3 | name=ply-jna 4 | namespace=ply-jna 5 | -------------------------------------------------------------------------------- /dist/ply/lib/jackson-mapper-asl-1.9.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/lib/jackson-mapper-asl-1.9.9.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-file-changed-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-file-changed-1.0.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-repo-install-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-repo-install-1.0.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-repo-manager-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-repo-manager-1.0.jar -------------------------------------------------------------------------------- /java-scripts/ply-print-classpath/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Thu Dec 01 19:46:23 EST 2011 2 | ply-util\:ply-util=1.0 3 | -------------------------------------------------------------------------------- /java-scripts/ply-repo-manager/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | namespace=ply-repo-manager 2 | name=ply-repo-manager 3 | version=1.0 4 | -------------------------------------------------------------------------------- /java-scripts/ply-test-junit/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.source=1.6 2 | java.target=1.6 3 | java.warningsLevel=-rawtypes 4 | -------------------------------------------------------------------------------- /ply-util/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sun Nov 06 09:35:16 EST 2011 2 | version=1.0 3 | name=ply-util 4 | namespace=ply-util 5 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-prop-loader-files/loader.test.properties: -------------------------------------------------------------------------------- 1 | mock_key=mock_value_test 2 | mock_key_2=mock_value_test_2 -------------------------------------------------------------------------------- /src/test/resources/dot-ply/config/project.properties: -------------------------------------------------------------------------------- 1 | name=ply-unit-test 2 | namespace=ply 3 | version=1.0 4 | submodules.scope= 5 | -------------------------------------------------------------------------------- /dist/ply/repo/junit/junit/4.10/junit-4.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/repo/junit/junit/4.10/junit-4.10.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-dependency-copy-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-dependency-copy-1.0.jar -------------------------------------------------------------------------------- /dist/ply/scripts/ply-print-classpath-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-print-classpath-1.0.jar -------------------------------------------------------------------------------- /java-scripts/ply-repo-manager/.ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | java.target=1.6 2 | java.source=1.6 3 | java.warningsLevel=-rawtypes 4 | -------------------------------------------------------------------------------- /dist/ply/config/depmngr.properties: -------------------------------------------------------------------------------- 1 | # the local repository where remote repositories' downloads will be saved. 2 | localRepo=~/.ply_home/repo -------------------------------------------------------------------------------- /dist/ply/scripts/ply-dependency-manager-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/scripts/ply-dependency-manager-1.0.jar -------------------------------------------------------------------------------- /java-scripts/ply-clean/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 07 15:35:13 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.Clean 3 | -------------------------------------------------------------------------------- /java-scripts/ply-dependency-copy/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | namespace=ply-dependency-copy 2 | name=ply-dependency-copy 3 | version=1.0 4 | -------------------------------------------------------------------------------- /java-scripts/ply-exec/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Thu Nov 17 10:14:46 EST 2011 2 | version=1.0 3 | name=ply-exec 4 | namespace=ply-exec 5 | -------------------------------------------------------------------------------- /java-scripts/ply-repo-manager/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | ply-util:ply-util=1.0 2 | org.codehaus.jackson:jackson-mapper-asl=1.9.9 3 | -------------------------------------------------------------------------------- /java-scripts/ply-test-junit/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Thu Oct 13 16:07:25 EDT 2011 2 | ply-util\:ply-util=1.0 3 | junit\:junit=4.10 -------------------------------------------------------------------------------- /ply-jvm-primer/.ply/config/aliases.ply.properties: -------------------------------------------------------------------------------- 1 | ply-install=`cp target/ply-jvm-primer-1.0.jar /home/blangel/projects/ply/dist/ply/lib/` 2 | -------------------------------------------------------------------------------- /java-scripts/ply-clean/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 30 11:57:16 EDT 2011 2 | version=1.0 3 | name=ply-clean 4 | namespace=ply-clean 5 | -------------------------------------------------------------------------------- /java-scripts/ply-intellij/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Sat Dec 03 10:52:12 EST 2011 2 | ply-util\:ply-util=1.0 3 | ply-jna\:ply-jna=1.0 4 | -------------------------------------------------------------------------------- /java-scripts/ply-package/.ply/config/dependencies.properties: -------------------------------------------------------------------------------- 1 | #Tue Nov 08 19:43:52 EST 2011 2 | ply-jna\:ply-jna=1.0 3 | ply-util\:ply-util=1.0 4 | -------------------------------------------------------------------------------- /src/test/resources/update-instr-test-3: -------------------------------------------------------------------------------- 1 | VERSION=1.0_1 2 | # nothing to do 3 | # nothing at all 4 | VERSION=1.0_2 5 | something to do 6 | VERSION=1.0_3 -------------------------------------------------------------------------------- /java-scripts/ply-compiler/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Sat Sep 24 16:55:14 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.CompilerScript 3 | -------------------------------------------------------------------------------- /java-scripts/ply-intellij/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Sat Dec 03 10:53:15 EST 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.IntellijScript 3 | -------------------------------------------------------------------------------- /java-scripts/ply-package/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 30 10:45:52 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.PackageScript 3 | -------------------------------------------------------------------------------- /java-scripts/ply-package/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 30 11:49:25 EDT 2011 2 | version=1.0 3 | name=ply-package 4 | namespace=ply-package 5 | -------------------------------------------------------------------------------- /java-scripts/ply-test-junit/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Thu Oct 13 10:52:50 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.JunitTester 3 | -------------------------------------------------------------------------------- /src/test/resources/dot-ply/config/submodules.properties: -------------------------------------------------------------------------------- 1 | child-3= 2 | child-1= 3 | child-2= 4 | #child-4 will be skipped b/c it does not exist 5 | child-4= -------------------------------------------------------------------------------- /src/test/resources/update-instr-test-2: -------------------------------------------------------------------------------- 1 | VERSION=1.0_1 2 | do something 3 | # ignore 4 | something else 5 | VERSION=1.0_2 6 | next version do something -------------------------------------------------------------------------------- /dist/ply/repo/net.java.dev.jna/jna/3.3.0/jna-3.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/repo/net.java.dev.jna/jna/3.3.0/jna-3.3.0.jar -------------------------------------------------------------------------------- /java-scripts/ply-compiler/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 30 11:59:53 EDT 2011 2 | version=1.0 3 | name=ply-compiler 4 | namespace=ply-compiler 5 | -------------------------------------------------------------------------------- /java-scripts/ply-filter-file/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 16 16:48:34 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.FilterScript 3 | -------------------------------------------------------------------------------- /java-scripts/ply-intellij/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sat Dec 03 10:51:52 EST 2011 2 | version=1.0 3 | name=ply-intellij 4 | namespace=ply-intellij 5 | -------------------------------------------------------------------------------- /java-scripts/ply-resources/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 14 14:47:45 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.ResourcesScript 3 | -------------------------------------------------------------------------------- /java-scripts/ply-resources/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 14 14:39:17 EDT 2011 2 | version=1.0 3 | name=ply-resources 4 | namespace=ply-resources 5 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/org/slf4j/slf4j-jdk14/1.5.11/dependencies.properties: -------------------------------------------------------------------------------- 1 | log4j:log4j=1.2.16:transient 2 | org.slf4j:slf4j-api=1.5.11 3 | -------------------------------------------------------------------------------- /java-scripts/ply-file-changed/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Sat Sep 24 16:55:00 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.FileChangeDetector 3 | -------------------------------------------------------------------------------- /java-scripts/ply-repo-install/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Sat Oct 01 13:27:18 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.RepositoryInstaller 3 | -------------------------------------------------------------------------------- /java-scripts/ply-test-junit/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 12 19:45:10 EDT 2011 2 | version=1.0 3 | name=ply-test-junit 4 | namespace=ply-test-junit 5 | -------------------------------------------------------------------------------- /java-scripts/ply-dependency-manager/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Thu Sep 29 09:42:01 EDT 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.DependencyManager 3 | -------------------------------------------------------------------------------- /java-scripts/ply-file-changed/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 30 12:03:23 EDT 2011 2 | version=1.0 3 | name=ply-file-changed 4 | namespace=ply-file-changed 5 | -------------------------------------------------------------------------------- /java-scripts/ply-filter-file/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sat Oct 15 11:00:35 EDT 2011 2 | version=1.0 3 | name=ply-filter-file 4 | namespace=ply-filter-file 5 | -------------------------------------------------------------------------------- /java-scripts/ply-print-classpath/.ply/config/package.properties: -------------------------------------------------------------------------------- 1 | #Thu Dec 01 19:46:03 EST 2011 2 | manifest.mainClass=net.ocheyedan.ply.script.PrintClasspathScript 3 | -------------------------------------------------------------------------------- /java-scripts/ply-repo-install/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 30 12:05:48 EDT 2011 2 | version=1.0 3 | name=ply-repo-install 4 | namespace=ply-repo-install 5 | -------------------------------------------------------------------------------- /dist/ply/config/scripts-clj.properties: -------------------------------------------------------------------------------- 1 | # location of the 'clojure.jar' file with which to invoke clojure scripts 2 | # i.e., /opt/clojure-1.3.0/clojure-1.3.0.jar 3 | clojure.home= -------------------------------------------------------------------------------- /java-scripts/ply-print-classpath/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Thu Dec 01 19:45:09 EST 2011 2 | version=1.0 3 | name=ply-print-classpath 4 | namespace=ply-print-classpath 5 | -------------------------------------------------------------------------------- /dist/ply/config/deploy.properties: -------------------------------------------------------------------------------- 1 | # override property git to define the directory into which to deploy 2 | git=dne 3 | git.push=true 4 | git.remote.name=origin 5 | git.refspec=master -------------------------------------------------------------------------------- /dist/ply/repo/org.hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlr/ply/master/dist/ply/repo/org.hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar -------------------------------------------------------------------------------- /java-scripts/ply-dependency-manager/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 30 12:01:45 EDT 2011 2 | version=1.0 3 | name=ply-dependency-manager 4 | namespace=ply-dependency-manager 5 | -------------------------------------------------------------------------------- /src/test/resources/child-1/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | name=ply-unit-test-child-1 2 | namespace=ply 3 | version=1.0 4 | artifact.name=${name}-${version}.${packaging} 5 | packaging=jar 6 | submodules.scope= 7 | -------------------------------------------------------------------------------- /src/test/resources/child-2/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | name=ply-unit-test-child-2 2 | namespace=ply 3 | version=1.0 4 | artifact.name=${name}-${version}.${packaging} 5 | packaging=jar 6 | submodules.scope= 7 | -------------------------------------------------------------------------------- /src/test/resources/child-3/.ply/config/project.properties: -------------------------------------------------------------------------------- 1 | name=ply-unit-test-child-3 2 | namespace=ply 3 | version=1.0 4 | artifact.name=${name}-${version}.${packaging} 5 | packaging=jar 6 | submodules.scope= 7 | -------------------------------------------------------------------------------- /.ply/config/aliases.properties: -------------------------------------------------------------------------------- 1 | #Sun Jan 15 19:07:30 EST 2012 2 | clean=`rm -rf ${project.build.dir}` 3 | intellij=dep "dep resolve-classifiers sources,javadoc" test:dep ply-intellij-1.0.jar -Pproject.submodules.scope\=intellij 4 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/logkit/logkit/1.0.1/logkit-1.0.1.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | logkit 4 | logkit 5 | 1.0.1 6 | 7 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/javax/servlet/servlet-api/2.3/servlet-api-2.3.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | javax.servlet 4 | servlet-api 5 | 2.3 6 | -------------------------------------------------------------------------------- /dist/ply/config/scripts-sh.properties: -------------------------------------------------------------------------------- 1 | # The shell to be used for unix commands (i.e., those surrounded by tick marks '`') or those ending in '.sh' 2 | shell=/bin/bash 3 | # The default arguments to be passed to the shell whenever a unix command is run 4 | shell.args=-c 5 | -------------------------------------------------------------------------------- /java-scripts/ply-compiler/src/test/java/net/ocheyedan/ply/script/FormattedDiagnosticListenerTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | /** 4 | * User: blangel 5 | * Date: 10/21/11 6 | * Time: 5:20 PM 7 | */ 8 | public class FormattedDiagnosticListenerTest { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/spy/spymemcached/2.6/spymemcached-2.6.pom: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | spy 5 | spymemcached 6 | 2.6 7 | 8 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | avalon-framework 4 | avalon-framework 5 | 4.1.3 6 | 7 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.0/geronimo-jms_1.1_spec-1.0.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | org.apache.geronimo.specs 4 | geronimo-jms_1.1_spec 5 | 1.0 6 | -------------------------------------------------------------------------------- /dist/ply/config/compiler.test.properties: -------------------------------------------------------------------------------- 1 | # overrides the build.path for the test scope; note ${project.build.dir} will be resolved in the test scope as well 2 | build.path=${project.build.dir}/test-classes 3 | # overrides the class.deps for the test scope; note ${project.build.dir} will be resolved in the test scope as well 4 | class.deps=${project.build.dir}/test-classdeps -------------------------------------------------------------------------------- /java-scripts/ply-package/src/main/java/net/ocheyedan/ply/script/PackagingScript.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 11/5/11 8 | * Time: 1:55 PM 9 | */ 10 | public interface PackagingScript { 11 | 12 | void invoke() throws IOException, InterruptedException; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ply-jna/src/main/java/net/ocheyedan/ply/jna/lib/CUnixLibrary.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.jna.lib; 2 | 3 | import com.sun.jna.Library; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 11/8/11 8 | * Time: 7:29 PM 9 | * 10 | * Facade to native c-library for linux. 11 | */ 12 | public interface CUnixLibrary extends Library { 13 | 14 | int symlink(String targetPath, String linkPath); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java-scripts/ply-intellij/src/main/resources/etc/ply-intellij/templates/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | - openjdk8 5 | - openjdk7 6 | install: 7 | - mkdir -p $PWD/opt 8 | - pushd $PWD/opt 9 | - curl https://s3.amazonaws.com/ply-buildtool/ply.tar | tar xz 10 | - ply/bin/ply update 11 | - popd 12 | env: 13 | - PLY_HOME=$PWD/opt/ply PATH=$PLY_HOME/bin:$PATH 14 | script: 15 | - pushd ply-util 16 | - ply install 17 | - popd 18 | - ply test 19 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/log4j/log4j/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | log4j 4 | log4j 5 | 6 | 1.2.16 7 | 1.2.16 8 | 9 | 1.2.16 10 | 11 | 20110108142414 12 | 13 | 14 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/dep/ConflictingVersionVisitor.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.dep; 2 | 3 | import net.ocheyedan.ply.graph.Graph; 4 | import net.ocheyedan.ply.graph.Vertex; 5 | 6 | /** 7 | * User: blangel 8 | * Date: 3/20/16 9 | * Time: 12:31 PM 10 | */ 11 | public interface ConflictingVersionVisitor { 12 | 13 | void visit(Dep diffVersionDep, Dep resolvedDep, Vertex parentVertex, 14 | DependencyAtom dependencyAtom, Graph graph); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-prop-files/mock-1.properties: -------------------------------------------------------------------------------- 1 | # comments for key_1 2 | key_1=value 3 | # comments for key_2 4 | # which go onto another line 5 | key_2=value_2 6 | key_3=value_\ 7 | 3:with:colon 8 | # comments for key_4 9 | # again on another line and note the escaped key 10 | key_4\:with\:colon=value_\ 11 | 5\ 12 | _and_\ 13 | 6 14 | 15 | # notice the blank space between, both before and after this comment 16 | 17 | key_7=more and more and more 18 | 19 | key_8=something with an equals character=another 20 | -------------------------------------------------------------------------------- /.ply/config/submodules.intellij.properties: -------------------------------------------------------------------------------- 1 | ply-util= 2 | ply-jna= 3 | ply-jvm-primer= 4 | java-scripts/ply-clean= 5 | java-scripts/ply-compiler= 6 | java-scripts/ply-dependency-manager= 7 | java-scripts/ply-file-changed= 8 | java-scripts/ply-resources= 9 | java-scripts/ply-filter-file= 10 | java-scripts/ply-package= 11 | java-scripts/ply-repo-install= 12 | java-scripts/ply-test-junit= 13 | java-scripts/ply-print-classpath= 14 | java-scripts/ply-exec= 15 | java-scripts/ply-intellij= 16 | java-scripts/ply-jetty=exclude 17 | java-scripts/ply-repo-manager= 18 | java-scripts/ply-dependency-copy= 19 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/javax/mail/mail/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | javax.mail 4 | mail 5 | 6 | 1.4.4 7 | 1.4.4 8 | 9 | 1.4.2 10 | 1.4.3-rc1 11 | 1.4.3 12 | 1.4.4-rc1 13 | 1.4.4 14 | 15 | 20110815192738 16 | 17 | 18 | -------------------------------------------------------------------------------- /ply-util/src/test/java/net/ocheyedan/ply/BitUtilTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | import org.junit.Test; 4 | 5 | import static junit.framework.Assert.assertEquals; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 10/13/11 10 | * Time: 8:50 PM 11 | */ 12 | public class BitUtilTest { 13 | 14 | @Test 15 | public void toHexString() { 16 | assertEquals("", BitUtil.toHexString(null)); 17 | 18 | assertEquals("00", BitUtil.toHexString(new byte[] { 0 })); 19 | 20 | assertEquals("FFFFFFFF", BitUtil.toHexString(new byte[] { (byte) 0xff, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF })); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/config/Prepend.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd.config; 2 | 3 | import net.ocheyedan.ply.cmd.Args; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 1/1/12 8 | * Time: 4:04 PM 9 | * 10 | * A {@link net.ocheyedan.ply.cmd.Command} to prepend a value to a property value within the project's configuration. 11 | */ 12 | public final class Prepend extends Append { 13 | 14 | public Prepend(Args args) { 15 | super(args); 16 | } 17 | 18 | protected String getFromExisting(String existing, String addition) { 19 | return addition + (existing.isEmpty() ? existing : " " + existing); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/commons-logging/commons-logging/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | commons-logging 3 | commons-logging 4 | 1.1.1 5 | 6 | 1.1.1 7 | 8 | 1.0 9 | 1.0.1 10 | 1.0.2 11 | 1.0.3 12 | 1.0.4 13 | 1.1 14 | 1.1.1 15 | 16 | 20071128191817 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/ShutdownHandler.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | /** 4 | * User: blangel 5 | * Date: 3/20/15 6 | * Time: 12:55 PM 7 | */ 8 | public class ShutdownHandler extends Thread { 9 | 10 | public ShutdownHandler() { 11 | super(new Runnable() { 12 | @Override public void run() { 13 | // ensure project.ply.invocation.dir is removed after invocation 14 | try { 15 | PlyUtil.cleanupInvocationProperties(); 16 | } catch (SystemExit se) { 17 | // ignore; shutting down anyway 18 | } 19 | } 20 | }); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /dist/ply/config/ply.properties: -------------------------------------------------------------------------------- 1 | #Fri Sep 09 21:10:32 EDT 2011 2 | # There are three log levels; error, warn, info. Level error cannot be disabled. 3 | # The others can by exclusion from the 'log.levels' property below. 4 | log.levels=warn 5 | # True to allow output to be colored 6 | color=true 7 | # True to allow for output to include unicode characters 8 | unicode=true 9 | # True to disallow all prompts 10 | headless=false 11 | # False to disable all ply generated output and any decoration applied to scripts' output (i.e., name prefix). 12 | decorated=true 13 | # The url from which to download 'update-instr' for updating ply 14 | update.url=https://raw.github.com/blangel/ply/master/dist/ply/update-instr 15 | -------------------------------------------------------------------------------- /java-scripts/ply-test-junit/src/main/java/net/ocheyedan/ply/script/print/PrivilegedOutput.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script.print; 2 | 3 | import net.ocheyedan.ply.Output; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 10/29/11 8 | * Time: 2:50 PM 9 | * 10 | * Prefixes all print statements with {@link PrivilegedPrintStream#PRIVILEGED_PREFIX} 11 | */ 12 | public final class PrivilegedOutput { 13 | 14 | public static void print(String message, Object ... args) { 15 | Output.print(PrivilegedPrintStream.PRIVILEGED_PREFIX + message, args); 16 | } 17 | 18 | public static void print(Throwable t) { 19 | print("^error^ Message: ^i^^red^%s^r^", (t == null ? "" : t.getMessage())); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/config/Config.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd.config; 2 | 3 | import net.ocheyedan.ply.OutputExt; 4 | import net.ocheyedan.ply.cmd.Args; 5 | import net.ocheyedan.ply.cmd.Command; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 2/10/12 10 | * Time: 6:23 PM 11 | * 12 | * Abstract representation of all config {@link net.ocheyedan.ply.cmd.Command} implementations. 13 | */ 14 | abstract class Config extends Command.ProjectReliant { 15 | 16 | protected Config(Args args) { 17 | super(args); 18 | } 19 | 20 | @Override protected void runBeforeAssumptionsCheck() { 21 | OutputExt.init(); // dis-regard ad-hoc props and defined properties, simply setup for config 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/OutputExt.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | /** 4 | * User: blangel 5 | * Date: 1/13/12 6 | * Time: 4:54 PM 7 | * 8 | * Provides access to package-protected methods from {@link Output}. 9 | */ 10 | public class OutputExt { 11 | 12 | public static void printFromExec(String message, Object ... args) { 13 | Output.printFromExec(message, args); 14 | } 15 | 16 | public static String resolve(String message, Object[] args) { 17 | return Output.resolve(message, args); 18 | } 19 | 20 | public static void init() { 21 | Output.init(); 22 | } 23 | 24 | public static void init(String coloredOutput, String decorated, String logLevels) { 25 | Output.init(coloredOutput, decorated, logLevels, true); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/BitUtil.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | /** 4 | * User: blangel 5 | * Date: 10/3/11 6 | * Time: 9:40 PM 7 | * 8 | * Utility class to deal with bits and bytes within the java language. 9 | */ 10 | public final class BitUtil { 11 | 12 | public static String toHexString(byte[] array) { 13 | if (array == null) { 14 | return ""; 15 | } 16 | StringBuilder sb = new StringBuilder(array.length * 2); 17 | for (byte byt : array) { 18 | int v = byt & 0xff; 19 | if (v < 16) { 20 | sb.append('0'); 21 | } 22 | sb.append(Integer.toHexString(v)); 23 | } 24 | return sb.toString().toUpperCase(); 25 | } 26 | 27 | private BitUtil() { } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /java-scripts/ply-repo-manager/src/main/java/net/ocheyedan/ply/script/github/App.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script.github; 2 | 3 | /** 4 | * User: blangel 5 | * Date: 1/10/13 6 | * Time: 10:01 AM 7 | * 8 | * The {@literal app} field from calling {@literal https://api.github.com/authorizations} 9 | * { 10 | * "url": "http://dillinger.io", 11 | * "name": "Dillinger" 12 | * } 13 | */ 14 | public class App { 15 | 16 | private final String url; 17 | 18 | private final String name; 19 | 20 | private App() { 21 | this(null, null); 22 | } 23 | 24 | public App(String url, String name) { 25 | this.url = url; 26 | this.name = name; 27 | } 28 | 29 | public String getUrl() { 30 | return url; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dist/ply/config/project.test.properties: -------------------------------------------------------------------------------- 1 | # the directory in which test source files are stored. used for test compilation. 2 | # the default follows the convention of maven 3 | src.dir=src/${artifacts.label}/java 4 | # the directory in which test resource files are stored. used for test compilation and packaging. 5 | # the default follows the convention of maven 6 | res.dir=src/${artifacts.label}/resources 7 | # the directory into which resources are copied (primed for filtering/packaging/etc) 8 | res.build.dir=${build.dir}/${artifacts.label}-resources 9 | # the artifact name of the project. 10 | artifact.name=${name}-${version}-${artifacts.label}.${packaging} 11 | # artifact files (like dependencies and checksum) when saved into repositories should be labeled as 'test' 12 | artifacts.label=test 13 | # depend upon non-scoped self dependency 14 | depend.upon.self=true -------------------------------------------------------------------------------- /ply-jna/src/main/java/net/ocheyedan/ply/jna/JnaAccessor.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.jna; 2 | 3 | import com.sun.jna.Native; 4 | import net.ocheyedan.ply.jna.lib.CUnixLibrary; 5 | 6 | /** 7 | * User: blangel 8 | * Date: 11/8/11 9 | * Time: 7:36 PM 10 | * 11 | * Provides access to the {@literal net.ocheyedan.ply.jna.lib} interfaces. 12 | */ 13 | public final class JnaAccessor { 14 | 15 | private static final CUnixLibrary cUnixLibrary; 16 | 17 | static { 18 | if (JnaUtil.isJnaPresent() && JnaUtil.getOperatingSystem().isUnix()) { 19 | cUnixLibrary = (CUnixLibrary) Native.loadLibrary("c", CUnixLibrary.class); 20 | } else { 21 | cUnixLibrary = null; 22 | } 23 | } 24 | 25 | public static CUnixLibrary getCUnixLibrary() { 26 | return cUnixLibrary; 27 | } 28 | 29 | private JnaAccessor() { } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /dist/ply/config/package.properties: -------------------------------------------------------------------------------- 1 | # the base name of the package (excluding the packaging; i.e. '.zip') 2 | name=${project.artifact.name} 3 | # true to print verbose output while creating the package file 4 | verbose=false 5 | # true to compress the packaged file 6 | compress=true 7 | # true to include the resolved dependencies, if any, within the package file itself 8 | includeDeps=false 9 | # true to include the source files within a package file itself 10 | includeSrc=false 11 | # the standard manifest entries 12 | manifest.version=1.0 13 | manfiest.createdBy=Ply 14 | manifest.spec.title=${project.name} 15 | manifest.spec.version=${project.version} 16 | manifest.impl.title=${project.name} 17 | manifest.impl.version=${project.version} 18 | # the webapp directory (only applicable for war packaging) 19 | webapp.dir=src/main/webapp 20 | exploded.war.dir=${project.build.dir}/${project.artifact.name} -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/Ply.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | import net.ocheyedan.ply.cmd.Command; 4 | import net.ocheyedan.ply.cmd.CommandLineParser; 5 | import net.ocheyedan.ply.props.AdHoc; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 9/2/11 10 | * Time: 11:03 AM 11 | * 12 | * The main entry-point, invoked via a {@literal Unix} style command line. 13 | */ 14 | public final class Ply { 15 | 16 | public static void main(String[] args) { 17 | 18 | try { 19 | SystemExit.ply = true; 20 | Runtime.getRuntime().addShutdownHook(new ShutdownHandler()); 21 | Command command = CommandLineParser.parse(args); 22 | AdHoc.add(command.args.adHocProps); 23 | command.run(); 24 | } catch (SystemExit se) { 25 | Output.init(); // ensure the queue-ed messages have been printed 26 | System.exit(se.exitCode); 27 | } 28 | 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/Args.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 12/28/11 8 | * Time: 4:39 PM 9 | * 10 | * Represents the command line arguments passed to ply. 11 | */ 12 | public final class Args { 13 | 14 | public final List args; 15 | 16 | public final List adHocProps; 17 | 18 | public Args(List args, List adHocProps) { 19 | this.args = args; 20 | this.adHocProps = adHocProps; 21 | } 22 | 23 | @Override public String toString() { 24 | StringBuilder buffer = new StringBuilder(); 25 | for (String arg : args) { 26 | buffer.append(arg); buffer.append(' '); 27 | } 28 | for (String adHocProp : adHocProps) { 29 | buffer.append("-P"); buffer.append(adHocProp); buffer.append(' '); 30 | } 31 | return buffer.toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dist/ply/config/aliases.properties: -------------------------------------------------------------------------------- 1 | clean=ply-clean-1.0.jar 2 | # normal lifecycle 3 | file-changed=ply-file-changed-1.0.jar 4 | dep=ply-dependency-manager-1.0.jar 5 | resolve=ply-resources-1.0.jar ply-filter-file-1.0.jar 6 | compile=dep file-changed ply-compiler-1.0.jar 7 | package=resolve ply-package-1.0.jar 8 | local-repo-install=ply-repo-install-1.0.jar 9 | install=compile package local-repo-install 10 | # test lifecycle 11 | test=install test:install test:ply-test-junit-1.0.jar 12 | # supplemental aliases 13 | exec=compile package ply-exec-1.0.jar 14 | repo=ply-repo-manager-1.0.jar 15 | deploy=ply-repo-deploy-1.0.sh 16 | dep-copy=dep ply-dependency-copy-1.0.jar 17 | install-file=ply-repo-install-1.0.jar 18 | # print project's classpath (can be used to inline classpath; i.e., 'java -cp `ply classpath` my.package.MainClass' 19 | classpath=ply-print-classpath-1.0.jar -Pply.decorated\=false 20 | # creates intellij configuration files (.ipr/.iml/.iws) for a project 21 | intellij=dep "dep resolve-classifiers sources,javadoc" test:dep ply-intellij-1.0.jar 22 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/submodules/Submodule.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.submodules; 2 | 3 | /** 4 | * User: blangel 5 | * Date: 10/27/11 6 | * Time: 3:58 PM 7 | */ 8 | public final class Submodule { 9 | 10 | public final String name; 11 | 12 | public final String dependencyName; 13 | 14 | public Submodule(String name, String dependencyName) { 15 | this.name = name; 16 | this.dependencyName = dependencyName; 17 | } 18 | 19 | @Override public String toString() { 20 | return name; 21 | } 22 | 23 | @Override public boolean equals(Object o) { 24 | if (this == o) { 25 | return true; 26 | } 27 | if (o == null || getClass() != o.getClass()) { 28 | return false; 29 | } 30 | 31 | Submodule submodule = (Submodule) o; 32 | 33 | return (name == null ? submodule.name == null : name.equals(submodule.name)); 34 | } 35 | 36 | @Override public int hashCode() { 37 | return name != null ? name.hashCode() : 0; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/org/apache/httpcomponents/httpclient/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.apache.httpcomponents 4 | httpclient 5 | 6 | 4.2-alpha1 7 | 4.2-alpha1 8 | 9 | 4.0-alpha1 10 | 4.0-alpha2 11 | 4.0-alpha3 12 | 4.0-alpha4 13 | 4.0-beta1 14 | 4.0-beta2 15 | 4.0 16 | 4.0.1 17 | 4.0.2 18 | 4.0.3 19 | 4.1-alpha1 20 | 4.1-alpha2 21 | 4.1-beta1 22 | 4.1 23 | 4.1.1 24 | 4.1.2 25 | 4.2-alpha1 26 | 27 | 20111102201531 28 | 29 | 30 | -------------------------------------------------------------------------------- /java-scripts/ply-test-junit/src/main/java/net/ocheyedan/ply/script/UnionFilter.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import org.junit.runner.Description; 4 | import org.junit.runner.manipulation.Filter; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * User: blangel 11 | * Date: 10/13/11 12 | * Time: 9:43 PM 13 | */ 14 | public class UnionFilter extends Filter { 15 | 16 | private final List filters = new ArrayList(); 17 | 18 | public void union(Filter filter) { 19 | filters.add(filter); 20 | } 21 | 22 | @Override public boolean shouldRun(Description description) { 23 | for (Filter filter : filters) { 24 | if (filter.shouldRun(description)) { 25 | return true; 26 | } 27 | } 28 | return false; 29 | } 30 | 31 | @Override public String describe() { 32 | return "union filter"; 33 | } 34 | 35 | @Override public Filter intersect(Filter second) { 36 | throw new UnsupportedOperationException("This is a union filter"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/net/ocheyedan/ply/submodules/SubmodulesTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.submodules; 2 | 3 | import org.junit.Test; 4 | 5 | import java.io.File; 6 | import java.util.List; 7 | 8 | import static junit.framework.Assert.assertEquals; 9 | 10 | /** 11 | * User: blangel 12 | * Date: 1/30/12 13 | * Time: 9:43 PM 14 | */ 15 | public class SubmodulesTest { 16 | 17 | @Test 18 | public void getSubmodules() { 19 | File configDir = new File("./src/test/resources/dot-ply/config"); 20 | List submodules = Submodules.getSubmodules(configDir); 21 | assertEquals(3, submodules.size()); 22 | assertEquals("child-1", submodules.get(0).name); 23 | assertEquals("ply:ply-unit-test-child-1:1.0", submodules.get(0).dependencyName); 24 | assertEquals("child-2", submodules.get(1).name); 25 | assertEquals("ply:ply-unit-test-child-2:1.0", submodules.get(1).dependencyName); 26 | assertEquals("child-3", submodules.get(2).name); 27 | assertEquals("ply:ply-unit-test-child-3:1.0", submodules.get(2).dependencyName); 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /docs/Submodules.md: -------------------------------------------------------------------------------- 1 | Submodules 2 | ---------- 3 | Ply has a concept of submodules which (like __maven__'s aggregators) is simply a convenient way to allow one sequence of script invocations to be progagated to other subprojects during the same execution. Submodules are configured by placing the subproject directory name in a property file with context `submodules`. For instance if you had a project named _mypoject_ which has a sub-directory named _mysubproject_ which was also a ply project one could add 4 | _mysubproject_ as a submodule to _myproject_ by invoking the following from within the _myproject_ directory: 5 | 6 | $ ply set mysubproject= in submodules 7 | 8 | Then all ply scripts run for _mypoject_ are also run for _mysubproject_; e.g. 9 | 10 | $ ply clean install 11 | 12 | Run from _myproject_ will also run `clean install` on _mysubproject_. 13 | 14 | One specifies a project as a submodule by using its directory name (which means that submodules need to be subdirectories of a project). Also, when adding a submodule to the `submodules.properties` file the property value is ignored and so can be anything; convention dictates that it is "". 15 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/dep/visitors/DependencyFieldVisitor.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.dep.visitors; 2 | 3 | import org.objectweb.asm.*; 4 | 5 | import java.util.Set; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 8/18/14 10 | * Time: 3:48 PM 11 | */ 12 | class DependencyFieldVisitor extends FieldVisitor { 13 | 14 | private final Dependencies dependencies; 15 | 16 | private final AnnotationVisitor annotationVisitor; 17 | 18 | DependencyFieldVisitor(Dependencies dependencies, AnnotationVisitor annotationVisitor) { 19 | super(Opcodes.ASM5); 20 | this.dependencies = dependencies; 21 | this.annotationVisitor = annotationVisitor; 22 | } 23 | 24 | @Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { 25 | DependencyVisitors.addDescription(desc, dependencies); 26 | return annotationVisitor; 27 | } 28 | 29 | @Override public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { 30 | DependencyVisitors.addDescription(desc, dependencies); 31 | return annotationVisitor; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /java-scripts/ply-clean/src/main/java/net/ocheyedan/ply/script/Clean.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import java.io.File; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 9/9/11 8 | * Time: 8:57 PM 9 | * 10 | * Removes the {@literal ply.build.dir} directory. 11 | */ 12 | public class Clean { 13 | 14 | public static void main(String[] args) { 15 | Clean clean = new Clean(System.getenv("ply_project.build.dir")); 16 | clean.invoke(); 17 | } 18 | 19 | private final String buildDirPath; 20 | 21 | private Clean(String buildDirPath) { 22 | this.buildDirPath = buildDirPath; 23 | } 24 | 25 | private void invoke() { 26 | File buildDir = new File(buildDirPath); 27 | if (buildDir.exists()) { 28 | delete(buildDir); 29 | } 30 | } 31 | 32 | private void delete(File file) { 33 | if (file.isDirectory()) { 34 | for (File subFile : file.listFiles()) { 35 | delete(subFile); 36 | } 37 | } 38 | if (!file.delete()) { 39 | System.out.println(String.format("^error^ could not delete file ^b^%s^r^", file.getPath())); 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /docs/Logging.md: -------------------------------------------------------------------------------- 1 | Changing Log Levels 2 | ------------------- 3 | 4 | The logging output in _ply_ is segregated into four levels; `error`, `warn`, `info`, `debug`. By default _ply_ prints only `error` and `warn` levels. You can change this for your project by: 5 | 6 | $ ply set log.levels=X in ply 7 | 8 | where `X` is the log levels desired. For instance, to change your log levels to all: 9 | 10 | $ ply set log.levels=warn,info,debug in ply 11 | 12 | Note, you cannot supress `error` logs, which is why the above example didn't explicitly need to set `error`. 13 | 14 | To simply append to the existing log levels: 15 | 16 | $ ply append info to log.levels in ply 17 | 18 | Which, given the default log levels of `error` and `warn`, will add `info`. 19 | 20 | Log levels can also be changed just for a single execution using the ad-hoc properties of _ply_. Ad-hoc properties are those specified on the command line with the `-P` directive. For instance to have `error`, `warn` and `info` information printed while running `test`: 21 | 22 | $ ply test -Pply.log.levels=warn,info 23 | 24 | Since we used the ad-hoc directive, the next execution will revert to the existing log levels of just `error` and `warn`. -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/javax/activation/activation/1.1/activation-1.1.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | javax.activation 4 | activation 5 | 1.1 6 | JavaBeans Activation Framework (JAF) 7 | 8 | JavaBeans Activation Framework (JAF) is a standard extension to the Java platform that lets you take advantage of standard services to: determine the type of an arbitrary piece of data; encapsulate access to it; discover the operations available on it; and instantiate the appropriate bean to perform the operation(s). 9 | 10 | http://java.sun.com/products/javabeans/jaf/index.jsp 11 | 12 | 13 | 14 | Common Development and Distribution License (CDDL) v1.0 15 | https://glassfish.dev.java.net/public/CDDLv1.0.html 16 | repo 17 | 18 | 19 | 20 | 21 | https://maven-repository.dev.java.net/nonav/repository/javax.activation/jars/activation-1.1.jar 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.ipr 3 | *.iws 4 | target/ 5 | *~ 6 | pom.xml 7 | .ply/config/depmngr.properties 8 | ply-util/.ply/config/depmngr.properties 9 | ply-jna/.ply/config/depmngr.properties 10 | java-scripts/ply-clean/.ply/config/depmngr.properties 11 | java-scripts/ply-compiler/.ply/config/depmngr.properties 12 | java-scripts/ply-dependency-manager/.ply/config/depmngr.properties 13 | java-scripts/ply-exec/.ply/config/depmngr.properties 14 | java-scripts/ply-file-changed/.ply/config/depmngr.properties 15 | java-scripts/ply-filter-file/.ply/config/depmngr.properties 16 | java-scripts/ply-intellij/.ply/config/depmngr.properties 17 | java-scripts/ply-package/.ply/config/depmngr.properties 18 | java-scripts/ply-print-classpath/.ply/config/depmngr.properties 19 | java-scripts/ply-repo-install/.ply/config/depmngr.properties 20 | java-scripts/ply-resources/.ply/config/depmngr.properties 21 | java-scripts/ply-test-junit/.ply/config/depmngr.properties 22 | java-scripts/ply-update/.ply/config/depmngr.properties 23 | dist/ply/config/aliases.ply.properties 24 | .ply/config/aliases.ply.properties 25 | ply-util/.ply/config/aliases.ply.properties 26 | ply-jna/.ply/config/aliases.ply.properties 27 | dist/ply/config/depmngr.properties 28 | dist/ply/config/intellij.properties -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/org/codehaus/jackson/jackson-core-asl/1.9.2/jackson-core-asl-1.9.2.pom: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 4.0.0 7 | org.codehaus.jackson 8 | jackson-core-asl 9 | jar 10 | Jackson 11 | 1.9.2 12 | Jackson is a high-performance JSON processor (parser, generator) 13 | 14 | 15 | 16 | 17 | http://jackson.codehaus.org 18 | 19 | http://jira.codehaus.org/browse/JACKSON 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | The Apache Software License, Version 2.0 32 | http://www.apache.org/licenses/LICENSE-2.0.txt 33 | repo 34 | 35 | 36 | 37 | 38 | FasterXML 39 | http://fasterxml.com 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/dep/visitors/DependencyAnnotationVisitor.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.dep.visitors; 2 | 3 | import org.objectweb.asm.AnnotationVisitor; 4 | import org.objectweb.asm.Opcodes; 5 | import org.objectweb.asm.Type; 6 | 7 | import java.util.Set; 8 | 9 | /** 10 | * User: blangel 11 | * Date: 8/18/14 12 | * Time: 3:46 PM 13 | */ 14 | class DependencyAnnotationVisitor extends AnnotationVisitor { 15 | 16 | private final Dependencies dependencies; 17 | 18 | DependencyAnnotationVisitor(Dependencies dependencies) { 19 | super(Opcodes.ASM5); 20 | this.dependencies = dependencies; 21 | } 22 | 23 | @Override public void visit(String name, Object value) { 24 | if (value instanceof Type) { 25 | DependencyVisitors.addType((Type) value, dependencies); 26 | } 27 | } 28 | 29 | @Override public void visitEnum(String name, String desc, String value) { 30 | DependencyVisitors.addDescription(desc, dependencies); 31 | } 32 | 33 | @Override public AnnotationVisitor visitAnnotation(String name, String desc) { 34 | DependencyVisitors.addDescription(desc, dependencies); 35 | return this; 36 | } 37 | 38 | @Override public AnnotationVisitor visitArray(String name) { 39 | return this; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/config/GetAll.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd.config; 2 | 3 | import net.ocheyedan.ply.Output; 4 | import net.ocheyedan.ply.cmd.Args; 5 | import net.ocheyedan.ply.props.PropFile; 6 | import net.ocheyedan.ply.props.Scope; 7 | 8 | import static net.ocheyedan.ply.props.PropFile.Prop; 9 | 10 | /** 11 | * User: blangel 12 | * Date: 12/30/11 13 | * Time: 2:53 PM 14 | * 15 | * An extension to {@link Get} which prints all properties including system defaults. 16 | */ 17 | public class GetAll extends Get { 18 | 19 | public GetAll(Args args) { 20 | super(args); 21 | } 22 | 23 | @Override protected boolean accept(Prop prop) { 24 | return true; 25 | } 26 | 27 | @Override protected String getSuffix(Prop prop, Scope scope) { 28 | String superSuffix = super.getSuffix(prop, scope); 29 | if (prop.loc() == PropFile.Loc.System) { 30 | return superSuffix + " ^green^*^r^"; 31 | } 32 | return superSuffix; 33 | } 34 | 35 | @Override protected String getNothingMessageSuffix() { 36 | return ""; 37 | } 38 | 39 | @Override protected void printAppendix(Scope scope, Result result) { 40 | super.printAppendix(scope, result); 41 | Output.print("^green^*^r^ indicates system-wide property."); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/SystemExit.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | /** 4 | * User: blangel 5 | * Date: 1/16/12 6 | * Time: 9:56 AM 7 | * 8 | * Throw this exception to cause ply or the running script to exit. Ply will catch this exception, run any shutdown 9 | * code and then call {@link System#exit(int)} with the provided {@link #exitCode}. 10 | */ 11 | @SuppressWarnings("serial") 12 | public final class SystemExit extends RuntimeException { 13 | 14 | /** 15 | * Set internally by ply itself so that calls to {@link #exit(int)} throw an exception. 16 | */ 17 | static volatile boolean ply = false; 18 | 19 | /** 20 | * If {@link #ply} then throw an {@link SystemExit} exception, otherwise, call {@link System#exit(int)} 21 | * with {@code exitCode} 22 | * @param exitCode to use when exiting. 23 | */ 24 | public static void exit(int exitCode) { 25 | if (ply) { 26 | throw new SystemExit(exitCode); 27 | } else { 28 | System.exit(exitCode); 29 | } 30 | } 31 | 32 | public final int exitCode; 33 | 34 | public SystemExit(int exitCode) { 35 | this.exitCode = exitCode; 36 | } 37 | 38 | public SystemExit(int exitCode, Throwable cause) { 39 | super(cause); 40 | this.exitCode = exitCode; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/input/Resource.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.input; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | 6 | /** 7 | * User: blangel 8 | * Date: 11/13/11 9 | * Time: 9:50 AM 10 | * 11 | * Represents a consistent way of dealing with {@link InputStream} objects whether they originate from the file system, 12 | * classpath or over remote protocols like {@literal http}. 13 | */ 14 | public interface Resource { 15 | 16 | /** 17 | * Represents information known about a resource. Certain types of resources may not be able to determine 18 | * their existence until their stream is opened, in which case their {@link Ontology} would be {@link Ontology#Unknown} 19 | */ 20 | static enum Ontology { 21 | Unknown, Exists, DoesNotExist 22 | } 23 | 24 | /** 25 | * @return a name for this resource 26 | */ 27 | String name(); 28 | 29 | /** 30 | * @return the actual open resource. 31 | * @throws IOException if opening the stream results in an exception 32 | */ 33 | InputStream open() throws IOException; 34 | 35 | /** 36 | * @return the {@link Ontology} of the {@link Resource} 37 | */ 38 | Ontology getOntology(); 39 | 40 | /** 41 | * Close the open opened by calling {@link #open()} 42 | */ 43 | void close(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/Version.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd; 2 | 3 | import net.ocheyedan.ply.Output; 4 | import net.ocheyedan.ply.OutputExt; 5 | import net.ocheyedan.ply.PlyUtil; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 1/19/12 10 | * Time: 6:05 PM 11 | * 12 | * Prints version information. 13 | */ 14 | public class Version extends Command { 15 | 16 | public Version(Args args) { 17 | super(args); 18 | } 19 | 20 | @Override public void run() { 21 | OutputExt.init(); // dis-regard ad-hoc props and defined properties, simply init 22 | Output.print("^ply^ ^b^ply^r^ version ^b^%s^r^", PlyUtil.PLY_VERSION); 23 | Output.print("^ply^ installed at ^b^%s^r^", PlyUtil.INSTALL_DIRECTORY); 24 | Output.print("^ply^ with java version ^b^%s^r^ from vendor ^b^%s^r^", System.getProperty("java.version"), 25 | System.getProperty("java.vendor")); 26 | Output.print("^ply^ installed at ^b^%s^r^", System.getProperty("java.home")); 27 | Output.print("^ply^ and operating-system ^b^%s^r^ version ^b^%s^r^ arch ^b^%s^r^", System.getProperty("os.name"), 28 | System.getProperty("os.version"), 29 | System.getProperty("os.arch")); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/input/Resources.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.input; 2 | 3 | import java.net.MalformedURLException; 4 | import java.util.Map; 5 | import java.util.concurrent.atomic.AtomicReference; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 11/13/11 10 | * Time: 9:56 AM 11 | * 12 | * Utility in dealing with {@link Resource} objects. 13 | */ 14 | public final class Resources { 15 | 16 | private static final AtomicReference LOADER = new AtomicReference(Resources.class.getClassLoader()); 17 | 18 | public static void setResourcesLoader(ClassLoader classLoader) { 19 | LOADER.set(classLoader); 20 | } 21 | 22 | public static Resource parse(String resource, Map headers) { 23 | 24 | if (resource == null) { 25 | return null; 26 | } else if (resource.startsWith("http:") || resource.startsWith("https:")) { 27 | try { 28 | return new UrlResource(resource, headers); 29 | } catch (MalformedURLException murle) { 30 | throw new RuntimeException(murle); 31 | } 32 | } else if (resource.startsWith("classpath:")) { 33 | return new ClasspathResource(resource.substring(10), LOADER.get()); 34 | } else { 35 | return new FileResource(resource); 36 | } 37 | 38 | } 39 | 40 | private Resources() { } 41 | } 42 | -------------------------------------------------------------------------------- /java-scripts/ply-intellij/src/main/java/net/ocheyedan/ply/script/WorkspaceUtil.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | import net.ocheyedan.ply.input.ClasspathResource; 5 | import net.ocheyedan.ply.input.FileResource; 6 | import net.ocheyedan.ply.props.Context; 7 | import net.ocheyedan.ply.props.Props; 8 | import org.w3c.dom.Document; 9 | 10 | import java.io.File; 11 | 12 | /** 13 | * User: blangel 14 | * Date: 12/3/11 15 | * Time: 2:24 PM 16 | * 17 | * Updates/creates the {@literal .iws} file for the project with the project's relevant configuration information. 18 | */ 19 | public class WorkspaceUtil { 20 | 21 | public static void updateWorkspace(File projectDir) { 22 | 23 | String projectName = Props.get("name", Context.named("project")).value(); 24 | String iwsFileName = projectName + ".iws"; 25 | File iwsFile = FileUtil.fromParts(projectDir.getPath(), iwsFileName); 26 | Document iwsDocument = IntellijUtil.readXmlDocument(new FileResource(iwsFile.getPath()), 27 | new ClasspathResource("etc/ply-intellij/templates/workspace.xml", 28 | WorkspaceUtil.class.getClassLoader())); 29 | // nothing to do for ply 30 | 31 | IntellijUtil.writeXmlDocument(iwsFile, iwsDocument); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/AntStyleWildcardUtil.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | import java.util.regex.Pattern; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 10/16/11 8 | * Time: 2:08 PM 9 | * 10 | * Provides methods to convert {@literal Ant} style wildcard expressions into {@literal regex} strings. 11 | */ 12 | public final class AntStyleWildcardUtil { 13 | 14 | /** 15 | * Converts {@code antStyleWildcard} into a {@literal regex} string. Note, ant-style wildcards are assumed 16 | * to be package separated by the '/' character. 17 | * @param antStyleWildcard to convert 18 | * @return the converted {@literal regex} representation of {@code antStyleWildcard} 19 | */ 20 | public static String regexString(String antStyleWildcard) { 21 | String regex = antStyleWildcard; // Pattern.quote? 22 | // replace all '?' with a single character match 23 | regex = regex.replaceAll("\\?", ".{1}"); 24 | // replace all '**' with a match for any package 25 | regex = regex.replaceAll("\\*\\*", ".+?"); 26 | // replace all remaining '*' with a match for any character not package separator 27 | return regex.replaceAll("\\*", "[^/]*?"); 28 | } 29 | 30 | public static Pattern regex(String anyStyleWildcard) { 31 | return Pattern.compile(regexString(anyStyleWildcard)); 32 | } 33 | 34 | private AntStyleWildcardUtil() { } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ply-util/src/test/java/net/ocheyedan/ply/dep/ReposTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.dep; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | import net.ocheyedan.ply.props.Scope; 5 | import org.junit.Test; 6 | 7 | import java.io.File; 8 | import java.lang.reflect.Method; 9 | 10 | import static junit.framework.Assert.assertEquals; 11 | import static junit.framework.Assert.assertNull; 12 | 13 | /** 14 | * User: blangel 15 | * Date: 6/29/16 16 | * Time: 10:12 PM 17 | */ 18 | public class ReposTest { 19 | 20 | @Test 21 | public void createChecksumFile() throws Exception { 22 | Method createChecksumFileMethod = Repos.class.getDeclaredMethod("createChecksumFile", Scope.class, String.class); 23 | createChecksumFileMethod.setAccessible(true); 24 | 25 | // null value 26 | String result = (String) createChecksumFileMethod.invoke(null, Scope.Default, null); 27 | assertNull(result); 28 | 29 | // empty value 30 | result = (String) createChecksumFileMethod.invoke(null, Scope.Default, null); 31 | assertNull(result); 32 | 33 | // no file separator 34 | result = (String) createChecksumFileMethod.invoke(null, Scope.Default, "foo"); 35 | assertNull(result); 36 | 37 | // valid, default scope 38 | result = (String) createChecksumFileMethod.invoke(null, Scope.Default, FileUtil.pathFromParts("foo", "bar")); 39 | assertEquals("foo/checksum.properties", result); 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /ply-util/src/test/java/net/ocheyedan/ply/AntStyleWildcardUtilTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | import org.junit.Test; 4 | 5 | import java.util.regex.Pattern; 6 | 7 | import static junit.framework.Assert.*; 8 | 9 | /** 10 | * User: blangel 11 | * Date: 10/16/11 12 | * Time: 2:12 PM 13 | */ 14 | public class AntStyleWildcardUtilTest { 15 | 16 | @Test 17 | public void regexString() { 18 | String antStyleWildcard = "**/*Test.???"; 19 | String regex = AntStyleWildcardUtil.regexString(antStyleWildcard); 20 | assertEquals(".+?/[^/]*?Test..{1}.{1}.{1}", regex); 21 | } 22 | 23 | @Test 24 | public void regex() { 25 | Pattern pattern = AntStyleWildcardUtil.regex("**/*Test.???"); 26 | assertTrue(pattern.matcher("/more/and/more/somethingTest.xml").matches()); 27 | assertTrue(pattern.matcher("test/1Test.111").matches()); 28 | assertTrue(pattern.matcher("brian/SomethingTest....").matches()); 29 | assertTrue(pattern.matcher("a/testTest.cvs").matches()); 30 | assertTrue(pattern.matcher("something/Test.xml").matches()); 31 | 32 | assertFalse(pattern.matcher("/testTest.cvs").matches()); 33 | assertFalse(pattern.matcher("aTest.xml").matches()); 34 | assertFalse(pattern.matcher("something/aTest.xmld").matches()); 35 | assertFalse(pattern.matcher("something/aTest.xm").matches()); 36 | assertFalse(pattern.matcher("/testTestXcvs").matches()); 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/input/ClasspathResource.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.input; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | 6 | /** 7 | * User: blangel 8 | * Date: 11/13/11 9 | * Time: 9:53 AM 10 | */ 11 | public class ClasspathResource implements Resource { 12 | 13 | private final String name; 14 | 15 | private final InputStream stream; 16 | 17 | public ClasspathResource(String resource, ClassLoader classLoader) { 18 | this.name = resource; 19 | ClassLoader loader = (classLoader == null ? (ClasspathResource.class.getClassLoader() == null 20 | ? ClassLoader.getSystemClassLoader() 21 | : ClasspathResource.class.getClassLoader()) 22 | : classLoader); 23 | this.stream = loader.getResourceAsStream(resource); 24 | } 25 | 26 | @Override public String name() { 27 | return name; 28 | } 29 | 30 | @Override public InputStream open() throws IOException { 31 | return stream; 32 | } 33 | 34 | @Override public Ontology getOntology() { 35 | return Ontology.Unknown; 36 | } 37 | 38 | @Override public void close() { 39 | if (stream != null) { 40 | try { 41 | stream.close(); 42 | } catch (IOException ioe) { 43 | throw new AssertionError(ioe); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /java-scripts/ply-package/src/main/java/net/ocheyedan/ply/script/PackageScript.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import net.ocheyedan.ply.Output; 4 | import net.ocheyedan.ply.props.Context; 5 | import net.ocheyedan.ply.props.Props; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * User: blangel 11 | * Date: 10/30/11 12 | * Time: 10:42 AM 13 | * 14 | * This script packages the project. It is packaged according to the value of {@literal project[.scope].packaging}. 15 | * The supported values are: 16 | * 'zip' => {@link ZipPackageScript} 17 | * 'jar' => {@link JarPackageScript} 18 | * 'war' => {@link WarPackageScript} 19 | */ 20 | public class PackageScript { 21 | 22 | public static void main(String[] args) { 23 | String packaging = Props.get("packaging", Context.named("project")).value(); 24 | PackagingScript packagingScript; 25 | if ("zip".equals(packaging)) { 26 | packagingScript = new ZipPackageScript(); 27 | } else if ("jar".equals(packaging)) { 28 | packagingScript = new JarPackageScript(); 29 | } else if ("war".equals(packaging)) { 30 | packagingScript = new WarPackageScript(); 31 | } else { 32 | Output.print("Packaging type ^b^%s^r^ not supported.", packaging); 33 | System.exit(1); return; 34 | } 35 | try { 36 | packagingScript.invoke(); 37 | } catch (IOException ioe) { 38 | Output.print(ioe); 39 | } catch (InterruptedException ie) { 40 | Output.print(ie); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /java-scripts/ply-test-junit/src/main/java/net/ocheyedan/ply/script/print/PrivilegedPrintStream.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script.print; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.PrintStream; 6 | import java.io.UnsupportedEncodingException; 7 | 8 | /** 9 | * User: blangel 10 | * Date: 10/29/11 11 | * Time: 2:35 PM 12 | * 13 | * All calls go to a file. Calls to {@link #print(String)} and {@link #println(String)} go to a file unless the String 14 | * starts with {@link #PRIVILEGED_PREFIX} in which case the call is delegated to {@link #delegate}. 15 | */ 16 | public class PrivilegedPrintStream extends PrintStream { 17 | 18 | public static final String PRIVILEGED_PREFIX = "^priv^"; 19 | 20 | private final PrintStream delegate; 21 | 22 | public PrivilegedPrintStream(PrintStream delegate, File file) throws FileNotFoundException, UnsupportedEncodingException { 23 | super(file); 24 | this.delegate = new PrintStream(delegate, true, "UTF-8"); 25 | } 26 | 27 | @Override public void print(String out) { 28 | if ((out != null) && out.startsWith(PRIVILEGED_PREFIX)) { 29 | this.delegate.print(out.substring(PRIVILEGED_PREFIX.length())); 30 | } else { 31 | super.print(out); 32 | } 33 | } 34 | 35 | @Override public void println(String out) { 36 | if ((out != null) && out.startsWith(PRIVILEGED_PREFIX)) { 37 | this.delegate.println(out.substring(PRIVILEGED_PREFIX.length())); 38 | } else { 39 | super.println(out); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/input/FileResource.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.input; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | 5 | import java.io.File; 6 | import java.io.FileInputStream; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.util.concurrent.atomic.AtomicReference; 10 | 11 | /** 12 | * User: blangel 13 | * Date: 11/13/11 14 | * Time: 9:54 AM 15 | */ 16 | public class FileResource implements Resource { 17 | 18 | private final String name; 19 | 20 | private final File file; 21 | 22 | private final AtomicReference ref; 23 | 24 | public FileResource(String file) { 25 | this.name = file; 26 | file = FileUtil.stripFileUriPrefix(file); 27 | file = FileUtil.resolveUnixTilde(file); 28 | this.file = new File(file); 29 | this.ref = new AtomicReference(); 30 | } 31 | 32 | @Override public String name() { 33 | return name; 34 | } 35 | 36 | @Override public InputStream open() throws IOException { 37 | ref.set(new FileInputStream(file)); 38 | return ref.get(); 39 | } 40 | 41 | @Override public Ontology getOntology() { 42 | return (file.exists() ? Ontology.Exists : Ontology.DoesNotExist); 43 | } 44 | 45 | @Override public void close() { 46 | InputStream stream = ref.get(); 47 | if (stream != null) { 48 | try { 49 | stream.close(); 50 | } catch (IOException ioe) { 51 | throw new AssertionError(ioe); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ply-jvm-primer/src/main/java/net/ocheyedan/ply/JvmPrimer.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | import java.lang.reflect.InvocationTargetException; 4 | import java.lang.reflect.Method; 5 | 6 | /** 7 | * User: blangel 8 | * Date: 4/28/12 9 | * Time: 3:13 PM 10 | * 11 | * Waits for a character to be sent via {@link System#in} and as soon as a character is sent, treats the first 12 | * argument to {@literal args} as the main-class and invokes as appropriate. 13 | */ 14 | public class JvmPrimer { 15 | 16 | /** 17 | * @param args [0] = main-class, rest are arguments to that main-class 18 | */ 19 | public static void main(String[] args) throws Throwable { 20 | if ((args == null) || (args.length < 1)) { 21 | throw new AssertionError("Expecting a main-class in args[0]."); 22 | } 23 | String mainClassName = args[0]; 24 | String[] mainClassArgs = new String[args.length - 1]; 25 | if (mainClassArgs.length > 0) { 26 | System.arraycopy(args, 1, mainClassArgs, 0, mainClassArgs.length); 27 | } 28 | 29 | // wait 30 | int read = System.in.read(); 31 | if (read != 0xb) { // pipe-broken? 32 | System.exit(read); 33 | } 34 | 35 | // ok, got go-ahead, invoke main class 36 | Class mainClass = Class.forName(mainClassName); 37 | Method method = mainClass.getMethod("main", String[].class); 38 | try { 39 | method.invoke(null, new Object[]{ mainClassArgs }); 40 | } catch (InvocationTargetException ite) { 41 | throw ite.getTargetException(); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /docs/BuildingProject.md: -------------------------------------------------------------------------------- 1 | Building 2 | ------------- 3 | 4 | To build a project, simply run 5 | 6 | $ ply compile 7 | 8 | To build and package a project, simply run 9 | 10 | $ ply compile package 11 | 12 | To build, package and install the package into the local repository, simply run 13 | 14 | $ ply install 15 | 16 | Those familiar with __maven__ will note the similarities. 17 | 18 | Utilizing the `electric-chilly` project made in [Project Setup](ProjectSetup.md), let's create a source file and build. 19 | 20 | $ mkdir -p src/main/java/net/ocheyedan/electricchilly/ 21 | $ touch src/main/java/net/ocheyedan/electricchilly/FrigidWinter.java 22 | 23 | Then copy/paste the following code into the `FrigidWinter.java` file. 24 | 25 | package net.ocheyedan.electricchilly; 26 | 27 | public class FrigidWinter { 28 | 29 | public boolean pluginFizzleElectricBlanket() { 30 | return (System.currentTimeMillis() % 2) == 0; 31 | } 32 | 33 | } 34 | 35 | Now let's compile! 36 | 37 | $ ply compile 38 | 39 | ![project compile](https://github.com/blangel/ply/raw/master/docs/imgs/building-compile.png "project compile") 40 | 41 | We can package and install the project as well. 42 | 43 | $ ply install 44 | 45 | ![project install](https://github.com/blangel/ply/raw/master/docs/imgs/building-install.png "project install") 46 | 47 | Note, the output, because the `FrigidWinter.java` file has not changed since last we compiled, nothing needed to be recompiled. Doing a `ply clean install` would force a recompilation. 48 | 49 | Continue on to [Adding dependencies](DependenciesTutorial.md) -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/props/Context.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.props; 2 | 3 | import java.util.Map; 4 | import java.util.concurrent.ConcurrentHashMap; 5 | 6 | /** 7 | * User: blangel 8 | * Date: 1/15/12 9 | * Time: 12:48 PM 10 | * 11 | * Typed representation of a context in {@literal ply}. 12 | */ 13 | public final class Context implements Comparable { 14 | 15 | private static final Map interned = new ConcurrentHashMap(); 16 | 17 | public static Context named(String name) { 18 | if (interned.containsKey(name)) { 19 | return interned.get(name); 20 | } 21 | Context context = new Context(name); 22 | interned.put(name, context); 23 | return context; 24 | } 25 | 26 | public final String name; 27 | 28 | public Context(String name) { 29 | this.name = name; 30 | } 31 | 32 | @Override public String toString() { 33 | return name; 34 | } 35 | 36 | @Override public boolean equals(Object o) { 37 | if (this == o) { 38 | return true; 39 | } 40 | if (o == null || getClass() != o.getClass()) { 41 | return false; 42 | } 43 | 44 | Context context = (Context) o; 45 | return (name == null ? context.name == null : name.equals(context.name)); 46 | } 47 | 48 | @Override public int hashCode() { 49 | return (name == null ? 0 : name.hashCode()); 50 | } 51 | 52 | @Override public int compareTo(Context o) { 53 | if (o == null) { 54 | return -1; 55 | } 56 | return name.compareTo(o.name); 57 | } 58 | } -------------------------------------------------------------------------------- /ply-util/src/test/java/net/ocheyedan/ply/mvn/MavenMetadataParserTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.mvn; 2 | 3 | import org.junit.Test; 4 | 5 | import static junit.framework.Assert.assertEquals; 6 | import static junit.framework.Assert.assertNull; 7 | 8 | /** 9 | * User: blangel 10 | * Date: 11/11/11 11 | * Time: 9:25 AM 12 | */ 13 | public class MavenMetadataParserTest { 14 | 15 | @Test 16 | public void parseMetadata() { 17 | MavenMetadataParser parser = new MavenMetadataParser(); 18 | assertNull(parser.parseMetadata(null, null)); 19 | 20 | MavenMetadataParser.Metadata metadata = parser.parseMetadata("classpath:mock-mvn-repo/log4j/log4j", null); 21 | assertEquals("1.2.16", metadata.latest); 22 | assertEquals(1, metadata.versions.size()); 23 | assertEquals("1.2.16", metadata.versions.get(0)); 24 | metadata = parser.parseMetadata("classpath:mock-mvn-repo/log4j/log4j/", null); // test with ending slash 25 | assertEquals("1.2.16", metadata.latest); 26 | assertEquals(1, metadata.versions.size()); 27 | assertEquals("1.2.16", metadata.versions.get(0)); 28 | 29 | metadata = parser.parseMetadata("classpath:mock-mvn-repo/javax/mail/mail", null); 30 | assertEquals("1.4.4", metadata.latest); 31 | assertEquals(5, metadata.versions.size()); 32 | assertEquals("1.4.2", metadata.versions.get(0)); 33 | assertEquals("1.4.3-rc1", metadata.versions.get(1)); 34 | assertEquals("1.4.3", metadata.versions.get(2)); 35 | assertEquals("1.4.4-rc1", metadata.versions.get(3)); 36 | assertEquals("1.4.4", metadata.versions.get(4)); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /java-scripts/ply-test-junit/src/main/java/net/ocheyedan/ply/script/AllFilterCollectPad.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import org.junit.runner.Description; 4 | import org.junit.runner.manipulation.Filter; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.concurrent.atomic.AtomicInteger; 9 | 10 | /** 11 | * User: blangel 12 | * Date: 10/13/11 13 | * Time: 10:00 PM 14 | * 15 | * Does no filtering but is used as a hook to retrieve longest method name before classes/methods are actually invoked. 16 | */ 17 | public class AllFilterCollectPad extends Filter { 18 | 19 | private final AtomicInteger maxMethodName = new AtomicInteger(0); 20 | 21 | private final List intersections = new ArrayList(); 22 | 23 | public int getMaxMethodNameLength() { 24 | return maxMethodName.get(); 25 | } 26 | 27 | @Override public boolean shouldRun(Description description) { 28 | for (Filter filter : intersections) { 29 | if (!filter.shouldRun(description)) { 30 | return false; 31 | } 32 | } 33 | if ((description.getMethodName() != null) && (description.getMethodName().length() > maxMethodName.get())) { 34 | maxMethodName.set(description.getMethodName().length()); 35 | } 36 | return true; 37 | } 38 | 39 | @Override public String describe() { 40 | return "all tests (collecting padding information)"; 41 | } 42 | 43 | @Override public Filter intersect(Filter second) { 44 | if (second != this) { 45 | intersections.add(second); 46 | } 47 | return this; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /java-scripts/ply-compiler/src/main/java/net/ocheyedan/ply/script/DependencyGraphVisitor.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import com.sun.tools.javac.tree.JCTree; 4 | import com.sun.tools.javac.tree.TreeTranslator; 5 | import net.ocheyedan.ply.Output; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 3/11/15 10 | * Time: 8:51 PM 11 | */ 12 | class DependencyGraphVisitor extends TreeTranslator { 13 | 14 | @Override public void visitMethodDef(JCTree.JCMethodDecl jcMethodDecl) { 15 | super.visitMethodDef(jcMethodDecl); 16 | Output.print("Visiting method %s", jcMethodDecl.getName()); 17 | } 18 | 19 | @Override public void visitTypeIdent(JCTree.JCPrimitiveTypeTree jcPrimitiveTypeTree) { 20 | super.visitTypeIdent(jcPrimitiveTypeTree); 21 | Output.print("Visiting type-ident %s", jcPrimitiveTypeTree == null ? "" : jcPrimitiveTypeTree.toString()); 22 | } 23 | 24 | @Override public void visitTypeArray(JCTree.JCArrayTypeTree jcArrayTypeTree) { 25 | super.visitTypeArray(jcArrayTypeTree); 26 | Output.print("Visiting type-array %s", jcArrayTypeTree == null ? "" : jcArrayTypeTree.toString()); 27 | } 28 | 29 | @Override public void visitTypeApply(JCTree.JCTypeApply jcTypeApply) { 30 | super.visitTypeApply(jcTypeApply); 31 | Output.print("Visiting type-apply %s", jcTypeApply == null ? "" : jcTypeApply.toString()); 32 | } 33 | 34 | @Override public void visitTypeParameter(JCTree.JCTypeParameter jcTypeParameter) { 35 | super.visitTypeParameter(jcTypeParameter); 36 | Output.print("Visiting type-parameter %s", jcTypeParameter == null ? "" : jcTypeParameter.toString()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/com/amazonaws/aws-java-sdk/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.amazonaws 4 | aws-java-sdk 5 | 6 | 1.2.12 7 | 1.2.12 8 | 9 | 1.0.000 10 | 1.0.001 11 | 1.0.002 12 | 1.0.003 13 | 1.0.004 14 | 1.0.005 15 | 1.0.006 16 | 1.0.007 17 | 1.0.008 18 | 1.0.009 19 | 1.0.10 20 | 1.0.11 21 | 1.0.12 22 | 1.0.14 23 | 1.1.0 24 | 1.1.1 25 | 1.1.2 26 | 1.1.3 27 | 1.1.4 28 | 1.1.5 29 | 1.1.6 30 | 1.1.7 31 | 1.1.7.1 32 | 1.1.8 33 | 1.1.9 34 | 1.2.0 35 | 1.2.1 36 | 1.2.2 37 | 1.2.3 38 | 1.2.4 39 | 1.2.5 40 | 1.2.6 41 | 1.2.7 42 | 1.2.8 43 | 1.2.9 44 | 1.2.10 45 | 1.2.11 46 | 1.2.12 47 | 48 | 20111109185458 49 | 50 | 51 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/stax/stax-api/1.0.1/stax-api-1.0.1.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | stax 4 | stax-api 5 | StAX API 6 | 1.0.1 7 | StAX API is the standard java XML processing API defined by JSR-173 8 | http://stax.codehaus.org/ 9 | 10 | http://jira.codehaus.org/browse/STAX 11 | 12 | 13 | 14 | 15 | 16 |
dev@stax.codehaus.org
17 |
18 |
19 |
20 |
21 | 2005 22 | 23 | 24 | The Apache Software License, Version 2.0 25 | http://www.apache.org/licenses/LICENSE-2.0.txt 26 | repo 27 | 28 | 29 | 30 | 31 | StAX Builders List 32 | stax_builders-subscribe@yahoogroups.com 33 | stax_builders-unsubscribe@yahoogroups.com 34 | http://groups.yahoo.com/group/stax_builders/ 35 | 36 | 37 | 38 | 39 | aslom 40 | Aleksander Slominski 41 | 42 | Indiana University 43 | 44 | 45 | chris 46 | Chris Fry 47 | 48 | 49 | 50 | 51 |
-------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/dep/Dep.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.dep; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 11/4/11 8 | * Time: 5:05 PM 9 | * 10 | * A resolved dependency; includes a {@link DependencyAtom}, the resolved local-repository directory in which 11 | * the dependency is stored and a list of the dependency's own dependencies. 12 | */ 13 | public final class Dep { 14 | 15 | public final DependencyAtom dependencyAtom; 16 | 17 | public final List dependencies; 18 | 19 | public final String localRepositoryDirectory; 20 | 21 | public Dep(DependencyAtom dependencyAtom, List dependencies, String localRepositoryDirectory) { 22 | this.dependencyAtom = dependencyAtom; 23 | this.dependencies = dependencies; 24 | this.localRepositoryDirectory = localRepositoryDirectory; 25 | } 26 | 27 | @Override public String toString() { 28 | return (dependencyAtom == null ? "" : String.format("%s:%s", dependencyAtom.namespace, dependencyAtom.name)); 29 | } 30 | 31 | public String toVersionString() { 32 | return (dependencyAtom == null ? "" : String.format("%s:%s:%s", dependencyAtom.namespace, dependencyAtom.name, dependencyAtom.version)); 33 | } 34 | 35 | @Override public boolean equals(Object o) { 36 | if (this == o) { 37 | return true; 38 | } 39 | if (o == null || getClass() != o.getClass()) { 40 | return false; 41 | } 42 | 43 | Dep dep = (Dep) o; 44 | 45 | return (dependencyAtom == null ? dep.dependencyAtom == null : dependencyAtom.equals(dep.dependencyAtom)); 46 | } 47 | 48 | @Override public int hashCode() { 49 | return dependencyAtom == null ? 0 : dependencyAtom.hashCode(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/org/slf4j/slf4j-jcl/1.5.11/slf4j-jcl-1.5.11.pom: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | org.slf4j 5 | slf4j-parent 6 | 1.5.11 7 | 8 | 9 | 4.0.0 10 | 11 | org.slf4j 12 | slf4j-jcl 13 | jar 14 | SLF4J JCL Binding 15 | 16 | http://www.slf4j.org 17 | 18 | 19 | The slf4j jcl binding 20 | 21 | 22 | 23 | 24 | org.slf4j 25 | slf4j-api 26 | 27 | 28 | 29 | commons-logging 30 | commons-logging 31 | 1.1.1 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | org.apache.maven.plugins 40 | maven-jar-plugin 41 | 42 | 43 | 44 | ${parsedVersion.osgiVersion} 45 | ${project.description} 46 | ${project.version} 47 | 48 | ${project.build.outputDirectory}/META-INF/MANIFEST.MF 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ply-util/src/test/java/net/ocheyedan/ply/props/PrefixedPropsTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.props; 2 | 3 | import org.junit.Test; 4 | 5 | import java.util.Collections; 6 | import java.util.List; 7 | import java.util.Map; 8 | import java.util.concurrent.ConcurrentHashMap; 9 | 10 | import static junit.framework.Assert.assertEquals; 11 | 12 | /** 13 | * User: blangel 14 | * Date: 3/20/15 15 | * Time: 9:14 AM 16 | */ 17 | public class PrefixedPropsTest { 18 | 19 | @Test 20 | public void getArguments() { 21 | PropFile container = new PropFile(Context.named(""), PropFile.Loc.System); 22 | container.add("argsFoo", "=bar"); 23 | PropFileChain chain = new PropFileChain(Collections.emptyMap()); 24 | chain.set(container, PropFile.Loc.System); 25 | 26 | Map filterConsultant = new ConcurrentHashMap(2, 1.0f); 27 | filterConsultant.put(Context.named(""), chain); 28 | PropFileChain props = new PropFileChain(chain, filterConsultant); 29 | 30 | List arguments = PrefixedProps.getArguments(props, "args"); 31 | assertEquals(1, arguments.size()); 32 | assertEquals("Foo=bar", arguments.get(0)); 33 | 34 | container.add("argsfoo", "=Bar"); 35 | arguments = PrefixedProps.getArguments(props, "args"); 36 | assertEquals(2, arguments.size()); 37 | assertEquals("Foo=bar", arguments.get(0)); 38 | assertEquals("foo=Bar", arguments.get(1)); 39 | 40 | container.add("argsARG", "VAL"); 41 | arguments = PrefixedProps.getArguments(props, "args", "="); 42 | assertEquals(3, arguments.size()); 43 | assertEquals("Foo==bar", arguments.get(0)); 44 | assertEquals("foo==Bar", arguments.get(1)); 45 | assertEquals("ARG=VAL", arguments.get(2)); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/dep/visitors/DependencySignatureVisitor.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.dep.visitors; 2 | 3 | import org.objectweb.asm.Opcodes; 4 | import org.objectweb.asm.signature.SignatureVisitor; 5 | 6 | import java.util.Set; 7 | 8 | /** 9 | * User: blangel 10 | * Date: 8/18/14 11 | * Time: 3:41 PM 12 | */ 13 | class DependencySignatureVisitor extends SignatureVisitor { 14 | 15 | private final Dependencies dependencies; 16 | 17 | DependencySignatureVisitor(Dependencies dependencies) { 18 | super(Opcodes.ASM5); 19 | this.dependencies = dependencies; 20 | } 21 | 22 | @Override public SignatureVisitor visitClassBound() { 23 | return this; 24 | } 25 | 26 | @Override public SignatureVisitor visitInterfaceBound() { 27 | return this; 28 | } 29 | 30 | @Override public SignatureVisitor visitSuperclass() { 31 | return this; 32 | } 33 | 34 | @Override public SignatureVisitor visitInterface() { 35 | return this; 36 | } 37 | 38 | @Override public SignatureVisitor visitParameterType() { 39 | return this; 40 | } 41 | 42 | @Override public SignatureVisitor visitReturnType() { 43 | return this; 44 | } 45 | 46 | @Override public SignatureVisitor visitExceptionType() { 47 | return this; 48 | } 49 | 50 | @Override public void visitTypeVariable(String name) { 51 | DependencyVisitors.addName(name, dependencies); 52 | } 53 | 54 | @Override public void visitClassType(String name) { 55 | DependencyVisitors.addName(name, dependencies); 56 | } 57 | 58 | @Override public void visitInnerClassType(String name) { 59 | DependencyVisitors.addName(name, dependencies); 60 | } 61 | 62 | @Override public SignatureVisitor visitTypeArgument(char wildcard) { 63 | return this; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /java-scripts/ply-dependency-copy/src/main/java/net/ocheyedan/ply/script/DependencyCopy.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | import net.ocheyedan.ply.Output; 5 | import net.ocheyedan.ply.dep.DependencyAtom; 6 | import net.ocheyedan.ply.dep.Deps; 7 | import net.ocheyedan.ply.props.Context; 8 | import net.ocheyedan.ply.props.PropFile; 9 | import net.ocheyedan.ply.props.Props; 10 | 11 | import java.io.File; 12 | 13 | /** 14 | * User: blangel 15 | * Date: 1/14/13 16 | * Time: 12:50 PM 17 | * 18 | * Copies the resolved dependencies (the {@literal resolved-deps} file within the {@literal project.build.dir}) 19 | * into {@literal depcopy.dir}, deleting all files within {@literal depcopy.dir} first. 20 | */ 21 | public final class DependencyCopy { 22 | 23 | public static void main(String[] args) { 24 | PropFile resolvedProperties = Deps.getResolvedProperties(false); 25 | String toDirPath = Props.get("dir", Context.named("depcopy")).value(); 26 | if (toDirPath.isEmpty()) { 27 | Output.print("^warn^ The ^b^depcopy.dir^r^ property is null, skipping dependency copying."); 28 | return; 29 | } 30 | File copyToDir = new File(toDirPath); 31 | FileUtil.delete(copyToDir); 32 | copyDependencies(resolvedProperties, copyToDir); 33 | } 34 | 35 | protected static void copyDependencies(PropFile resolvedProperties, File copyToDir) { 36 | copyToDir.mkdirs(); 37 | for (PropFile.Prop resolvedKey : resolvedProperties.props()) { 38 | if (DependencyAtom.isTransient(resolvedKey.name)) { 39 | continue; 40 | } 41 | File dependency = new File(resolvedKey.value()); 42 | File to = FileUtil.fromParts(copyToDir.getPath(), dependency.getName()); 43 | FileUtil.copy(dependency, to); 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /java-scripts/ply-file-changed/src/test/java/net/ocheyedan/ply/script/CompilableFilesTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import net.ocheyedan.ply.props.Context; 4 | import net.ocheyedan.ply.props.PropFile; 5 | import org.junit.Test; 6 | 7 | import java.lang.reflect.Method; 8 | 9 | import static org.junit.Assert.assertEquals; 10 | import static org.junit.Assert.assertTrue; 11 | 12 | /** 13 | * User: blangel 14 | * Date: 8/20/14 15 | * Time: 8:43 AM 16 | */ 17 | public class CompilableFilesTest { 18 | 19 | @Test 20 | public void getSourceFile() throws Exception { 21 | Method getSourceFileMethod = CompilableFiles.class.getDeclaredMethod("getSourceFile", PropFile.Prop.class, String.class); 22 | getSourceFileMethod.setAccessible(true); 23 | 24 | CompilableFiles compilableFiles = new CompilableFiles(); 25 | 26 | // test without inner class 27 | PropFile.Prop prop = new PropFile(Context.named("test"), PropFile.Loc.AdHoc).add("net.ocheyedan.ply.script.CompilerScript", ""); 28 | String sourceFilePath = (String) getSourceFileMethod.invoke(compilableFiles, prop, "foo"); 29 | assertTrue(sourceFilePath.endsWith("foo/net/ocheyedan/ply/script/CompilerScript.java")); 30 | 31 | // test with inner class 32 | prop = new PropFile(Context.named("test"), PropFile.Loc.AdHoc).add("net.ocheyedan.ply.script.CompilerScript$1", ""); 33 | sourceFilePath = (String) getSourceFileMethod.invoke(compilableFiles, prop, "foo"); 34 | assertTrue(sourceFilePath.endsWith("foo/net/ocheyedan/ply/script/CompilerScript.java")); 35 | prop = new PropFile(Context.named("test"), PropFile.Loc.AdHoc).add("net.ocheyedan.ply.script.CompilerScript$InnerName", ""); 36 | sourceFilePath = (String) getSourceFileMethod.invoke(compilableFiles, prop, "foo"); 37 | assertTrue(sourceFilePath.endsWith("foo/net/ocheyedan/ply/script/CompilerScript.java")); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /docs/DependenciesTutorial.md: -------------------------------------------------------------------------------- 1 | Dependencies 2 | ------------- 3 | 4 | First, make sure you understand dependencies and their role in Ply by reading [Dependencies](Dependencies.md). 5 | 6 | Utilizing the `electric-chilly` project made in [Project Setup](ProjectSetup.md), let's add a dependency to the [Google Guava](http://code.google.com/p/guava-libraries/) project. 7 | 8 | $ ply dep add com.google.guava:guava-collections:r03 -Pply.log.levels=info 9 | 10 | The `-Pply.log.levels=info` property override is unnecessary but added to give more detailed feedback about what transitive dependencies are being downloaded, see [Changing Log Levels](Logging.md) for details about available log levels. Your output should be similar to the following: 11 | 12 | ![dep guava](https://github.com/blangel/ply/raw/master/docs/imgs/ply-dep-guava.png "dep guava") 13 | 14 | We can see that four dependencies were downloaded even though we only added one. Let's issue the `ply dep tree` command to visualize the dependencies of `electric-chilly`: 15 | 16 | $ ply dep tree 17 | 18 | ![dep tree](https://github.com/blangel/ply/raw/master/docs/imgs/ply-dep-tree.png "dep tree") 19 | 20 | It's now apparent that `electric-chilly` has the one direct dependency which we added `com.google.guava:guava-collections:r03` but that the `guava-collections` dependency itself depends upon two other projects: `com.google.guava:guava-primitives:r03` and `com.google.guava:guava-annotations:r03`. The `guava-primitives` itself depends upon `com.google.guava:guava-base:r03`. 21 | 22 | Test Scoped Dependency 23 | --------------------- 24 | 25 | Let's now add `junit` to our `electric-chilly` project as a test dependency. 26 | 27 | $ ply test:dep add junit:junit:4.10 28 | 29 | Note, adding a test dependency is the same except the `dep` script is run within scope _test_ (i.e., `test:dep`). 30 | See [Scopes](Scopes.md) for more information on their usage in ply. 31 | 32 | Continue on to [Repositories](Repositories.md) -------------------------------------------------------------------------------- /java-scripts/ply-compiler/src/main/java/net/ocheyedan/ply/script/DependencyGraphProcessor.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import com.sun.source.util.Trees; 4 | import com.sun.tools.javac.tree.JCTree; 5 | import com.sun.tools.javac.tree.TreeTranslator; 6 | import net.ocheyedan.ply.Output; 7 | 8 | import javax.annotation.processing.AbstractProcessor; 9 | import javax.annotation.processing.ProcessingEnvironment; 10 | import javax.annotation.processing.RoundEnvironment; 11 | import javax.annotation.processing.SupportedAnnotationTypes; 12 | import javax.lang.model.SourceVersion; 13 | import javax.lang.model.element.Element; 14 | import javax.lang.model.element.ElementKind; 15 | import javax.lang.model.element.TypeElement; 16 | import java.util.Set; 17 | 18 | /** 19 | * User: blangel 20 | * Date: 3/11/15 21 | * Time: 7:12 PM 22 | */ 23 | @SupportedAnnotationTypes("*") 24 | public class DependencyGraphProcessor extends AbstractProcessor { 25 | 26 | private Trees trees; 27 | 28 | public synchronized void init(ProcessingEnvironment env) { 29 | super.init(env); 30 | trees = Trees.instance(env); 31 | } 32 | 33 | @Override public SourceVersion getSupportedSourceVersion() { 34 | return SourceVersion.latestSupported(); 35 | } 36 | 37 | @Override public boolean process(Set annotations, RoundEnvironment roundEnv) { 38 | if (!roundEnv.processingOver()) { 39 | Set elements = roundEnv.getRootElements(); 40 | for (Element each : elements) { 41 | if (each.getKind() == ElementKind.CLASS) { 42 | Output.print("Looking at type %s", each.getSimpleName()); 43 | JCTree tree = (JCTree) trees.getTree(each); 44 | TreeTranslator visitor = new DependencyGraphVisitor(); 45 | tree.accept(visitor); 46 | } 47 | } 48 | } 49 | return false; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/dep/RepositoryRegistry.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.dep; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | /** 7 | * User: blangel 8 | * Date: 11/5/11 9 | * Time: 11:01 AM 10 | * 11 | * A struct to hold {@link RepositoryAtom} objects to be used during dependency resolution. 12 | */ 13 | public final class RepositoryRegistry { 14 | 15 | /** 16 | * The local repository used to store resolved dependencies. 17 | */ 18 | public final RepositoryAtom localRepository; 19 | 20 | /** 21 | * List of remote repositories to search after consulting the {@link #localRepository} when resolving 22 | * dependencies. 23 | */ 24 | public final List remoteRepositories; 25 | 26 | /** 27 | * A synthetic repository to consult before looking into either the {@link #localRepository} or 28 | * the list of {@link #remoteRepositories}. Use a synthetic repository when adding dependencies; as none of the 29 | * actual repositories will hold the new dependency until it has been resolved correctly. This is like a staging 30 | * repository until it has been determined that adding the new dependency will do no harm (i.e., cause a circular 31 | * dependency). 32 | */ 33 | public final Map> syntheticRepository; 34 | 35 | public RepositoryRegistry(RepositoryAtom localRepository, List remoteRepositories, 36 | Map> syntheticRepository) { 37 | this.localRepository = localRepository; 38 | this.remoteRepositories = remoteRepositories; 39 | this.syntheticRepository = syntheticRepository; 40 | } 41 | 42 | public boolean isEmpty() { 43 | return ((localRepository == null) && ((remoteRepositories == null) || !remoteRepositories.isEmpty()) 44 | && ((syntheticRepository == null) || syntheticRepository.isEmpty())); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/build/ShellScript.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd.build; 2 | 3 | import net.ocheyedan.ply.exec.Execution; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * User: blangel 10 | * Date: 1/15/12 11 | * Time: 10:50 AM 12 | * 13 | * Extends {@link Script} to allow for shell invocations. Shell invocation within ply are denoted by surrounding 14 | * the script with '`' (tick marks). 15 | */ 16 | public final class ShellScript extends Script { 17 | 18 | ShellScript(Script script) { 19 | super(script.name, script.scope, script.arguments, script.unparsedName); 20 | } 21 | 22 | /** 23 | * Removes the tick marks from the script and creates an appropriate {@link Execution} object. 24 | * Note, any {@link #arguments} are concatenated (space delimited) into a string and appended to the end of the 25 | * {@link #name} as the shell invocation's arguments are the argument to the resolved shell (i.e., bash) and 26 | * not considered part of the actual scripts arguments (i.e., ls). 27 | * @param overriddenExecutionName to use in the converted {@link Execution} objects' {@link Execution#name} values. 28 | * @return an shell script execution 29 | */ 30 | @Override protected List convert(String overriddenExecutionName) { 31 | String[] executableArgs = new String[1]; 32 | // remove the '`' leading and trailing tick marks 33 | String cleaned = name.substring(1, name.length() - 1); 34 | // replace any "\`" with simply '`' 35 | cleaned = cleaned.replace("\\`", "`"); 36 | StringBuilder shellScript = new StringBuilder(cleaned); 37 | for (String arg : arguments) { 38 | shellScript.append(" "); 39 | shellScript.append(arg); 40 | } 41 | executableArgs[0] = shellScript.toString(); 42 | List executions = new ArrayList(1); 43 | executions.add(new Execution(overriddenExecutionName, this, executableArgs)); 44 | return executions; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/input/UrlResource.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.input; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.net.HttpURLConnection; 6 | import java.net.MalformedURLException; 7 | import java.net.URL; 8 | import java.net.URLConnection; 9 | import java.util.Map; 10 | import java.util.concurrent.atomic.AtomicReference; 11 | 12 | /** 13 | * User: blangel 14 | * Date: 11/13/11 15 | * Time: 9:51 AM 16 | */ 17 | public class UrlResource implements Resource { 18 | 19 | private final String name; 20 | 21 | private final URL url; 22 | 23 | private final AtomicReference ref; 24 | 25 | private final Map headers; 26 | 27 | public UrlResource(String url, Map headers) throws MalformedURLException { 28 | this.name = url; 29 | this.url = new URL(url); 30 | this.ref = new AtomicReference(); 31 | this.headers = headers; 32 | } 33 | 34 | @Override public String name() { 35 | return name; 36 | } 37 | 38 | @Override public InputStream open() throws IOException { 39 | URLConnection urlConnection = url.openConnection(); 40 | if ((headers != null) && (urlConnection instanceof HttpURLConnection)) { 41 | HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection; 42 | for (Map.Entry entry : headers.entrySet()) { 43 | httpURLConnection.setRequestProperty(entry.getKey(), entry.getValue()); 44 | } 45 | } 46 | ref.set(urlConnection.getInputStream()); 47 | return ref.get(); 48 | } 49 | 50 | @Override public Ontology getOntology() { 51 | return Ontology.Unknown; 52 | } 53 | 54 | @Override public void close() { 55 | InputStream stream = ref.get(); 56 | if (stream != null) { 57 | try { 58 | stream.close(); 59 | } catch (IOException ioe) { 60 | throw new AssertionError(ioe); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /docs/ProjectSetup.md: -------------------------------------------------------------------------------- 1 | Project Setup 2 | ------------- 3 | 4 | To enable a directory/project to use ply, simply run init from within the directory: 5 | 6 | $ ply init 7 | 8 | This will create the `.ply/config` directory and also a `project.properties` file with the following properties set 9 | 10 | * __namespace__ - will default to be the name of the project directory. The _namespace_ is analogous to _groupId_ in __maven__. 11 | * __name__ - will default to be the name of the project directory. The _name_ is analogous to _artifactId_ in __maven__. 12 | * __version__ - will default to be `1.0`. 13 | 14 | Additionally the `project.src.dir` and `project.res.dir` directories will be created for you in the default and `test` [scopes](Scopes.md). 15 | 16 | So issuing the following sequence of commands: 17 | 18 | $ mkdir electric-chilly 19 | $ cd electric-chilly/ 20 | $ ply init 21 | 22 | Will create directories `.ply/config` under `electric-chilly` and the following `project.properties` file within `.ply/config` 23 | 24 | namespace=electric-chilly 25 | name=electric-chilly 26 | version=1.0 27 | 28 | Also, directories `src/main/java`, `src/main/resources`, `src/test/java` and `src/test/resources` will be created under `electric-chilly`. 29 | 30 | The created property values can be verified via _ply_ itself by doing: 31 | 32 | $ ply get 33 | 34 | Here's an image of the steps: 35 | 36 | ![project setup](https://github.com/blangel/ply/raw/master/docs/imgs/project-setup.png "project setup") 37 | 38 | Overriding Default Values 39 | ------------------------- 40 | 41 | In case the default values are not desired, you can use the [ad hoc](Properties.md) properties of ply to override any value. For instance, to specify a different __namespace__, say __net.ocheyedan__, you would invoke `ply init` with an ad hoc property: 42 | 43 | $ ply init -Pproject.namespace=net.ocheyedan 44 | 45 | Everything would be created as in the original example except the __namespace__ would be __net.ocheyedan__ instead of the default (i.e., the name of the project directory). 46 | 47 | Continue on to [Building](BuildingProject.md) -------------------------------------------------------------------------------- /java-scripts/ply-print-classpath/src/main/java/net/ocheyedan/ply/script/PrintClasspathScript.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | import net.ocheyedan.ply.Output; 5 | import net.ocheyedan.ply.dep.DependencyAtom; 6 | import net.ocheyedan.ply.dep.Deps; 7 | import net.ocheyedan.ply.props.Context; 8 | import net.ocheyedan.ply.props.PropFile; 9 | import net.ocheyedan.ply.props.Props; 10 | 11 | import java.io.File; 12 | 13 | /** 14 | * User: blangel 15 | * Date: 12/1/11 16 | * Time: 7:47 PM 17 | * 18 | * Prints the project's classpath. This script assumes the project has been built and all dependencies 19 | * resolved. 20 | */ 21 | public class PrintClasspathScript { 22 | 23 | public static void main(String[] args) { 24 | String buildDir = Props.get("build.dir", Context.named("project")).value(); 25 | DependencyAtom dependencyAtom = Deps.getProjectDep(); 26 | String artifactName = dependencyAtom.getArtifactName(); 27 | File artifactFile = FileUtil.fromParts(buildDir, artifactName); 28 | if (!artifactFile.exists()) { 29 | Output.print("Packaged artifact [ %s ] not found, run `ply compile package` first.", artifactName); 30 | System.exit(1); 31 | } 32 | String classpath = createClasspath(artifactFile.getPath(), Deps.getResolvedProperties(false)); 33 | Output.print(classpath); 34 | } 35 | 36 | /** 37 | * Concatenates together {@code artifact} with the keys of {@code dependencies} (if any), separating each 38 | * by the {@link File#pathSeparator}. 39 | * @param artifact of the project 40 | * @param dependencies of the project, if any 41 | * @return the concatenated classpath 42 | */ 43 | private static String createClasspath(String artifact, PropFile dependencies) { 44 | StringBuilder buffer = new StringBuilder(artifact); 45 | for (PropFile.Prop dependency : dependencies.props()) { 46 | buffer.append(File.pathSeparator); 47 | buffer.append(dependency.value()); 48 | } 49 | return buffer.toString(); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/graph/Graphs.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.graph; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 11/5/11 10 | * Time: 9:01 AM 11 | * 12 | * A utility class for {@link Graph} objects. 13 | */ 14 | public final class Graphs { 15 | 16 | public static interface Visitor { 17 | void visit(Vertex vertex); 18 | } 19 | 20 | private final static Integer NOT_VISTITED = 0; 21 | private final static Integer VISITING = 1; 22 | private final static Integer VISITED = 2; 23 | 24 | /** 25 | * TODO - augment to support CycleDetector needs 26 | * Visits each {@link Vertex} within {@code graph} once and only once. 27 | * @param graph to visit 28 | * @param visitor the visitor object 29 | * @param type of the value of {@link Vertex} objects within {@code graph} 30 | */ 31 | public static void visit(Graph graph, Visitor visitor) { 32 | final List> vertices = graph.getVertices(); 33 | final Map, Integer> vertexStateMap = new HashMap, Integer>(); 34 | for (final Vertex vertex : vertices) { 35 | visit(vertex, visitor, vertexStateMap); 36 | } 37 | } 38 | 39 | private static void visit(Vertex vertex, Visitor visitor, Map, Integer> vertexStateMap) { 40 | if (isNotVisited(vertex, vertexStateMap)) { 41 | vertexStateMap.put(vertex, VISITING); 42 | visitor.visit(vertex); 43 | for (Vertex child : vertex.getChildren()) { 44 | visit(child, visitor, vertexStateMap); 45 | } 46 | vertexStateMap.put(vertex, VISITED); 47 | } 48 | } 49 | 50 | private static boolean isNotVisited(final Vertex vertex, final Map, Integer> vertexStateMap) { 51 | if (!vertexStateMap.containsKey(vertex)) { 52 | return true; 53 | } 54 | final Integer state = vertexStateMap.get(vertex); 55 | return NOT_VISTITED.equals(state); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/mvn/MavenPom.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.mvn; 2 | 3 | import net.ocheyedan.ply.props.PropFile; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 11/18/11 8 | * Time: 8:27 AM 9 | * 10 | * Encapsulates the relevant information parsed from a {@literal maven} {@literal pom} file. 11 | */ 12 | public final class MavenPom { 13 | 14 | public final String groupId; 15 | 16 | public final String artifactId; 17 | 18 | public final String version; 19 | 20 | public final String packaging; 21 | 22 | public final PropFile dependencies; 23 | 24 | public final PropFile testDependencies; 25 | 26 | public final PropFile modules; 27 | 28 | public final PropFile repositories; 29 | 30 | public final String buildDirectory; 31 | 32 | public final String buildOutputDirectory; 33 | 34 | public final String buildFinalName; 35 | 36 | public final String buildSourceDirectory; 37 | 38 | public final String buildTestOutputDirectory; 39 | 40 | public final String buildTestSourceDirectory; 41 | 42 | public MavenPom(String groupId, String artifactId, String version, String packaging, PropFile dependencies, 43 | PropFile testDependencies, PropFile repositories, PropFile modules, String buildDirectory, 44 | String buildOutputDirectory, String buildFinalName, String buildSourceDirectory, 45 | String buildTestOutputDirectory, String buildTestSourceDirectory) { 46 | this.groupId = groupId; 47 | this.artifactId = artifactId; 48 | this.version = version; 49 | this.packaging = packaging; 50 | this.dependencies = dependencies; 51 | this.testDependencies = testDependencies; 52 | this.repositories = repositories; 53 | this.modules = modules; 54 | this.buildDirectory = buildDirectory; 55 | this.buildOutputDirectory = buildOutputDirectory; 56 | this.buildFinalName = buildFinalName; 57 | this.buildSourceDirectory = buildSourceDirectory; 58 | this.buildTestOutputDirectory = buildTestOutputDirectory; 59 | this.buildTestSourceDirectory = buildTestSourceDirectory; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /java-scripts/ply-package/src/main/java/net/ocheyedan/ply/script/ZipFiles.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import net.ocheyedan.ply.Output; 4 | 5 | import java.io.IOException; 6 | import java.util.HashSet; 7 | import java.util.Set; 8 | import java.util.zip.ZipEntry; 9 | import java.util.zip.ZipFile; 10 | import java.util.zip.ZipInputStream; 11 | import java.util.zip.ZipOutputStream; 12 | 13 | /** 14 | * User: blangel 15 | * Date: 11/16/11 16 | * Time: 6:25 PM 17 | * 18 | * Utility for interacting with {@link ZipFile} objects. 19 | */ 20 | public final class ZipFiles { 21 | 22 | /** 23 | * Appends all entries within {@code zip} into {@code intoZip}. 24 | * Note, the {@code intoZip} is not closed by this method to facilitate multiple append calls before closing 25 | * the zip. 26 | * @param zip from which to append 27 | * @param intoZip to which to append 28 | * @param existing {@link ZipEntry} names to avoid duplicate entries exceptions. 29 | * @throws IOException @see {@link ZipOutputStream#write(byte[])} 30 | */ 31 | public static void append(ZipInputStream zip, ZipOutputStream intoZip, Set existing) throws IOException { 32 | if ((zip == null) || (intoZip == null)) { 33 | return; 34 | } 35 | Set duplicateWarnings = new HashSet(); 36 | ZipEntry entry; 37 | int len; byte[] buf = new byte[1024]; 38 | while ((entry = zip.getNextEntry()) != null) { 39 | String entryName = entry.getName(); 40 | if (!existing.add(entryName)) { 41 | if (duplicateWarnings.add(entryName) 42 | && !entry.isDirectory() && !"META-INF/MANIFEST.MF".equals(entryName) 43 | && ((entryName != null) && !entryName.startsWith("META-INF/ply/dependencies."))) { 44 | Output.print("^warn^ Duplicate entry ^b^%s^r^ skipped.", entryName); 45 | } 46 | continue; 47 | } 48 | intoZip.putNextEntry(entry); 49 | while ((len = zip.read(buf)) > 0) { 50 | intoZip.write(buf, 0, len); 51 | } 52 | intoZip.closeEntry(); 53 | } 54 | zip.close(); 55 | } 56 | 57 | private ZipFiles() { } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /docs/IncludedScripts.md: -------------------------------------------------------------------------------- 1 | Included Scripts 2 | ---------------- 3 | 4 | Ply ships with the following scripts (for detailed information about each, check the corresponding wiki page): 5 | 6 | __ply-clean-1.0.jar__ - deletes directory `project.build.dir` and all its subdirectories 7 | 8 | __ply-dependency-manager-1.0.jar__ - resolves dependency-atoms from the `dependencies` context property file. 9 | 10 | __ply-dependency-copy-1.0.jar__ - copies resolved dependencies (obtained via files within `resolved-deps`) into `depcopy.dir` 11 | 12 | __ply-file-changed-1.0.jar__ - determines which files within `project.src.dir` have changed since last invocation (using timestamp and SHA1 hash). 13 | 14 | __ply-compiler-1.0.jar__ - compiles files within `project.src.dir` which have changed (determines change by using the `ply-file-changed-1.0.jar` output) and places the compiled output in `compiler.build.path` 15 | 16 | __ply-resources-1.0.jar__ - copies files from `project.res.dir` to `project.res.build.dir` 17 | 18 | __ply-filter-file-1.0.jar__ - filters files from `project.filter.dir` with all available properties 19 | 20 | __ply-package-1.0.jar__ - packages compiled code (within `compiler.build.path`) and resources (within `project.res.build.dir`) into an archive (jar/zip/war/etc). 21 | 22 | __ply-repo-install-1.0.jar__ - copies the packaged code/resources into the `depmng.localRepo` 23 | 24 | __ply-repo-manager-1.0.jar__ - resolves repository-atoms from the `repositories` context property file. 25 | 26 | __ply-repo-deploy-1.0.sh__ - copies the local packaged code/resources file (e.g. `jar`) from the `depmng.localRepo` to a ply repository (i.e. a `git` repo, pushing it to the `origin` remote) 27 | 28 | __ply-test-junit-1.0.jar__ - runs all junit tests found within the package `project.artifact.name` in directory `project.build.dir` 29 | 30 | __ply-exec-1.0.jar__ - executes the current project using the specified main class (via `exec.class` and if that property is not specified looks at the `package.manifest.mainClass`) 31 | 32 | __ply-print-classpath-1.0.jar__ - prints the project's classpath (especially useful in conjunction with `-Pply.decorated=false`) 33 | 34 | __ply-intellij-1.0.jar__ - creates _Intellij IDEA_ project (.ipr) and module (.iml) files for the project (the files will point to the resolved dependencies and correctly setup the JDK and source and output directories based on ply properties). -------------------------------------------------------------------------------- /ply-jna/src/main/java/net/ocheyedan/ply/jna/JnaUtil.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.jna; 2 | 3 | /** 4 | * User: blangel 5 | * Date: 11/8/11 6 | * Time: 7:11 PM 7 | */ 8 | public final class JnaUtil { 9 | 10 | public static enum Os { 11 | Linux, OSX, BSD, Solaris, OpenVMS, OS2, Windows; 12 | 13 | public boolean isUnix() { 14 | return ((this == Linux) || (this == OSX) || (this == BSD) || (this == Solaris)); 15 | } 16 | 17 | } 18 | 19 | private static final String JNA_CLASS_NAME = "com.sun.jna.Library"; 20 | 21 | private static final boolean jnaPresent; 22 | 23 | private static final Os os; 24 | 25 | static { 26 | ClassLoader loader = JnaUtil.class.getClassLoader(); 27 | if (loader == null) { 28 | loader = ClassLoader.getSystemClassLoader(); 29 | } 30 | boolean jnaPresentLocal = false; 31 | if (loader != null) { 32 | try { 33 | loader.loadClass(JNA_CLASS_NAME); 34 | jnaPresentLocal = true; 35 | } catch (ClassNotFoundException cnfe) { 36 | jnaPresentLocal = false; 37 | } 38 | } 39 | jnaPresent = jnaPresentLocal; 40 | 41 | String osName = System.getProperty("os.name"); 42 | osName = (osName == null ? "linux" /* need to default to something */ : osName.toLowerCase()); 43 | 44 | if (osName.contains("linux") || osName.contains("hp-ux")) { 45 | os = Os.Linux; 46 | } else if (osName.contains("mac") || osName.contains("darwin")) { 47 | os = Os.OSX; 48 | } else if (osName.contains("bsd")) { 49 | os = Os.BSD; 50 | } else if (osName.contains("solaris") || osName.contains("sunos")) { 51 | os = Os.Solaris; 52 | } else if (osName.contains("openvms")) { 53 | os = Os.OpenVMS; 54 | } else if (osName.contains("os/2")) { 55 | os = Os.OS2; 56 | } else if (osName.contains("windows")) { 57 | os = Os.Windows; 58 | } else { 59 | os = Os.Linux; // need to default to something 60 | } 61 | } 62 | 63 | public static boolean isJnaPresent() { 64 | return jnaPresent; 65 | } 66 | 67 | public static Os getOperatingSystem() { 68 | return os; 69 | } 70 | 71 | private JnaUtil() { } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /ply-util/src/test/java/net/ocheyedan/ply/input/ResourcesTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.input; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | import org.junit.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | 9 | import static junit.framework.Assert.fail; 10 | 11 | /** 12 | * User: blangel 13 | * Date: 11/19/11 14 | * Time: 8:26 AM 15 | */ 16 | public class ResourcesTest { 17 | 18 | @Test 19 | public void parse() throws IOException { 20 | 21 | File testFile = File.createTempFile("resources", "test"); 22 | 23 | // test file 24 | Resource resource = Resources.parse(testFile.getPath(), null); 25 | try { 26 | resource.open(); 27 | } catch (IOException ioe) { 28 | fail(ioe.getMessage()); 29 | } finally { 30 | resource.close(); 31 | } 32 | 33 | // test ~ 34 | File withinHome = new File(FileUtil.pathFromParts(System.getProperty("user.home"), "test.txt")); 35 | withinHome.createNewFile(); 36 | withinHome.deleteOnExit(); 37 | resource = Resources.parse(FileUtil.pathFromParts("~", "test.txt"), null); 38 | try { 39 | resource.open(); 40 | } catch (IOException ioe) { 41 | fail(ioe.getMessage()); 42 | } finally { 43 | resource.close(); 44 | } 45 | 46 | // test uri-syntax file 47 | resource = Resources.parse("file://" + testFile.getPath(), null); 48 | try { 49 | resource.open(); 50 | } catch (IOException ioe) { 51 | fail(ioe.getMessage()); 52 | } finally { 53 | resource.close(); 54 | } 55 | 56 | // test uri - http: 57 | resource = Resources.parse("http://repo1.maven.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.pom", null); 58 | try { 59 | resource.open(); 60 | } catch (IOException ioe) { 61 | fail(ioe.getMessage()); 62 | } finally { 63 | resource.close(); 64 | } 65 | 66 | // test classpath: 67 | resource = Resources.parse("classpath:mock-mvn-repo/commons-logging/commons-logging/1.1.1/maven-metadata.xml", null); 68 | try { 69 | resource.open(); 70 | } catch (IOException ioe) { 71 | fail(ioe.getMessage()); 72 | } finally { 73 | resource.close(); 74 | } 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /ply-util/src/test/java/net/ocheyedan/ply/props/PropFileWriterTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.props; 2 | 3 | import org.junit.Test; 4 | 5 | import java.io.BufferedWriter; 6 | import java.io.IOException; 7 | import java.io.StringWriter; 8 | 9 | import static junit.framework.Assert.assertEquals; 10 | 11 | /** 12 | * User: blangel 13 | * Date: 2/17/12 14 | * Time: 9:46 PM 15 | */ 16 | public class PropFileWriterTest { 17 | 18 | @Test 19 | public void store() throws IOException { 20 | PropFileWriter writer = PropFileWriter.Default; 21 | 22 | StringWriter stringWriter = new StringWriter(); 23 | BufferedWriter bufferedWriter = new BufferedWriter(stringWriter); 24 | 25 | PropFile propFile = new PropFile(Context.named("test"), PropFile.Loc.Local); 26 | propFile.add("key_1", "value_1"); 27 | propFile.add("key_2", "unfilteredValue", " comment line 1\n comment line 2"); 28 | propFile.add("key_3", "value_3 with spaces", "more comments and more and more"); 29 | writer.store(bufferedWriter, propFile); 30 | bufferedWriter.flush(); 31 | stringWriter.flush(); 32 | String propertiesFile = stringWriter.toString(); 33 | assertEquals("key_1=value_1\n" + 34 | "# comment line 1\n" + 35 | "# comment line 2\n" + 36 | "key_2=unfilteredValue\n" + 37 | "#more comments and more and more\n" + 38 | "key_3=value_3 with spaces\n", propertiesFile); 39 | 40 | 41 | stringWriter = new StringWriter(); 42 | bufferedWriter = new BufferedWriter(stringWriter); 43 | 44 | propFile = new PropFile(Context.named("test"), PropFile.Loc.Local); 45 | propFile.add("key=1", "value=1"); 46 | propFile.add("key=2", "unfilteredValue", " comment line = 1\n comment line 2"); 47 | propFile.add("key=3", "value=3 with spaces", "more comments and more and more"); 48 | writer.store(bufferedWriter, propFile); 49 | bufferedWriter.flush(); 50 | stringWriter.flush(); 51 | propertiesFile = stringWriter.toString(); 52 | assertEquals("key\\=1=value\\=1\n" + 53 | "# comment line = 1\n" + 54 | "# comment line 2\n" + 55 | "key\\=2=unfilteredValue\n" + 56 | "#more comments and more and more\n" + 57 | "key\\=3=value\\=3 with spaces\n", propertiesFile); 58 | 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /java-scripts/ply-resources/src/main/java/net/ocheyedan/ply/script/ResourcesScript.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | import net.ocheyedan.ply.Output; 5 | import net.ocheyedan.ply.props.Context; 6 | import net.ocheyedan.ply.props.Props; 7 | 8 | import java.io.File; 9 | import java.io.FilenameFilter; 10 | import java.util.Arrays; 11 | import java.util.HashSet; 12 | import java.util.Set; 13 | 14 | import static net.ocheyedan.ply.props.PropFile.Prop; 15 | 16 | /** 17 | * User: blangel 18 | * Date: 10/14/11 19 | * Time: 1:59 PM 20 | * 21 | * Simply copies {@literal project[.scope].res.dir} to {@literal project[.scope].res.build.dir} priming the resources 22 | * for filtering/packaging/etc. 23 | */ 24 | public final class ResourcesScript { 25 | 26 | public static void main(String[] args) { 27 | Prop resourcesDirProp = Props.get("res.dir", Context.named("project")); 28 | Prop resourcesBuildDirProp = Props.get("res.build.dir", Context.named("project")); 29 | String resourcesExclusionPropValue = Props.get("exclude", Context.named("resources")).value(); 30 | if (Prop.Empty.equals(resourcesDirProp) || Prop.Empty.equals(resourcesBuildDirProp)) { 31 | Output.print("^error^ Could not find properties 'project.res.dir' or 'project.res.build.dir'"); 32 | System.exit(1); 33 | } 34 | String[] split = resourcesExclusionPropValue.split(","); 35 | final Set exclusions = new HashSet(Arrays.asList(split)); 36 | 37 | File resDir = new File(resourcesDirProp.value()); 38 | if (!resDir.exists()) { 39 | // nothing to copy. 40 | Output.print("^dbug^ No resources to copy."); 41 | return; 42 | } 43 | 44 | File resBuildDir = new File(resourcesBuildDirProp.value()); 45 | FilenameFilter excluding = (exclusions.isEmpty() ? null : new FilenameFilter() { 46 | @Override public boolean accept(File dir, String name) { 47 | return exclusions.contains(name); 48 | } 49 | }); 50 | if (!FileUtil.copyDir(resDir, resBuildDir, excluding)) { 51 | Output.print("^error^ Could not copy resources directory (%s) to resources build directory (%s).", 52 | resourcesDirProp.value(), resourcesBuildDirProp.value()); 53 | System.exit(1); 54 | } 55 | } 56 | 57 | private ResourcesScript() { } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/config/Remove.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd.config; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | import net.ocheyedan.ply.PlyUtil; 5 | import net.ocheyedan.ply.cmd.Args; 6 | import net.ocheyedan.ply.cmd.Usage; 7 | import net.ocheyedan.ply.props.Context; 8 | import net.ocheyedan.ply.props.PropFile; 9 | import net.ocheyedan.ply.props.PropFiles; 10 | import net.ocheyedan.ply.props.Scope; 11 | 12 | /** 13 | * User: blangel 14 | * Date: 1/1/12 15 | * Time: 3:45 PM 16 | * 17 | * A {@link net.ocheyedan.ply.cmd.Command} to remove a property from a project's configuration. 18 | */ 19 | public final class Remove extends Config { 20 | 21 | static class Opts { 22 | final Scope scope; 23 | final Context context; 24 | final String propName; 25 | 26 | Opts(Scope scope, Context context, String propName) { 27 | this.scope = scope; 28 | this.context = context; 29 | this.propName = propName; 30 | } 31 | } 32 | 33 | public Remove(Args args) { 34 | super(args); 35 | } 36 | 37 | @Override protected void runAfterAssumptionsCheck() { 38 | Opts opts = parse(args); 39 | if (opts == null) { 40 | new Usage(args).run(); 41 | return; 42 | } 43 | String path = FileUtil.pathFromParts(PlyUtil.LOCAL_CONFIG_DIR.getPath(), 44 | opts.context.name + opts.scope.getFileSuffix() + ".properties"); 45 | PropFile properties = new PropFile(opts.context, opts.scope, PropFile.Loc.Local); 46 | PropFiles.load(path, properties, true); 47 | properties.remove(opts.propName); 48 | if (properties.isEmpty()) { 49 | FileUtil.fromParts(path).delete(); 50 | } else { 51 | PropFiles.store(properties, path, true); 52 | } 53 | } 54 | 55 | @SuppressWarnings("fallthrough") 56 | Opts parse(Args args) { 57 | Scope scope = Scope.Default; 58 | int scopeIndex = args.args.get(0).indexOf(":"); 59 | if (scopeIndex != -1) { 60 | scope = Scope.named(args.args.get(0).substring(0, scopeIndex)); 61 | } 62 | switch (args.args.size()) { 63 | case 4: 64 | if ("from".equals(args.args.get(2))) { 65 | String propName = args.args.get(1); 66 | return new Opts(scope, new Context(args.args.get(3)), propName); 67 | } // fall-through 68 | default: 69 | return null; 70 | } 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/dep/visitors/DependencyVisitors.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.dep.visitors; 2 | 3 | import org.objectweb.asm.Type; 4 | import org.objectweb.asm.signature.SignatureReader; 5 | import org.objectweb.asm.signature.SignatureVisitor; 6 | 7 | import java.util.Set; 8 | 9 | /** 10 | * User: blangel 11 | * Date: 8/18/14 12 | * Time: 4:08 PM 13 | */ 14 | class DependencyVisitors { 15 | 16 | static void addName(String name, Dependencies dependencies) { 17 | if (name == null) { 18 | return; 19 | } 20 | // decode arrays 21 | if (name.startsWith("[L") && name.endsWith(";")) { 22 | name = name.substring(2, name.length() - 1); 23 | } 24 | // decode internal representation 25 | name = name.replace('/', '.'); 26 | 27 | dependencies.add(name); 28 | } 29 | 30 | static void addNames(String[] names, Dependencies dependencies) { 31 | if (names == null) { 32 | return; 33 | } 34 | for (String name : names) { 35 | addName(name, dependencies); 36 | } 37 | } 38 | 39 | static void addType(Type type, Dependencies dependencies) { 40 | if (type == null) { 41 | return; 42 | } 43 | switch (type.getSort()) { 44 | case Type.ARRAY: 45 | addType(type.getElementType(), dependencies); 46 | break; 47 | case Type.OBJECT: 48 | addName(type.getClassName(), dependencies); 49 | break; 50 | } 51 | } 52 | 53 | static void addDescription(String description, Dependencies dependencies) { 54 | addType(Type.getType(description), dependencies); 55 | } 56 | 57 | static void addMethodDescription(String methodDescription, Dependencies dependencies) { 58 | addType(Type.getReturnType(methodDescription), dependencies); 59 | Type[] types = Type.getArgumentTypes(methodDescription); 60 | for (Type type : types) { 61 | addType(type, dependencies); 62 | } 63 | } 64 | 65 | static void addSignature(String signature, SignatureVisitor signatureVisitor) { 66 | if (signature == null) { 67 | return; 68 | } 69 | new SignatureReader(signature).accept(signatureVisitor); 70 | } 71 | 72 | static void addTypeSignature(String signature, SignatureVisitor signatureVisitor) { 73 | if (signature == null) { 74 | return; 75 | } 76 | new SignatureReader(signature).acceptType(signatureVisitor); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/Usage.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd; 2 | 3 | import net.ocheyedan.ply.Output; 4 | import net.ocheyedan.ply.OutputExt; 5 | 6 | /** 7 | * User: blangel 8 | * Date: 12/30/11 9 | * Time: 2:49 PM 10 | * 11 | * A {@link Command} to print the usage information. 12 | */ 13 | public final class Usage extends Command { 14 | 15 | public Usage(Args args) { 16 | super(args); 17 | } 18 | 19 | @Override public void run() { 20 | OutputExt.init(); 21 | Output.print("ply <^b^command^r^> [--usage|--help|--version] [-PadHocProp]"); 22 | Output.print(" where ^b^command^r^ is either:"); 23 | Output.print(" ^b^init^r^"); 24 | Output.print(" initializes the current directory as a ply project"); 25 | Output.print(" ^b^update^r^"); 26 | Output.print(" checks for updates to the ply system itself"); 27 | Output.print(" ^b^describe^r^"); 28 | Output.print(" lists all local contexts and any non-default scopes"); 29 | Output.print(" ^b^get^r^ [propName] [from ^b^context^r^] [--unfiltered]"); 30 | Output.print(" lists all project properties or, if specified, those like '^b^propName^r^' within '^b^context^r^'"); 31 | Output.print(" ^b^get-all^r^ [propName] [from ^b^context^r^] [--unfiltered]"); 32 | Output.print(" same as the '^b^get^r^' command but also lists non-project properties (i.e., system defaults)."); 33 | Output.print(" ^b^set^r^ propName=propValue in ^b^context^r^"); 34 | Output.print(" sets '^b^propName^r^' equal to '^b^propValue^r^' within '^b^context^r^' for the project"); 35 | Output.print(" ^b^append^r^ propValue to propName in ^b^context^r^"); 36 | Output.print(" appends '^b^propValue^r^' to the value of '^b^propName^r^' within '^b^context^r^' for the project"); 37 | Output.print(" ^b^prepend^r^ propValue to propName in ^b^context^r^"); 38 | Output.print(" prepends '^b^propValue^r^' to the value of '^b^propName^r^' within '^b^context^r^' for the project"); 39 | Output.print(" ^b^rm^r^ propName from ^b^context^r^"); 40 | Output.print(" removes '^b^propName^b^' from '^b^context^r^' for the project"); 41 | Output.print(" <^b^build-scripts^r^>"); 42 | Output.print(" a space delimited list of build scripts; i.e., ^b^ply clean \"myscript opt1\" compile test^r^"); 43 | Output.print(" and ^b^-PadHocProp^r^ is zero to many ad-hoc properties prefixed with ^b^-P^r^ in the format ^b^context[#scope].propName=propValue^r^"); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/org/codehaus/jackson/jackson-core-asl/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.codehaus.jackson 4 | jackson-core-asl 5 | 0.9.8 6 | 7 | 8 | 0.9.8 9 | 0.9.7 10 | 0.9.9 11 | 0.9.9-2 12 | 0.9.9-3 13 | 0.9.9-4 14 | 0.9.9-5 15 | 0.9.9-6 16 | 1.0.0 17 | 1.0.1 18 | 1.1.0 19 | 1.1.1 20 | 1.1.2 21 | 1.2.0 22 | 1.2.1 23 | 1.3.0 24 | 1.3.1 25 | 1.3.2 26 | 1.4.0 27 | 1.3.3 28 | 1.4.1 29 | 1.4.2 30 | 1.3.4 31 | 1.3.5 32 | 1.4.3 33 | 1.5.0 34 | 1.5.1 35 | 1.5.2 36 | 1.4.4 37 | 1.5.3 38 | 1.4.5 39 | 1.5.4 40 | 1.5.5 41 | 1.5.6 42 | 1.6.0 43 | 1.5.7 44 | 1.6.1 45 | 1.6.2 46 | 1.6.3 47 | 1.6.4 48 | 1.5.8 49 | 1.7.0 50 | 1.7.1 51 | 1.6.5 52 | 1.7.2 53 | 1.6.6 54 | 1.7.3 55 | 1.7.4 56 | 1.6.7 57 | 1.7.5 58 | 1.7.6 59 | 1.8.0 60 | 1.7.7 61 | 1.8.1 62 | 1.8.2 63 | 1.7.8 64 | 1.8.3 65 | 1.8.4 66 | 1.6.9 67 | 1.8.5 68 | 1.7.9 69 | 1.9.0 70 | 1.8.6 71 | 1.9.1 72 | 1.9.2 73 | 74 | 20111105024007 75 | 76 | 77 | -------------------------------------------------------------------------------- /java-scripts/ply-test-junit/src/main/java/net/ocheyedan/ply/script/DescriptionMatcher.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script; 2 | 3 | import net.ocheyedan.ply.AntStyleWildcardUtil; 4 | import org.junit.runner.Description; 5 | import org.junit.runner.manipulation.Filter; 6 | 7 | import java.util.regex.Pattern; 8 | 9 | /** 10 | * User: blangel 11 | * Date: 10/13/11 12 | * Time: 6:06 PM 13 | * 14 | * Given an ant-style wildcard path, will match package.class#method's for test execution. 15 | */ 16 | public class DescriptionMatcher extends Filter { 17 | 18 | private final String match; 19 | 20 | private final Pattern classOnlyPattern; 21 | 22 | private final Pattern pattern; 23 | 24 | public DescriptionMatcher(String match) { 25 | this.match = match.replaceAll("\\.", "/"); // normalize to '/' 26 | String regex = this.match; 27 | String prefix = "", suffix = ""; 28 | // if no package specified, use any 29 | if (!regex.contains("/") && !regex.startsWith("**")) { 30 | prefix = ".*?/"; 31 | } 32 | // if no method specified, use any 33 | String packageClassOnly = regex; 34 | if (!regex.contains("#")) { 35 | suffix = "#.*"; 36 | } else { 37 | packageClassOnly = regex.substring(0, regex.indexOf("#")); 38 | } 39 | 40 | regex = AntStyleWildcardUtil.regexString(regex); 41 | packageClassOnly = AntStyleWildcardUtil.regexString(packageClassOnly); 42 | this.pattern = Pattern.compile(prefix + regex + suffix); 43 | this.classOnlyPattern = Pattern.compile(prefix + packageClassOnly); 44 | } 45 | 46 | @Override public boolean shouldRun(Description description) { 47 | if (description.getMethodName() == null) { 48 | String toMatch = description.getClassName(); 49 | toMatch = toMatch.replaceAll("\\.", "/"); // normalize to '/' 50 | if (!classOnlyPattern.matcher(toMatch).matches()) { 51 | return false; 52 | } 53 | for (Description child : description.getChildren()) { 54 | String fullMatch = toMatch + "#" + child.getMethodName(); 55 | if (pattern.matcher(fullMatch).matches()) { 56 | return true; 57 | } 58 | } 59 | return false; 60 | } else { 61 | String toMatch = (description.getClassName() + "#" + description.getMethodName()); 62 | toMatch = toMatch.replaceAll("\\.", "/"); // normalize to '/' 63 | return pattern.matcher(toMatch).matches(); 64 | } 65 | } 66 | 67 | @Override public String describe() { 68 | return match; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/EmptyConcurrentMap.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | import java.util.Collection; 4 | import java.util.Collections; 5 | import java.util.Map; 6 | import java.util.Set; 7 | import java.util.concurrent.ConcurrentMap; 8 | 9 | /** 10 | * User: blangel 11 | * Date: 2/21/12 12 | * Time: 9:45 PM 13 | */ 14 | public final class EmptyConcurrentMap implements ConcurrentMap { 15 | 16 | @SuppressWarnings("unchecked") 17 | public static EmptyConcurrentMap get() { 18 | return (EmptyConcurrentMap) EMPTY_CONCURRENT_MAP; 19 | } 20 | 21 | private static final EmptyConcurrentMap EMPTY_CONCURRENT_MAP = new EmptyConcurrentMap(); 22 | 23 | private final Map delegate = Collections.emptyMap(); 24 | 25 | private EmptyConcurrentMap() { } 26 | 27 | @Override public V putIfAbsent(K key, V value) { 28 | return null; 29 | } 30 | 31 | @Override public boolean remove(Object key, Object value) { 32 | return false; 33 | } 34 | 35 | @Override public boolean replace(K key, V oldValue, V newValue) { 36 | return false; 37 | } 38 | 39 | @Override public V replace(K key, V value) { 40 | return null; 41 | } 42 | 43 | @Override public int size() { 44 | return delegate.size(); 45 | } 46 | 47 | @Override public boolean isEmpty() { 48 | return delegate.isEmpty(); 49 | } 50 | 51 | @Override public boolean containsKey(Object key) { 52 | return delegate.containsKey(key); 53 | } 54 | 55 | @Override public boolean containsValue(Object value) { 56 | return delegate.containsValue(value); 57 | } 58 | 59 | @Override public V get(Object key) { 60 | return delegate.get(key); 61 | } 62 | 63 | public V put(K key, V value) { 64 | return delegate.put(key, value); 65 | } 66 | 67 | @Override public V remove(Object key) { 68 | return delegate.remove(key); 69 | } 70 | 71 | @Override public void putAll(Map m) { 72 | delegate.putAll(m); 73 | } 74 | 75 | @Override public void clear() { 76 | delegate.clear(); 77 | } 78 | 79 | @Override public Set keySet() { 80 | return delegate.keySet(); 81 | } 82 | 83 | @Override public Collection values() { 84 | return delegate.values(); 85 | } 86 | 87 | @Override public Set> entrySet() { 88 | return delegate.entrySet(); 89 | } 90 | 91 | @Override public boolean equals(Object o) { 92 | return delegate.equals(o); 93 | } 94 | 95 | @Override public int hashCode() { 96 | return delegate.hashCode(); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /docs/Aliases.md: -------------------------------------------------------------------------------- 1 | Aliases 2 | ------- 3 | 4 | Aliases in ply are analogous to aliases within bash. A word substitutes for a series of other aliases and/or scripts. For instance, by default in ply, `compile` is 5 | an alias which expands to be `file-changed dep ply-compiler-1.0.jar`. The `file-changed` is itself another alias which expands to be the script `ply-file-changed-1.0.jar` and `dep` is also 6 | another alias which expands to be the script `ply-dependency-manager-1.0.jar`. The `ply-compiler-1.0.jar` is simply a script. So, typing 7 | 8 | $ ply compile 9 | 10 | is simply shorthand for typing 11 | 12 | $ ply ply-file-changed-1.0.jar ply-dependency-manager-1.0.jar ply-compiler-1.0.jar 13 | 14 | Aliases are defined to be properties from within context `aliases`. In other words, to define an alias simply add the alias as a property name and value pair within the `aliases.properties` file. Of course 15 | you can use `ply` itself to do the same thing. For instance, to add an alias named `example` to be `echo you`: 16 | 17 | $ ply set 'example=`echo you`' in aliases 18 | 19 | Note the use of tick marks. See [Scripts](Scripts.md) for an explanation. 20 | 21 | Like any other properties, aliases can be overridden. For example, one could augment the `compile` alias by appending other aliases/scripts to its definition: 22 | 23 | $ ply append example to compile in aliases 24 | 25 | Which would append the script `example` (which is actually an another alias in this case) to the already defined value of `compile`. This makes the expanded value of `compile` to be: 26 | 27 | $ ply ply-file-changed-1.0.jar ply-dependency-manager-1.0.jar ply-compiler-1.0.jar `echo you` 28 | 29 | Alternatively, one could indirectly change `compile` by changing one of the aliases defined within it. For instance, now that `compile` is defined to include the `example` alias, one could 30 | change the `example` alias and indirectly affect the expanded `compile` alias: 31 | 32 | $ ply prepend '`echo hello`' to example in aliases 33 | 34 | Which means that when `compile` is fully resolved it becomes: 35 | 36 | $ ply ply-file-changed-1.0.jar ply-dependency-manager-1.0.jar ply-compiler-1.0.jar `echo hello` `echo you` 37 | 38 | Changing an alias need not just be appending or prepending. One can completely override its value too. For instance to make `compile` simply an alias for `echo hello` one could: 39 | 40 | $ ply set 'compile=`echo hello`' in aliases 41 | 42 | Setting and modifying aliases is in fact a powerful tool in allowing projects to customize their build lifecycles in any way they like. To see all the default aliases provided by ply: 43 | 44 | $ ply get-all from aliases 45 | 46 | or 47 | 48 | $ less $PLY_HOME/config/aliases.properties 49 | -------------------------------------------------------------------------------- /dist/ply/config/compiler.properties: -------------------------------------------------------------------------------- 1 | # where to place the compiled files. 2 | build.path=${project.build.dir}/classes 3 | # where to place generated source files (i.e., files automatically generated as part of the build process) 4 | generated.src.path=${build.path} 5 | # where to place the class dependencies files. 6 | class.deps=${project.build.dir}/classdeps 7 | # true to include debug information in the compiled files. 8 | debug=true 9 | # true to print messages from the concrete compiler. 10 | verbose=false 11 | # true to optimize the compiled code using the concrete compiler's optimization mechanisms 12 | optimize=true 13 | # true to show concrete compiler's warning messages (see java.warningsLevel for configuration of 14 | # which warnings are displayed). 15 | warnings=true 16 | # the -source argument for the java compiler, note only 1.6+ is supported. 17 | # null implies value of System.getProperty("java.version") 18 | java.source= 19 | # the -target argument for the java compiler, note only 1.6+ is supported. 20 | # null implies value of System.getProperty("java.version") 21 | java.target= 22 | # a comma delimited list of warning names (which may be prefaced with a '-' to indicate disabling). 23 | # for a complete list of available names for 1.6 see xlint warnings here: 24 | # http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javac.html 25 | # and for 1.7 see http://download.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html#xlintwarnings 26 | # If 'warnings' property is false, this property is irrelevant. 27 | # set to 'all' so that 'ply config --compiler append java.warningsLevel -serial' does the 28 | # expected thing (show all warnings except serial). 29 | java.warningsLevel=all 30 | # true to output deprecation warnings in the java compiler 31 | java.deprecation=false 32 | # the source file encoding 33 | # null will result in the platform encoding 34 | java.encoding= 35 | # comma-separated list of levels to be appended to the '-g' debug switch for the java compiler. 36 | # valid levels are 'lines', 'vars', 'source'. 37 | # if 'debug' property is false, this property is irrelevant. 38 | java.debugLevel= 39 | # either 'none' or 'only' see javac "-proc:" option for details 40 | # null will be ignored 41 | java.proc= 42 | # the path for which to search for annotation processors 43 | # null will be ignored 44 | java.processorpath= 45 | # explicitly defined class names (separated by commas) of annotation processors 46 | # null will be ignored 47 | java.processor= 48 | # see "-implicit:" option for details 49 | # null will be ignored 50 | java.implicit= 51 | # to specify java annotation keys (see -A in javac) simply provide properties named java.Akey=value 52 | # e.g. to provide the following javac option "-Afoo=bar" you'd make a property here "java.Afoo=bar" 53 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/config/Set.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd.config; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | import net.ocheyedan.ply.PlyUtil; 5 | import net.ocheyedan.ply.cmd.Args; 6 | import net.ocheyedan.ply.cmd.Usage; 7 | import net.ocheyedan.ply.props.Context; 8 | import net.ocheyedan.ply.props.PropFile; 9 | import net.ocheyedan.ply.props.PropFiles; 10 | import net.ocheyedan.ply.props.Scope; 11 | 12 | /** 13 | * User: blangel 14 | * Date: 12/30/11 15 | * Time: 2:52 PM 16 | * 17 | * A {@link net.ocheyedan.ply.cmd.Command} to set a property value within the project's configuration. 18 | */ 19 | public final class Set extends Config { 20 | 21 | static class Opts { 22 | final Scope scope; 23 | final Context context; 24 | final String propName; 25 | final String propValue; 26 | 27 | Opts(Scope scope, Context context, String propName, String propValue) { 28 | this.scope = scope; 29 | this.context = context; 30 | this.propName = propName; 31 | this.propValue = propValue; 32 | } 33 | } 34 | 35 | public Set(Args args) { 36 | super(args); 37 | } 38 | 39 | @Override protected void runAfterAssumptionsCheck() { 40 | Opts opts = parse(args); 41 | if (opts == null) { 42 | new Usage(args).run(); 43 | return; 44 | } 45 | String path = FileUtil.pathFromParts(PlyUtil.LOCAL_CONFIG_DIR.getPath(), opts.context.name 46 | + opts.scope.getFileSuffix() + ".properties"); 47 | PropFile properties = new PropFile(opts.context, opts.scope, PropFile.Loc.Local); 48 | PropFiles.load(path, properties, true); 49 | properties.remove(opts.propName); 50 | properties.add(opts.propName, opts.propValue); 51 | PropFiles.store(properties, path, true); 52 | } 53 | 54 | @SuppressWarnings("fallthrough") 55 | Opts parse(Args args) { 56 | Scope scope = Scope.Default; 57 | int scopeIndex = args.args.get(0).indexOf(":"); 58 | if (scopeIndex != -1) { 59 | scope = Scope.named(args.args.get(0).substring(0, scopeIndex)); 60 | } 61 | switch (args.args.size()) { 62 | case 4: 63 | if ("in".equals(args.args.get(2)) && args.args.get(1).contains("=")) { 64 | int index = args.args.get(1).indexOf("="); 65 | String propName = args.args.get(1).substring(0, index); 66 | String propValue = args.args.get(1).substring(index + 1); 67 | return new Opts(scope, new Context(args.args.get(3)), propName, propValue); 68 | } // fall-through 69 | default: 70 | return null; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/dep/Auth.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.dep; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 1/9/13 8 | * Time: 7:26 PM 9 | * 10 | * Authorization definition for accessing secured repositories. 11 | */ 12 | public interface Auth { 13 | 14 | /** 15 | * Callback for {@link net.ocheyedan.ply.dep.Auth#acquireAccess(Acquisition)}. 16 | */ 17 | static interface Acquisition { 18 | /** 19 | * @param username of the user 20 | * @param encryptedPwd of the user 21 | * @return auth-token or similar for the given implementation 22 | */ 23 | String getAccess(String username, String encryptedPwd); 24 | } 25 | 26 | String getUsername(); 27 | 28 | String getEncryptedPwd(); 29 | 30 | RepositoryAtom getRepositoryAtom(); 31 | 32 | /** 33 | * @return the property value to save into the {@link net.ocheyedan.ply.props.Context} named {@literal repomngr} 34 | */ 35 | String getPropertyValue(); 36 | 37 | /** 38 | * @param remotePathDir path into the remote repository where the artifact is located 39 | * @param dependencyAtom represents the artifact for which to get its path 40 | * @return the path to the artifact associated with {@code dependencyAtom} within {@code remotePathDir} 41 | */ 42 | String getArtifactPath(String remotePathDir, DependencyAtom dependencyAtom); 43 | 44 | /** 45 | * Note for some implementations this will delegate to {@linkplain #getPath(String, String)} 46 | * @param remotePathDir path into the remote repository where the dependencies file is located 47 | * @param name represents the dependencies file for which to get the path (typically {@literal dependencies.properties}) 48 | * @return the path to the dependencies file found within {@code remotePathDir} on the remote repository 49 | */ 50 | String getDependenciesPath(String remotePathDir, String name); 51 | 52 | /** 53 | * @param remotePathDir path into the remote repository where the {@code fileName} file is located 54 | * @param fileName within the repository 55 | * @return the path to the {@code fileName} within {@code remotePathDir} on the remote repository 56 | */ 57 | String getPath(String remotePathDir, String fileName); 58 | 59 | /** 60 | * @return {@literal http} headers necessary when interacting with the remote repository 61 | */ 62 | Map getHeaders(); 63 | 64 | /** 65 | * Called at creation to pre-seed any authorization token information, etc. This may be a no-op depending 66 | * upon the implementation. 67 | * @param acquisition to be used to acquire access. 68 | */ 69 | void acquireAccess(Acquisition acquisition); 70 | 71 | } 72 | -------------------------------------------------------------------------------- /java-scripts/ply-repo-manager/src/main/java/net/ocheyedan/ply/script/github/Authorization.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.script.github; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | /** 6 | * User: blangel 7 | * Date: 1/10/13 8 | * Time: 10:01 AM 9 | * 10 | * From calling {@literal https://api.github.com/authorizations} 11 | * { 12 | * "created_at": "2012-04-26T16:32:16Z", 13 | * "app": { 14 | * "url": "http://dillinger.io", 15 | * "name": "Dillinger" 16 | * }, 17 | * "note": null, 18 | * "token": "xxxxxx", 19 | * "token_last_eight": "xxxx", 20 | * "hashed_token": "xxxxxxxxxx", 21 | * "fingerprint": "xxxxxx", 22 | * "url": "https://api.github.com/authorizations/323907", 23 | * "updated_at": "2012-04-26T16:32:16Z", 24 | * "scopes": [ 25 | * "repo" 26 | * ], 27 | * "note_url": null, 28 | * "id": 323907 29 | * } 30 | */ 31 | public class Authorization { 32 | 33 | private final String note; 34 | 35 | private final String token; 36 | 37 | @JsonProperty("token_last_eight") 38 | private final String tokenLastEight; 39 | 40 | @JsonProperty("hashed_token") 41 | private final String hashToken; 42 | 43 | @JsonProperty("fingerprint") 44 | private final String fingerPrint; 45 | 46 | private final App app; 47 | 48 | private final String url; 49 | 50 | private final String[] scopes; 51 | 52 | private final String id; 53 | 54 | private Authorization() { 55 | this(null, null, null, null, null, null, null, null, null); 56 | } 57 | 58 | public Authorization(String note, String token, String tokenLastEight, String hashToken, String fingerPrint, App app, String url, String[] scopes, String id) { 59 | this.note = note; 60 | this.token = token; 61 | this.tokenLastEight = tokenLastEight; 62 | this.hashToken = hashToken; 63 | this.fingerPrint = fingerPrint; 64 | this.app = app; 65 | this.url = url; 66 | this.scopes = scopes; 67 | this.id = id; 68 | } 69 | 70 | public String getNote() { 71 | return note; 72 | } 73 | 74 | public String getToken() { 75 | return token; 76 | } 77 | 78 | public String getTokenLastEight() { 79 | return tokenLastEight; 80 | } 81 | 82 | public String getHashToken() { 83 | return hashToken; 84 | } 85 | 86 | public String getFingerPrint() { 87 | return fingerPrint; 88 | } 89 | 90 | public App getApp() { 91 | return app; 92 | } 93 | 94 | public String getUrl() { 95 | return url; 96 | } 97 | 98 | public String[] getScopes() { 99 | return scopes; 100 | } 101 | 102 | public String getId() { 103 | return id; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/org/slf4j/slf4j-jdk14/1.5.11/slf4j-jdk14-1.5.11.pom: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | org.slf4j 8 | slf4j-parent 9 | 1.5.11 10 | 11 | 12 | 4.0.0 13 | 14 | org.slf4j 15 | slf4j-jdk14 16 | 17 | jar 18 | SLF4J JDK14 Binding 19 | 20 | http://www.slf4j.org 21 | 22 | The slf4j JDK14 binding 23 | 24 | 25 | 26 | 27 | org.slf4j 28 | slf4j-api 29 | 30 | 31 | 32 | 33 | log4j 34 | log4j 35 | 1.2.16 36 | provided 37 | 38 | 39 | 40 | org.slf4j 41 | slf4j-api 42 | test-jar 43 | ${project.version} 44 | test 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.apache.maven.plugins 53 | maven-compiler-plugin 54 | 55 | 1.4 56 | 1.4 57 | 58 | 59 | 60 | 61 | org.apache.maven.plugins 62 | maven-jar-plugin 63 | 64 | 65 | 66 | ${parsedVersion.osgiVersion} 67 | ${project.description} 68 | ${project.version} 69 | 70 | ${project.build.outputDirectory}/META-INF/MANIFEST.MF 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/Iter.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply; 2 | 3 | import java.util.Collection; 4 | import java.util.Iterator; 5 | 6 | /** 7 | * User: blangel 8 | * Date: 1/5/12 9 | * Time: 2:49 PM 10 | * 11 | * Provides utility methods when interacting with {@link Iterable} object in java. 12 | */ 13 | public final class Iter { 14 | 15 | /** 16 | * Extends {@link Iterable} to expose size information. 17 | * @param type of the underlying collection/array 18 | */ 19 | public static interface Sized extends Iterable { 20 | int size(); 21 | } 22 | 23 | private static final class ArrayIterable implements Sized { 24 | private final T[] array; 25 | private ArrayIterable(T[] array) { 26 | this.array = array; 27 | } 28 | @Override public Iterator iterator() { 29 | return new Iterator() { 30 | int index = 0; 31 | @Override public boolean hasNext() { 32 | return (index < array.length); 33 | } 34 | @Override public T next() { 35 | return array[index++]; 36 | } 37 | @Override public void remove() { 38 | throw new UnsupportedOperationException(); 39 | } 40 | }; 41 | } 42 | @Override public int size() { 43 | return array.length; 44 | } 45 | } 46 | 47 | private static final class CollectionIterable implements Sized { 48 | private final Collection collection; 49 | private CollectionIterable(Collection collection) { 50 | this.collection = collection; 51 | } 52 | @Override public Iterator iterator() { 53 | return collection.iterator(); 54 | } 55 | @Override public int size() { 56 | return collection.size(); 57 | } 58 | } 59 | 60 | /** 61 | * Converts {@code array} into an {@link Sized} object without copying the array into a collection. 62 | * @param array to convert 63 | * @param type of the elements within {@code array} 64 | * @return an {@link Sized} over the elements of {@code collection} 65 | */ 66 | public static Sized sized(T[] array) { 67 | return (array == null ? null : new ArrayIterable(array)); 68 | } 69 | 70 | /** 71 | * Converts {@code collection} into an {@link Sized} object without copying the collection. 72 | * @param collection to convert 73 | * @param type of the elements within {@code collection} 74 | * @return an {@link Sized} over the elements of {@code collection} 75 | */ 76 | public static Sized sized(Collection collection) { 77 | return (collection == null ? null : new CollectionIterable(collection)); 78 | } 79 | 80 | private Iter() { } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /docs/Dependencies.md: -------------------------------------------------------------------------------- 1 | Dependencies 2 | ------------- 3 | 4 | Ply handles dependencies in much the same way as __maven__. Dependencies are installed into repositories (which can be local or remote) and then downloaded when necessary. In fact, Ply piggy-backs off of the central __maven__ repository by default (see `ply get-all from repositories`). Dependencies are described in an atom format: 5 | 6 | namespace:name:version[:artifactName] 7 | 8 | where the `artifactName` is optionally specified and defaults to be `${name}-${version}.${packaging}`. 9 | 10 | To add a dependency to a project you can add the dependency into the `dependencies.properties` file, however, this will not resolve the dependency (i.e., download the dependency thus ensuring that it is available) until the next time the `dep` alias is run (e.g., during compilation). You can use the `dep` script itself to add a dependency and force resolution immediately: 11 | 12 | $ ply dep add namespace:name:version 13 | 14 | Just like __maven__, if you add a dependency to a project which itself has dependencies, these transitive dependencies are incorporated where necessary. To see all transitive and direct dependencies of your project, run the following: 15 | 16 | $ ply dep tree 17 | 18 | Scoped Dependencies 19 | ------------------- 20 | 21 | If you haven't already, read [Scopes](Scopes.md) for a general description of what scopes are in Ply. With respect to dependencies, we use scopes to indicate to Ply that certain dependencies are only applicable in certain circumstances. The most familiar example would be test scoped dependencies. For instance, suppose we want to add a dependency to our project but only want that dependency utilized when we are running within the _test_ scope. We can accomplish that by adding the dependency to the `dependencies.test.properties` file or adding via `dep` run within scope _test_; e.g., to add a _test_ scoped dependency to the [Junit](http://www.junit.org/) project we would: 22 | 23 | $ ply test:dep add junit:junit:4.10 24 | 25 | The junit dependency has now been added but only within the _test_ scope. To visualize our _test_ dependencies we issue the same _tree_ command but scope it with _test_: 26 | 27 | $ ply test:dep tree 28 | 29 | Transient Dependencies 30 | ---------------------- 31 | 32 | Transient dependencies let others know that when they use your project the dependency is not necessary in order to work correctly. Transient dependencies are available on the compilation classpath but are not exported into packages (war/uber-jar/etc) or pulled in as transitive dependencies. One example of where this is necessary is when your project provides two implementations of the same feature. For instance, suppose your project provides caching support and can work with either the [memcache](http://memcached.org/) or [ehcache](http://ehcache.org/) libraries. Your project will need to compile with both but dependent projects will not. Those dependent projects would depend upon your project and then, directly, on whichever cache library they choose. 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/Command.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd; 2 | 3 | import net.ocheyedan.ply.Output; 4 | import net.ocheyedan.ply.PlyUtil; 5 | import net.ocheyedan.ply.SystemExit; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 12/22/11 10 | * Time: 11:03 AM 11 | * 12 | * Represents a command given to Ply from the user via the command line. 13 | */ 14 | public abstract class Command implements Runnable { 15 | 16 | /** 17 | * Represents {@link Command} implementations which have assumptions which need to be met to be executed. This class 18 | * ensures that the {@link PlyUtil#SYSTEM_CONFIG_DIR} directory exists. 19 | */ 20 | public abstract static class SystemReliant extends Command { 21 | 22 | protected SystemReliant(Args args) { 23 | super(args); 24 | } 25 | 26 | @Override public final void run() { 27 | runBeforeAssumptionsCheck(); 28 | checkAssumptions(); 29 | runAfterAssumptionsCheck(); 30 | } 31 | 32 | /** 33 | * The implementations' {@link #run()} method to implement. This will ensure implementations don't forget 34 | * to call {@link super#run()} which will likely circumvent the {@link #checkAssumptions()} call. 35 | */ 36 | protected abstract void runAfterAssumptionsCheck(); 37 | 38 | /** 39 | * The implementations' hook into doing something before the {@link #checkAssumptions()} is done. 40 | */ 41 | protected abstract void runBeforeAssumptionsCheck(); 42 | 43 | /** 44 | * Performs sanity checks that the ply system configuration directory exists. 45 | */ 46 | protected void checkAssumptions() { 47 | if (!PlyUtil.SYSTEM_CONFIG_DIR.exists()) { 48 | Output.print("^error^ the ply install directory is corrupt, please re-install."); 49 | throw new SystemExit(1); 50 | } 51 | } 52 | } 53 | 54 | /** 55 | * Represents {@link Command.SystemReliant} implementations which has an additional assumption. This class 56 | * ensures that the {@link net.ocheyedan.ply.PlyUtil#SYSTEM_CONFIG_DIR} and 57 | * {@link net.ocheyedan.ply.PlyUtil#LOCAL_CONFIG_DIR} directories exist. 58 | */ 59 | public abstract static class ProjectReliant extends SystemReliant { 60 | 61 | protected ProjectReliant(Args args) { 62 | super(args); 63 | } 64 | 65 | /** 66 | * Performs sanity checks on what ply assumes to exist. 67 | */ 68 | @Override 69 | protected void checkAssumptions() { 70 | super.checkAssumptions(); 71 | if (!PlyUtil.LOCAL_CONFIG_DIR.exists()) { 72 | Output.print( 73 | "^warn^ not a ply project (or any of the parent directories), please initialize first: ^b^ply init^r^."); 74 | throw new SystemExit(1); 75 | } 76 | } 77 | } 78 | 79 | public final Args args; 80 | 81 | protected Command(Args args) { 82 | this.args = args; 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /docs/Scripts.md: -------------------------------------------------------------------------------- 1 | Scripts 2 | ------- 3 | Scripts are anything executable; a bash script, perl script, ruby script, groovy script, etc. A script can even be a java 4 | jar file with a main method specified in its manifest. 5 | Ply resolves scripts through the following sequence: 6 | 7 | -1- First check to see if it is an alias, if so expand it (see [Aliases](Aliases.md) for more information). For each expanded 8 | value go back to -1-. If there is nothing to expand go to -2-. 9 | 10 | -2- Then check for an executable script of the same name within the project's scripts directory (defined to be the value of a property named `scripts.dir` 11 | within context `project`; see [Properties](Properties.md) for a general description of properties) This particular property defaults to _scripts_ relative to the project directory (so if 12 | your project is located at `~/projects/myproject` its scripts directory would default to be `~/projects/myproject/scripts`). If such a script is found, invoke it, otherwise try -3-. 13 | 14 | -3- Check for an executable script of the same name within the ply scripts' directory `$PLY_HOME/scripts`. If found, 15 | invoke it, otherwise, use it as an argument to the previous script. 16 | 17 | For example; here is how ply resolves the following execution (assuming the default properties; i.e., you haven't re-aliased or added new scripts): 18 | 19 | $ ply dep tree 20 | 21 | Ply first looks up `dep` to see if it is an alias. It is, it is aliased as `ply-dependency-manager-1.0.jar`. It then checks to see if `ply-dependency-manager-1.0.jar` is itself an alias. It is not. So it then checks to see if `ply-dependency-manager-1.0.jar` is a script from with the local project's scripts directory. It is not so it checks to see if it is a script within the `$PLY_HOME/scripts` directory. It is. Ply then needs to resolve the next argument `tree` in case it is an argument to the script. It goes through the same process as it did for `dep` however `tree` is neither an alias nor is it a script in either the local scripts directory or the system scripts directory and so it is treated as an argument to the `ply-dependency-manager-1.0.jar` script. 22 | 23 | You can also run shell scripts directly from ply. Shell scripts are those things which one could invoke natively from the shell/terminal; e.g., `ls`, `grep` or even `ply` itself. To invoke shell scripts from ply use tick-marks to surround the shell invocation (i.e., __\`ls -al\`__). These shell scripts can be aliased like any other script; e.g., __print-directory=\`ls -al\`__. When invoking directly from the shell itself, most shells will interpret the tick marks and execute the command eagerly, short-circuiting their execution by ply. To circumvent this, escape the tick marks appropriately for your shell. For instance in bash one can do this: 24 | 25 | $ ply '`echo hello there`' 26 | 27 | __Properties Passed to Scripts__ 28 | 29 | Each script invocation will be passed, via environmental variables, a set of resolved properties particular to the 30 | invocation. See the [Properties](Properties.md) section for a description of how properties are resolved and then passed to scripts. 31 | -------------------------------------------------------------------------------- /ply-util/src/test/java/net/ocheyedan/ply/props/PropFilesTest.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.props; 2 | 3 | import org.junit.Test; 4 | 5 | import java.io.*; 6 | 7 | import static junit.framework.Assert.*; 8 | 9 | /** 10 | * User: blangel 11 | * Date: 2/18/12 12 | * Time: 8:04 AM 13 | */ 14 | public class PropFilesTest { 15 | 16 | @Test 17 | public void store() throws IOException { 18 | 19 | // test null case 20 | assertFalse(PropFiles.store(null, null)); 21 | assertFalse(PropFiles.store(null, null, false)); 22 | assertFalse(PropFiles.store(null, null, null, false)); 23 | 24 | PropFile empty = new PropFile(Context.named("test"), PropFile.Loc.Local); 25 | // test fnf and create false 26 | assertFalse(PropFiles.store(empty, null)); 27 | assertFalse(PropFiles.store(empty, "not a file", false)); 28 | 29 | File tmp = File.createTempFile("test", "store"); 30 | PropFile props = new PropFile(Context.named("test"), PropFile.Loc.Local); 31 | long now = System.currentTimeMillis(); 32 | props.add("test", String.valueOf(now)); 33 | assertTrue(PropFiles.store(props, tmp.getPath(), true)); 34 | 35 | PropFile loaded = new PropFile(Context.named("test"), PropFile.Loc.Local); 36 | PropFileReader.Default.load(new BufferedReader(new FileReader(tmp)), loaded); 37 | 38 | assertEquals(now, (long) Long.valueOf(loaded.get("test").value())); 39 | } 40 | 41 | @Test 42 | public void load() throws IOException { 43 | 44 | try { 45 | PropFiles.load(null, null); 46 | fail("Expecting a NullPointerException."); 47 | } catch (NullPointerException npe) { 48 | // expected 49 | } 50 | try { 51 | PropFiles.load(null, null, false); 52 | fail("Expecting a NullPointerException."); 53 | } catch (NullPointerException npe) { 54 | // expected 55 | } 56 | try { 57 | PropFiles.load(null, null, false, false); 58 | fail("Expecting a NullPointerException."); 59 | } catch (NullPointerException npe) { 60 | // expected 61 | } 62 | try { 63 | PropFiles.load(null, null, null, false, false); 64 | fail("Expecting a NullPointerException."); 65 | } catch (NullPointerException npe) { 66 | // expected 67 | } 68 | 69 | File tmp = File.createTempFile("test", "store"); 70 | PropFile props = new PropFile(Context.named("test"), PropFile.Loc.Local); 71 | long now = System.currentTimeMillis(); 72 | props.add("test", String.valueOf(now)); 73 | BufferedWriter writer = new BufferedWriter(new FileWriter(tmp)); 74 | PropFileWriter.Default.store(writer, props); 75 | writer.close(); 76 | 77 | PropFile loaded = new PropFile(Context.named("test"), PropFile.Loc.Local); 78 | assertTrue(PropFiles.load(tmp.getPath(), loaded, false, false)); 79 | assertEquals(now, (long) Long.valueOf(loaded.get("test").value())); 80 | 81 | loaded = new PropFile(Context.named("test"), PropFile.Loc.Local); 82 | assertFalse(PropFiles.load("not a file", loaded, false, false)); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /ply-util/src/main/java/net/ocheyedan/ply/graph/Vertex.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.graph; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 11/4/11 10 | * Time: 9:53 AM 11 | * 12 | * A vertex within a {@link Graph} 13 | * Code influenced by {@see org.codehaus.plexus.util.dag.Vertex} 14 | */ 15 | public final class Vertex { 16 | 17 | private final List> parents; 18 | 19 | private final List> children; 20 | 21 | private final T value; 22 | 23 | Vertex(T value) { 24 | this.parents = new ArrayList>(); 25 | this.children = new ArrayList>(); 26 | this.value = value; 27 | } 28 | 29 | void addEdgeTo(Vertex vertex) { 30 | if (!children.contains(vertex)) { 31 | children.add(vertex); 32 | } 33 | } 34 | 35 | void addEdgeFrom(Vertex vertex) { 36 | if (!parents.contains(vertex)) { 37 | parents.add(vertex); 38 | } 39 | } 40 | 41 | void removeEdgeTo(Vertex vertex) { 42 | children.remove(vertex); 43 | } 44 | 45 | void removeEdgeFrom(Vertex vertex) { 46 | parents.remove(vertex); 47 | } 48 | 49 | public boolean hasEdgeTo(Vertex to) { 50 | return children.contains(to); 51 | } 52 | 53 | public boolean hasEdgeFrom(Vertex from) { 54 | return parents.contains(from); 55 | } 56 | 57 | public boolean isLeaf() { 58 | return children.isEmpty(); 59 | } 60 | 61 | public boolean isRoot() { 62 | return parents.isEmpty(); 63 | } 64 | 65 | public Vertex getAnyParent() { 66 | return (parents.isEmpty() ? null : parents.get(0)); 67 | } 68 | 69 | public T getValue() { 70 | return value; 71 | } 72 | 73 | public boolean isConnected() { 74 | return (isLeaf() || isRoot()); 75 | } 76 | 77 | public List> getChildren() { 78 | return Collections.unmodifiableList(children); 79 | } 80 | 81 | @Override public String toString() { 82 | return (value == null ? "" : value.toString()); 83 | } 84 | 85 | public String toExtendedString() { 86 | StringBuilder buffer = new StringBuilder(); 87 | buffer.append(toString()); 88 | for (Vertex child : children) { 89 | if (buffer.length() > toString().length()) { 90 | buffer.append("\n\t"); 91 | } 92 | buffer.append(" -> "); 93 | buffer.append(child.toExtendedString()); 94 | } 95 | return buffer.toString(); 96 | } 97 | 98 | @Override public boolean equals(Object o) { 99 | if (this == o) { 100 | return true; 101 | } 102 | if (o == null || getClass() != o.getClass()) { 103 | return false; 104 | } 105 | 106 | Vertex vertex = (Vertex) o; 107 | return (value == null ? vertex.value == null : value.equals(vertex.value)); 108 | } 109 | 110 | @Override public int hashCode() { 111 | return value == null ? 0 : value.hashCode(); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/CommandLineParser.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd; 2 | 3 | import net.ocheyedan.ply.Iter; 4 | import net.ocheyedan.ply.cmd.build.Build; 5 | import net.ocheyedan.ply.cmd.config.*; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | /** 12 | * User: blangel 13 | * Date: 12/22/11 14 | * Time: 11:03 AM 15 | * 16 | * Responsible for parsing the command line arguments given to Ply and creating a Command object. 17 | */ 18 | public final class CommandLineParser { 19 | 20 | /** 21 | * A singleton, empty {@link Args} object. 22 | */ 23 | final static Args NIL = new Args(Collections.emptyList(), Collections.emptyList()); 24 | 25 | /** 26 | * @param args to parse 27 | * @return a {@link Command} parsed from {@code args}. 28 | */ 29 | public static Command parse(String[] args) { 30 | if ((args == null) || (args.length < 1) || "--usage".equals(args[0]) || "--help".equals(args[0])) { 31 | return new Usage(parseArgs(Iter.sized(args))); 32 | } else if ("--version".equals(args[0]) || "-v".equals(args[0]) || "-version".equals(args[0])) { 33 | return new Version(parseArgs(Iter.sized(args))); 34 | } else if ("init".equals(args[0])) { 35 | return new Init(parseArgs(Iter.sized(args))); 36 | } else if ("get".equals(args[0]) || args[0].endsWith(":get")) { 37 | return new Get(parseArgs(Iter.sized(args))); 38 | } else if ("get-all".equals(args[0]) || args[0].endsWith(":get-all")) { 39 | return new GetAll(parseArgs(Iter.sized(args))); 40 | } else if ("set".equals(args[0]) || args[0].endsWith(":set")) { 41 | return new Set(parseArgs(Iter.sized(args))); 42 | } else if ("rm".equals(args[0]) || args[0].endsWith(":rm")) { 43 | return new Remove(parseArgs(Iter.sized(args))); 44 | } else if ("append".equals(args[0]) || args[0].endsWith(":append")) { 45 | return new Append(parseArgs(Iter.sized(args))); 46 | } else if ("prepend".equals(args[0]) || args[0].endsWith(":prepend")) { 47 | return new Prepend(parseArgs(Iter.sized(args))); 48 | } else if ("update".equals(args[0]) || args[0].endsWith(":update")) { 49 | return new Update(parseArgs(Iter.sized(args))); 50 | } else if ("describe".equals(args[0]) || args[0].endsWith(":describe")) { 51 | return new Describe(parseArgs(Iter.sized(args))); 52 | } else { 53 | return new Build(parseArgs(Iter.sized(args))); 54 | } 55 | } 56 | 57 | public static Args parseArgs(Iter.Sized clArgs) { 58 | if ((clArgs == null) || (clArgs.size() < 1)) { 59 | return NIL; 60 | } 61 | List args = new ArrayList(clArgs.size()); 62 | List adHocProps = new ArrayList(2); 63 | for (String arg : clArgs) { 64 | if (arg.startsWith("-P")) { 65 | if (arg.length() > 2) { 66 | adHocProps.add(arg.substring(2)); 67 | } 68 | } else { 69 | args.add(arg); 70 | } 71 | } 72 | return new Args(args, adHocProps); 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/cmd/config/Append.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.cmd.config; 2 | 3 | import net.ocheyedan.ply.FileUtil; 4 | import net.ocheyedan.ply.PlyUtil; 5 | import net.ocheyedan.ply.cmd.Args; 6 | import net.ocheyedan.ply.cmd.Usage; 7 | import net.ocheyedan.ply.props.*; 8 | 9 | import static net.ocheyedan.ply.props.PropFile.Prop; 10 | 11 | /** 12 | * User: blangel 13 | * Date: 1/1/12 14 | * Time: 3:52 PM 15 | * 16 | * A {@link net.ocheyedan.ply.cmd.Command} to append a value to a property value within the project's configuration. 17 | */ 18 | public class Append extends Config { 19 | 20 | static class Opts { 21 | final Scope scope; 22 | final Context context; 23 | final String propName; 24 | final String propValue; 25 | 26 | Opts(Scope scope, Context context, String propName, String propValue) { 27 | this.scope = scope; 28 | this.context = context; 29 | this.propName = propName; 30 | this.propValue = propValue; 31 | } 32 | } 33 | 34 | public Append(Args args) { 35 | super(args); 36 | } 37 | 38 | @Override protected void runAfterAssumptionsCheck() { 39 | Opts opts = parse(args); 40 | if (opts == null) { 41 | new Usage(args).run(); 42 | return; 43 | } 44 | String path = FileUtil.pathFromParts(PlyUtil.LOCAL_CONFIG_DIR.getPath(), opts.context.name + opts.scope.getFileSuffix() + ".properties"); 45 | PropFile properties = new PropFile(opts.context, opts.scope, PropFile.Loc.Local); 46 | PropFiles.load(path, properties, true); 47 | String propValue = opts.propValue; 48 | String existing = getExisting(opts.context, opts.propName); 49 | if (existing != null) { 50 | propValue = getFromExisting(existing, propValue); 51 | } 52 | properties.remove(opts.propName); 53 | properties.add(opts.propName, propValue); 54 | PropFiles.store(properties, path, true); 55 | } 56 | 57 | protected String getFromExisting(String existing, String addition) { 58 | return (existing.isEmpty() ? existing : existing + " ") + addition; 59 | } 60 | 61 | protected String getExisting(Context context, String propName) { 62 | PropFileChain props = Props.get(context); 63 | if (props == null) { 64 | return null; 65 | } 66 | for (Prop prop : props.props()) { 67 | if (prop.name.equals(propName)) { 68 | return prop.unfilteredValue; 69 | } 70 | } 71 | return null; 72 | } 73 | 74 | @SuppressWarnings("fallthrough") 75 | Opts parse(Args args) { 76 | Scope scope = Scope.Default; 77 | int scopeIndex = args.args.get(0).indexOf(":"); 78 | if (scopeIndex != -1) { 79 | scope = Scope.named(args.args.get(0).substring(0, scopeIndex)); 80 | } 81 | switch (args.args.size()) { 82 | case 6: 83 | if ("to".equals(args.args.get(2)) && "in".equals(args.args.get(4))) { 84 | String propName = args.args.get(3); 85 | String propValue = args.args.get(1); 86 | return new Opts(scope, new Context(args.args.get(5)), propName, propValue); 87 | } // fall-through 88 | default: 89 | return null; 90 | } 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /ply-util/src/test/resources/mock-mvn-repo/org/slf4j/slf4j-api/1.5.11/slf4j-api-1.5.11.pom: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | org.slf4j 7 | slf4j-parent 8 | 1.5.11 9 | 10 | 11 | 4.0.0 12 | 13 | org.slf4j 14 | slf4j-api 15 | jar 16 | SLF4J API Module 17 | 18 | http://www.slf4j.org 19 | The slf4j API 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | org.apache.maven.plugins 29 | maven-surefire-plugin 30 | 31 | once 32 | plain 33 | false 34 | 35 | **/AllTest.java 36 | **/PackageTest.java 37 | 38 | 39 | 40 | 41 | 42 | org.apache.maven.plugins 43 | maven-jar-plugin 44 | 45 | 46 | 47 | ${parsedVersion.osgiVersion} 48 | ${project.description} 49 | ${project.version} 50 | 51 | ${project.build.outputDirectory}/META-INF/MANIFEST.MF 52 | 53 | 54 | 55 | 56 | bundle-test-jar 57 | package 58 | 59 | jar 60 | test-jar 61 | 62 | 63 | 64 | 65 | 66 | 67 | org.apache.maven.plugins 68 | maven-antrun-plugin 69 | 70 | 71 | process-classes 72 | 73 | run 74 | 75 | 76 | 77 | 78 | 79 | Removing slf4j-api's dummy StaticLoggerBinder and StaticMarkerBinder 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | org.codehaus.mojo 93 | clirr-maven-plugin 94 | 95 | 1.5.6 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /src/main/java/net/ocheyedan/ply/exec/StdinProcessPipe.java: -------------------------------------------------------------------------------- 1 | package net.ocheyedan.ply.exec; 2 | 3 | import java.io.*; 4 | import java.util.concurrent.atomic.AtomicBoolean; 5 | import java.util.concurrent.atomic.AtomicReference; 6 | 7 | /** 8 | * User: blangel 9 | * Date: 11/19/11 10 | * Time: 4:23 PM 11 | * 12 | * Pipes {@link System#in} to the {@link Runner#processStdin}. 13 | * 14 | * This class can be instantiated once for all executions. Multiple calls to {@link #start()} have no negative 15 | * effect; the first call actually starts and all subsequent calls are no-ops. 16 | */ 17 | final class StdinProcessPipe extends Thread { 18 | 19 | static final class Runner implements Runnable { 20 | 21 | final AtomicReference processStdin; 22 | 23 | Runner(AtomicReference processStdin) { 24 | this.processStdin = processStdin; 25 | } 26 | 27 | // TODO - should only slurp input if requested by our child process 28 | // TODO - otherwise, if ply is being invoked from within the context of a script (loop) reading input 29 | // TODO - ply will consume the input from the parent process 30 | @Override public void run() { 31 | byte[] buffer = new byte[4096]; 32 | while (!Thread.currentThread().isInterrupted()) { 33 | try { 34 | int avail = System.in.available(); 35 | if (avail > 0) { 36 | int read = System.in.read(buffer, 0, Math.min(avail, buffer.length)); 37 | OutputStream stdin = processStdin.get(); 38 | if (stdin != null) { 39 | stdin.write(buffer, 0, read); 40 | stdin.flush(); 41 | } 42 | } else { 43 | Thread.sleep(100); 44 | } 45 | } catch (IOException ioe) { 46 | if (ioe.getMessage().contains("Broken pipe")) { // old process died 47 | processStdin.set(null); 48 | } else { 49 | throw new AssertionError(ioe); 50 | } 51 | } catch (InterruptedException ie) { 52 | Thread.currentThread().interrupt(); 53 | } 54 | } 55 | } 56 | } 57 | 58 | final AtomicBoolean started; 59 | 60 | final AtomicReference processStdin; 61 | 62 | public StdinProcessPipe() { 63 | this(new AtomicReference(null)); 64 | } 65 | 66 | private StdinProcessPipe(AtomicReference processStdin) { 67 | super(new Runner(processStdin)); 68 | setDaemon(true); 69 | started = new AtomicBoolean(false); 70 | this.processStdin = processStdin; 71 | } 72 | 73 | void write(char[] buffer) throws IOException { 74 | BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(this.processStdin.get())); 75 | writer.write(buffer, 0, buffer.length); 76 | writer.write('\n'); 77 | writer.flush(); 78 | } 79 | 80 | public void pausePipe() { 81 | this.processStdin.set(null); 82 | } 83 | 84 | public void startPipe(OutputStream processStdin) { 85 | this.processStdin.set(processStdin); 86 | start(); 87 | } 88 | 89 | @Override public void start() { 90 | if (!started.getAndSet(true)) { 91 | super.start(); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /dist/ply/config/project.properties: -------------------------------------------------------------------------------- 1 | # the directory in which source files are stored. used primarily in compilation. 2 | # the default follows the convention of maven 3 | src.dir=src/main/java 4 | # the directory in which resource (non-source files like properties and configuration xml files) are stored. 5 | # the default follows the convention of maven 6 | res.dir=src/main/resources 7 | # the directory into which build artifacts and compiled files are stored. 8 | # the default follows the convention of maven 9 | build.dir=target 10 | # the directory into which resources are copied (primed for filtering/packaging/etc) 11 | res.build.dir=${build.dir}/resources 12 | # the base directory used to match files for filtering (the matched files are determined by the filter-files[.scope].properties) 13 | filter.dir=${res.build.dir} 14 | # the namespace for the project. analogous to the groupId in maven. see the init process for how this is defaulted. 15 | #namespace= 16 | # the name of the project. analogous to the artifactId in maven (maven also has a name tag which 17 | # ply forgoes for simplicity). see the init process for how this is defaulted. 18 | #name= 19 | # the version of the project. analogous to the version in maven. see the init process for how this is defaulted 20 | #version= 21 | # the packaging type of the project. this is used by the resolved script from the 'package' alias to determine how 22 | # to package the project (i.e., bundle into a zip/jar/war etc). 23 | packaging=jar 24 | # the artifact name of the project. 25 | artifact.name=${name}-${version}.${packaging} 26 | # the non-scoped dependency atom of this project (should not be overridden by scopes as 27 | # this provides for a reliable way to determine the non-scoped namespace:name:version:artifact.name information). 28 | nonscoped.artifact.name=${namespace}:${name}:${version}:${name}-${version}.${packaging} 29 | # the directory into which project specific scripts are stored. when resolving scripts, 30 | # ply first resolves the script name as an alias from the scripts.properties, then 31 | # looks for an executable script named as such in this directory. if it is not found, 32 | # ply then looks in the install directory's scripts directory. if still not found, 33 | # ply finally invokes the script as an executable resolved via the OS's native PATH. 34 | scripts.dir=scripts 35 | # the directory into which reports (like test coverage reports) will be saved 36 | reports.dir=${build.dir}/reports 37 | # the scope to use to resolve which submodules to use for the project while building. 38 | # normally scope is prepended to the alias/script with a ':' (i.e., 'ply test:install' 39 | # where 'test' is the scope for the alias 'install'). the scope is per alias/script, as 40 | # opposed to per invocation (i.e.; it is not, 'ply --test install') to allow for invocation with 41 | # mixed scope (i.e., 'ply clean install test:install'). instead of making ply also have per 42 | # invocation scope options (i.e., again, 'ply --test install') just to handle this one-off 43 | # use case for submodules this property is used. typically, this property will just 44 | # be set on invocation (i.e., 'ply test:install -Pproject.submodules.scope=test'). 45 | submodules.scope= 46 | # the scope to use when saving 'dependencies' and 'checksum' artifacts into a repository 47 | artifacts.label= 48 | # for a scoped dependency, depend upon self (i.e., in test scope, depend upon non-scoped self dependency) 49 | depend.upon.self= 50 | # the directory into which ply specific invocation information should be placed 51 | ply.invocation.dir=${build.dir}/ply --------------------------------------------------------------------------------