├── .gclient ├── .gitignore ├── .gitmodules ├── .travis.yml ├── deps.edn ├── dirac ├── docs ├── about-repls.md ├── cli.md ├── configuration.md ├── extension.md ├── faq.md ├── hacking.md ├── installation.md ├── integration.md ├── motivation.md ├── node.md └── upgrading.md ├── examples ├── figwheel-main │ ├── .gitignore │ ├── README.md │ ├── deps.edn │ ├── dev.cljs.edn │ ├── figwheel-main.edn │ ├── resources │ │ └── public │ │ │ ├── css │ │ │ └── style.css │ │ │ ├── index.html │ │ │ └── test.html │ ├── scripts │ │ ├── _shared.sh │ │ ├── canary.sh │ │ ├── clean.sh │ │ └── repl.sh │ ├── src │ │ ├── main │ │ │ └── dirac_figmain │ │ │ │ └── core.cljs │ │ └── repl │ │ │ └── dirac_figmain │ │ │ └── repl.clj │ ├── test.cljs.edn │ └── test │ │ └── dirac_figmain │ │ ├── core_test.cljs │ │ └── test_runner.cljs ├── leiningen │ ├── .gitignore │ ├── project.clj │ ├── readme.md │ ├── resources │ │ └── public │ │ │ ├── demo.html │ │ │ ├── index.html │ │ │ ├── inline_breakpoints.html │ │ │ ├── issue_53.html │ │ │ ├── issue_7.html │ │ │ ├── playground.html │ │ │ ├── styles │ │ │ └── default.css │ │ │ └── tests.html │ ├── scripts │ │ ├── dev-server.sh │ │ ├── reveal.cljs │ │ ├── reveal.sh │ │ ├── run-demo-node-source-maps-server.sh │ │ └── run-node-demo.sh │ └── src │ │ ├── demo-node │ │ └── dirac_lein │ │ │ └── demo.cljs │ │ ├── demo │ │ └── dirac_lein │ │ │ └── demo.cljs │ │ ├── shared │ │ └── dirac_lein │ │ │ └── logging.clj │ │ └── tests │ │ └── dirac_lein │ │ ├── inline_breakpoints.cljs │ │ ├── issue_53.cljs │ │ ├── issue_7.cljs │ │ ├── main.cljs │ │ └── playground.cljs ├── readme.md └── shadow │ ├── .gitignore │ ├── deps.edn │ ├── package.json │ ├── public │ └── index.html │ ├── shadow-cljs.edn │ └── src │ └── main │ └── dirac_shadow │ └── app.cljs ├── install ├── license.txt ├── privacy-policy.txt ├── project.clj ├── readme.md ├── releases.edn ├── resources ├── dev │ └── log4j.properties ├── release │ ├── background.html │ ├── blank.html │ ├── css │ ├── images │ ├── manifest.json │ └── options.html ├── shared │ ├── css │ │ ├── bootstrap.css │ │ └── options.css │ └── images │ │ ├── icon128.png │ │ ├── icon16.png │ │ ├── icon19.png │ │ ├── icon19g.png │ │ ├── icon38.png │ │ ├── icon38g.png │ │ └── icon48.png ├── templates │ └── dirac │ │ ├── install-playground-runtime-template.js │ │ └── playground-template │ │ ├── readme.md │ │ └── src │ │ └── dirac │ │ └── playground.cljs.template └── unpacked │ ├── background.html │ ├── background.js │ ├── blank.html │ ├── css │ ├── images │ ├── manifest.json │ ├── options.html │ ├── options.js │ └── setup.js ├── scripts ├── .test-stage-excludes ├── _config.sh ├── agent-launcher.sh ├── bisect-compiler-helper.sh ├── bisect-compiler-test.sh ├── bisect-compiler.sh ├── check-code.sh ├── check-versions.sh ├── clean-compiled.sh ├── clean-dev-browser-tests.sh ├── clean-notify.sh ├── clean-target.sh ├── clean-test-stage.sh ├── cljsbuild-notify.sh ├── deploy-clojars.sh ├── depot-build-devtools.sh ├── depot-clean.sh ├── depot-ninja.sh ├── depot-sync.sh ├── dev-browser-tests.sh ├── dev-server.sh ├── docker-boot.sh ├── docker-build.sh ├── docker-clean.sh ├── docker-entrypoint.sh ├── docker-run.sh ├── ensure-checkouts.sh ├── ensure-eof-lf.sh ├── extract-chrome-version.sh ├── extract-help-doc-main.sh ├── find-devtools-merge-sha.sh ├── git-fetch-dev.sh ├── health-check-launcher.sh ├── health-check.sh ├── init-travis.sh ├── install-health-checking-job.sh ├── launch-canary.sh ├── launch-custom-canary.sh ├── launch-fixtures-server.sh ├── launch-release-canary.sh ├── launch-test-browser.sh ├── lib │ ├── tools.sh │ ├── travis.sh │ └── utils.sh ├── list-jar.sh ├── local-install.sh ├── lookup-chromium-link.sh ├── main-launch-dev.sh ├── main-launcher-local.sh ├── main-launcher.sh ├── main.sh ├── package.sh ├── plists │ └── com.binaryage.dirac-health-check.plist ├── position-for-version.sh ├── prepare-chromium-links.sh ├── prepare-rolling-section.sh ├── prune-release.sh ├── pull-chromium.sh ├── regenerate.sh ├── release.sh ├── roll-devtools.sh ├── run-backend-tests.sh ├── run-browser-tests.sh ├── run-cli-tests.sh ├── run-devtools-tests.sh ├── run-devtools-yarn.sh ├── start-job.sh ├── sync-test-stage.sh ├── sync-transcripts-from-docker.sh ├── sync-transcripts.sh ├── test-all.sh ├── test-backend.sh ├── test-browser-dev.sh ├── test-browser.sh ├── test-cli.sh ├── test-devtools.sh ├── test-health-check-job.sh ├── travis-entrypoint.sh ├── update-installer-checksum.sh ├── update-versions.sh └── wait-for-notify.sh ├── src ├── agent │ └── dirac │ │ ├── agent.clj │ │ └── agent │ │ ├── cli.clj │ │ ├── config.clj │ │ ├── impl.clj │ │ └── version.clj ├── automation │ └── dirac │ │ ├── automation.clj │ │ ├── automation.cljs │ │ └── automation │ │ ├── constants.cljs │ │ ├── devtools.cljs │ │ ├── feedback.cljs │ │ ├── helpers.cljs │ │ ├── launcher.cljs │ │ ├── logging.clj │ │ ├── logging.cljs │ │ ├── machinery.cljs │ │ ├── matchers.cljs │ │ ├── messages.cljs │ │ ├── notifications.cljs │ │ ├── options.cljs │ │ ├── runner.cljs │ │ ├── runtime.cljs │ │ ├── scenario.clj │ │ ├── scenario.cljs │ │ ├── status.cljs │ │ ├── status_host.cljs │ │ ├── task.cljs │ │ ├── test.clj │ │ ├── test.cljs │ │ ├── transcript.cljs │ │ ├── transcript_host.cljs │ │ ├── transcript_streamer.cljs │ │ ├── triggers.cljs │ │ └── verbs.cljs ├── background │ └── dirac │ │ ├── background.cljs │ │ └── background │ │ ├── action.cljs │ │ ├── chrome.cljs │ │ ├── core.cljs │ │ ├── debugging.cljs │ │ ├── devtools.cljs │ │ ├── helpers.cljs │ │ ├── logging.clj │ │ ├── logging.cljs │ │ ├── marion.cljs │ │ ├── state.cljs │ │ └── tools.cljs ├── base │ └── dirac │ │ ├── config.clj │ │ ├── utils.clj │ │ └── ws_server.clj ├── devtools │ └── dirac │ │ └── devtools.cljs ├── empty │ └── readme.md ├── figwheel │ └── dirac │ │ └── figwheel.cljs ├── home │ └── dirac │ │ ├── home.clj │ │ └── home │ │ ├── chromium.clj │ │ ├── chromium │ │ ├── extra_args.clj │ │ ├── link.clj │ │ ├── mapping.clj │ │ ├── profiles.clj │ │ ├── scout.clj │ │ └── version.clj │ │ ├── defaults.clj │ │ ├── helpers.clj │ │ ├── locations.clj │ │ └── releases.clj ├── implant │ └── dirac │ │ ├── implant.cljs │ │ └── implant │ │ ├── analyzer.cljs │ │ ├── automation.cljs │ │ ├── automation │ │ ├── reps.cljs │ │ ├── scrapers.clj │ │ └── scrapers.cljs │ │ ├── console.cljs │ │ ├── editor.cljs │ │ ├── eval.clj │ │ ├── eval.cljs │ │ ├── feedback.cljs │ │ ├── helpers.cljs │ │ ├── info.cljs │ │ ├── intercom.clj │ │ ├── intercom.cljs │ │ ├── link_handlers.cljs │ │ ├── logging.clj │ │ ├── logging.cljs │ │ ├── munging.cljs │ │ ├── nrepl_tunnel_client.cljs │ │ ├── options.cljs │ │ ├── repl.clj │ │ ├── repl.cljs │ │ ├── reporter.cljs │ │ ├── version.clj │ │ ├── version.cljs │ │ └── weasel_client.cljs ├── logging │ └── dirac │ │ ├── logging.clj │ │ └── logging │ │ ├── format.clj │ │ ├── toolkit.clj │ │ ├── toolkit.cljs │ │ └── utils.clj ├── main │ └── dirac │ │ ├── main.clj │ │ └── main │ │ ├── actions.clj │ │ ├── actions │ │ ├── launch.clj │ │ └── nuke.clj │ │ ├── cli.clj │ │ ├── logging.clj │ │ ├── logging │ │ └── format.clj │ │ ├── playground.clj │ │ ├── terminal.clj │ │ └── utils.clj ├── nrepl-lib │ └── dirac │ │ └── nrepl_lib │ │ ├── bencode_hell.clj │ │ ├── common.clj │ │ ├── nrepl_client.clj │ │ ├── nrepl_protocols.clj │ │ ├── nrepl_tunnel.clj │ │ ├── nrepl_tunnel_server.clj │ │ ├── version.clj │ │ └── weasel_server.clj ├── nrepl │ └── dirac │ │ ├── nrepl.clj │ │ └── nrepl │ │ ├── bootstrap.clj │ │ ├── compilation.clj │ │ ├── compilation │ │ └── direct.clj │ │ ├── compilers.clj │ │ ├── config.clj │ │ ├── config_helpers.clj │ │ ├── controls.clj │ │ ├── debug.clj │ │ ├── driver.clj │ │ ├── eval.clj │ │ ├── figwheel.clj │ │ ├── figwheel2.clj │ │ ├── helpers.clj │ │ ├── jobs.clj │ │ ├── joining.clj │ │ ├── messages.clj │ │ ├── piggieback.clj │ │ ├── protocol.clj │ │ ├── requests.clj │ │ ├── sessions.clj │ │ ├── sniffer.clj │ │ ├── special.clj │ │ ├── state.clj │ │ ├── transports │ │ ├── bencode_workarounds.clj │ │ ├── debug_logging.clj │ │ ├── errors_observing.clj │ │ ├── job_observing.clj │ │ ├── output_capturing.clj │ │ ├── status_cutting.clj │ │ └── trace_printing.clj │ │ ├── usage.clj │ │ ├── utils.clj │ │ └── version.clj ├── options │ └── dirac │ │ ├── options.cljs │ │ └── options │ │ ├── core.cljs │ │ ├── logging.clj │ │ ├── logging.cljs │ │ ├── model.cljs │ │ └── ui.cljs ├── project │ └── dirac │ │ ├── project.clj │ │ └── project.cljs ├── runtime │ └── dirac │ │ ├── runtime.cljs │ │ └── runtime │ │ ├── bootstrap.cljs │ │ ├── core.cljs │ │ ├── deps.cljs │ │ ├── oops.clj │ │ ├── output.cljs │ │ ├── prefs.clj │ │ ├── prefs.cljs │ │ ├── preload.clj │ │ ├── preload.cljs │ │ ├── repl.cljs │ │ ├── tag.cljs │ │ ├── util.clj │ │ └── util.cljs ├── settings │ └── dirac │ │ ├── settings.clj │ │ └── settings.cljs └── shared │ └── dirac │ └── shared │ ├── async.clj │ ├── async.cljs │ ├── console.cljs │ ├── cookies.cljs │ ├── dom.cljs │ ├── dom │ └── shim.cljs │ ├── i18n.cljs │ ├── logging.clj │ ├── logging.cljs │ ├── mime.cljs │ ├── pprint.cljs │ ├── quoted_printable.cljs │ ├── sugar.cljs │ ├── travis.clj │ ├── utils.clj │ ├── utils.cljs │ └── ws_client.cljs └── test ├── backend └── src │ └── backend_tests │ └── dirac │ └── tests │ └── backend │ ├── agent │ ├── fixtures.clj │ ├── helpers.clj │ ├── state.clj │ └── tests.clj │ └── runner.clj ├── browser ├── fixtures │ ├── resources │ │ ├── css │ │ │ ├── index.css │ │ │ ├── runner.css │ │ │ └── scenario.css │ │ ├── index.html │ │ ├── runner.html │ │ ├── scenarios │ │ │ ├── barebone.html │ │ │ ├── breakpoint.html │ │ │ ├── completions.html │ │ │ ├── core-async.html │ │ │ ├── exception.html │ │ │ ├── future-repl-api.html │ │ │ ├── future-runtime.html │ │ │ ├── issue-53.html │ │ │ ├── issue-55.html │ │ │ ├── issue-74.html │ │ │ ├── no-agent.html │ │ │ ├── no-repl.html │ │ │ ├── no-runtime.html │ │ │ ├── normal-via-preloads.html │ │ │ ├── normal-with-feedback.html │ │ │ ├── normal.html │ │ │ ├── old-repl-api.html │ │ │ ├── old-runtime.html │ │ │ ├── repl.html │ │ │ └── runtime-api.html │ │ └── scripts │ │ │ ├── index.js │ │ │ └── runner.js │ └── src │ │ ├── scenarios01 │ │ └── dirac │ │ │ └── tests │ │ │ └── scenarios │ │ │ ├── barebone.cljs │ │ │ ├── breakpoint.cljs │ │ │ ├── breakpoint │ │ │ └── core.cljs │ │ │ ├── completions.cljs │ │ │ ├── completions │ │ │ └── workspace.cljs │ │ │ ├── core_async.cljs │ │ │ ├── exception.cljs │ │ │ ├── exception │ │ │ └── core.cljs │ │ │ ├── future_repl_api.cljs │ │ │ ├── future_runtime.cljs │ │ │ ├── no_agent.cljs │ │ │ ├── no_repl.cljs │ │ │ ├── no_runtime.cljs │ │ │ ├── normal.cljs │ │ │ ├── normal_with_feedback.cljs │ │ │ ├── old_repl_api.cljs │ │ │ ├── old_runtime.cljs │ │ │ ├── repl.cljs │ │ │ ├── repl │ │ │ └── workspace.cljs │ │ │ └── runtime_api.cljs │ │ ├── scenarios02 │ │ └── dirac │ │ │ └── tests │ │ │ └── scenarios │ │ │ └── normal_via_preloads.cljs │ │ ├── scenarios03 │ │ └── dirac │ │ │ └── tests │ │ │ └── scenarios │ │ │ ├── completions │ │ │ └── issue_55.cljc │ │ │ ├── issue_53.cljs │ │ │ ├── issue_53 │ │ │ └── core.cljs │ │ │ ├── issue_55.cljs │ │ │ ├── issue_74.cljs │ │ │ └── issue_74 │ │ │ └── core.cljs │ │ └── tasks │ │ └── dirac │ │ └── tests │ │ └── tasks │ │ ├── helpers │ │ └── open_scenario.cljs │ │ ├── suite01 │ │ ├── barebone.cljs │ │ ├── completions.cljs │ │ ├── console.cljs │ │ ├── error_feedback.cljs │ │ ├── misc.cljs │ │ ├── no_agent.cljs │ │ ├── options.cljs │ │ ├── preloads.cljs │ │ ├── repl.cljs │ │ ├── runtime_api.cljs │ │ └── version_checks.cljs │ │ ├── suite02 │ │ ├── beautify_function_names.cljs │ │ ├── clean_urls.cljs │ │ ├── enable_parinfer.cljs │ │ └── welcome_message.cljs │ │ └── suite03 │ │ ├── issue_53.cljs │ │ ├── issue_55.cljs │ │ └── issue_74.cljs ├── src │ └── browser_tests │ │ └── dirac │ │ └── tests │ │ └── browser │ │ ├── runner.clj │ │ └── tasks │ │ ├── helpers.clj │ │ ├── macros.clj │ │ ├── output.clj │ │ ├── signal_server.clj │ │ ├── task_state.clj │ │ ├── tests.clj │ │ ├── transcript.clj │ │ └── transcript_streamer_server.clj └── transcripts │ └── expected │ ├── suite01-barebone.txt │ ├── suite01-completions.txt │ ├── suite01-console.txt │ ├── suite01-error-feedback.txt │ ├── suite01-misc.txt │ ├── suite01-no-agent.txt │ ├── suite01-options.txt │ ├── suite01-preloads.txt │ ├── suite01-repl.txt │ ├── suite01-runtime-api.txt │ ├── suite01-version-checks.txt │ ├── suite02-beautify-function-names.txt │ ├── suite02-clean-urls.txt │ ├── suite02-enable-parinfer.txt │ ├── suite02-welcome-message.txt │ ├── suite03-issue-53.txt │ ├── suite03-issue-55.txt │ └── suite03-issue-74.txt ├── dirac ├── home │ ├── chromium │ │ ├── scout_test.clj │ │ └── version_test.clj │ ├── chromium_test.clj │ └── locations_test.clj ├── main │ └── cli_test.clj └── test_runner.clj ├── docker └── Dockerfile ├── gpig ├── .gitignore ├── README.md ├── deps.edn ├── dev.cljs.edn ├── figwheel-main.edn ├── resources │ └── public │ │ ├── css │ │ └── style.css │ │ ├── index.html │ │ └── test.html ├── scripts │ ├── _shared.sh │ ├── canary.sh │ ├── clean.sh │ └── repl.sh ├── src │ ├── main │ │ └── dirac_gpig │ │ │ └── core.cljs │ └── repl │ │ └── dirac_gpig │ │ └── repl.clj ├── test.cljs.edn └── test │ └── dirac_gpig │ ├── core_test.cljs │ └── test_runner.cljs ├── marion ├── resources │ └── unpacked │ │ ├── background.html │ │ ├── background.js │ │ ├── compiled │ │ ├── content_script.js │ │ ├── manifest.json │ │ └── setup.js └── src │ ├── background │ └── marion │ │ ├── background.cljs │ │ ├── background │ │ ├── chrome.cljs │ │ ├── clients.cljs │ │ ├── content_script.cljs │ │ ├── core.cljs │ │ ├── dirac.cljs │ │ ├── feedback.cljs │ │ ├── helpers.cljs │ │ ├── logging.clj │ │ ├── logging.cljs │ │ └── notifications.cljs │ │ └── figwheel.cljs │ └── content_script │ └── marion │ ├── content_script.cljs │ └── content_script │ ├── background.cljs │ ├── core.cljs │ ├── logging.clj │ ├── logging.cljs │ ├── page.cljs │ └── state.cljs ├── playground └── chromium-home │ ├── bin │ └── executable.sh │ ├── chromium-link-broken │ ├── chromium-link1 │ ├── chromium-link2 │ ├── chromium-link3 │ ├── chromium-link4 │ ├── chromium-link5 │ ├── chromium-text-link │ ├── chromium-text-link-broken │ └── chromium-text-link2 └── src ├── test_lib └── dirac │ └── test_lib │ ├── agent.clj │ ├── chrome_browser.clj │ ├── chrome_driver.clj │ ├── fixtures_web_server.clj │ ├── mock_nrepl_tunnel_client.clj │ ├── mock_weasel_client.clj │ ├── nrepl_server.clj │ ├── nrepl_server_helpers.clj │ └── taxi.clj └── webdriver └── clj_webdriver ├── cache.clj ├── cookie.clj ├── core.clj ├── core_by.clj ├── core_driver.clj ├── core_element.clj ├── driver.clj ├── element.clj ├── firefox.clj ├── form_helpers.clj ├── js └── browserbot.clj ├── options.clj ├── readme.md ├── remote ├── driver.clj └── server.clj ├── taxi.clj ├── util.clj ├── wait.clj ├── window.clj └── wire.clj /.gclient: -------------------------------------------------------------------------------- 1 | solutions = [ 2 | { 3 | "name": "devtools-frontend", 4 | "url": "https://github.com/binaryage/devtools-frontend.git", 5 | "deps_file": "DEPS", 6 | "managed": False, 7 | "custom_deps": {}, 8 | }, 9 | ] 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /test/browser/transcripts/_actual_ 2 | /test/marion/resources/unpacked/.compiled 3 | /test/browser/fixtures/resources/.compiled 4 | /.nrepl-port 5 | /resources/unpacked/devtools/front_end/dirac/.compiled 6 | /resources/unpacked/devtools/CSSProperties.in 7 | /.lein-env 8 | .lein* 9 | .dev-chrome-profile 10 | /resources/unpacked/.compiled 11 | /resources/release.crx 12 | /resources/release.pem 13 | /resources/release/.compiled 14 | /resources/release/devtools 15 | /releases 16 | /.idea 17 | /target 18 | /checkouts* 19 | .profiles/ 20 | pom.xml* 21 | /test/chromedriver 22 | /out/ 23 | .notify/ 24 | .figwheel* 25 | resources/release/background.js 26 | resources/release/options.js 27 | npm-debug.log 28 | /resources/unpacked/devtools/front_end/protocol_externs.js 29 | chrome-linux/ 30 | snapshot.zip 31 | chromium-latest-linux/ 32 | !/.lein-fast-trampoline 33 | .cpcache/ 34 | .test-dirac-chrome-profile 35 | .depot 36 | *.pyc 37 | .ws/ 38 | .tmp/ 39 | dirac.iml 40 | .venv 41 | /.cipd/ 42 | .gclient_entries 43 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "devtools-frontend"] 2 | path = devtools-frontend 3 | url = https://github.com/binaryage/devtools-frontend.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: true 2 | dist: bionic 3 | language: clojure 4 | notifications: 5 | email: 6 | - antonin@hildebrand.cz 7 | cache: 8 | directories: 9 | - "$HOME/.m2" 10 | addons: 11 | apt: 12 | update: true 13 | script: scripts/travis-entrypoint.sh 14 | -------------------------------------------------------------------------------- /examples/figwheel-main/.gitignore: -------------------------------------------------------------------------------- 1 | pom.xml 2 | *jar 3 | /lib/ 4 | /classes/ 5 | /out/ 6 | /target/ 7 | .lein-deps-sum 8 | .lein-repl-history 9 | .lein-plugins/ 10 | .repl 11 | .nrepl-port 12 | .cpcache/ 13 | .rebel_readline_history 14 | .test-dirac-chrome-profile/ 15 | .idea/ -------------------------------------------------------------------------------- /examples/figwheel-main/deps.edn: -------------------------------------------------------------------------------- 1 | {:deps {org.clojure/clojure {:mvn/version "1.10.1"} 2 | org.clojure/clojurescript {:mvn/version "1.10.764"} 3 | cljsjs/react {:mvn/version "16.13.1-0"} 4 | cljsjs/react-dom {:mvn/version "16.13.1-0"} 5 | cljsjs/create-react-class {:mvn/version "15.6.3-1"} 6 | sablono {:mvn/version "0.8.6"} 7 | binaryage/dirac {:mvn/version "1.7.2"}} 8 | :paths ["src/main" "resources"] 9 | :aliases {:fig {:extra-deps {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"} 10 | com.bhauman/figwheel-main {:mvn/version "0.2.5"}} 11 | :extra-paths ["target" "test"]} 12 | :repl {:extra-deps {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"} 13 | com.bhauman/figwheel-main {:mvn/version "0.2.5"} 14 | nrepl {:mvn/version "0.7.0"}} 15 | :extra-paths ["target" "test" "src/repl"]} 16 | :build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]} 17 | :min {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]} 18 | :test {:main-opts ["-m" "figwheel.main" "-co" "test.cljs.edn" "-m" dirac-figmain.test-runner]}}} 19 | -------------------------------------------------------------------------------- /examples/figwheel-main/dev.cljs.edn: -------------------------------------------------------------------------------- 1 | ^{:watch-dirs ["test" "src/main"] 2 | :css-dirs ["resources/public/css"] 3 | :auto-testing true} 4 | {:main dirac-figmain.core 5 | :preloads [dirac.runtime.preload] 6 | :external-config {:dirac.runtime/config {:nrepl-config {:preferred-compiler "figwheel"}}} 7 | } 8 | -------------------------------------------------------------------------------- /examples/figwheel-main/figwheel-main.edn: -------------------------------------------------------------------------------- 1 | ;; Figwheel-main configuration options see: https://figwheel.org/config-options 2 | ;; these will be overriden by the metadata config options in dev.cljs.edn build file 3 | { 4 | ;; Set the server port https://figwheel.org/config-options#ring-server-options 5 | ;; :ring-server-options {:port 9500} 6 | 7 | ;; Target directory https://figwheel.org/config-options#target-dir 8 | ;; you may want to set this to resources if you are using Leiningen 9 | ;; :target-dir "resources" 10 | 11 | ;; Server Ring Handler (optional) https://figwheel.org/docs/ring-handler.html 12 | ;; If you want to embed a ring handler into the figwheel server, this 13 | ;; is for simple ring servers 14 | ;; :ring-handler hello_world.server/handler 15 | 16 | ;; To be able to open files in your editor from the heads up display 17 | ;; you will need to put a script on your path. This script will have 18 | ;; to take a file path and a line number ie. 19 | ;; in ~/bin/myfile-opener: 20 | ;; 21 | ;; #! /bin/sh 22 | ;; emacsclient -n +$2:$3 $1 23 | ;; 24 | ;; :open-file-command "myfile-opener" 25 | 26 | ;; if you are using emacsclient you can just use 27 | ;; :open-file-command "emacsclient" 28 | 29 | ;; Logging output gets printed to the REPL, if you want to redirect it to a file: 30 | ;; :log-file "figwheel-main.log" 31 | 32 | :open-url false 33 | } 34 | -------------------------------------------------------------------------------- /examples/figwheel-main/resources/public/css/style.css: -------------------------------------------------------------------------------- 1 | /* some style */ 2 | 3 | -------------------------------------------------------------------------------- /examples/figwheel-main/resources/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Dirac DevTools Demo Project

11 |

12 | Dirac DevTools provides a custom DevTools frontend packaged in a Chrome Extension.
13 | To use REPL from Dirac you also need to start an nREPL server and a Dirac Agent server. 14 |

15 |
16 |

17 | This project has Figwheel Main support as well...
18 |

19 |
20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /examples/figwheel-main/resources/public/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Test host page

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/figwheel-main/scripts/_shared.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | 5 | cd "$(dirname "${BASH_SOURCE[0]}")" 6 | cd .. 7 | 8 | ROOT_DIR=$(pwd) 9 | SCRIPTS_DIR="$ROOT_DIR/scripts" 10 | 11 | -------------------------------------------------------------------------------- /examples/figwheel-main/scripts/canary.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # shellcheck source=_shared.sh 4 | source "$(dirname "${BASH_SOURCE[0]}")/_shared.sh" 5 | 6 | exec /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary \ 7 | --remote-debugging-port=9222 \ 8 | --no-first-run \ 9 | --user-data-dir=.test-dirac-chrome-profile -------------------------------------------------------------------------------- /examples/figwheel-main/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # shellcheck source=_shared.sh 4 | source "$(dirname "${BASH_SOURCE[0]}")/_shared.sh" 5 | 6 | rm -rf .cpcache 7 | rm -rf target/ -------------------------------------------------------------------------------- /examples/figwheel-main/scripts/repl.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # shellcheck source=_shared.sh 4 | source "$(dirname "${BASH_SOURCE[0]}")/_shared.sh" 5 | 6 | exec clojure -A:repl -m dirac-figmain.repl -------------------------------------------------------------------------------- /examples/figwheel-main/test.cljs.edn: -------------------------------------------------------------------------------- 1 | ^{ 2 | ;; use an alternative landing page for the tests so that we don't 3 | ;; launch the application 4 | :open-url "http://[[server-hostname]]:[[server-port]]/test.html" 5 | 6 | ;; uncomment to launch tests in a headless environment 7 | ;; you will have to figure out the path to chrome on your system 8 | ;; :launch-js ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" "--headless" "--disable-gpu" "--repl" :open-url] 9 | } 10 | {:main dirac-figmain.test-runner} 11 | -------------------------------------------------------------------------------- /examples/figwheel-main/test/dirac_figmain/core_test.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac-figmain.core-test 2 | (:require 3 | [cljs.test :refer-macros [deftest is testing]] 4 | [dirac-figmain.core :refer [multiply]])) 5 | 6 | (deftest multiply-test 7 | (is (= (* 1 2) (multiply 1 2)))) 8 | 9 | (deftest multiply-test-2 10 | (is (= (* 75 10) (multiply 10 75)))) 11 | -------------------------------------------------------------------------------- /examples/figwheel-main/test/dirac_figmain/test_runner.cljs: -------------------------------------------------------------------------------- 1 | ;; This test runner is intended to be run from the command line 2 | (ns dirac-figmain.test-runner 3 | (:require 4 | ;; require all the namespaces that you want to test 5 | [dirac-figmain.core-test] 6 | [figwheel.main.testing :refer [run-tests-async]])) 7 | 8 | (defn -main [& args] 9 | (run-tests-async 5000)) 10 | -------------------------------------------------------------------------------- /examples/leiningen/.gitignore: -------------------------------------------------------------------------------- 1 | /.cljs_rhino_repl 2 | /.lein-env 3 | pom.xml 4 | *jar 5 | /lib/ 6 | /classes/ 7 | /out/ 8 | /target/ 9 | .lein-deps-sum 10 | .lein-repl-history 11 | .lein-plugins/ 12 | .repl* 13 | /checkouts* 14 | /resources/public/.compiled 15 | /resources/demo-node/.compiled 16 | .idea 17 | *.iml 18 | .nrepl-port 19 | .test-dirac-chrome-profile 20 | .figwheel* 21 | .tmp 22 | figwheel_server.log 23 | -------------------------------------------------------------------------------- /examples/leiningen/resources/public/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dirac DevTools Demo 5 | 6 | 7 | 8 | 9 | 10 |

Dirac DevTools Demo Project

11 |

12 | Dirac DevTools provides a custom DevTools frontend packaged in a Chrome Extension.
13 | To use REPL from Dirac you also need to start an nREPL server and a Dirac Agent server.
14 |

15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/leiningen/resources/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dirac DevTools Index 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/leiningen/resources/public/inline_breakpoints.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/leiningen/resources/public/issue_53.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/leiningen/resources/public/issue_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/leiningen/resources/public/playground.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

Playground

10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/leiningen/resources/public/styles/default.css: -------------------------------------------------------------------------------- 1 | html { font-family: arial } 2 | -------------------------------------------------------------------------------- /examples/leiningen/resources/public/tests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dirac DevTools Tests 5 | 6 | 7 | 8 | 9 |

Dirac DevTools ad-hoc manual tests

10 |

note: you have run `lein dev` instead of `lein demo` to have these tests compiled:

11 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/leiningen/scripts/dev-server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "${BASH_SOURCE[0]}")"; cd .. 6 | 7 | ROOT=`pwd` 8 | DEVSERVER_ROOT="$ROOT/resources/public" 9 | DEVSERVER_PORT=9977 10 | 11 | cd "$DEVSERVER_ROOT" 12 | 13 | set +e 14 | PYTHON_PATH=`which python` 15 | set -e 16 | if [ -z "$PYTHON_PATH" ]; then 17 | echo "Error: python does not seem to be installed on your PATH. We use python to start a simple HTTP server." 18 | exit 3 19 | else 20 | echo "Starting HTTP server on port $DEVSERVER_PORT => http://localhost:$DEVSERVER_PORT" 21 | fi 22 | 23 | # taken from https://stackoverflow.com/a/52967771/84283 24 | VERSION=$(python -V 2>&1 | cut -d\ -f 2) # python 2 prints version to stderr 25 | VERSION=(${VERSION//./ }) # make an version parts array 26 | if [[ ${VERSION[0]} -lt 3 ]]; then 27 | LAUNCH_SERVER_CMD="python -m SimpleHTTPServer" 28 | else 29 | LAUNCH_SERVER_CMD="python -m http.server" 30 | fi 31 | 32 | ${LAUNCH_SERVER_CMD} "$DEVSERVER_PORT" 2> /dev/null \ 33 | || echo "Error: failed to start '${LAUNCH_SERVER_CMD} ...', do you have python properly installed? isn't the port $DEVSERVER_PORT already used?" 34 | -------------------------------------------------------------------------------- /examples/leiningen/scripts/reveal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # set working directory as project's root now 6 | cd "$(dirname "${BASH_SOURCE[0]}")"; cd .. 7 | 8 | ./scripts/reveal.cljs $@ 9 | -------------------------------------------------------------------------------- /examples/leiningen/scripts/run-demo-node-source-maps-server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "${BASH_SOURCE[0]}")"; cd .. 6 | 7 | ROOT=`pwd` 8 | SERVER_ROOT="$ROOT/resources/demo-node" 9 | SERVER_PORT=9988 10 | 11 | pushd "$SERVER_ROOT" > /dev/null 12 | 13 | set +e 14 | PYTHON_PATH=`which python` 15 | set -e 16 | if [ -z "$PYTHON_PATH" ]; then 17 | echo "Error: python does not seem to be installed on your PATH. We use python to start a simple HTTP server." 18 | exit 3 19 | else 20 | echo "Starting HTTP server on port $SERVER_PORT => http://localhost:$SERVER_PORT" 21 | fi 22 | 23 | python -m SimpleHTTPServer "$SERVER_PORT" 2> /dev/null \ 24 | || echo "Error: failed to start 'python -m SimpleHTTPServer ...', do you have python properly installed? isn't the port $SERVER_PORT already used?" 25 | 26 | popd 27 | -------------------------------------------------------------------------------- /examples/leiningen/scripts/run-node-demo.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # http://stackoverflow.com/a/22644006/84283 6 | trap "exit" INT TERM 7 | trap "kill 0" EXIT 8 | 9 | cd "$(dirname "${BASH_SOURCE[0]}")"; cd .. 10 | 11 | ROOT=`pwd` 12 | NODE_TARGET_ROOT="$ROOT/resources/demo-node" 13 | 14 | if [ -z "$1" ]; then 15 | echo "launching source-maps server..." 16 | scripts/run-demo-node-source-maps-server.sh & 17 | fi 18 | 19 | pushd "$NODE_TARGET_ROOT" > /dev/null 20 | 21 | node --inspect .compiled/demo.js 22 | 23 | popd 24 | -------------------------------------------------------------------------------- /examples/leiningen/src/shared/dirac_lein/logging.clj: -------------------------------------------------------------------------------- 1 | (ns dirac-lein.logging) 2 | 3 | (defmacro log [& args] 4 | `(do (.log js/console ~@args) nil)) -------------------------------------------------------------------------------- /examples/leiningen/src/tests/dirac_lein/inline_breakpoints.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac-lein.inline-breakpoints 2 | (:require-macros [dirac-lein.logging :refer [log]]) 3 | (:require [clojure.string :as string])) 4 | 5 | (defn ^:export trigger [] 6 | (map (fn [x] (str x)) (range 10)) 7 | (-> "abc_efg" 8 | (string/upper-case) 9 | (string/replace #"ABC" "XYZ"))) 10 | -------------------------------------------------------------------------------- /examples/leiningen/src/tests/dirac_lein/issue_53.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac-lein.issue-53 2 | (:require-macros [dirac-lein.logging :refer [log]])) 3 | 4 | ; https://github.com/binaryage/dirac/issues/53 5 | 6 | (defn repro [count] 7 | (let [x 1 8 | y 2 9 | x 3 10 | z #(println x)] 11 | (js-debugger))) 12 | 13 | (defn ^:export trigger [] 14 | (repro 3)) 15 | -------------------------------------------------------------------------------- /examples/leiningen/src/tests/dirac_lein/issue_7.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac-lein.issue-7 2 | (:require-macros [dirac-lein.logging :refer [log]])) 3 | 4 | ; https://github.com/binaryage/dirac/issues/7 5 | 6 | (def circular1 (atom nil)) 7 | (reset! circular1 circular1) 8 | 9 | (defn ^:export trigger [] 10 | (let [circular circular1] 11 | ; at this point we should be able to play with infinitely expanding structure "circular" in Scope Panel to expose issue #7 12 | (js-debugger))) 13 | 14 | (new x) 15 | -------------------------------------------------------------------------------- /examples/leiningen/src/tests/dirac_lein/main.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac-lein.main) 2 | 3 | ; intentionally left empty 4 | ; we need :main for :preloads to work properly 5 | -------------------------------------------------------------------------------- /examples/leiningen/src/tests/dirac_lein/playground.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac-lein.playground 2 | (:require-macros [dirac-lein.logging :refer [log]]) 3 | (:require [goog.i18n.uChar :as u] 4 | [clojure.string :as s])) 5 | 6 | ; https://github.com/binaryage/dirac/issues/58 7 | (log "u/toCharCode" u/toCharCode (u/toCharCode "a")) 8 | 9 | (log "s/reverse" s/reverse (s/reverse "abc")) 10 | -------------------------------------------------------------------------------- /examples/readme.md: -------------------------------------------------------------------------------- 1 | # Dirac integration examples 2 | 3 | Here are some example projects showing Dirac integration in various scenarios. 4 | 5 | * leiningen - old-school leiningen + cljs-build 6 | * figwheel-main - Figwheel Main project template with deps.edn 7 | 8 | Would be nice to have in the future (PRs welcome): 9 | 10 | * boot example (https://github.com/binaryage/dirac/issues/88) 11 | * plain deps.edn 12 | -------------------------------------------------------------------------------- /examples/shadow/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | public/js 3 | 4 | /target 5 | /checkouts 6 | /src/gen 7 | 8 | pom.xml 9 | pom.xml.asc 10 | *.iml 11 | *.jar 12 | *.log 13 | .shadow-cljs 14 | .idea 15 | .lein-* 16 | .nrepl-* 17 | .DS_Store 18 | 19 | .hgignore 20 | .hg/ 21 | 22 | /public/.compiled/ 23 | /package-lock.json 24 | -------------------------------------------------------------------------------- /examples/shadow/deps.edn: -------------------------------------------------------------------------------- 1 | {:deps 2 | {org.clojure/clojure {:mvn/version "RELEASE"} 3 | org.clojure/clojurescript {:mvn/version "RELEASE"} 4 | ; ---- 5 | thheller/shadow-cljs {:mvn/version "2.11.6"}} 6 | 7 | :paths 8 | ["src/main"] 9 | 10 | } 11 | -------------------------------------------------------------------------------- /examples/shadow/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shadow-app", 3 | "version": "0.0.1", 4 | "private": true, 5 | "devDependencies": { 6 | "shadow-cljs": "2.11.6" 7 | }, 8 | "dependencies": {} 9 | } 10 | -------------------------------------------------------------------------------- /examples/shadow/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | dirac-shadow app 6 | 7 | 8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/shadow/shadow-cljs.edn: -------------------------------------------------------------------------------- 1 | {:deps true 2 | :dev-http {8080 "public"} 3 | :builds {:app 4 | {:target :browser 5 | :output-dir "public/.compiled" 6 | :asset-path "/.compiled" 7 | :modules {:main {:init-fn dirac-shadow.app/init}} 8 | }} 9 | 10 | } 11 | -------------------------------------------------------------------------------- /examples/shadow/src/main/dirac_shadow/app.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac-shadow.app) 2 | 3 | (defn init [] 4 | (println "Hello from dirac-shadow example")) 5 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this the install script for Dirac CLI tool 4 | 5 | set -e -o pipefail 6 | 7 | INSTALL_LOCATION=${1:-/usr/local/bin} 8 | 9 | NAME="dirac" 10 | SOURCE_URL="https://raw.githubusercontent.com/binaryage/dirac/master/dirac" 11 | TARGET="$INSTALL_LOCATION/$NAME" 12 | EXPECTED_CHECKSUM=${DIRAC_INSTALL_EXPECTED_CHECKSUM:-8e580df350401c1a00c0d93aa720103177dfc4050bdc4ded5e817ff5c403c8ed} 13 | 14 | TMP_FILE=$(mktemp "/tmp/dirac.XXXXXX") 15 | 16 | echo "Downloading Dirac CLI tool..." 17 | curl -s "$SOURCE_URL" >"$TMP_FILE" 18 | 19 | # here we perform a paranoid checksum test to make sure we got expected file 20 | if [[ -n "$EXPECTED_CHECKSUM" ]]; then 21 | CHECKSUM=$(shasum -a 256 "$TMP_FILE" | cut -d " " -f 1) 22 | if [[ "$CHECKSUM" != "$EXPECTED_CHECKSUM" ]]; then 23 | echo "SHA checksum of downloaded file does not match expected value" 24 | echo " URL: $SOURCE_URL" 25 | echo " FILE: $TMP_FILE" 26 | echo " '$CHECKSUM' != '$EXPECTED_CHECKSUM'" 27 | echo 28 | echo "If this is not a network issue, please file an issue at https://github.com/binaryage/dirac/issues" 29 | exit 1 30 | fi 31 | fi 32 | 33 | echo "Installing Dirac CLI tool as '$TARGET'..." 34 | mkdir -p "$(dirname "$TARGET")" 35 | cp "$TMP_FILE" "$TARGET" 36 | chmod a+rx "$TARGET" 37 | 38 | command -v $NAME 39 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) BinaryAge Limited and contributors 2 | https://github.com/binaryage/dirac/graphs/contributors 3 | 4 | MIT License 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /privacy-policy.txt: -------------------------------------------------------------------------------- 1 | Dirac Chrome Extension Privacy Policy 2 | 3 | 1. Dirac bundles and uses official Chrome DevTools codebase[1]. 4 | 2. Our code modifies Chrome DevTools in several places to improve ClojureScript experience. 5 | 3. Dirac does not call home in any way. 6 | 4. We do not collect any data from Dirac usage. 7 | 8 | [1] https://github.com/ChromeDevTools/devtools-frontend 9 | -------------------------------------------------------------------------------- /releases.edn: -------------------------------------------------------------------------------- 1 | ; this file is used by dirac command-line tool 2 | ; it describes mapping between Chromium versions and compatible Dirac releases 3 | {:chromium 4 | {; we match most recent Chromium version from the list below 5 | ; see https://github.com/binaryage/dirac/blob/master/src/home/dirac/home/chromium/mapping.clj 6 | ; ... 7 | "88.0.4321" "1.7.2" 8 | "88.0.4310" "1.7.1" 9 | ; botched release "88.0.4310" "1.7.0" 10 | "86.0.4221" "1.6.1" 11 | "86.0.4186" "1.6.0" 12 | "84.0.4145" "1.5.12" 13 | "84.0.4125" "1.5.11" 14 | "84.0.4110" "1.5.10" 15 | "82.0.4080" "1.5.9" 16 | ; deploy of version 1.5.8 is broken on clojars 17 | "82.0.4052" "1.5.7" 18 | "81.0.4000" "1.5.5" 19 | :unsupported {:message "This Chromium version is too old and is not supported by Dirac 1.5.x"} 20 | ; alternatively you can point to a local folder with something like this: 21 | ; "80.0.4000" {:result :local :path "/Users/darwin/code/dirac-ws/dirac/resources/unpacked"} 22 | }} 23 | -------------------------------------------------------------------------------- /resources/dev/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=DEBUG, console 2 | log4j.appender.console=org.apache.log4j.ConsoleAppender 3 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.console.layout.ConversionPattern=%-5p %c: %m%n 5 | -------------------------------------------------------------------------------- /resources/release/background.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/release/blank.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/release/css: -------------------------------------------------------------------------------- 1 | ../shared/css -------------------------------------------------------------------------------- /resources/release/images: -------------------------------------------------------------------------------- 1 | ../shared/images -------------------------------------------------------------------------------- /resources/release/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Dirac", 3 | "name": "Dirac DevTools", 4 | "version": "1.7.2", 5 | "browser_action": { 6 | "default_title": "Open Dirac DevTools", 7 | "default_icon": { 8 | "19": "images/icon19g.png", 9 | "38": "images/icon38g.png" 10 | } 11 | }, 12 | "icons": { 13 | "16": "images/icon16.png", 14 | "48": "images/icon48.png", 15 | "128": "images/icon128.png" 16 | }, 17 | "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", 18 | "background": { 19 | "page": "background.html", 20 | "persistent": true 21 | }, 22 | "commands": { 23 | "open-dirac-devtools": { 24 | "suggested_key": { 25 | "default": "Ctrl+Shift+I" 26 | }, 27 | "description": "Open Dirac DevTools" 28 | }, 29 | "focus-best-console-prompt": { 30 | "suggested_key": { 31 | "default": "Ctrl+Shift+P" 32 | }, 33 | "description": "Focus Console Prompt" 34 | } 35 | }, 36 | "options_ui": { 37 | "page": "options.html", 38 | "chrome_style": true 39 | }, 40 | "permissions": [ 41 | "storage", 42 | "http://*/json", 43 | "activeTab" 44 | ], 45 | "manifest_version": 2 46 | } 47 | -------------------------------------------------------------------------------- /resources/release/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | -------------------------------------------------------------------------------- /resources/shared/images/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binaryage/dirac/34064db1ff668938a22136fedd1f5077bb2504b9/resources/shared/images/icon128.png -------------------------------------------------------------------------------- /resources/shared/images/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binaryage/dirac/34064db1ff668938a22136fedd1f5077bb2504b9/resources/shared/images/icon16.png -------------------------------------------------------------------------------- /resources/shared/images/icon19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binaryage/dirac/34064db1ff668938a22136fedd1f5077bb2504b9/resources/shared/images/icon19.png -------------------------------------------------------------------------------- /resources/shared/images/icon19g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binaryage/dirac/34064db1ff668938a22136fedd1f5077bb2504b9/resources/shared/images/icon19g.png -------------------------------------------------------------------------------- /resources/shared/images/icon38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binaryage/dirac/34064db1ff668938a22136fedd1f5077bb2504b9/resources/shared/images/icon38.png -------------------------------------------------------------------------------- /resources/shared/images/icon38g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binaryage/dirac/34064db1ff668938a22136fedd1f5077bb2504b9/resources/shared/images/icon38g.png -------------------------------------------------------------------------------- /resources/shared/images/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binaryage/dirac/34064db1ff668938a22136fedd1f5077bb2504b9/resources/shared/images/icon48.png -------------------------------------------------------------------------------- /resources/templates/dirac/install-playground-runtime-template.js: -------------------------------------------------------------------------------- 1 | (function (d, urls, after) { 2 | let require = function (url, f) { 3 | let s = d.createElement('script'); 4 | s.type = 'text/javascript'; 5 | s.async = true; 6 | if (f) {s.onload = f;} 7 | s.src = url; 8 | d.getElementsByTagName('head')[0].appendChild(s); 9 | }; 10 | let next = function (rest) { 11 | let url = rest.shift(); 12 | if (url) { 13 | require(url, function () { 14 | next(rest); 15 | }); 16 | } else { 17 | if (after) after(); 18 | } 19 | }; 20 | next(urls); 21 | })(document, [/**/], function() { 22 | /**/ 23 | }); 24 | -------------------------------------------------------------------------------- /resources/templates/dirac/playground-template/readme.md: -------------------------------------------------------------------------------- 1 | This is a simple CLJS project with Dirac integration. 2 | 3 | We use it as the playground runtime for Dirac REPL when there is no user-defined Dirac runtime available. 4 | -------------------------------------------------------------------------------- /resources/templates/dirac/playground-template/src/dirac/playground.cljs.template: -------------------------------------------------------------------------------- 1 | (ns dirac.playground 2 | ; see standard-repl-init-code 3 | (:require [cljs.repl :refer-macros [source doc find-doc apropos dir pst]] 4 | [cljs.pprint :refer [pprint] :refer-macros [pp]])) 5 | -------------------------------------------------------------------------------- /resources/unpacked/background.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /resources/unpacked/background.js: -------------------------------------------------------------------------------- 1 | goog.require("dirac.devtools"); 2 | goog.require("dirac.figwheel"); 3 | goog.require("dirac.background"); 4 | -------------------------------------------------------------------------------- /resources/unpacked/blank.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/unpacked/css: -------------------------------------------------------------------------------- 1 | ../shared/css -------------------------------------------------------------------------------- /resources/unpacked/images: -------------------------------------------------------------------------------- 1 | ../shared/images -------------------------------------------------------------------------------- /resources/unpacked/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /resources/unpacked/options.js: -------------------------------------------------------------------------------- 1 | goog.require("dirac.devtools"); 2 | goog.require("dirac.figwheel"); 3 | goog.require("dirac.options"); 4 | -------------------------------------------------------------------------------- /resources/unpacked/setup.js: -------------------------------------------------------------------------------- 1 | goog.define('goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', true); -------------------------------------------------------------------------------- /scripts/.test-stage-excludes: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.idea 3 | /.notify 4 | /.profiles 5 | /.cpcache 6 | /.test-dirac-chrome-profile 7 | /.tmp 8 | /.ws 9 | /releases 10 | /target 11 | /out 12 | /dirac.iml 13 | /pom.xml* 14 | /resources/release/.compiled 15 | /resources/release/devtools 16 | /resources/release/background.js 17 | /resources/release/options.js 18 | /resources/unpacked/.compiled 19 | /resources/unpacked/devtools/front_end/dirac/.compiled 20 | /test/browser/fixtures/resources/.compiled 21 | /test/marion/resources/unpacked/.compiled 22 | /test/browser/transcripts/_actual_ 23 | -------------------------------------------------------------------------------- /scripts/agent-launcher.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this script tries to launch dirac agent from command line 4 | # 5 | # usage ./agent-launcher.sh [args] 6 | # 7 | 8 | set -e 9 | 10 | VERSION=${DIRAC_AGENT_VERSION:-LATEST} # e.g. 0.1.0 or LATEST 11 | GROUP=${DIRAC_AGENT_GROUP:-binaryage} 12 | ARTIFACT=${DIRAC_AGENT_ARTIFACT:-dirac} 13 | 14 | DIRAC_DEP=${DIRAC_AGENT_DIRAC_DEP:-"{$GROUP/$ARTIFACT {:mvn/version \"$VERSION\"}}"} 15 | DEPS=${DIRAC_AGENT_DEPS:-"{:deps $DIRAC_DEP}"} 16 | CLI_NS=${DIRAC_AGENT_CLI_NS:-"dirac.agent.cli"} 17 | 18 | # $DEPS should be something like '{:deps {binaryage/dirac {:mvn/version "LATEST"}}}' 19 | exec clojure -Sdeps "$DEPS" -m "$CLI_NS" "$@" 20 | -------------------------------------------------------------------------------- /scripts/bisect-compiler-test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # running in $ROOT, see bisect-compiler-helper.sh 4 | 5 | set -e 6 | 7 | COMPILER_VERSION=$1 8 | 9 | # here implement actual testing of dirac against pre-compiled clojurescript version 10 | 11 | export CANARY_CLOJURESCRIPT_VERSION=${COMPILER_VERSION} 12 | export DIRAC_SETUP_BROWSER_TEST_FILTER="issue-53" 13 | 14 | ./scripts/clean-test-stage.sh 15 | set +e 16 | lein test-browser 17 | STATUS=$? 18 | set -e 19 | 20 | # lein test-browser returns 255 (-1) on failure 21 | # git bisect run expects status codes between 1 - 127, 125 is special, 128+ is abort 22 | # convert status to 0/1 23 | if [[ "$STATUS" -ne "0" ]]; then 24 | STATUS=1 # failed 25 | else 26 | STATUS=0 # passed 27 | fi 28 | 29 | exit ${STATUS} -------------------------------------------------------------------------------- /scripts/bisect-compiler.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this will run browser tests against fully optimized dirac extension (release build) 4 | 5 | set -e -o pipefail 6 | # shellcheck source=_config.sh 7 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 8 | 9 | CLOJURESCRIPT_REPO_DIR=${CLOJURESCRIPT_REPO_DIR:-$HOME/farm/clojurescript} 10 | 11 | echo "ClojureScript compiler repo dir is '${CLOJURESCRIPT_REPO_DIR}'" 12 | 13 | cd "${CLOJURESCRIPT_REPO_DIR}" 14 | 15 | git bisect start "$@" 16 | git bisect run "$SCRIPTS/bisect-compiler-helper.sh" 17 | -------------------------------------------------------------------------------- /scripts/check-code.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # check our devtools code for google closure annotations and Chromium coding conventions 4 | 5 | set -e -o pipefail 6 | # shellcheck source=_config.sh 7 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 8 | 9 | set -x 10 | 11 | cd "$DEVTOOLS_ROOT" 12 | 13 | yarn check-gn 14 | #yarn check-grdp 15 | #yarn check-json 16 | yarn check-loc 17 | 18 | yarn closure 19 | -------------------------------------------------------------------------------- /scripts/clean-compiled.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | ./scripts/clear-notify.sh 10 | 11 | rm -rf "resources/unpacked/.compiled" 12 | rm -rf "resources/unpacked/devtools/front_end/dirac/.compiled" 13 | rm -rf "test/browser/fixtures/resources/.compiled" 14 | rm -rf "test/marion/resources/unpacked/.compiled" 15 | -------------------------------------------------------------------------------- /scripts/clean-dev-browser-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | rm -rf "resources/unpacked/.compiled" 10 | rm -rf "resources/unpacked/devtools/front_end/dirac/.compiled" 11 | rm -rf "test/browser/fixtures/resources/.compiled" 12 | rm -rf "test/marion/resources/unpacked/.compiled" 13 | -------------------------------------------------------------------------------- /scripts/clean-notify.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | if [[ -d "$NOTIFY_DIR" ]]; then 8 | rm -rf "$NOTIFY_DIR" 9 | fi 10 | -------------------------------------------------------------------------------- /scripts/clean-target.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | rm -rf "target" 10 | -------------------------------------------------------------------------------- /scripts/clean-test-stage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | TEST_STAGE=${1:-$DIRAC_TEST_STAGE_DIR} 8 | 9 | cd "$ROOT" 10 | 11 | rm -rf "$TEST_STAGE" 12 | -------------------------------------------------------------------------------- /scripts/cljsbuild-notify.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | if [[ ! -d "$NOTIFY_DIR" ]]; then 8 | mkdir -p "$NOTIFY_DIR" 9 | fi 10 | 11 | cd "$NOTIFY_DIR" 12 | 13 | touch "$1" 14 | echo "${@:2}" >> "$1" 15 | -------------------------------------------------------------------------------- /scripts/deploy-clojars.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | LIB_PROFILES="lib" 8 | 9 | cd "$ROOT" 10 | 11 | if [[ -n "$CANARY_CLOJURESCRIPT_VERSION" ]]; then 12 | echo "CANARY_CLOJURESCRIPT_VERSION is set, this would likely break the release - remove it from env before deploy" 13 | exit 1 14 | fi 15 | 16 | ./scripts/list-jar.sh "$LIB_PROFILES" 17 | 18 | LEIN_VERSION=$(grep "defproject" <"$PROJECT_FILE" | cut -d' ' -f3 | cut -d\" -f2) 19 | 20 | # http://stackoverflow.com/a/1885534/84283 21 | echo "Are you sure to publish version ${LEIN_VERSION}? [Yy]" 22 | read -n 1 -r 23 | if [[ "$REPLY" =~ ^[Yy]$ ]]; then 24 | lein with-profile "$LIB_PROFILES" deploy clojars 25 | else 26 | exit 1 27 | fi 28 | -------------------------------------------------------------------------------- /scripts/depot-build-devtools.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | TASK=${1:-compile-dirac-pseudo-names} 8 | 9 | cd "$ROOT" 10 | 11 | lein "$TASK" 12 | 13 | cd "$DEPOT_DIR" 14 | 15 | "$SCRIPTS/depot-ninja.sh" 16 | -------------------------------------------------------------------------------- /scripts/depot-clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$DEPOT_DIR" 8 | 9 | rm -rf out 10 | -------------------------------------------------------------------------------- /scripts/depot-ninja.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$DEPOT_DIR" 8 | 9 | gn gen out/Default 10 | 11 | autoninja -C out/Default 12 | -------------------------------------------------------------------------------- /scripts/depot-sync.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$DEPOT_DIR" 8 | 9 | set -x 10 | exec gclient sync --no-history 11 | -------------------------------------------------------------------------------- /scripts/dev-browser-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | ./scripts/clean-dev-browser-tests.sh 10 | ./scripts/clean-notify.sh 11 | 12 | # we want to prevent clashes between: 13 | # * chrome instance for developing tests (port 9333) 14 | # * chrome instance for automated tests (port 9444) 15 | # * and ad-hoc chrome instances with default (port 9222) 16 | export DIRAC_AGENT_PORT=9041 17 | 18 | export DIRAC_SETUP_CHROME_REMOTE_DEBUGGING_PORT=9333 19 | export DIRAC_SETUP_NREPL_SERVER_PORT=9040 20 | export DIRAC_AGENT__NREPL_SERVER__PORT=9040 21 | export DIRAC_AGENT__NREPL_TUNNEL__PORT=${DIRAC_AGENT_PORT} 22 | export DIRAC_RUNTIME__AGENT_PORT=${DIRAC_AGENT_PORT} 23 | export DIRAC_NREPL__WEASEL_PORT=9042 24 | #export DIRAC_BROWSER_TESTS_LOG_LEVEL=DEBUG 25 | export DIRAC_BROWSER_TESTS_LOG_LEVEL=TRACE 26 | 27 | lein with-profile +cooper,+dev-browser-tests cooper 28 | -------------------------------------------------------------------------------- /scripts/dev-server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$DEVSERVER_ROOT" 8 | 9 | python -m SimpleHTTPServer "$DEVSERVER_PORT" 10 | -------------------------------------------------------------------------------- /scripts/docker-boot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set +e 4 | 5 | # ensure host user matches our internal docker user 6 | env | grep DIRAC 7 | 8 | deluser docker 9 | delgroup docker 10 | EXISTING_USER="$(getent passwd "$DIRAC_HOST_UID")" 11 | EXISTING_GROUP="$(getent group "$DIRAC_HOST_GID" | cut -d ":" -f 1)" 12 | if [[ -n "$EXISTING_USER" ]]; then 13 | deluser "$EXISTING_USER" 14 | fi 15 | if [[ -n "$EXISTING_GROUP" ]]; then 16 | delgroup "$EXISTING_GROUP" 17 | fi 18 | groupadd --system --gid "$DIRAC_HOST_GID" docker 19 | useradd --create-home --shell /bin/bash --uid "$DIRAC_HOST_UID" --gid "$DIRAC_HOST_GID" -G sudo docker 20 | 21 | set -e 22 | 23 | chown -R docker /dirac-ws 24 | chown docker /dirac 25 | chown -R docker /home/docker 26 | 27 | export DIRAC_WORKSPACE_DIR="/dirac-ws" 28 | 29 | exec sudo -u docker --preserve-env=DIRAC_WORKSPACE_DIR,DIRAC_DEBUG -- "$(dirname "${BASH_SOURCE[0]}")/docker-entrypoint.sh" "$@" 30 | -------------------------------------------------------------------------------- /scripts/docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$DOCKER_TESTS_DIR" 8 | 9 | docker build -t "dirac" "$@" . 10 | -------------------------------------------------------------------------------- /scripts/docker-clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$DOCKER_TESTS_DIR" 8 | "$SCRIPTS/clean-test-stage.sh" "$DIRAC_DOCKER_TEST_STAGE_DIR" 9 | 10 | cd "$DOCKER_TESTS_DIR" 11 | 12 | # shellcheck disable=SC2143 13 | if [[ -n "$(docker volume ls | grep 'dirac-data-home$')" ]]; then 14 | docker volume rm -f "dirac-data-home" 15 | fi 16 | 17 | # shellcheck disable=SC2143 18 | if [[ -n "$(docker volume ls | grep 'dirac-data-ws$')" ]]; then 19 | docker volume rm -f "dirac-data-ws" 20 | fi 21 | 22 | # shellcheck disable=SC2143 23 | if [[ -n "$(docker volume ls | grep 'dirac-data-var-cache-apt$')" ]]; then 24 | docker volume rm -f "dirac-data-var-cache-apt" 25 | fi 26 | 27 | # shellcheck disable=SC2143 28 | if [[ -n "$(docker images ls | grep 'dirac$')" ]]; then 29 | docker rmi -f "dirac" 30 | fi 31 | -------------------------------------------------------------------------------- /scripts/docker-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | "$SCRIPTS/sync-test-stage.sh" "$DIRAC_DOCKER_TEST_STAGE_DIR" 8 | 9 | cd "$DOCKER_TESTS_DIR" 10 | 11 | docker volume create --name "dirac-data-home" >/dev/null 12 | docker volume create --name "dirac-data-ws" >/dev/null 13 | docker volume create --name "dirac-data-var-cache-apt" >/dev/null 14 | 15 | DIRAC_HOST_UID=${DIRAC_HOST_UID:-$(id -u)} 16 | DIRAC_HOST_GID=${DIRAC_HOST_GID:-$(id -g)} 17 | 18 | # for dns see https://forums.docker.com/t/intermittent-dns-resolving-issues/9584/17?u=drwin 19 | docker run \ 20 | --name "dirac-job" \ 21 | -e DIRAC_HOST_UID="$DIRAC_HOST_UID" \ 22 | -e DIRAC_HOST_GID="$DIRAC_HOST_GID" \ 23 | -e DIRAC_DEBUG="$DIRAC_DEBUG" \ 24 | --dns=8.8.8.8 \ 25 | -v "dirac-data-home:/home/docker" \ 26 | -v "dirac-data-ws:/dirac-ws" \ 27 | -v "dirac-data-var-cache-apt:/var/cache/apt" \ 28 | -v "$DIRAC_DOCKER_TEST_STAGE_DIR:/dirac" \ 29 | --rm \ 30 | -it dirac \ 31 | "$@" 32 | -------------------------------------------------------------------------------- /scripts/ensure-checkouts.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # checkouts folders mentioned in :source-paths must exist for cljs compiler to be happy 4 | # they can be empty and that should be perfectly fine 5 | 6 | set -e -o pipefail 7 | # shellcheck source=_config.sh 8 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 9 | 10 | cd "$ROOT" 11 | 12 | mkdir -p "checkouts/cljs-devtools/src" 13 | mkdir -p "checkouts/chromex/src/lib" 14 | mkdir -p "checkouts/chromex/src/exts" 15 | -------------------------------------------------------------------------------- /scripts/ensure-eof-lf.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # http://unix.stackexchange.com/a/161853 4 | for f in $(find . -type fls); do tail -n1 $f | read -r _ || echo >> ${f}; done 5 | -------------------------------------------------------------------------------- /scripts/extract-chrome-version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | SHA=${1:-HEAD} 10 | 11 | MERGE_SHA=$("$SCRIPTS/find-devtools-merge-sha.sh" "$SHA") 12 | 13 | FULL_MESSAGE=$(git log --max-count=1 --date=default --pretty=full "$MERGE_SHA") 14 | 15 | #FULL_MESSAGE=$(cat << EOF 16 | #commit ab61c4f00888c9b4e99c0077fe7f7208b4831dd1 17 | #Merge: 97c41dd48 ed96a88e2 18 | #Author: Antonin Hildebrand 19 | #Commit: Antonin Hildebrand 20 | # 21 | # merge updates from official devtools 22 | # 23 | # CHROME-REV:abc 24 | # CHROME-TAG:205.2.30 25 | # SOME-OTHER-DATA:xyz 26 | #EOF 27 | #) 28 | 29 | if [[ ! "$FULL_MESSAGE" =~ ^.*CHROME-TAG:([0-9.]*).*$ ]]; then 30 | printf "unable to find CHROME-TAG in commit message of '%s':\n%s" "$MERGE_SHA" "$FULL_MESSAGE" 31 | exit 1 32 | fi 33 | 34 | echo "${BASH_REMATCH[1]}" 35 | -------------------------------------------------------------------------------- /scripts/extract-help-doc-main.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this script tries to launch dirac.main via lein 4 | # 5 | # usage ./main.sh [args] 6 | # 7 | 8 | set -e 9 | 10 | # https://stackoverflow.com/a/17841619/84283 11 | join_by() { 12 | local IFS="$1" 13 | shift 14 | echo "$*" 15 | } 16 | 17 | start_pre_block() { 18 | echo "\`\`\`" 19 | } 20 | 21 | end_pre_block() { 22 | echo "\`\`\`" 23 | } 24 | 25 | emit_help_markdown() { 26 | local line 27 | # shellcheck disable=SC2068 28 | line="$(join_by " " ${@/eval/})" 29 | echo "" 30 | echo "##### \`> dirac $line\`" 31 | start_pre_block 32 | lein run -m dirac.main -- "$@" 33 | end_pre_block 34 | } 35 | 36 | generate_readme() { 37 | emit_help_markdown help 38 | emit_help_markdown help launch 39 | emit_help_markdown help nuke 40 | } 41 | 42 | cd "$ROOT" 43 | generate_readme 44 | -------------------------------------------------------------------------------- /scripts/find-devtools-merge-sha.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | START_SHA=${1:-HEAD} 10 | 11 | git rev-parse "$START_SHA^{/merge updates from official devtools}" 12 | -------------------------------------------------------------------------------- /scripts/git-fetch-dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | GIT_ORIGIN=${1:-b} 8 | GIT_BRANCH=${2:-master} 9 | 10 | cd "$ROOT" 11 | git fetch "$GIT_ORIGIN" 12 | REMOTE_HEAD="$GIT_ORIGIN/$GIT_BRANCH" 13 | DEVTOOLS_SUBMODULE_COMMIT=$(git ls-tree "$REMOTE_HEAD" | grep "devtools-frontend" | cut -d " " -f 3 | cut -d$'\t' -f 1) 14 | 15 | cd devtools-frontend 16 | git fetch "$GIT_ORIGIN" HEAD 17 | 18 | cd "$ROOT" 19 | git reset --hard "$REMOTE_HEAD" 20 | 21 | cd devtools-frontend 22 | git checkout "$DEVTOOLS_SUBMODULE_COMMIT" 23 | -------------------------------------------------------------------------------- /scripts/health-check-launcher.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | # this will combine stdout and stderr and tee logs into syslog as well 6 | # see http://elevated-dev.com/TechTips/Launchd%20&%20Logging/ 7 | exec 1> >(tee >(logger -t "dirac health-check")) 2>&1 8 | 9 | die_if_dirty_working_copy () { 10 | if [[ -n "$(git status -uno --porcelain)" ]]; then 11 | echo "working copy is not clean in '$(pwd)'" 12 | exit 1 13 | fi 14 | } 15 | 16 | # ensure we start in scripts folder 17 | cd "$(dirname "${BASH_SOURCE[0]}")/.." 18 | 19 | ROOT="$(pwd)" 20 | SCRIPTS="$ROOT/scripts" 21 | 22 | # update our code to latest 23 | git fetch origin 24 | git checkout -B master origin/master 25 | 26 | exec "$SCRIPTS/health-check.sh" 27 | -------------------------------------------------------------------------------- /scripts/install-health-checking-job.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$SCRIPTS" 8 | 9 | AGENTS_DIR=~/Library/LaunchAgents 10 | PLIST_NAME=com.binaryage.dirac-health-check.plist 11 | PLIST_SOURCE="plists/$PLIST_NAME" 12 | PLIST_PATH="$AGENTS_DIR/$PLIST_NAME" 13 | 14 | cp "$PLIST_SOURCE" "$AGENTS_DIR" 15 | launchctl unload "$PLIST_PATH" 16 | launchctl load -w "$PLIST_PATH" 17 | -------------------------------------------------------------------------------- /scripts/launch-canary.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | if [[ ! -d "$DIRAC_USER_PROFILE" ]]; then 10 | mkdir -p "$DIRAC_USER_PROFILE" 11 | fi 12 | 13 | if [[ ! -z "$1" ]]; then 14 | EXE="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" 15 | else 16 | EXE="/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" 17 | fi 18 | 19 | "$EXE" \ 20 | --remote-debugging-port=9222 \ 21 | --no-first-run \ 22 | --disable-infobars \ 23 | --disable-default-apps \ 24 | --user-data-dir="$DIRAC_USER_PROFILE" \ 25 | localhost:9222/json 26 | -------------------------------------------------------------------------------- /scripts/launch-custom-canary.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | if [[ ! -d "$DIRAC_USER_PROFILE2" ]]; then 10 | mkdir -p "$DIRAC_USER_PROFILE2" 11 | fi 12 | 13 | if [[ -n "$1" ]]; then 14 | EXE="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" 15 | else 16 | EXE="/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" 17 | fi 18 | 19 | "$EXE" \ 20 | --no-first-run \ 21 | --disable-infobars \ 22 | --disable-default-apps \ 23 | --user-data-dir="$DIRAC_USER_PROFILE2" \ 24 | "--custom-devtools-frontend=file://$DEPOT_DIR/out/Default/resources/inspector" 25 | -------------------------------------------------------------------------------- /scripts/launch-fixtures-server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$DEV_FIXTURES_SERVER_ROOT" 8 | 9 | echo "launching fixtures server for development (silent mode) in '$DEV_FIXTURES_SERVER_ROOT' on port $DEV_FIXTURES_SERVER_PORT" 10 | 11 | set -x 12 | exec python -m SimpleHTTPServer "$DEV_FIXTURES_SERVER_PORT" >/dev/null 2>&1 13 | -------------------------------------------------------------------------------- /scripts/launch-release-canary.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | if [[ ! -d "$DIRAC_USER_PROFILE2" ]]; then 10 | mkdir -p "$DIRAC_USER_PROFILE2" 11 | fi 12 | 13 | if [[ -n "$1" ]]; then 14 | EXE="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" 15 | else 16 | EXE="/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" 17 | fi 18 | 19 | "$EXE" \ 20 | --no-first-run \ 21 | --disable-infobars \ 22 | --disable-default-apps \ 23 | --user-data-dir="$DIRAC_USER_PROFILE2" \ 24 | --remote-debugging-port=9222 \ 25 | "--custom-devtools-frontend=file://$ROOT/resources/release/devtools/front_end" 26 | -------------------------------------------------------------------------------- /scripts/lib/tools.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | redirect_to_test_stage_if_needed() { 4 | if [[ -n "$DIRAC_TEST_IN_STAGE" ]]; then 5 | local spawn_script_path 6 | spawn_script_path=$(portable_realpath "$SPAWN_COMMAND") 7 | local script_path 8 | script_path=$(portable_realpath --relative-to="$ROOT" "$spawn_script_path") 9 | "$SCRIPTS/sync-test-stage.sh" 10 | cd "$DIRAC_TEST_STAGE_DIR" 11 | unset DIRAC_TEST_IN_STAGE 12 | export DIRAC_WORKSPACE_DIR="$DIRAC_WORKSPACE_DIR" 13 | exec "$script_path" "$@" 14 | fi 15 | } 16 | -------------------------------------------------------------------------------- /scripts/list-jar.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | LIB_PROFILES=${1:-lib} 10 | 11 | ./scripts/check-versions.sh 12 | 13 | lein with-profile "${LIB_PROFILES}" jar 14 | 15 | LEIN_VERSION=$(grep "defproject" < "$PROJECT_FILE"| cut -d' ' -f3 | cut -d\" -f2) 16 | BASE_FILE="dirac-$LEIN_VERSION" 17 | POM_PATH="META-INF/maven/binaryage/dirac/pom.xml" 18 | 19 | cd target 20 | unzip -l "$BASE_FILE.jar" 21 | unzip "$BASE_FILE.jar" "$POM_PATH" -d inspect 22 | 23 | echo 24 | echo "approx. pom.xml dependencies:" 25 | grep -E -i "artifactId|version" < "inspect/$POM_PATH" 26 | 27 | echo 28 | echo "----------------------------" 29 | echo 30 | -------------------------------------------------------------------------------- /scripts/local-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | if [[ -n "$CANARY_CLOJURESCRIPT_VERSION" ]]; then 10 | echo "CANARY_CLOJURESCRIPT_VERSION is set, this would likely break the release - remove it from env before deploy" 11 | exit 1 12 | fi 13 | 14 | LIB_PROFILE=${1:-lib} 15 | 16 | ./scripts/list-jar.sh "${LIB_PROFILE}" 17 | 18 | lein with-profile "${LIB_PROFILE}" install 19 | -------------------------------------------------------------------------------- /scripts/lookup-chromium-link.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | PLATFORM=${1:-Mac} 10 | POSITION=$2 11 | RANGE=${3:-100} 12 | 13 | PLATFORM_ZIP="chrome-mac.zip" 14 | if [[ "$PLATFORM" == Linux* ]]; then 15 | PLATFORM_ZIP="chrome-linux.zip" 16 | fi 17 | if [[ "$PLATFORM" == Win* ]]; then 18 | PLATFORM_ZIP="chrome-win.zip" 19 | fi 20 | 21 | if [[ -z "$POSITION" ]]; then 22 | echo -n "Determining latest build for $PLATFORM..." 23 | POSITION=$(curl -s "http://commondatastorage.googleapis.com/chromium-browser-snapshots/${PLATFORM}/LAST_CHANGE") 24 | echo "=> position is $POSITION" 25 | fi 26 | 27 | # shellcheck disable=SC2086 28 | # shellcheck disable=SC2003 29 | MIN_POSITION=$(expr ${POSITION} - ${RANGE}) 30 | # shellcheck disable=SC2086 31 | for i in $(seq ${POSITION} -1 ${MIN_POSITION}); do 32 | echo ${i}; 33 | url="http://commondatastorage.googleapis.com/chromium-browser-snapshots/$PLATFORM/$i/$PLATFORM_ZIP" 34 | if curl --output /dev/null --silent --head --fail "$url"; then 35 | echo "${url}" 36 | exit 0 37 | fi 38 | done 39 | 40 | echoerr "unable to find chromium for platform $PLATFORM in the range [$MIN_POSITION, $POSITION]" 41 | 42 | echo "" 43 | exit 1 44 | -------------------------------------------------------------------------------- /scripts/main-launch-dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | JVM_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:5005" 10 | export JVM_OPTS 11 | 12 | ./scripts/main.sh -vv launch --releases "$ROOT/../releases-dev.edn" --debug 9222 "$@" 13 | -------------------------------------------------------------------------------- /scripts/main-launcher-local.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this a wrapper script for launching dirac.main from command line 4 | # 5 | # usage ./main-launcher.sh [args] 6 | # 7 | 8 | set -e -o pipefail 9 | # shellcheck source=_config.sh 10 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 11 | 12 | DEPS="{:deps {binaryage/dirac {:local/root \"$ROOT\"} clj-logging-config {:mvn/version \"1.9.12\"}}}" 13 | 14 | JVM_OPTS=() 15 | #JVM_OPTS+=("-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=127.0.0.1:5005") 16 | 17 | set -x 18 | clojure "${JVM_OPTS[@]}" -Sdeps "$DEPS" -m dirac.main "$@" 19 | -------------------------------------------------------------------------------- /scripts/main-launcher.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this a wrapper script for launching dirac.main from command line 4 | # 5 | # usage ./main-launcher.sh [args] 6 | # 7 | 8 | set -e -o pipefail 9 | 10 | DEPS='{:deps {binaryage/dirac {:mvn/version "1.5.0"} clj-logging-config {:mvn/version "1.9.12"}}}' 11 | 12 | #set -x 13 | exec clojure -Sdeps "$DEPS" -m dirac.main "$@" 14 | -------------------------------------------------------------------------------- /scripts/main.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this script tries to launch dirac.main via lein 4 | # 5 | # usage ./main.sh [args] 6 | # 7 | 8 | set -e 9 | 10 | ARGS=() 11 | if [[ -t 1 ]] ; then 12 | # please note that lein run does some internal piping and prevents TTY detection, we have to force colors by hand 13 | # https://stackoverflow.com/a/29425613/84283 14 | ARGS+=("--force-color") 15 | fi 16 | 17 | # set -x 18 | exec lein run -m dirac.main -- "${ARGS[@]}" "$@" 19 | -------------------------------------------------------------------------------- /scripts/position-for-version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | VERSION=$1 10 | 11 | if [[ -n "$VERSION" ]]; then 12 | OMAHA_URL="https://omahaproxy.appspot.com/deps.json?version=$VERSION" 13 | set +e 14 | POSITION=$(curl -s "$OMAHA_URL"| python -mjson.tool | grep chromium_base_position | cut -d ":" -f 2 | sed "s/[ ,\"]//g") 15 | set -e 16 | 17 | if [[ "$POSITION" = "null" || -z "$POSITION" || "$POSITION" = "No JSON object could be decoded\n" ]]; then 18 | echoerr "unable to determine chrome position for version '$VERSION', $OMAHA_URL returned null chromium_base_position" 19 | echoerr "this could happen when given version does not exist because of test/build failures" 20 | echoerr "use 'env OVERRIDE_CHROME_VERSION=version' to override broken version for this script" 21 | exit 2 22 | fi 23 | 24 | echo "$POSITION" 25 | else 26 | popd 27 | popd 28 | exit 1 29 | fi 30 | -------------------------------------------------------------------------------- /scripts/prepare-chromium-links.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | VERSION=$1 10 | 11 | if [[ -n "$VERSION" ]]; then 12 | echo "looking up position for version $VERSION..." 13 | POSITION=$(./scripts/position-for-version.sh "${VERSION}") 14 | echo " => $POSITION" 15 | else 16 | echo "looking up latest versions..." 17 | fi 18 | 19 | echo "----" 20 | 21 | platforms="Mac Linux_x64 Win Win_x64" 22 | for platform in ${platforms}; do 23 | set +e # lookup can fail, we don't provide a link in that case 24 | LINK=$(./scripts/lookup-chromium-link.sh "${platform}" "${POSITION}" | tail -n1) 25 | set -e 26 | if [[ -n "${LINK}" ]]; then 27 | echo "[$platform](${LINK})" 28 | else 29 | echo "$platform" 30 | fi 31 | done 32 | -------------------------------------------------------------------------------- /scripts/prune-release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | #set -x 8 | 9 | echo "Pruning release build in $RELEASE_BUILD" 10 | 11 | cd "$RELEASE_BUILD" 12 | 13 | rm -f "devtools/front_end/debug" 14 | rm -f "devtools/front_end/dirac/.compiled" 15 | 16 | find . -name ".DS_Store" -exec rm -rf {} \; 17 | find . -name ".htaccess" -exec rm -rf {} \; 18 | find . -depth -name '*runner' -type d -exec rm -rf {} \; 19 | 20 | rm -f "devtools/front_end/Tests.js" 21 | -------------------------------------------------------------------------------- /scripts/pull-chromium.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$CHROMIUM_MIRROR_DIR" 8 | 9 | git checkout master 10 | git pull 11 | git clean -fd 12 | 13 | gclient sync --with_branch_heads --reset --delete_unversioned_trees 14 | git fetch --tags 15 | -------------------------------------------------------------------------------- /scripts/regenerate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | "$SCRIPTS/depot-sync.sh" 10 | "$SCRIPTS/depot-clean.sh" 11 | "$SCRIPTS/depot-ninja.sh" 12 | -------------------------------------------------------------------------------- /scripts/roll-devtools.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | die_if_dirty_working_copy () { 8 | if [[ -n "$(git status -uno --porcelain)" ]]; then 9 | echo "working copy is not clean in '$(pwd)'" 10 | exit 1 11 | fi 12 | } 13 | 14 | cd "$ROOT" 15 | 16 | set -x 17 | 18 | cd "$DEVTOOLS_FRONTEND_DIR" 19 | 20 | die_if_dirty_working_copy 21 | 22 | # assume: 23 | # git remote add official https://github.com/ChromeDevTools/devtools-frontend.git 24 | git fetch official 25 | git merge official/master 26 | -------------------------------------------------------------------------------- /scripts/run-backend-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | echo "Running backend tests..." 10 | lein run-backend-tests-110 11 | lein run-backend-tests-19 12 | -------------------------------------------------------------------------------- /scripts/run-browser-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | export CHROME_LOG_FILE="$ROOT/target/chrome_debug.log" 10 | 11 | echo "Running browser tests..." 12 | lein with-profile +test-runner trampoline run -m "$@" 2>&1 13 | -------------------------------------------------------------------------------- /scripts/run-cli-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | export DIRAC_TEST_PLAYGROUND="$ROOT/test/playground" 10 | 11 | echo "Running CLI tests..." 12 | lein run-cli-tests-110 13 | lein run-cli-tests-19 14 | -------------------------------------------------------------------------------- /scripts/run-devtools-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | set -x 8 | 9 | cd "$DEVTOOLS_SCRIPTS" 10 | 11 | yarn test --chromium-path="$CHROMIUM_MIRROR_DIR" 12 | -------------------------------------------------------------------------------- /scripts/run-devtools-yarn.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | set -x 8 | 9 | cd "$DEVTOOLS_ROOT" 10 | 11 | yarn "$@" 12 | -------------------------------------------------------------------------------- /scripts/start-job.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | launchctl start com.binaryage.dirac 4 | 5 | # note: you may want to 6 | # 7 | # sudo launchctl log level debug 8 | # sudo tail -f /var/log/system.log 9 | # 10 | # => http://serverfault.com/questions/249199/manually-start-scheduled-launchd-job 11 | -------------------------------------------------------------------------------- /scripts/sync-test-stage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | TEST_STAGE=${1:-$DIRAC_TEST_STAGE_DIR} 8 | 9 | cd "$ROOT" 10 | 11 | mkdir -p "$TEST_STAGE" 12 | 13 | RSYNC_VERSION=$(rsync --version | head -n 1 | cut -d " " -f 4) 14 | 15 | set +e 16 | vercomp "$RSYNC_VERSION" "3.1.1" 17 | if [[ $? != 1 ]]; then 18 | echo "rsync version 3.1.2+ needed, your version $RSYNC_VERSION" 19 | echo "under mac use 'brew install homebrew/dupes/rsync' to get the latest rsync" 20 | exit 1 21 | fi 22 | set -e 23 | 24 | echo "Syncing test stage from '$ROOT' to '$(portable_realpath "$TEST_STAGE")'..." 25 | rsync -a --info=progress2 --delete --exclude-from="$DIRAC_TEST_STAGE_RSYNC_EXCLUDE_FILE" "$ROOT/" "$TEST_STAGE" 26 | echo 27 | -------------------------------------------------------------------------------- /scripts/sync-transcripts-from-docker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$SCRIPTS" 8 | 9 | ./sync-transcripts.sh "$DIRAC_DOCKER_TEST_STAGE_DIR" 10 | -------------------------------------------------------------------------------- /scripts/sync-transcripts.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | TEST_STAGE=${1:-$DIRAC_TEST_STAGE_DIR} 8 | 9 | "$SCRIPTS/sync-test-stage.sh" "$TEST_STAGE" 10 | 11 | cd "$ROOT" 12 | 13 | mkdir -p "$EXPECTED_TRANSCRIPTS_PATH" 14 | 15 | rsync -av --delete "$TEST_STAGE/$ACTUAL_TRANSCRIPTS_PATH/" "$EXPECTED_TRANSCRIPTS_PATH/" 16 | -------------------------------------------------------------------------------- /scripts/test-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ -n "$SKIP_DIRAC_TESTS" ]]; then 4 | echo "skipping tests due to SKIP_DIRAC_TESTS" 5 | exit 0 6 | fi 7 | 8 | set -e -o pipefail 9 | # shellcheck source=_config.sh 10 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 11 | 12 | redirect_to_test_stage_if_needed 13 | 14 | cd "$ROOT" 15 | 16 | ./scripts/test-cli.sh 17 | ./scripts/test-backend.sh 18 | ./scripts/test-browser.sh "$@" 19 | -------------------------------------------------------------------------------- /scripts/test-backend.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this will run browser tests against fully optimized dirac extension (release build) 4 | 5 | set -e -o pipefail 6 | # shellcheck source=_config.sh 7 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 8 | 9 | redirect_to_test_stage_if_needed 10 | 11 | cd "$ROOT" 12 | 13 | # we want to prevent clashes between: 14 | # * chrome instance for developing tests (port 9333) 15 | # * chrome instance for automated tests (port 9444) 16 | # * and ad-hoc chrome instances with default (port 9222) 17 | export DIRAC_SETUP_CHROME_REMOTE_DEBUGGING_PORT=9444 18 | export DIRAC_SETUP_NREPL_SERVER_PORT=12040 19 | export DIRAC_AGENT__NREPL_SERVER__PORT=12040 20 | export DIRAC_AGENT__NREPL_TUNNEL__PORT=12041 21 | export DIRAC_RUNTIME__AGENT_PORT=12041 22 | export DIRAC_NREPL__WEASEL_PORT=12042 23 | 24 | ./scripts/run-backend-tests.sh 25 | -------------------------------------------------------------------------------- /scripts/test-browser-dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this will run browser tests against unpacked dirac extension 4 | 5 | set -e -o pipefail 6 | # shellcheck source=_config.sh 7 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 8 | 9 | redirect_to_test_stage_if_needed 10 | 11 | cd "$ROOT" 12 | 13 | # we want to prevent clashes between: 14 | # * chrome instance for developing tests (port 9333) 15 | # * chrome instance for automated tests (port 9444) 16 | # * and ad-hoc chrome instances with default (port 9222) 17 | export DIRAC_SETUP_CHROME_REMOTE_DEBUGGING_PORT=9444 18 | export DIRAC_SETUP_NREPL_SERVER_PORT=13040 19 | export DIRAC_AGENT__NREPL_SERVER__PORT=13040 20 | export DIRAC_AGENT__NREPL_TUNNEL__PORT=13041 21 | export DIRAC_RUNTIME__AGENT_PORT=13041 22 | export DIRAC_NREPL__WEASEL_PORT=13042 23 | 24 | lein compile-browser-tests 25 | lein compile-marion 26 | lein compile-dirac-dev 27 | ./scripts/run-browser-tests.sh "dirac.tests.browser.runner/-dev-main" 28 | -------------------------------------------------------------------------------- /scripts/test-browser.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this will run browser tests against fully optimized dirac extension (release build) 4 | 5 | set -e -o pipefail 6 | # shellcheck source=_config.sh 7 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 8 | 9 | redirect_to_test_stage_if_needed "$@" 10 | 11 | cd "$ROOT" 12 | 13 | # we want to prevent clashes between: 14 | # * chrome instance for developing tests (port 9333) 15 | # * chrome instance for automated tests (port 9444) 16 | # * and ad-hoc chrome instances with default (port 9222) 17 | export DIRAC_SETUP_CHROME_REMOTE_DEBUGGING_PORT=9444 18 | export DIRAC_SETUP_NREPL_SERVER_PORT=13040 19 | export DIRAC_AGENT__NREPL_SERVER__PORT=13040 20 | export DIRAC_AGENT__NREPL_TUNNEL__PORT=13041 21 | export DIRAC_RUNTIME__AGENT_PORT=13041 22 | export DIRAC_NREPL__WEASEL_PORT=13042 23 | 24 | export CHROME_DRIVER_LOG_PATH="$ROOT/target/chromedriver.log" 25 | export DIRAC_CHROME_DRIVER_VERBOSE=1 26 | export DIRAC_TEST_BROWSER=1 27 | 28 | source "scripts/lib/travis.sh" 29 | 30 | travis_fold start compile-browser 31 | travis_time_start 32 | echo "Compile browser tests" 33 | lein compile-browser-tests 34 | lein compile-marion 35 | ./scripts/release.sh 36 | travis_time_finish 37 | travis_fold end compile-browser 38 | 39 | if [[ -n "$1" ]]; then 40 | export DIRAC_SETUP_BROWSER_TEST_FILTER=$1 41 | fi 42 | 43 | ./scripts/run-browser-tests.sh "dirac.tests.browser.runner" 44 | -------------------------------------------------------------------------------- /scripts/test-cli.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # this will run browser tests against fully optimized dirac extension (release build) 4 | 5 | set -e -o pipefail 6 | # shellcheck source=_config.sh 7 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 8 | 9 | redirect_to_test_stage_if_needed 10 | 11 | cd "$ROOT" 12 | 13 | ./scripts/run-cli-tests.sh 14 | -------------------------------------------------------------------------------- /scripts/test-devtools.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$DEVTOOLS_ROOT" 8 | 9 | npm install 10 | npm test 11 | -------------------------------------------------------------------------------- /scripts/test-health-check-job.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | launchctl start com.binaryage.dirac-health-check 4 | 5 | # note: you may want to 6 | # 7 | # sudo launchctl log level debug 8 | # sudo tail -f /var/log/system.log 9 | # 10 | # => http://serverfault.com/questions/249199/manually-start-scheduled-launchd-job 11 | -------------------------------------------------------------------------------- /scripts/update-installer-checksum.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | cd "$ROOT" 8 | 9 | CURRENT_CHECKSUM=$(shasum -a 256 "dirac" | cut -d " " -f 1) 10 | 11 | echo "$CURRENT_CHECKSUM" 12 | 13 | sed -i "" -e "s/{DIRAC_INSTALL_EXPECTED_CHECKSUM:-.*}/{DIRAC_INSTALL_EXPECTED_CHECKSUM:-$CURRENT_CHECKSUM}/g" "install" 14 | -------------------------------------------------------------------------------- /scripts/update-versions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # updates all version strings 4 | 5 | set -e -o pipefail 6 | # shellcheck source=_config.sh 7 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 8 | 9 | cd "$ROOT" 10 | 11 | VERSION=$1 12 | 13 | if [[ -z "$VERSION" ]]; then 14 | echo "please specify version as the first argument" 15 | exit 1 16 | fi 17 | 18 | sed -i "" -e "s/defproject binaryage\/dirac \".*\"/defproject binaryage\/dirac \"$VERSION\"/g" "$PROJECT_FILE" 19 | sed -i "" -e "s/def version \".*\"/def version \"$VERSION\"/g" "$PROJECT_VERSION_FILE" 20 | sed -i "" -e "s/\"version\"\: \".*\"/\"version\": \"$VERSION\"/g" "$UNPACKED_MANIFEST_FILE" 21 | sed -i "" -e "s/\"version\"\: \".*\"/\"version\": \"$VERSION\"/g" "$RELEASE_MANIFEST_FILE" 22 | sed -i "" -e "s/dirac-version \".*\"/dirac-version \"$VERSION\"/g" "$EXAMPLES_LEININGEN_PROJECT_FILE" 23 | sed -i "" -E "s/binaryage\\/dirac([ ]*){:mvn\\/version \".*\"}/binaryage\\/dirac\\1{:mvn\\/version \"$VERSION\"}/g" "$EXAMPLES_FIGMAIN_DEPS_FILE" 24 | sed -i "" -e "s/def cli-version \".*\"/def cli-version \"$VERSION\"/g" "$DIRAC_MAIN_CLI_FILE" 25 | 26 | # this is just a sanity check 27 | ./scripts/check-versions.sh 28 | -------------------------------------------------------------------------------- /scripts/wait-for-notify.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | # shellcheck source=_config.sh 5 | source "$(dirname "${BASH_SOURCE[0]}")/_config.sh" 6 | 7 | TRIGGER_FILE="$NOTIFY_DIR/$1" 8 | 9 | counter=0 10 | while [[ ! -f "$TRIGGER_FILE" ]]; 11 | do 12 | counter=$((counter+1)) 13 | n=$((counter%60)) 14 | if [[ ${n} -eq 0 ]]; then 15 | echo "still waiting for '$TRIGGER_FILE' to be created..." 16 | fi 17 | sleep 1 18 | done 19 | 20 | echo "$TRIGGER_FILE found" 21 | -------------------------------------------------------------------------------- /src/agent/dirac/agent/config.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.agent.config 2 | (:require [dirac.utils :refer [deep-merge-ignoring-nils]] 3 | [dirac.config :refer [read-env-config]])) 4 | 5 | (def env-config-prefix "dirac-agent") 6 | 7 | ; you can override individual config keys via ENV variables, for example: 8 | ; DIRAC_AGENT/LOG_LEVEL=debug or DIRAC_AGENT/NREPL_SERVER/PORT=7777 9 | ; 10 | ; see https://github.com/binaryage/env-config 11 | (def default-config 12 | {:log-level "WARN" ; OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL 13 | :max-boot-trials 10 14 | :initial-boot-delay 1000 15 | :delay-between-boot-trials 500 16 | :nrepl-server {:host "localhost" 17 | :port 8230} 18 | :nrepl-tunnel {:host "localhost" 19 | :port 8231}}) 20 | 21 | ; -- config evaluation ------------------------------------------------------------------------------------------------------ 22 | 23 | (defn get-effective-config* [& [config]] 24 | (let [env-config (read-env-config env-config-prefix)] 25 | (deep-merge-ignoring-nils default-config env-config config))) 26 | 27 | (def ^:dynamic get-effective-config (memoize get-effective-config*)) ; assuming env-config is constant 28 | -------------------------------------------------------------------------------- /src/agent/dirac/agent/version.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.agent.version 2 | (:require [dirac.project])) 3 | 4 | (def ^:dynamic version dirac.project/version) 5 | -------------------------------------------------------------------------------- /src/automation/dirac/automation/constants.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.automation.constants) 2 | 3 | (def ^:const SECOND 1000) 4 | (def ^:const MINUTE (* 60 SECOND)) 5 | -------------------------------------------------------------------------------- /src/automation/dirac/automation/devtools.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.automation.devtools 2 | (:require [devtools.core :as devtools] 3 | [devtools.prefs :as devtools-prefs] 4 | [dirac.automation.logging :refer [error info log warn]] 5 | [dirac.shared.async :refer [") 7 | (let [result# ~form 8 | printed-result# (dirac.shared.utils/strip-last-nl (cljs.core/with-out-str (dirac.shared.pprint/pprint result#)))] 9 | (dirac.automation.scenario/go-post-feedback! printed-result# "scenario =>"))))) 10 | 11 | (defmacro with-feedback [& forms] 12 | (let [make-exec (fn [form] 13 | `(dirac.automation.scenario/exec-with-feedback! ~form)) 14 | execs (map make-exec forms)] 15 | `(do ~@execs))) 16 | 17 | (defmacro with-captured-console [& forms] 18 | `(try 19 | (dirac.automation.scenario/capture-console-as-feedback!) 20 | ~@forms 21 | (finally 22 | (dirac.automation.scenario/uncapture-console-as-feedback!)))) 23 | -------------------------------------------------------------------------------- /src/automation/dirac/automation/status.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.automation.status 2 | (:require [oops.core :refer [gcall gcall! ocall! oget oset!]])) 3 | 4 | ; status is a
tag which shows status of fixtures page 5 | 6 | (defn set-style! [status-el & [style]] 7 | {:pre [status-el]} 8 | (let [class-names (str "status" (if (some? style) (str " status-" style)))] 9 | (oset! status-el "className" class-names))) 10 | 11 | (defn make-status [] 12 | (let [status-el (gcall "document.createElement" "div")] 13 | (set-style! status-el) 14 | status-el)) 15 | 16 | (defn create-status! [parent-el] 17 | {:pre [parent-el]} 18 | (let [status-el (make-status)] 19 | (ocall! parent-el "appendChild" status-el) 20 | status-el)) 21 | 22 | (defn destroy-status! [status-el] 23 | {:pre [status-el]} 24 | (ocall! status-el "remove")) 25 | 26 | (defn set-status! [status-el text] 27 | {:pre [status-el]} 28 | (oset! status-el "textContent" text)) 29 | 30 | (defn clear-status! [status-el] 31 | {:pre [status-el]} 32 | (set-status! status-el "")) 33 | -------------------------------------------------------------------------------- /src/automation/dirac/automation/status_host.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.automation.status-host 2 | (:require [dirac.automation.helpers :as helpers] 3 | [dirac.automation.status :as status])) 4 | 5 | (defonce current-status (atom nil)) 6 | 7 | (defn set-status! [text] 8 | (status/set-status! @current-status text)) 9 | 10 | (defn init-status! [id] 11 | (let [status-el (status/create-status! (helpers/get-el-by-id id))] 12 | (reset! current-status status-el) 13 | (set-status! "ready to run"))) 14 | 15 | (defn set-style! [style] 16 | (status/set-style! @current-status style)) 17 | -------------------------------------------------------------------------------- /src/automation/dirac/automation/test.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.automation.test) 2 | 3 | (defmacro with-captured-output [& body] 4 | `(-> (cljs.core/with-out-str ~@body) 5 | (dirac.shared.utils/strip-last-nl) 6 | (dirac.shared.utils/trim-leading-nls))) 7 | -------------------------------------------------------------------------------- /src/background/dirac/background.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.background 2 | (:require [dirac.background.core :as core] 3 | [dirac.shared.utils :refer [runonce]])) 4 | 5 | (runonce 6 | (core/init!)) 7 | -------------------------------------------------------------------------------- /src/background/dirac/background/core.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.background.core 2 | (:require [chromex.chrome-event-channel :refer [make-chrome-event-channel]] 3 | [dirac.background.action :as action] 4 | [dirac.background.chrome :as chrome] 5 | [dirac.background.logging :refer [error info log warn]] 6 | [dirac.background.state :as state] 7 | [dirac.options.model :as options] 8 | [dirac.shared.async :refer [ {} 13 | (into (System/getenv)) 14 | (into (System/getProperties)))) 15 | 16 | (defn deep-merge-ignoring-nils 17 | "Recursively merges maps. If keys are not maps, the last value wins. Nils are ignored." 18 | [& vals] 19 | (let [non-nil-vals (remove nil? vals)] 20 | (if (every? map? non-nil-vals) 21 | (apply merge-with deep-merge-ignoring-nils non-nil-vals) 22 | (last non-nil-vals)))) 23 | 24 | (defn remove-keys-with-nil-val [m] 25 | (into {} (remove (comp nil? second) m))) 26 | -------------------------------------------------------------------------------- /src/devtools/dirac/devtools.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.devtools 2 | (:require [devtools.core :as devtools] 3 | [dirac.shared.utils :refer [runonce when-not-advanced-mode]])) 4 | 5 | (defn install-devtools-if-needed! [] 6 | (when-not-advanced-mode 7 | (devtools/install!))) 8 | 9 | (runonce (install-devtools-if-needed!)) 10 | -------------------------------------------------------------------------------- /src/empty/readme.md: -------------------------------------------------------------------------------- 1 | This folder is intentionally left empty (no sources). 2 | 3 | It is used in project.clj to work around some unwanted cljsbuild behaviour. -------------------------------------------------------------------------------- /src/figwheel/dirac/figwheel.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.figwheel 2 | (:require [dirac.shared.utils :refer [runonce when-not-advanced-mode when-not-dirac-test-mode]] 3 | [figwheel.client :as figwheel])) 4 | 5 | ; ------------------------------------------------------------------------------------------------------------------- 6 | ; has to be included before boot 7 | 8 | (when-not-advanced-mode 9 | (when-not-dirac-test-mode 10 | (runonce 11 | (figwheel/start 12 | {;:build-id ['background 'popup] 13 | :websocket-url "ws://localhost:7100/figwheel-ws"})))) 14 | -------------------------------------------------------------------------------- /src/home/dirac/home.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.home 2 | (:require [dirac.home.locations :as locations])) 3 | 4 | (def get-home-dir-path locations/get-home-dir-path) 5 | 6 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | (comment 9 | (get-home-dir-path) 10 | ) 11 | -------------------------------------------------------------------------------- /src/home/dirac/home/chromium.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.home.chromium 2 | (:require [dirac.home.chromium.scout :as scout] 3 | [dirac.home.chromium.link :as link] 4 | [dirac.home.chromium.profiles :as profiles] 5 | [dirac.home.defaults :as defaults] 6 | [dirac.home.chromium.extra-args :as extra-args] 7 | [dirac.home.chromium.mapping :as mapping] 8 | [dirac.home.locations :as locations])) 9 | 10 | (def find-chrome-executable scout/find-chrome-executable) 11 | (def determine-chrome-version scout/determine-chrome-version) 12 | 13 | (def chromium-link-exists? link/chromium-link-exists?) 14 | (def resolve-chromium-link link/resolve-chromium-link) 15 | 16 | (def resolve-dirac-release! mapping/resolve-dirac-release!) 17 | (def try-download-releases-file-if-needed! mapping/try-download-releases-file-if-needed!) 18 | 19 | (def get-chromium-profile-dir-path profiles/get-chromium-profile-dir-path) 20 | 21 | (def read-chromium-extra-args extra-args/read-chromium-extra-args) 22 | 23 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 | 25 | (comment 26 | (find-chrome-executable) 27 | (determine-chrome-version (find-chrome-executable)) 28 | (resolve-dirac-release! "81.1.4014.0" defaults/releases-file-url (locations/get-releases-file-path)) 29 | (read-chromium-extra-args) 30 | ) 31 | -------------------------------------------------------------------------------- /src/home/dirac/home/chromium/extra_args.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.home.chromium.extra-args 2 | (:require [dirac.home.helpers :as helpers] 3 | [dirac.home.locations :as locations] 4 | [clojure.java.io :as io]) 5 | (:import (java.io File))) 6 | 7 | (def get-chromium-extra-args-file-path locations/get-chromium-extra-args-file-path) 8 | 9 | (defn read-chromium-extra-args 10 | ([] (read-chromium-extra-args (get-chromium-extra-args-file-path))) 11 | ([^File file] 12 | (let [file (io/file file)] 13 | (if (.exists file) 14 | (-> file 15 | (helpers/read-trimmed-lines) 16 | (helpers/filter-commented-lines)))))) 17 | 18 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 | 20 | (comment 21 | (get-chromium-extra-args-file-path) 22 | (read-chromium-extra-args) 23 | ) 24 | -------------------------------------------------------------------------------- /src/home/dirac/home/chromium/profiles.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.home.chromium.profiles 2 | (:require [dirac.home.locations :as locations])) 3 | 4 | (def get-chromium-profiles-dir-path locations/get-chromium-profiles-dir-path) 5 | 6 | (defn get-chromium-profile-dir-path [name] 7 | (locations/canonical-path (get-chromium-profiles-dir-path) name)) 8 | 9 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 | 11 | (comment 12 | (get-chromium-profiles-dir-path) 13 | (get-chromium-profile-dir-path "test") 14 | ) 15 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/editor.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.editor 2 | "Glues Parinfer's formatter to a CodeMirror editor" 3 | (:require [oops.core :refer [gcall gget oapply ocall oget]])) 4 | 5 | (def basic-editor-opts 6 | {:mode "clojure-parinfer" 7 | :theme "dirac" 8 | :matchBrackets true 9 | :height "auto"}) 10 | 11 | (def parinfer-editor-opts 12 | basic-editor-opts) 13 | 14 | (defn create-editor! [element _key parinfer?] 15 | (let [element-id (oget element "id") 16 | cm-class (gget "CodeMirror") 17 | effective-opts (clj->js (if parinfer? parinfer-editor-opts basic-editor-opts)) 18 | cm (cm-class. element effective-opts) 19 | wrapper (ocall cm "getWrapperElement") 20 | class (if parinfer? "cm-x-parinfer" "cm-x-basic")] 21 | (set! (.-id wrapper) (str "cm-" element-id)) 22 | (set! (.-className wrapper) (str (.-className wrapper) " " class)) 23 | (gcall "parinferCodeMirror.init" cm "smart" effective-opts) 24 | cm)) 25 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/eval.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.eval 2 | (:require [clojure.java.io :as io])) 3 | 4 | (def playground-template-path "dirac/install-playground-runtime-template.js") 5 | 6 | (defn read-playground-template [] 7 | (slurp (io/file (io/resource playground-template-path)))) 8 | 9 | (defmacro emit-install-playground-runtime-template [] 10 | (read-playground-template)) 11 | 12 | (comment 13 | (read-playground-template)) 14 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/info.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.info 2 | (:require [clojure.string :as string] 3 | [dirac.implant.logging :refer [error log warn]] 4 | [dirac.implant.version :refer [get-version]] 5 | [dirac.runtime.util :refer [get-browser-platform-info get-browser-version-info]] ; TODO: we should not depend on runtime here 6 | [oops.core :refer [gget oapply ocall oget oset!]])) 7 | 8 | ; -- helpers ---------------------------------------------------------------------------------------------------------------- 9 | 10 | (defn make-chrome-info [tag rev] 11 | (str tag "@" (.substring rev 0 7))) 12 | 13 | ; -- versions --------------------------------------------------------------------------------------------------------------- 14 | 15 | (defn get-version-info [] 16 | (str "Dirac v" (get-version))) 17 | 18 | ; -- public ----------------------------------------------------------------------------------------------------------------- 19 | 20 | (defn get-info-line [] 21 | (let [parts [(get-version-info) 22 | (get-browser-version-info) 23 | (get-browser-platform-info)]] 24 | (string/join ", " parts))) 25 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/intercom.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.intercom) 2 | 3 | (defmacro error-response [id & args] 4 | `(cljs.core.async/go 5 | (~'error ~@args) 6 | {:op :error 7 | :id ~id 8 | :err (apply str ~@(interpose " " args))})) 9 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/logging.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.logging 2 | (:require [dirac.logging.toolkit :refer [gen-console-log]])) 3 | 4 | ; --------------------------------------------------------------------------------------------------------------------------- 5 | ; logging - these need to be macros to preserve source location for devtools 6 | 7 | (def enabled? true) 8 | (def color "blue") 9 | 10 | (defn gen-log [method env args] 11 | (if enabled? 12 | (gen-console-log method args {:env env 13 | :bg-color color}))) 14 | 15 | ; -- public api ------------------------------------------------------------------------------------------------------------- 16 | 17 | (defmacro log [& args] 18 | (gen-log "log" &env args)) 19 | 20 | (defmacro info [& args] 21 | (gen-log "info" &env args)) 22 | 23 | (defmacro error [& args] 24 | (gen-log "error" &env args)) 25 | 26 | (defmacro warn [& args] 27 | (gen-log "warn" &env args)) 28 | 29 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/logging.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.logging 2 | (:require-macros [dirac.implant.logging]) 3 | (:require [dirac.logging.toolkit])) 4 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/munging.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.munging 2 | (:require [clojure.string :as string] 3 | [devtools.munging :as munging] 4 | [dirac.implant.helpers :refer [get-dirac-angel]] 5 | [oops.core :refer [gcall oapply ocall oget oset!]])) 6 | 7 | (defn is-cljs-function-name? [munged-name] 8 | (or (empty? munged-name) 9 | (munging/cljs-fn-name? munged-name))) 10 | 11 | (defn ns-detector [name] 12 | (let [demunged-name (demunge name) 13 | namespace-descriptor (ocall (get-dirac-angel) "getNamespace" demunged-name)] 14 | (some? namespace-descriptor))) 15 | 16 | (defn present-function-name [munged-name & [include-ns? include-protocol-ns?]] 17 | (if (empty? munged-name) 18 | "λ" 19 | (let [present-opts {:include-ns? include-ns? 20 | :include-protocol-ns? include-protocol-ns? 21 | :silence-common-protocols? false 22 | :ns-detector ns-detector}] 23 | (munging/present-function-name munged-name present-opts)))) 24 | 25 | (defn ns-to-relpath [ns ext] 26 | (str (string/replace (munge ns) \. \/) "." (name ext))) 27 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/options.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.options 2 | (:require [dirac.implant.logging :refer [error log warn]] 3 | [oops.core :refer [gcall gget oapply oget]])) 4 | 5 | (defn get-query-param [name] 6 | (gcall "Root.Runtime.queryParam" name)) 7 | 8 | ; -- url param access ------------------------------------------------------------------------------------------------------- 9 | 10 | (defn get-devtools-id* [] 11 | (or (js/parseInt (get-query-param "devtools_id") 10) 0)) 12 | 13 | (defn should-automate?* [] 14 | (= (get-query-param "dirac_automate") "1")) 15 | 16 | (defn should-mock-old-extension-version?* [] 17 | (= (get-query-param "mock_old_extension_version") "1")) 18 | 19 | (defn should-mock-future-extension-version?* [] 20 | (= (get-query-param "mock_future_extension_version") "1")) 21 | 22 | (defn should-disable-reporter?* [] 23 | (= (get-query-param "disable_reporter") "1")) 24 | 25 | ; -- memoized API ----------------------------------------------------------------------------------------------------------- 26 | 27 | (def get-devtools-id (memoize get-devtools-id*)) 28 | (def should-automate? (memoize should-automate?*)) 29 | (def should-mock-old-extension-version? (memoize should-mock-old-extension-version?*)) 30 | (def should-mock-future-extension-version? (memoize should-mock-future-extension-version?*)) 31 | (def should-disable-reporter? (memoize should-disable-reporter?*)) 32 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/repl.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.repl 2 | (:require [cljs.repl :refer [default-special-fns]])) 3 | 4 | (defmacro default-specials [] 5 | `(vector ~@(distinct (map name (keys default-special-fns))))) 6 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/repl.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.repl 2 | (:require-macros [dirac.implant.repl :refer [default-specials]])) 3 | 4 | (def repl-specials (to-array (default-specials))) 5 | (def extra-specials #js ["dirac!" "*1" "*2" "*3" "*e"]) 6 | (def all-specials (.concat repl-specials extra-specials)) 7 | 8 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/version.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.version 2 | (:require [dirac.project])) 3 | 4 | (defonce version dirac.project/version) 5 | 6 | (defmacro get-version [] 7 | version) 8 | -------------------------------------------------------------------------------- /src/implant/dirac/implant/version.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.implant.version 2 | (:require-macros [dirac.implant.version :refer [get-version]]) 3 | (:require [dirac.implant.options :as options])) 4 | 5 | (defonce version (cond 6 | (options/should-mock-old-extension-version?) "0.0.1" 7 | (options/should-mock-future-extension-version?) "1000.0.1" 8 | :else (get-version))) 9 | -------------------------------------------------------------------------------- /src/logging/dirac/logging/toolkit.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.logging.toolkit 2 | "Helper namespace for requires needed by logging.toolkit macros" 3 | (:require-macros [dirac.logging.toolkit]) 4 | (:require [dirac.shared.utils] 5 | [oops.core])) 6 | -------------------------------------------------------------------------------- /src/logging/dirac/logging/utils.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.logging.utils 2 | (:require [clojure.set :refer [rename-keys]] 3 | [dirac.utils :as utils]) 4 | (:import (org.apache.log4j Level))) 5 | 6 | (defn convert-config-to-logging-options [config] 7 | (-> config 8 | (select-keys [:log-out :log-level]) 9 | (rename-keys {:log-out :out 10 | :log-level :level}) 11 | (update :level #(if % (Level/toLevel ^String % Level/INFO))) 12 | (utils/remove-keys-with-nil-val))) 13 | 14 | (defn merge-options [& option-maps] 15 | (or (apply utils/deep-merge-ignoring-nils option-maps) {})) 16 | -------------------------------------------------------------------------------- /src/main/dirac/main.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.main 2 | (:require [clojure.tools.logging :as log] 3 | [dirac.main.cli :as cli] 4 | [dirac.main.actions :as actions] 5 | [dirac.main.logging :as logging] 6 | [dirac.main.utils :as utils] 7 | [dirac.main.terminal :as terminal]) 8 | (:gen-class)) 9 | 10 | (defn exit! [config] 11 | (when-some [message (:message config)] 12 | (println message)) 13 | (System/exit (or (:exit-status config) 0))) 14 | 15 | (defn dispatch! [config] 16 | (case (:command config) 17 | :exit (exit! config) 18 | :launch (actions/launch! config) 19 | :nuke (actions/nuke! config) 20 | (throw (ex-info "Unexpected command" config)))) 21 | 22 | ; -- main entry point ------------------------------------------------------------------------------------------------------- 23 | 24 | (defn -main [& args] 25 | (let [config (cli/parse-cli-args args)] 26 | (terminal/setup! config) 27 | (logging/setup! config) 28 | (log/trace (str "Using ANSI:" (pr-str (terminal/using-ansi?)))) 29 | (log/debug (str "CLI config:\n" (utils/pp config))) 30 | (let [exit-code (dispatch! config)] 31 | (assert (or (nil? exit-code) (integer? exit-code))) 32 | (System/exit (or exit-code 0))))) 33 | -------------------------------------------------------------------------------- /src/main/dirac/main/actions.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.main.actions 2 | (:require [dirac.main.actions.launch] 3 | [dirac.main.actions.nuke])) 4 | 5 | (def launch! dirac.main.actions.launch/launch!) 6 | (def nuke! dirac.main.actions.nuke/nuke!) 7 | 8 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 | 10 | (comment 11 | ) 12 | -------------------------------------------------------------------------------- /src/main/dirac/main/logging/format.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.main.logging.format 2 | (:require [dirac.main.terminal :refer [style]]) 3 | (:import (org.apache.log4j Layout Level) 4 | (org.apache.log4j.spi LoggingEvent))) 5 | 6 | (defn level->styles [level] 7 | (case (.toString level) 8 | "ERROR" [:red] 9 | "INFO" [:default] 10 | "DEBUG" [:magenta] 11 | [:black])) 12 | 13 | (defn standard-formatter [event & [_kind]] 14 | (let [{:keys [renderedMessage level]} event 15 | style-args (level->styles level)] 16 | (str (apply style renderedMessage style-args) "\n"))) 17 | 18 | (defn as-map [^LoggingEvent ev] 19 | (assoc (bean ev) :event ev)) 20 | 21 | (defn create-layout-adaptor [f & args] 22 | (proxy [Layout] [] 23 | (format [ev] (apply f (as-map ev) args)) 24 | (ignoresThrowable [] true))) 25 | 26 | ; https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html 27 | (defn standard-layout [& args] 28 | {:layout (apply create-layout-adaptor standard-formatter args)}) 29 | -------------------------------------------------------------------------------- /src/main/dirac/main/utils.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.main.utils 2 | (:require [clojure.pprint :refer [pprint]] 3 | [clojure.string :as string] 4 | [clojure.java.io :as io])) 5 | 6 | (defn pp [data & [level length]] 7 | (string/trim (with-out-str 8 | (binding [*print-level* (or level 10) ; we have to be careful here, data might contain circular references 9 | *print-length* (or length 200) 10 | clojure.pprint/*print-right-margin* 126] ; don't limit right margin 11 | (pprint data))))) 12 | 13 | (defn output* [f config args] 14 | (assert (map? config)) 15 | (if-not (true? (:quiet config)) 16 | (apply f args))) 17 | 18 | (defn output [config & args] 19 | (output* print config args)) 20 | 21 | (defn outputln [config & args] 22 | (output* println config args)) 23 | 24 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 | 26 | (comment 27 | 28 | ) 29 | -------------------------------------------------------------------------------- /src/nrepl-lib/dirac/nrepl_lib/common.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.nrepl-lib.common 2 | (:require [clojure.pprint :refer [pprint]] 3 | [clojure.string :as string])) 4 | 5 | (defn get-nrepl-server-url [host port] 6 | (str "nrepl://" host ":" port)) 7 | 8 | (defn get-ws-url [host port] 9 | (str "ws://" host ":" port)) 10 | 11 | (defn first-part [s] 12 | (first (string/split s #"-" 2))) 13 | 14 | (defn sid [thing] 15 | (str "#" (first-part (cond 16 | (map? thing) (str (:id thing)) 17 | (seq? thing) (str (first thing)) 18 | :else (str thing))))) 19 | 20 | (defn exit-with-error! [msg & [exit-code]] 21 | (binding [*out* *err*] 22 | (println "-----------------------------------------------------------------------------------------------------------") 23 | (println "ERROR!") 24 | (println msg) 25 | (println "-----------------------------------------------------------------------------------------------------------") 26 | (System/exit (or exit-code 1)))) 27 | 28 | (defn print-warning! [& args] 29 | (binding [*out* *err*] 30 | (println "-----------------------------------------------------------------------------------------------------------") 31 | (println "WARNING!") 32 | (apply println args) 33 | (println "-----------------------------------------------------------------------------------------------------------"))) 34 | -------------------------------------------------------------------------------- /src/nrepl-lib/dirac/nrepl_lib/nrepl_protocols.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.nrepl-lib.nrepl-protocols) 2 | 3 | (defprotocol NREPLTunnelService 4 | (open-session [this]) 5 | (close-session [this session]) 6 | (deliver-message-to-server! [this message]) 7 | (deliver-message-to-client! [this message])) 8 | -------------------------------------------------------------------------------- /src/nrepl-lib/dirac/nrepl_lib/version.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.nrepl-lib.version 2 | (:require [dirac.project])) 3 | 4 | (def ^:dynamic version dirac.project/version) 5 | -------------------------------------------------------------------------------- /src/nrepl/dirac/nrepl/debug.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.nrepl.debug 2 | (:require [clojure.tools.logging :as log] 3 | [cuerdas.core :as cuerdas] 4 | [dirac.utils :as utils]) 5 | (:import (java.io PrintWriter StringWriter))) 6 | 7 | (def ^:dynamic *log-stack-traces* false) 8 | 9 | (defn drop-first-n-lines [n s] 10 | (->> s 11 | (cuerdas/lines) 12 | (drop n) 13 | (cuerdas/unlines))) 14 | 15 | (defn get-printed-stack-trace [] 16 | (try 17 | (throw (Throwable. "")) 18 | (catch Throwable e 19 | (let [string-writer (StringWriter.) 20 | writer (PrintWriter. string-writer)] 21 | (.printStackTrace e writer) 22 | (drop-first-n-lines 3 (str string-writer)))))) 23 | 24 | (defmacro log-stack-trace! [] 25 | (when *log-stack-traces* 26 | `(log/debug (get-printed-stack-trace)))) 27 | 28 | (defmacro log-stack-trace!! [] 29 | `(log/debug (get-printed-stack-trace))) 30 | 31 | (defn pprint-session [session] 32 | (str "session #" (-> session meta :id))) 33 | 34 | (defn pprint-nrepl-message [nrepl-message] 35 | (let [modified-nrepl-message (assoc nrepl-message :session (pprint-session (:session nrepl-message)))] 36 | (utils/pp modified-nrepl-message))) 37 | -------------------------------------------------------------------------------- /src/nrepl/dirac/nrepl/transports/debug_logging.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.nrepl.transports.debug-logging 2 | (:require [clojure.tools.logging :as log] 3 | [nrepl.transport :as nrepl-transport] 4 | [dirac.utils :as utils] 5 | [dirac.nrepl.debug :as debug]) 6 | (:import (nrepl.transport Transport))) 7 | 8 | ; -- transport wrapper ------------------------------------------------------------------------------------------------------ 9 | 10 | (defrecord DebugLoggingTransport [nrepl-message transport] 11 | Transport 12 | (recv [_this timeout] 13 | (nrepl-transport/recv transport timeout)) 14 | (send [_this reply-message] 15 | (log/debug (str "sending raw message via nREPL transport: " transport " \n") (utils/pp reply-message)) 16 | (debug/log-stack-trace!) 17 | (nrepl-transport/send transport reply-message))) 18 | 19 | ; -- public interface ------------------------------------------------------------------------------------------------------- 20 | 21 | (defn make-nrepl-message-with-debug-logging [nrepl-message] 22 | (update nrepl-message :transport (partial ->DebugLoggingTransport nrepl-message))) 23 | -------------------------------------------------------------------------------- /src/nrepl/dirac/nrepl/version.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.nrepl.version 2 | (:require [dirac.project])) 3 | 4 | (def ^:dynamic version dirac.project/version) 5 | -------------------------------------------------------------------------------- /src/options/dirac/options.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.options 2 | (:require [dirac.options.core :as core] 3 | [dirac.shared.utils :refer [runonce]])) 4 | 5 | (runonce 6 | (core/go-init!)) 7 | -------------------------------------------------------------------------------- /src/options/dirac/options/core.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.options.core 2 | (:require [dirac.options.model :as model] 3 | [dirac.options.ui :as ui] 4 | [dirac.shared.async :refer [ :dirac.runtime/config 7 | ; see https://github.com/binaryage/dirac/blob/master/docs/configuration.md#dirac-runtime---page-specific-configuration 8 | 9 | (def config (gen-config)) 10 | 11 | (dirac/set-prefs! (merge (dirac/get-prefs) config)) 12 | 13 | (when-not (dirac/get-pref :suppress-preload-install) 14 | (dirac/install!)) 15 | -------------------------------------------------------------------------------- /src/runtime/dirac/runtime/tag.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.runtime.tag 2 | (:require [dirac.runtime.prefs :as prefs] 3 | [dirac.runtime.util :refer [get-browser-platform-info 4 | get-browser-version-info 5 | get-js-context-description 6 | in-node-context?]])) 7 | 8 | ; -- helpers ---------------------------------------------------------------------------------------------------------------- 9 | 10 | (defn- prepare-tag-line [items] 11 | (apply str (interpose " | " items))) 12 | 13 | ; -- tag api ---------------------------------------------------------------------------------------------------------------- 14 | 15 | (defn get-browser-tag-data [] 16 | {:tag (prefs/pref :runtime-tag) 17 | :url (str js/location) 18 | :browser (get-browser-version-info) 19 | :platform (get-browser-platform-info)}) 20 | 21 | (defn get-node-tag-data [] 22 | {:tag (prefs/pref :runtime-tag) 23 | :platform (get-js-context-description)}) 24 | 25 | (defn get-tag [] 26 | (prepare-tag-line (if (in-node-context?) 27 | ((juxt :tag :platform) (get-node-tag-data)) 28 | ((juxt :tag :url :browser :platform) (get-browser-tag-data))))) 29 | -------------------------------------------------------------------------------- /src/settings/dirac/settings.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.settings 2 | (:require-macros [dirac.settings])) 3 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/async.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.shared.async 2 | (:require-macros [dirac.shared.async]) 3 | (:require [cljs.core.async])) ; used by macros 4 | 5 | ; --------------------------------------------------------------------------------------------------------------------------- 6 | ; mainly just a stub namespace for macros 7 | 8 | (defn set-timeout-marker! [o] 9 | (dirac.shared.async/gen-setup-timeout-marker o) 10 | true) 11 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/console.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.shared.console 2 | (:require [goog.debug.Console] 3 | [goog.debug.Logger.Level :as level] 4 | [goog.log :as goog-log] 5 | [oops.core :refer [gcall oapply ocall ocall! oget oset!]])) 6 | 7 | ; taken from https://gist.github.com/caskolkm/39d823f5bac7051d3062 8 | 9 | (def logger (goog-log/getLogger "app")) 10 | 11 | (def levels 12 | {:severe level/SEVERE 13 | :warning level/WARNING 14 | :info level/INFO 15 | :config level/CONFIG 16 | :fine level/FINE 17 | :finer level/FINER 18 | :finest level/FINEST}) 19 | 20 | (defn make-console [] 21 | (js/goog.debug.Console.)) 22 | 23 | (defn log-to-console! [] 24 | (ocall! (make-console) "setCapturing" true)) 25 | 26 | (defn set-level! [level-keyword] 27 | (let [wanted-level (get levels level-keyword (:info levels))] 28 | (ocall! logger "setLevel" wanted-level))) 29 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/cookies.cljs: -------------------------------------------------------------------------------- 1 | ; taken from https://github.com/Quantisan/cljs-cookies/blob/4963df43bd4b025f34a34be7b6b37b11fb69d278/src/cljs_cookies/core.cljs 2 | (ns dirac.shared.cookies 3 | (:refer-clojure :exclude [empty?]) 4 | (:require [oops.core :refer [gcall oapply ocall ocall! oget oset!]]) 5 | (:import goog.net.Cookies)) 6 | 7 | (def cookies (Cookies. js/document)) 8 | 9 | (defn make-key-name [k] 10 | (name k)) 11 | 12 | (defn set-cookie [k v & opts] 13 | "Sets a cookie. 14 | Options: 15 | max-age -- The max age in seconds (from now). Use -1 to set a session cookie. If not provided, the default is -1 (i.e. set a session cookie). 16 | " 17 | (let [key-name (make-key-name k)] 18 | (when (ocall cookies "isValidName" key-name) 19 | (when (ocall cookies "isValidValue" v) 20 | (let [{:keys [max-age path domain secure?]} (apply hash-map opts)] 21 | (ocall! cookies "set" key-name v max-age path domain secure?)))))) 22 | 23 | (defn get-cookie [k] 24 | "Returns the value for the first cookie with the given key." 25 | (let [key-name (make-key-name k)] 26 | (ocall cookies "get" key-name nil))) 27 | 28 | (defn remove-cookie [k] 29 | "Removes and expires a cookie." 30 | (let [key-name (make-key-name k)] 31 | (ocall cookies "remove" key-name))) 32 | 33 | (defn enabled? 34 | ([] (enabled? cookies)) 35 | ([c] (ocall c "isEnabled"))) 36 | 37 | (defn empty? 38 | ([] (empty? cookies)) 39 | ([c] (ocall c "isEmpty"))) 40 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/dom.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.shared.dom 2 | (:require [clojure.string :as string] 3 | [dirac.shared.dom.shim] 4 | [dirac.shared.logging :refer [error info log warn]] 5 | [oops.core :refer [gcall gget oapply ocall oget oset!]])) 6 | 7 | ; -- DOM access ------------------------------------------------------------------------------------------------------------- 8 | 9 | (defn element? [v] 10 | (instance? js/HTMLElement v)) 11 | 12 | (defn query-selector 13 | ([selector] (gcall "document.querySelectorAll" selector)) 14 | ([element selector] (ocall element "querySelectorAll" selector))) 15 | 16 | (defn query-selector-deep 17 | ([selector] (query-selector-deep (gget "document.body") selector)) 18 | ([node selector] (gcall "diracAngel.querySelectorAllDeep" node selector))) 19 | 20 | (defn get-tag-name [el] 21 | (when-some [tag-name (oget el "?tagName")] 22 | (string/lower-case tag-name))) 23 | 24 | (defn get-class-name [el] 25 | (oget el "?className")) 26 | 27 | (defn get-children [el] 28 | (oget el "?children")) 29 | 30 | (defn get-shadow-root [el] 31 | (oget el "?shadowRoot")) 32 | 33 | (defn get-own-text-content [el] 34 | (when (empty? (get-children el)) 35 | (oget el "?textContent"))) 36 | 37 | (defn get-title [el] 38 | (oget el "?title")) 39 | 40 | (defn get-next-sibling [el] 41 | (oget el "nextSibling")) 42 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/dom/shim.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.shared.dom.shim 2 | (:refer-clojure :exclude [empty next parents remove val])) 3 | 4 | ; --------------------------------------------------------------------------------------------------------------------------- 5 | ; taken from light-table 6 | 7 | (defn lazy-nl-via-item 8 | ([nl] (lazy-nl-via-item nl 0)) 9 | ([nl n] (when (< n (. nl -length)) 10 | (lazy-seq 11 | (cons (. nl (item n)) 12 | (lazy-nl-via-item nl (inc n))))))) 13 | 14 | (extend-type js/HTMLCollection 15 | ISeqable 16 | (-seq [this] (lazy-nl-via-item this)) 17 | 18 | ICounted 19 | (-count [this] (.-length this)) 20 | 21 | IIndexed 22 | (-nth 23 | ([this n] (.item this n)) 24 | ([this n not-found] (or (.item this n) not-found)))) 25 | 26 | (extend-type js/NodeList 27 | ISeqable 28 | (-seq [this] (lazy-nl-via-item this)) 29 | 30 | ICounted 31 | (-count [this] (.-length this)) 32 | 33 | IIndexed 34 | (-nth 35 | ([this n] (.item this n)) 36 | ([this n not-found] (or (.item this n) not-found)))) 37 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/i18n.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.shared.i18n) 2 | 3 | (def cannot-attach-help-url 4 | "https://github.com/binaryage/dirac/blob/master/docs/faq.md#getting-error-cannot-attach-dirac-devtools-what-now") 5 | 6 | (defn unable-to-create-dirac-tab [] 7 | "Unable to create a new tab for Dirac DevTools.") 8 | 9 | (defn cannot-attach-dirac [debugger-url tab-url] 10 | (str "Cannot attach Dirac DevTools. " 11 | "Likely cause: another instance of DevTools is already attached.\n" 12 | "Don't you have internal DevTools open in the tab?\n" 13 | "See " cannot-attach-help-url ".\n" 14 | "tab-url=" tab-url ", debugger-url=" debugger-url)) 15 | 16 | (defn unable-to-resolve-backend-url [debugger-url tab-url reason] 17 | (str "Unable to resolve backend-url for given tab-url (via debugger-url).\n" 18 | (when (some? reason) (str "reason: " reason "\n")) 19 | "tab-url=" tab-url ", debugger-url=" debugger-url)) 20 | 21 | (defn debugger-url-not-specified [] 22 | "Chrome debugger URL not specified. Check your Dirac options.") 23 | 24 | (defn tab-cannot-be-debugged [tab] 25 | (str "This tab cannot be debugged: it has no tab url" tab)) 26 | 27 | (defn unable-to-complete-intercom-initialization [frontend-tab-id reason] 28 | (str "Unable to complete intercom initialization" 29 | (when (some? reason) (str ", reason: " reason)) 30 | ". (frontend-tab-id=" frontend-tab-id ")")) 31 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/logging.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.shared.logging 2 | (:require [dirac.logging.toolkit :refer [gen-console-log]])) 3 | 4 | ; --------------------------------------------------------------------------------------------------------------------------- 5 | ; logging - these need to be macros to preserve source location for devtools 6 | 7 | (def enabled? true) 8 | (def color "gray") 9 | 10 | (defn gen-log [method env args] 11 | (if enabled? 12 | (gen-console-log method args {:env env 13 | :bg-color color}))) 14 | 15 | ; -- public api ------------------------------------------------------------------------------------------------------------- 16 | 17 | (defmacro log [& args] 18 | (gen-log "log" &env args)) 19 | 20 | (defmacro info [& args] 21 | (gen-log "info" &env args)) 22 | 23 | (defmacro error [& args] 24 | (gen-log "error" &env args)) 25 | 26 | (defmacro warn [& args] 27 | (gen-log "warn" &env args)) 28 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/logging.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.shared.logging 2 | (:require-macros [dirac.shared.logging]) 3 | (:require [dirac.logging.toolkit])) 4 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/quoted_printable.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.shared.quoted-printable 2 | (:require [oops.core :refer [gcall gget oapply ocall oget oset!]])) 3 | 4 | ; taken from 5 | ; https://github.com/mathiasbynens/quoted-printable/blob/326f631c9dd0cd051d12ab1b39682a97126b1894/src/quoted-printable.js 6 | ; by @mathias | MIT license 7 | 8 | (def re-qp-trailing-whitespace (js/RegExp. "\\s+$" "gm")) 9 | (def re-qp-hard-line-breaks (js/RegExp. "=(?:\\n|$)" "g")) 10 | (def re-qp-escaped-sequences (js/RegExp. "=([a-fA-F0-9]{2})" "g")) 11 | (def from-char-code (gget "String.fromCharCode")) 12 | 13 | (defn decode-escape-sequence [hex-code-point-str] 14 | (let [code-point (gcall "parseInt" hex-code-point-str 16)] 15 | (from-char-code code-point))) 16 | 17 | (defn decode-quoted-printable [source] 18 | (-> source 19 | (.replace re-qp-trailing-whitespace "") 20 | (.replace re-qp-hard-line-breaks "") 21 | (.replace re-qp-escaped-sequences #(decode-escape-sequence %2)))) 22 | -------------------------------------------------------------------------------- /src/shared/dirac/shared/utils.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.shared.utils 2 | (:require [cljs.env] 3 | [environ.core :as environ])) 4 | 5 | (defmacro runonce [& body] 6 | (let [code (cons 'do body) 7 | code-string (pr-str code) 8 | code-hash (hash code-string) 9 | name (symbol (str "runonce_" code-hash))] 10 | `(defonce ~name {:value ~code 11 | :code ~code-string}))) 12 | 13 | (defn timeout-display [time-ms] 14 | {:pre [(number? time-ms)]} 15 | (format "%.1fs" (/ time-ms 1000.))) 16 | 17 | (defn advanced-mode? [] 18 | (when (some? cljs.env/*compiler*) 19 | (= (get-in @cljs.env/*compiler* [:options :optimizations]) :advanced))) 20 | 21 | (defmacro when-advanced-mode [& body] 22 | (when (advanced-mode?) 23 | `(do ~@body))) 24 | 25 | (defmacro when-not-advanced-mode [& body] 26 | (when-not (advanced-mode?) 27 | `(do ~@body))) 28 | 29 | (defn dirac-test-mode? [] 30 | (some? (:dirac-test-browser environ/env))) 31 | 32 | (defmacro when-not-dirac-test-mode [& body] 33 | (when-not (dirac-test-mode?) 34 | `(do ~@body))) 35 | -------------------------------------------------------------------------------- /test/backend/src/backend_tests/dirac/tests/backend/agent/state.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.backend.agent.state) 2 | 3 | (def received-messages (atom [])) 4 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/css/index.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-family: courier, monospace; 3 | font-size: 12px; 4 | } 5 | 6 | .tasks .tasks-title { 7 | font-weight: bold; 8 | } 9 | 10 | .tasks .suite-title { 11 | font-weight: bold; 12 | display: block; 13 | margin-bottom: 6px; 14 | margin-top: 20px; 15 | } 16 | 17 | .tasks .suite-list { 18 | margin-bottom: 16px; 19 | list-style-type: square; 20 | padding-left: 20px; 21 | } 22 | 23 | .tasks .task-list { 24 | list-style-type: decimal-leading-zero; 25 | } 26 | 27 | .scenarios .scenarios-title { 28 | font-weight: bold; 29 | } 30 | 31 | .scenarios .scenarios-list { 32 | margin-bottom: 16px; 33 | padding-left: 60px; 34 | list-style-type: decimal-leading-zero; 35 | } 36 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/css/scenario.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-family: courier; 3 | font-size: 12px; 4 | } 5 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TASK INDEX 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/runner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TASK RUNNER 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 |
14 |
15 | 24 |
25 |
26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/barebone.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | barebone 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • no cljs-devtools
  • 14 |
  • no dirac runtime support
  • 15 |
  • we want to test basic feedback/notification systems
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/breakpoint.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | breakpoint 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
  • minimalist sample project paused on a breakpoint
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/completions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | completions 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
  • completions workspace is present
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/core-async.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | core-async 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
  • core-async code with async stack traces
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/exception.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | exception 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
  • minimalist sample project which can trigger an unhandled exception with non-trivial stack-trace
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/future-repl-api.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | future repl api 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized but repl api reports future version
  • 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/future-runtime.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | future runtime 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized, but reports future version
  • 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/issue-53.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | issue-53 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
  • issue-53 workspace is present
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/issue-55.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | issue-55 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
  • issue-55 workspace is present
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/issue-74.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | issue-74 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
  • issue-74 workspace is present
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/no-agent.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | no agent 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | This page scenario contains: 13 |
    14 |
  • cljs-devtools
  • 15 |
  • dirac runtime properly initialized but dirac agent is not listening
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/no-repl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | no repl 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized but :repl feature was disabled
  • 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/no-runtime.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | no runtime 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime is not installed
  • 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/normal-via-preloads.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | normal via preloads 5 | 6 | 7 | 8 | 9 | This page scenario contains: 10 |
    11 |
  • dirac runtime properly initialized via preloads
  • 12 |
13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/normal-with-feedback.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | normal + feedback 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
  • console feedback enabled
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/normal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | normal 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/old-repl-api.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | old repl api 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized but repl api reports old version
  • 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/old-runtime.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | old runtime 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized, but reports old version
  • 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/repl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | completions 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • dirac runtime properly initialized
  • 15 |
  • repl workspace is present
  • 16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/browser/fixtures/resources/scenarios/runtime-api.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | runtime api 5 | 6 | 7 | 8 | 9 | 10 | 11 | This page scenario contains: 12 |
    13 |
  • cljs-devtools
  • 14 |
  • our goal is to exercise dirac.runtime apis
  • 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/barebone.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.barebone 2 | (:require [chromex.logging :refer-macros [log]] 3 | [dirac.automation.runtime :refer [init-runtime!]] 4 | [dirac.automation.scenario :as scenario] 5 | [dirac.shared.async :refer [ i n) 17 | (break-here!) 18 | (do 19 | ( console-output 11 | replace-versions)) 12 | 13 | (init-runtime! {:future-runtime true}) 14 | (scenario/capture-console-as-feedback!) 15 | (scenario/register-feedback-transformer! transformer) 16 | (scenario/go-ready!) 17 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/no_agent.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.no-agent 2 | (:require [dirac.automation.runtime :refer [init-runtime!]] 3 | [dirac.automation.scenario :as scenario])) 4 | 5 | ; deliberately mis-configure agent port to simulate "agent not listening on port" situation 6 | (init-runtime! {:runtime-prefs {:agent-port 9999}}) 7 | (scenario/go-ready!) 8 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/no_repl.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.no-repl 2 | (:require [dirac.automation.runtime :refer [init-runtime!]] 3 | [dirac.automation.scenario :as scenario])) 4 | 5 | (init-runtime! {:do-not-enable-repl true}) 6 | (scenario/capture-console-as-feedback!) 7 | (scenario/go-ready!) 8 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/no_runtime.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.no-runtime 2 | (:require [dirac.automation.scenario :as scenario] 3 | [dirac.automation.triggers :refer [install-common-triggers!]])) 4 | 5 | (scenario/capture-console-as-feedback!) 6 | (install-common-triggers!) 7 | (scenario/go-ready!) 8 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/normal.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.normal 2 | (:require [dirac.automation.runtime :refer [init-runtime!]] 3 | [dirac.automation.scenario :as scenario] 4 | [dirac.automation.triggers :refer [install-common-triggers!]])) 5 | 6 | (init-runtime!) 7 | (install-common-triggers!) 8 | (scenario/go-ready!) 9 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/normal_with_feedback.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.normal-with-feedback 2 | (:require [clojure.string :as string] 3 | [dirac.automation.runtime :refer [init-runtime!]] 4 | [dirac.automation.scenario :as scenario])) 5 | 6 | (defn replace-versions [s] 7 | (string/replace s #"\(v.*?\)" "**VERSION**")) 8 | 9 | (defn transformer [console-output] 10 | (-> console-output 11 | replace-versions)) 12 | 13 | (init-runtime!) 14 | (scenario/capture-console-as-feedback!) 15 | (scenario/register-feedback-transformer! transformer) 16 | (scenario/go-ready!) 17 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/old_repl_api.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.old-repl-api 2 | (:require [dirac.automation.runtime :refer [init-runtime!]] 3 | [dirac.automation.scenario :as scenario])) 4 | 5 | (init-runtime! {:old-repl-api true}) 6 | (scenario/capture-console-as-feedback!) 7 | (scenario/go-ready!) 8 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/old_runtime.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.old-runtime 2 | (:require [clojure.string :as string] 3 | [dirac.automation.runtime :refer [init-runtime!]] 4 | [dirac.automation.scenario :as scenario])) 5 | 6 | (defn replace-versions [s] 7 | (string/replace s #"\(v.*?\)" "**VERSION**")) 8 | 9 | (defn transformer [console-output] 10 | (-> console-output 11 | replace-versions)) 12 | 13 | (init-runtime! {:old-runtime true}) 14 | (scenario/capture-console-as-feedback!) 15 | (scenario/register-feedback-transformer! transformer) 16 | (scenario/go-ready!) 17 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/repl.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.repl 2 | (:require [dirac.automation.runtime :refer [init-runtime!]] 3 | [dirac.automation.scenario :as scenario] 4 | [dirac.automation.triggers :refer [install-common-triggers!]] 5 | [dirac.tests.scenarios.repl.workspace :as workspace])) 6 | 7 | (init-runtime!) 8 | (install-common-triggers!) 9 | (scenario/go-ready!) 10 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/repl/workspace.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.repl.workspace) 2 | 3 | (enable-console-print!) 4 | 5 | (defn hello! [s] 6 | (println (str "Hello, " (or s "World") "!"))) 7 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios02/dirac/tests/scenarios/normal_via_preloads.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.normal-via-preloads 2 | (:require [dirac.automation.runtime :refer [init-runtime!]] 3 | [dirac.automation.scenario :as scenario] 4 | [dirac.runtime :as dirac-runtime])) 5 | 6 | (defn check-runtime-installed [] 7 | (.log js/console (str "runtime installed? " (dirac-runtime/installed?)))) 8 | 9 | (defn check-runtime-config [] 10 | (.log js/console (str ":external-config-setting is '" (:external-config-setting (dirac-runtime/get-prefs)) "'"))) 11 | 12 | ; note that dirac.runtime should be initialized via preloads 13 | ; see :scenarios02 build in project.clj - we use :main and :preloads there 14 | #_(init-runtime!) 15 | (scenario/capture-console-as-feedback!) 16 | (scenario/register-trigger! :check-runtime-installed check-runtime-installed) 17 | (scenario/register-trigger! :check-runtime-config check-runtime-config) 18 | (scenario/go-ready!) 19 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/completions/issue_55.cljc: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.completions.issue-55 2 | "https://github.com/binaryage/dirac/issues/55" 3 | (:require 4 | #?(:clj [dirac.settings :as ignored] 5 | :cljs [goog.object :as gobj]) 6 | #?(:clj 7 | [dirac.project :refer :all]))) ; there is no such thing as :refer :all in clojurescript 8 | 9 | #?(:cljs 10 | (do 11 | (enable-console-print!) 12 | (def some-var "something"))) 13 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_53.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.issue-53 2 | "https://github.com/binaryage/dirac/issues/53" 3 | (:require [dirac.automation.runtime :refer [init-runtime!]] 4 | [dirac.automation.scenario :as scenario] 5 | [dirac.automation.triggers :refer [install-common-triggers!]] 6 | [dirac.tests.scenarios.issue-53.core])) 7 | 8 | (init-runtime!) 9 | (install-common-triggers!) 10 | (scenario/go-ready!) 11 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_53/core.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.issue-53.core) 2 | 3 | (defn breakpoint-fn1 [] 4 | (let [x 1] 5 | (let [y 2] 6 | (let [x 3 7 | z #(println x)] 8 | (js-debugger))))) 9 | 10 | (defn breakpoint-fn2 [one-one] 11 | (let [two-two 2] 12 | ((fn rebind [] one-one)) 13 | (js-debugger))) 14 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_55.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.issue-55 2 | (:require [dirac.automation.runtime :refer [init-runtime!]] 3 | [dirac.automation.scenario :as scenario] 4 | [dirac.automation.triggers :refer [install-common-triggers!]] 5 | [dirac.tests.scenarios.completions.issue-55 :as issue-55])) 6 | 7 | (init-runtime!) 8 | (install-common-triggers!) 9 | (scenario/go-ready!) 10 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_74.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.issue-74 2 | "https://github.com/binaryage/dirac/issues/74" 3 | (:require [dirac.automation.runtime :refer [init-runtime!]] 4 | [dirac.automation.scenario :as scenario] 5 | [dirac.automation.triggers :refer [install-common-triggers!]] 6 | [dirac.tests.scenarios.issue-74.core])) 7 | 8 | (init-runtime!) 9 | (install-common-triggers!) 10 | (scenario/go-ready!) 11 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_74/core.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.scenarios.issue-74.core) 2 | 3 | (defn fn-with-breakpoint [] 4 | (let [a 42] 5 | (js-debugger) 6 | (* a 2))) 7 | 8 | (defn fn-with-async-breakpoint [] 9 | (js/setTimeout fn-with-breakpoint 0) 10 | 100) 11 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/tasks/dirac/tests/tasks/helpers/open_scenario.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.tasks.helpers.open-scenario 2 | (:require [dirac.automation :refer-macros [try to reconnect in 4 seconds" (seconds 20))))) 13 | -------------------------------------------------------------------------------- /test/browser/fixtures/src/tasks/dirac/tests/tasks/suite01/preloads.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac.tests.tasks.suite01.preloads 2 | (:require [cljs.test :refer-macros [is]] 3 | [dirac.automation :refer-macros [" into cljs url params 9 | 10 | (go-task 11 | (with-scenario "breakpoint" 12 | (testing "enabled :clean-urls feature" 13 | (with-devtools 14 | ("} 4 | extension set extension options:{:open-as "window"} 5 | automate open-scenario! ["barebone"] 6 | scenario immediate feedback 7 | automate trigger! [:test-trigger] 8 | scenario feedback from trigger 9 | automate close-scenario! ["scenario-tab#1"] 10 | summary Automated 3 actions with 2 check-points containing 0 assertions. 11 | 0 failures, 0 errors. 12 | -------------------------------------------------------------------------------- /test/browser/transcripts/expected/suite01-misc.txt: -------------------------------------------------------------------------------- 1 | ns Testing dirac.tests.tasks.suite01.misc 2 | extension reset extension state 3 | extension set extension options:{:target-url "http://localhost:"} 4 | extension set extension options:{:open-as "window"} 5 | automate open-scenario! ["normal"] 6 | automate close-scenario! ["scenario-tab#1"] 7 | summary Automated 2 actions with 0 check-points containing 0 assertions. 8 | 0 failures, 0 errors. 9 | -------------------------------------------------------------------------------- /test/browser/transcripts/expected/suite01-preloads.txt: -------------------------------------------------------------------------------- 1 | ns Testing dirac.tests.tasks.suite01.preloads 2 | extension reset extension state 3 | extension set extension options:{:target-url "http://localhost:"} 4 | extension set extension options:{:open-as "window"} 5 | automate open-scenario! ["normal-via-preloads"] 6 | automate trigger! [:check-runtime-installed] 7 | scenario out LOG: ("runtime installed? true") 8 | automate trigger! [:check-runtime-config] 9 | scenario out LOG: (":external-config-setting is 'configured externally'") 10 | automate close-scenario! ["scenario-tab#1"] 11 | summary Automated 4 actions with 2 check-points containing 0 assertions. 12 | 0 failures, 0 errors. 13 | -------------------------------------------------------------------------------- /test/dirac/home/chromium/scout_test.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.home.chromium.scout-test 2 | (:require [clojure.test :refer :all] 3 | [matcher-combinators.test :refer :all] 4 | [matcher-combinators.matchers :as m] 5 | [dirac.home.chromium.scout :refer [parse-chrome-version-string]])) 6 | 7 | (deftest parse-chrome-version-string-test 8 | (testing "parsing chrome executable version" 9 | (is (match? {:version "80.0.3968.0" :prefix "Google Chrome" :postfix "canary"} 10 | (parse-chrome-version-string "Google Chrome 80.0.3968.0 canary"))) 11 | (is (match? {:version "80.0.3968.0" :prefix "Google Chrome" :postfix nil} 12 | (parse-chrome-version-string "Google Chrome 80.0.3968.0"))) 13 | (is (match? {:version "80.0.3968.0" :prefix "Something" :postfix nil} 14 | (parse-chrome-version-string "Something 80.0.3968.0"))) 15 | (is (match? {:version "80.0.3968.0" :prefix nil :postfix nil} 16 | (parse-chrome-version-string "80.0.3968.0"))) 17 | (is (match? nil 18 | (parse-chrome-version-string ""))) 19 | )) 20 | 21 | (comment 22 | (run-tests)) 23 | 24 | -------------------------------------------------------------------------------- /test/dirac/home/locations_test.clj: -------------------------------------------------------------------------------- 1 | (ns dirac.home.locations-test 2 | (:require [clojure.test :refer :all]) 3 | (:require [dirac.home.helpers :as helpers] 4 | [dirac.home.locations :refer [resolve-home-dir]])) 5 | 6 | (defn make-mock-system-get-property [user-home-dir] 7 | (fn [name] 8 | (case name 9 | "user.home" user-home-dir))) 10 | 11 | (defn make-mock-system-get-env-empty [] 12 | (fn [_name])) 13 | 14 | (defn make-mock-system-get-env-dirac-home [dirac-home-dir] 15 | (fn [name] 16 | (case name 17 | "DIRAC_HOME" dirac-home-dir))) 18 | 19 | ; note: this tests will probably fail under windows 20 | (deftest resolve-home-dir-test 21 | (binding [helpers/*system-get-property-impl* (make-mock-system-get-property "/some/home") 22 | helpers/*system-get-env-impl* (make-mock-system-get-env-empty)] 23 | (is (= (resolve-home-dir) "/some/home/.dirac"))) 24 | (binding [helpers/*system-get-property-impl* (make-mock-system-get-property "/some/home") 25 | helpers/*system-get-env-impl* (make-mock-system-get-env-dirac-home "/explicit/dirac/home")] 26 | (is (= (resolve-home-dir) "/explicit/dirac/home")))) 27 | 28 | (comment 29 | (run-tests)) 30 | -------------------------------------------------------------------------------- /test/gpig/.gitignore: -------------------------------------------------------------------------------- 1 | pom.xml 2 | *jar 3 | /lib/ 4 | /classes/ 5 | /out/ 6 | /target/ 7 | .lein-deps-sum 8 | .lein-repl-history 9 | .lein-plugins/ 10 | .repl 11 | .nrepl-port 12 | .cpcache/ 13 | .rebel_readline_history 14 | .test-dirac-chrome-profile/ 15 | .idea/ -------------------------------------------------------------------------------- /test/gpig/deps.edn: -------------------------------------------------------------------------------- 1 | {:deps {org.clojure/clojure {:mvn/version "1.10.1"} 2 | org.clojure/clojurescript {:mvn/version "1.10.520"} 3 | cljsjs/react {:mvn/version "16.9.0-0"} 4 | cljsjs/react-dom {:mvn/version "16.9.0-0"} 5 | cljsjs/create-react-class {:mvn/version "15.6.3-1"} 6 | sablono {:mvn/version "0.8.6"} 7 | ;binaryage/dirac {:mvn/version "1.4.0} 8 | binaryage/dirac {:local/root "/Users/darwin/code/dirac-ws/dirac"} 9 | 10 | ; REPL 11 | com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"} 12 | com.bhauman/figwheel-main {:mvn/version "0.2.3"} 13 | nrepl {:mvn/version "0.6.0"} 14 | 15 | ; logging 16 | clj-logging-config {:mvn/version "1.9.12"} 17 | org.slf4j/slf4j-log4j12 {:mvn/version "1.7.28"} 18 | 19 | } 20 | :paths ["src/main" 21 | "src/repl" 22 | 23 | "test" 24 | 25 | "resources" 26 | "target"] 27 | :aliases {:build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]} 28 | :min {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]} 29 | :test {:main-opts ["-m" "figwheel.main" "-co" "test.cljs.edn" "-m" dirac-gpig.test-runner]}}} 30 | -------------------------------------------------------------------------------- /test/gpig/dev.cljs.edn: -------------------------------------------------------------------------------- 1 | ^{:watch-dirs ["test" "src/main"] 2 | :css-dirs ["resources/public/css"] 3 | :auto-testing true} 4 | {:main dirac-gpig.core 5 | :preloads [dirac.runtime.preload] 6 | :external-config {:dirac.runtime/config {:nrepl-config {:preferred-compiler "figwheel"}}} 7 | } 8 | -------------------------------------------------------------------------------- /test/gpig/figwheel-main.edn: -------------------------------------------------------------------------------- 1 | ;; Figwheel-main configuration options see: https://figwheel.org/config-options 2 | ;; these will be overriden by the metadata config options in dev.cljs.edn build file 3 | { 4 | ;; Set the server port https://figwheel.org/config-options#ring-server-options 5 | ;; :ring-server-options {:port 9500} 6 | 7 | ;; Target directory https://figwheel.org/config-options#target-dir 8 | ;; you may want to set this to resources if you are using Leiningen 9 | ;; :target-dir "resources" 10 | 11 | ;; Server Ring Handler (optional) https://figwheel.org/docs/ring-handler.html 12 | ;; If you want to embed a ring handler into the figwheel server, this 13 | ;; is for simple ring servers 14 | ;; :ring-handler hello_world.server/handler 15 | 16 | ;; To be able to open files in your editor from the heads up display 17 | ;; you will need to put a script on your path. This script will have 18 | ;; to take a file path and a line number ie. 19 | ;; in ~/bin/myfile-opener: 20 | ;; 21 | ;; #! /bin/sh 22 | ;; emacsclient -n +$2:$3 $1 23 | ;; 24 | ;; :open-file-command "myfile-opener" 25 | 26 | ;; if you are using emacsclient you can just use 27 | ;; :open-file-command "emacsclient" 28 | 29 | ;; Logging output gets printed to the REPL, if you want to redirect it to a file: 30 | ;; :log-file "figwheel-main.log" 31 | 32 | :open-url false 33 | } 34 | -------------------------------------------------------------------------------- /test/gpig/resources/public/css/style.css: -------------------------------------------------------------------------------- 1 | /* some style */ 2 | 3 | -------------------------------------------------------------------------------- /test/gpig/resources/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Dirac DevTools Demo Project

11 |

12 | Dirac DevTools provides a custom DevTools frontend packaged in a Chrome Extension.
13 | To use REPL from Dirac you also need to start an nREPL server and a Dirac Agent server. 14 |

15 |
16 |

17 | This project has Figwheel Main support as well...
18 |

19 |
20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/gpig/resources/public/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Test host page

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/gpig/scripts/_shared.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | 5 | cd "$(dirname "${BASH_SOURCE[0]}")" 6 | cd .. 7 | 8 | ROOT_DIR=$(pwd) 9 | SCRIPTS_DIR="$ROOT_DIR/scripts" 10 | 11 | -------------------------------------------------------------------------------- /test/gpig/scripts/canary.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # shellcheck source=_shared.sh 4 | source "$(dirname "${BASH_SOURCE[0]}")/_shared.sh" 5 | 6 | exec /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary \ 7 | --remote-debugging-port=9222 \ 8 | --no-first-run \ 9 | --user-data-dir=.test-dirac-chrome-profile -------------------------------------------------------------------------------- /test/gpig/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # shellcheck source=_shared.sh 4 | source "$(dirname "${BASH_SOURCE[0]}")/_shared.sh" 5 | 6 | rm -rf .cpcache 7 | rm -rf target/ -------------------------------------------------------------------------------- /test/gpig/scripts/repl.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # shellcheck source=_shared.sh 4 | source "$(dirname "${BASH_SOURCE[0]}")/_shared.sh" 5 | 6 | export DIRAC_NREPL__LOG_LEVEL=TRACE 7 | 8 | exec clojure -m dirac-gpig.repl -------------------------------------------------------------------------------- /test/gpig/test.cljs.edn: -------------------------------------------------------------------------------- 1 | ^{ 2 | ;; use an alternative landing page for the tests so that we don't 3 | ;; launch the application 4 | :open-url "http://[[server-hostname]]:[[server-port]]/test.html" 5 | 6 | ;; uncomment to launch tests in a headless environment 7 | ;; you will have to figure out the path to chrome on your system 8 | ;; :launch-js ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" "--headless" "--disable-gpu" "--repl" :open-url] 9 | } 10 | {:main dirac-gpig.test-runner} 11 | -------------------------------------------------------------------------------- /test/gpig/test/dirac_gpig/core_test.cljs: -------------------------------------------------------------------------------- 1 | (ns dirac-gpig.core-test 2 | (:require 3 | [cljs.test :refer-macros [deftest is testing]] 4 | [dirac-gpig.core :refer [multiply]])) 5 | 6 | (deftest multiply-test 7 | (is (= (* 1 2) (multiply 1 2)))) 8 | 9 | (deftest multiply-test-2 10 | (is (= (* 75 10) (multiply 10 75)))) 11 | -------------------------------------------------------------------------------- /test/gpig/test/dirac_gpig/test_runner.cljs: -------------------------------------------------------------------------------- 1 | ;; This test runner is intended to be run from the command line 2 | (ns dirac-gpig.test-runner 3 | (:require 4 | ;; require all the namespaces that you want to test 5 | [dirac-gpig.core-test] 6 | [figwheel.main.testing :refer [run-tests-async]])) 7 | 8 | (defn -main [& args] 9 | (run-tests-async 5000)) 10 | -------------------------------------------------------------------------------- /test/marion/resources/unpacked/background.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/marion/resources/unpacked/background.js: -------------------------------------------------------------------------------- 1 | goog.require("dirac.devtools"); 2 | goog.require("marion.figwheel"); 3 | goog.require("marion.background"); 4 | -------------------------------------------------------------------------------- /test/marion/resources/unpacked/compiled: -------------------------------------------------------------------------------- 1 | .compiled -------------------------------------------------------------------------------- /test/marion/resources/unpacked/content_script.js: -------------------------------------------------------------------------------- 1 | goog.require("marion.content_script"); 2 | -------------------------------------------------------------------------------- /test/marion/resources/unpacked/manifest.json: -------------------------------------------------------------------------------- 1 | /* this manifest is for development only 2 | we include all files individually 3 | also we allow unsafe eval for figwheel 4 | */ 5 | { 6 | "short_name": "Marion", 7 | "name": "Dirac Marionettist", 8 | "version": "0.0.1", 9 | "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", 10 | "background": { 11 | "page": "background.html", 12 | "persistent": true 13 | }, 14 | "permissions": [ 15 | "experimental", 16 | "management", 17 | "tabs" 18 | ], 19 | "content_scripts": [ 20 | { 21 | "matches": [ 22 | "" 23 | ], 24 | "js": [ 25 | /* we have to rely on on a symlink */ 26 | "compiled/content_script/content_script.js", 27 | "content_script.js" 28 | ], 29 | "run_at": "document_start" 30 | } 31 | ], 32 | "web_accessible_resources": [ 33 | "compiled/*" 34 | ], 35 | "manifest_version": 2 36 | } 37 | -------------------------------------------------------------------------------- /test/marion/resources/unpacked/setup.js: -------------------------------------------------------------------------------- 1 | goog.define('goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', true); 2 | -------------------------------------------------------------------------------- /test/marion/src/background/marion/background.cljs: -------------------------------------------------------------------------------- 1 | (ns marion.background 2 | (:require [dirac.shared.utils :refer [runonce]] 3 | [marion.background.core :as core])) 4 | 5 | (runonce 6 | (core/init!)) 7 | -------------------------------------------------------------------------------- /test/marion/src/background/marion/background/core.cljs: -------------------------------------------------------------------------------- 1 | (ns marion.background.core 2 | (:require [dirac.shared.async :refer [