{"id":20397107,"url":"https://github.com/elasticpath/rest-resource-viz","last_synced_at":"2025-04-12T13:03:30.236Z","repository":{"id":57719021,"uuid":"78681708","full_name":"elasticpath/rest-resource-viz","owner":"elasticpath","description":"rest-resource visualizer","archived":false,"fork":false,"pushed_at":"2020-10-13T01:13:21.000Z","size":552,"stargazers_count":4,"open_issues_count":3,"forks_count":2,"subscribers_count":9,"default_branch":"master","last_synced_at":"2023-11-07T11:20:17.306Z","etag":null,"topics":["clojure","clojurescript","d3"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elasticpath.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-11T21:31:42.000Z","updated_at":"2020-10-13T01:13:20.000Z","dependencies_parsed_at":"2022-09-26T21:40:33.941Z","dependency_job_id":null,"html_url":"https://github.com/elasticpath/rest-resource-viz","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticpath%2Frest-resource-viz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticpath%2Frest-resource-viz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticpath%2Frest-resource-viz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticpath%2Frest-resource-viz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elasticpath","download_url":"https://codeload.github.com/elasticpath/rest-resource-viz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224727043,"owners_count":17359535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","clojurescript","d3"],"created_at":"2024-11-15T04:11:49.192Z","updated_at":"2024-11-15T04:11:49.907Z","avatar_url":"https://github.com/elasticpath.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rest-resources-viz\n\nManipulate and visualize Cortex rest resources and relationships.\n\n![Resource Graph Showcase](doc/img/resource-graph-showcase.png)\n\n## Usage\n\nRest-resources-viz extracts the graph data from Elastic Path's resource definitions (just specify the dependencies) and therefore needs access to the Maven artifacts that contain them.\n\nIn order to do this you would need to add the `com.elasticpath/rest-viz-maven-plugin` to your `pom.xml` this way:\n\n```xml\n\u003cplugins\u003e\n  \u003cplugin\u003e\n    \u003cgroupId\u003ecom.elasticpath\u003c/groupId\u003e\n    \u003cartifactId\u003erest-viz-maven-plugin\u003c/artifactId\u003e\n    \u003cversion\u003eX.Y.Z\u003c/version\u003e\n    \u003cexecutions\u003e\n      \u003cexecution\u003e\n        \u003cid\u003eextract-viz-data\u003c/id\u003e\n        \u003cphase\u003epackage\u003c/phase\u003e \u003c!-- set yours --\u003e\n        \u003cgoals\u003e\n          \u003cgoal\u003eextract\u003c/goal\u003e\n        \u003c/goals\u003e\n      \u003c/execution\u003e\n    \u003c/executions\u003e\n    \u003cconfiguration\u003e\n      \u003c!-- Output Directory - defaults to ${project.build.directory}/rest-viz-assets --\u003e\n      \u003c!-- \u003ctargetDirectory\u003e${project.build.directory}/my-assets\u003c/targetDirectory\u003e --\u003e\n\n      \u003c!-- Custom name for the extracted data output file - defaults to graph-data.edn --\u003e\n      \u003c!-- \u003cdataTargetName\u003emy-name.edn\u003c/dataTargetName\u003e --\u003e\n\n      \u003c!-- Pretty print the extracted data - defaults to false --\u003e\n      \u003c!-- \u003cprettyPrint\u003etrue\u003c/prettyPrint\u003e --\u003e\n    \u003c/configuration\u003e\n\n    \u003cdependencies\u003e\n      \u003c!-- list of Maven artifacts containing the resource definitions --\u003e\n    \u003c/dependencies\u003e\n  \u003c/plugin\u003e\n\u003c/plugins\u003e\n```\n\nThe above generates all the necessary web assets to the specified output directory (or `rest-viz-assets`) and can be served directly.\nThe sample project in the repository can help with setting up your project. If artifacts cannot be found, make also sure that the correct repository has been specified in `.m2/settings.xml` and/or the correct profile has been activated.\n\nIf you want to just extract the data, at the command line you can call the goal explicitly (check [Plugin Prefix Resolution](https://maven.apache.org/guides/introduction/introduction-to-plugin-prefix-mapping.html) to type less):\n\n    mvn com.elasticpath:rest-viz-maven-plugin:extract\n    \nThe only supported output at the moment is the [Extensible Data Format](https://github.com/edn-format/edn). [Here](https://github.com/bpsm/edn-java) you can find a Java reader implementation.\n\n### Simple(r) Visualization\n\nThere is another way to visualize the resource graph. It requires cloning this repository and familiarizing yourself with the Clojure world. First of all the JavaScript app and assets needs to be materialized in `target`:\n\n```\nboot build-web target\n```\n\nThe conf file passed in is necessary in order to configure the Maven repository and coordinates (assuming they have a similar name) for the resource artifacts. For a sample configuration see `conf-sample.edn` in the repository root.\nIn case of missing keys a `clojure.spec` error will tell you what was expected. The error message is a bit cryptic and will be improved, bear with us.\n\nOnce the command finishes, you can serve the `target` folder.\n\nA simple way to serve a folder is by using `python2`, for instance:\n\n```\ncd target \u0026\u0026 python2 -m SimpleHTTPServer; cd..\n```\n\nPython 3 has got a slightly different command line:\n\n```\ncd target \u0026\u0026 python3 -m http.server; cd..\n```\n\n\nNow you can open your browser and connect to `localhost:8000`. You will see an empty frame. This is because the graph data is missing. That can be easily generated with the `extract` task (see `boot extract -h` as well) and needs to be saved in `target/graph-data.edn`:\n\n```\nboot extract --conf my-conf.edn --graph-edn target/graph-data.edn --pretty\n```\n\nNote that we are creating the file in `target` now - the app should pick up the changes (React is your friend). If not, reload the page.\n\n## Details\n\nThe project contains three main deliverables: the extractor, the website and the plugin. The extractor is the piece of code which scans and creates the data file used by the website.  The maven plugin just wraps them in a convenient way for consumption.\n\nFor all the available tasks run `boot -h`. The tasks prefixed with `dev-` tipically start in-context repl. Every task also has its own `-h/--help` switch.\n\n### Extractor\n\nThe extractor is a direct dependency of the plugin and needs to be installed:\n\n    boot install-extractor\n\nAdditionally, it can read the resource xmls from Maven and dump the graph data using the `extract` task:\n\n    boot extract -- -g data/graph-data2.edn -p\n\nThe above command dumps the graph data to `data/graph-data2.edn` with pretty print enabled. The brackets are necessary in order to send positional arguments to the task.\n\n### Plugin\n\nThis is at the moment a three-step process. The extractor and the web assets needs to be compiled first and positioned in `web-target`:\n\n    boot install-extractor\n\n    boot build-web target --dir web-target\n\nThen Maven needs to be invoked for compiling and installing the actual plugin:\n\n    mvn -Pboot-clj clean install\n\nThe above will generate a `mvn-target` folder containing the artifact and install it `$USER/.m2/repository`.\n\nThe plugin is less interactive in its nature but a repl can still be launched with:\n\n    boot dev-plugin\n\nNone of the Maven plugin classes will be available at the repl. Another useful trick is to repeatedly generate and install the plugin by watching the source files:\n\n    boot -B --source-paths \".\" watch  \".*\\.clj?\"  -i \"pom.xml\" -e \"^mvn-target\" sift -i \"src\" -i \"pom.xml\" mvn -W `pwd` -A \"-Pboot-clj clean install\"\n\n## Deploying to Sonatype\n\nIn order to deploy a staging/release artifact, the steps are almost the same as above:\n\n    boot -P deploy-extractor -u ... -p ...          # Sonatype credentials here\n    boot -P build-web target --dir web-target\n    mvn -Pboot-clj -Psonatype-release clean deploy  # Credentials come from settings.xml\n\nThe `-P` avoids pulling in packages from you global `profile.boot`.\n\nIn order to use Maven gpg signing, add the following to `settings.xml`:\n\n    \u003cprofile\u003e\n      \u003cid\u003edefault-profile\u003c/id\u003e\n      \u003cactivation\u003e\n        \u003cactiveByDefault\u003etrue\u003c/activeByDefault\u003e\n      \u003c/activation\u003e\n      \u003cproperties\u003e\n        \u003cgpg.executable\u003e/usr/bin/gpg2\u003c/gpg.executable\u003e\n        \u003cgpg.useagent\u003etrue\u003c/gpg.useagent\u003e\n        \u003cgpg.keyname\u003e...\u003c/gpg.keyname\u003e\n        \u003cgpg.passphrase\u003e...\u003c/gpg.passphrase\u003e\n      \u003c/properties\u003e\n    \u003c/profile\u003e\n\n## Test\n\n    boot test\n\nThe simple command above would do.\n\n## Boot\n\nThe build tool of choice for this project is [boot](http://boot-clj.com/)\u003cimg width=\"24px\" height=\"24px\" src=\"https://github.com/boot-clj/boot-clj.github.io/blob/master/assets/images/logos/boot-logo-3.png\" alt=\"Boot Logo\"/\u003e.\nBoot enables us to use Clojure code directly, and therefore repl-driven development, when defining our build tasks.\n\n## License\n\nCopyright 2020 Elastic Path\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felasticpath%2Frest-resource-viz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felasticpath%2Frest-resource-viz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felasticpath%2Frest-resource-viz/lists"}