Created
December 17, 2019 06:27
-
-
Save abhishalya/d2dd6bfb421ee117b81124bc6ca530b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script will create a new directory if it doesn't exist already and | |
# initialize it with a default index.jl file (if it doesn't exist) and | |
# add Manifest.toml and Project.toml files along with a Procfile to | |
# to initialize a heroku repository for the user and will deploy the app. | |
# This requires to login install and login to heroku-cli and should also | |
# have git installed. | |
index_template = """ | |
using Interact, Mux | |
b = button("Click me") | |
ui = hbox(b, observe(b)) | |
port = parse(Int64, ARGS[1]) | |
wait(WebIO.webio_serve(page("/", req -> ui), port)) | |
""" | |
procfile_template = """ | |
web: julia --project index.jl \$PORT | |
""" | |
project_toml_template = """ | |
[deps] | |
Interact = "c601a237-2ae4-5e1e-952c-7a85b0c7eef1" | |
Mux = "a975b10e-0019-58db-a62f-e48ff68538c9" | |
""" | |
manifest_toml_template = """ | |
# This file is machine-generated - editing it directly is not advised | |
[[AssetRegistry]] | |
deps = ["Distributed", "JSON", "Pidfile", "SHA", "Test"] | |
git-tree-sha1 = "b25e88db7944f98789130d7b503276bc34bc098e" | |
uuid = "bf4720bc-e11a-5d0c-854e-bdca1663c893" | |
version = "0.1.0" | |
[[Base64]] | |
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" | |
[[BinaryProvider]] | |
deps = ["Libdl", "SHA"] | |
git-tree-sha1 = "5b08ed6036d9d3f0ee6369410b830f8873d4024c" | |
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232" | |
version = "0.5.8" | |
[[CSSUtil]] | |
deps = ["Colors", "Compat", "JSON", "Measures", "Pkg", "WebIO"] | |
git-tree-sha1 = "ff13fd99e4dd54f56eb064815f843bc992a871a2" | |
uuid = "70588ee8-6100-5070-97c1-3cb50ed05fe8" | |
version = "0.1.0" | |
[[ColorTypes]] | |
deps = ["FixedPointNumbers", "Random"] | |
git-tree-sha1 = "10050a24b09e8e41b951e9976b109871ce98d965" | |
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" | |
version = "0.8.0" | |
[[Colors]] | |
deps = ["ColorTypes", "FixedPointNumbers", "InteractiveUtils", "Printf", "Reexport"] | |
git-tree-sha1 = "c9c1845d6bf22e34738bee65c357a69f416ed5d1" | |
uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" | |
version = "0.9.6" | |
[[Compat]] | |
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] | |
git-tree-sha1 = "ed2c4abadf84c53d9e58510b5fc48912c2336fbb" | |
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" | |
version = "2.2.0" | |
[[DataStructures]] | |
deps = ["InteractiveUtils", "OrderedCollections"] | |
git-tree-sha1 = "a1b652fb77ae8ca7ea328fa7ba5aa151036e5c10" | |
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" | |
version = "0.17.6" | |
[[Dates]] | |
deps = ["Printf"] | |
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" | |
[[DelimitedFiles]] | |
deps = ["Mmap"] | |
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" | |
[[Distributed]] | |
deps = ["Random", "Serialization", "Sockets"] | |
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" | |
[[FileWatching]] | |
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" | |
[[FixedPointNumbers]] | |
git-tree-sha1 = "bd1386f890e172ef38e1c735cda58cbf004a7c9a" | |
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" | |
version = "0.7.0" | |
[[FunctionalCollections]] | |
deps = ["Test"] | |
git-tree-sha1 = "04cb9cfaa6ba5311973994fe3496ddec19b6292a" | |
uuid = "de31a74c-ac4f-5751-b3fd-e18cd04993ca" | |
version = "0.5.0" | |
[[HTTP]] | |
deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"] | |
git-tree-sha1 = "5c49dab19938b119fe204fd7d7e8e174f4e9c68b" | |
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" | |
version = "0.8.8" | |
[[Hiccup]] | |
deps = ["MacroTools", "Test"] | |
git-tree-sha1 = "6187bb2d5fcbb2007c39e7ac53308b0d371124bd" | |
uuid = "9fb69e20-1954-56bb-a84f-559cc56a8ff7" | |
version = "0.2.2" | |
[[IniFile]] | |
deps = ["Test"] | |
git-tree-sha1 = "098e4d2c533924c921f9f9847274f2ad89e018b8" | |
uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f" | |
version = "0.5.0" | |
[[Interact]] | |
deps = ["CSSUtil", "InteractBase", "JSON", "Knockout", "Observables", "OrderedCollections", "Reexport", "WebIO", "Widgets"] | |
git-tree-sha1 = "381c584142ac744bcc23af64bff3e3dc44d7f632" | |
uuid = "c601a237-2ae4-5e1e-952c-7a85b0c7eef1" | |
version = "0.10.3" | |
[[InteractBase]] | |
deps = ["Base64", "CSSUtil", "Colors", "Dates", "JSExpr", "JSON", "Knockout", "Observables", "OrderedCollections", "Random", "WebIO", "Widgets"] | |
git-tree-sha1 = "4528a536425453c9658ad00cf097c979cc0fa03f" | |
uuid = "d3863d7c-f0c8-5437-a7b4-3ae773c01009" | |
version = "0.10.3" | |
[[InteractiveUtils]] | |
deps = ["Markdown"] | |
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" | |
[[JSExpr]] | |
deps = ["JSON", "MacroTools", "Observables", "WebIO"] | |
git-tree-sha1 = "ca99c457d67f7950e405f26044f4e38658a75e8a" | |
uuid = "97c1335a-c9c5-57fe-bc5d-ec35cebe8660" | |
version = "0.5.1" | |
[[JSON]] | |
deps = ["Dates", "Mmap", "Parsers", "Unicode"] | |
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e" | |
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" | |
version = "0.21.0" | |
[[Knockout]] | |
deps = ["JSExpr", "JSON", "Observables", "Test", "WebIO"] | |
git-tree-sha1 = "53533b51d4b6964eca3065b0834e9f61ed2f7515" | |
uuid = "bcebb21b-c2e3-54f8-a781-646b90f6d2cc" | |
version = "0.2.3" | |
[[Lazy]] | |
deps = ["MacroTools"] | |
git-tree-sha1 = "ead48f10ad295afe72046ab0f2b9d704466452a0" | |
uuid = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0" | |
version = "0.14.0" | |
[[LibGit2]] | |
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" | |
[[Libdl]] | |
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" | |
[[LinearAlgebra]] | |
deps = ["Libdl"] | |
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | |
[[Logging]] | |
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" | |
[[MacroTools]] | |
deps = ["DataStructures", "Markdown", "Random"] | |
git-tree-sha1 = "e2fc7a55bb2224e203bbd8b59f72b91323233458" | |
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" | |
version = "0.5.3" | |
[[Markdown]] | |
deps = ["Base64"] | |
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" | |
[[MbedTLS]] | |
deps = ["BinaryProvider", "Dates", "Libdl", "Random", "Sockets"] | |
git-tree-sha1 = "85f5947b53c8cfd53ccfa3f4abae31faa22c2181" | |
uuid = "739be429-bea8-5141-9913-cc70e7f3736d" | |
version = "0.7.0" | |
[[Measures]] | |
git-tree-sha1 = "e498ddeee6f9fdb4551ce855a46f54dbd900245f" | |
uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e" | |
version = "0.3.1" | |
[[Mmap]] | |
uuid = "a63ad114-7e13-5084-954f-fe012c677804" | |
[[Mux]] | |
deps = ["AssetRegistry", "Base64", "HTTP", "Hiccup", "Lazy", "Pkg", "Sockets", "Test", "WebSockets"] | |
git-tree-sha1 = "5b41f03d63400c290bab4e1a49fb9ac36de1084a" | |
uuid = "a975b10e-0019-58db-a62f-e48ff68538c9" | |
version = "0.7.0" | |
[[Observables]] | |
deps = ["Test"] | |
git-tree-sha1 = "dc02cec22747d1d10d9f70d8a1c03432b5bfbcd0" | |
uuid = "510215fc-4207-5dde-b226-833fc4488ee2" | |
version = "0.2.3" | |
[[OrderedCollections]] | |
deps = ["Random", "Serialization", "Test"] | |
git-tree-sha1 = "c4c13474d23c60d20a67b217f1d7f22a40edf8f1" | |
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" | |
version = "1.1.0" | |
[[Parsers]] | |
deps = ["Dates", "Test"] | |
git-tree-sha1 = "0139ba59ce9bc680e2925aec5b7db79065d60556" | |
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" | |
version = "0.3.10" | |
[[Pidfile]] | |
deps = ["FileWatching", "Test"] | |
git-tree-sha1 = "1ffd82728498b5071cde851bbb7abd780d4445f3" | |
uuid = "fa939f87-e72e-5be4-a000-7fc836dbe307" | |
version = "1.1.0" | |
[[Pkg]] | |
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] | |
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | |
[[Printf]] | |
deps = ["Unicode"] | |
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" | |
[[REPL]] | |
deps = ["InteractiveUtils", "Markdown", "Sockets"] | |
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" | |
[[Random]] | |
deps = ["Serialization"] | |
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | |
[[Reexport]] | |
deps = ["Pkg"] | |
git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0" | |
uuid = "189a3867-3050-52da-a836-e630ba90ab69" | |
version = "0.2.0" | |
[[Requires]] | |
deps = ["UUIDs"] | |
git-tree-sha1 = "999513b7dea8ac17359ed50ae8ea089e4464e35e" | |
uuid = "ae029012-a4dd-5104-9daa-d747884805df" | |
version = "1.0.0" | |
[[SHA]] | |
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" | |
[[Serialization]] | |
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" | |
[[SharedArrays]] | |
deps = ["Distributed", "Mmap", "Random", "Serialization"] | |
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" | |
[[Sockets]] | |
uuid = "6462fe0b-24de-5631-8697-dd941f90decc" | |
[[SparseArrays]] | |
deps = ["LinearAlgebra", "Random"] | |
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | |
[[Statistics]] | |
deps = ["LinearAlgebra", "SparseArrays"] | |
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | |
[[Test]] | |
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] | |
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | |
[[UUIDs]] | |
deps = ["Random", "SHA"] | |
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" | |
[[Unicode]] | |
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" | |
[[WebIO]] | |
deps = ["AssetRegistry", "Base64", "Compat", "Distributed", "FunctionalCollections", "JSON", "Logging", "Observables", "Pkg", "Random", "Requires", "Sockets", "UUIDs", "WebSockets", "Widgets"] | |
git-tree-sha1 = "ba53f245d0c4ef3ccf0f2c89546ecfcd1957797f" | |
uuid = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29" | |
version = "0.8.11" | |
[[WebSockets]] | |
deps = ["Base64", "Dates", "Distributed", "HTTP", "Logging", "Random", "Sockets", "Test"] | |
git-tree-sha1 = "13f763d38c7a05688938808b49cb29b18b60c8c8" | |
uuid = "104b5d7c-a370-577a-8038-80a2059c5097" | |
version = "1.5.2" | |
[[Widgets]] | |
deps = ["Colors", "Dates", "Observables", "OrderedCollections"] | |
git-tree-sha1 = "fc0feda91b3fef7fe6948ee09bb628f882b49ca4" | |
uuid = "cc8bc4a8-27d6-5769-a93b-9d913e69aa62" | |
version = "0.6.2" | |
""" | |
function create_index(path) | |
open(joinpath(path, "index.jl"), "w") do f | |
write(f, index_template) | |
end | |
end | |
function create_procfile(path) | |
open(joinpath(path, "Procfile"), "w") do f | |
write(f, procfile_template) | |
end | |
end | |
function create_project_toml(path) | |
open(joinpath(path, "Project.toml"), "w") do f | |
write(f, project_toml_template) | |
end | |
end | |
function create_manifest_toml(path) | |
open(joinpath(path, "Manifest.toml"), "w") do f | |
write(f, manifest_toml_template) | |
end | |
end | |
function check_if_exists(path, cwd; file = true) | |
if file | |
return isfile(joinpath(cwd, path)) | |
end | |
return isdir(joinpath(cwd, path)) | |
end | |
function main() | |
directory_name = "" | |
app_name = "my-new-app" | |
cwd = pwd() | |
try | |
directory_name = ARGS[1] | |
catch | |
println("No directory provided.") | |
exit(1) | |
end | |
try | |
app_name = ARGS[2] | |
catch | |
println("No appname provided.") | |
end | |
if !check_if_exists(directory_name, cwd, file = false) | |
mkdir(joinpath(cwd, directory_name)) | |
end | |
if !check_if_exists("$directory_name/index.jl", cwd) | |
create_index(directory_name) | |
end | |
if !check_if_exists("$directory_name/Procfile", cwd) | |
create_procfile(directory_name) | |
end | |
if !check_if_exists("$directory_name/Project.toml", cwd) | |
create_project_toml(directory_name) | |
end | |
if !check_if_exists("$directory_name/Manifest.toml", cwd) | |
create_manifest_toml(directory_name) | |
end | |
cd(joinpath(cwd, "$directory_name")) | |
run(`git init`) | |
run(`heroku create "$app_name" --buildpack https://github.com/Optomatica/heroku-buildpack-julia.git`) | |
run(`git add -A`) | |
run(`git commit -m "Initial commit"`) | |
run(`git push heroku master`) | |
end | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ julia heroku-interact.jl test-dir dumb-check | |
Initialized empty Git repository in /home/abhishalya/gci/julia/codes/test-dir/.git/ | |
Creating ⬢ dumb-check... done | |
Setting buildpack to https://github.com/Optomatica/heroku-buildpack-julia.git... done | |
https://dumb-check.herokuapp.com/ | https://git.heroku.com/dumb-check.git | |
[master (root-commit) 28a9946] Initial commit | |
4 files changed, 286 insertions(+) | |
create mode 100644 Manifest.toml | |
create mode 100644 Procfile | |
create mode 100644 Project.toml | |
create mode 100644 index.jl | |
Counting objects: 6, done. | |
Delta compression using up to 12 threads. | |
Compressing objects: 100% (5/5), done. | |
Writing objects: 100% (6/6), 3.88 KiB | 1.94 MiB/s, done. | |
Total 6 (delta 0), reused 0 (delta 0) | |
remote: Compressing source files... done. | |
remote: Building source: | |
remote: | |
remote: -----> Julia app detected | |
remote: -----> Installing julia .... - julia-1.2.0-linux-x86_64.tar.gz | |
remote: % Total % Received % Xferd Average Speed Time Time Time Current | |
remote: Dload Upload Total Spent Left Speed | |
remote: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 | |
remote: 100 87.7M 100 87.7M 0 0 53.7M 0 0:00:01 0:00:01 --:--:-- 62.9M | |
remote: ./.apt/usr/bin:./julia/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin | |
remote: ./.apt/usr/lib/x86_64-linux-gnu:./julia/lib:./julia/lib/x86_64-linux-gnu: | |
remote: cmake version 3.10.2 CMake suite maintained and supported by Kitware (kitware.com/cmake). | |
remote: julia version 1.2.0 | |
remote: done | |
remote: Cloning default registries into `~/.julia` | |
remote: Cloning registry from "https://github.com/JuliaRegistries/General.git" | |
Added registry `General` to `~/.julia/registries/General` | |
remote: Installed JSExpr ──────────────── v0.5.1 | |
remote: Installed Hiccup ──────────────── v0.2.2 | |
remote: Installed Pidfile ─────────────── v1.1.0 | |
remote: Installed MbedTLS ─────────────── v0.7.0 | |
remote: Installed Colors ──────────────── v0.9.6 | |
remote: Installed BinaryProvider ──────── v0.5.8 | |
remote: Installed Interact ────────────── v0.10.3 | |
remote: Installed WebIO ───────────────── v0.8.11 | |
remote: Installed Requires ────────────── v1.0.0 | |
remote: Installed Measures ────────────── v0.3.1 | |
remote: Installed Reexport ────────────── v0.2.0 | |
remote: Installed Compat ──────────────── v2.2.0 | |
remote: Installed Observables ─────────── v0.2.3 | |
remote: Installed Widgets ─────────────── v0.6.2 | |
remote: Installed FunctionalCollections ─ v0.5.0 | |
remote: Installed OrderedCollections ──── v1.1.0 | |
remote: Installed IniFile ─────────────── v0.5.0 | |
remote: Installed InteractBase ────────── v0.10.3 | |
remote: Installed Knockout ────────────── v0.2.3 | |
remote: Installed DataStructures ──────── v0.17.6 | |
remote: Installed Mux ─────────────────── v0.7.0 | |
remote: Installed FixedPointNumbers ───── v0.7.0 | |
remote: Installed AssetRegistry ───────── v0.1.0 | |
remote: Installed Parsers ─────────────── v0.3.10 | |
remote: Installed HTTP ────────────────── v0.8.8 | |
remote: Installed JSON ────────────────── v0.21.0 | |
remote: Installed MacroTools ──────────── v0.5.3 | |
remote: Installed Lazy ────────────────── v0.14.0 | |
remote: Installed WebSockets ──────────── v1.5.2 | |
remote: Installed ColorTypes ──────────── v0.8.0 | |
remote: Installed CSSUtil ─────────────── v0.1.0 | |
remote: Building MbedTLS ─────→ `~/.julia/packages/MbedTLS/a1JFn/deps/build.log` | |
remote: Building WebIO ───────→ `~/.julia/packages/WebIO/2mZPb/deps/build.log` | |
remote: Building Knockout ────→ `~/.julia/packages/Knockout/1sDlc/deps/build.log` | |
remote: Building InteractBase → `~/.julia/packages/InteractBase/9mFwe/deps/build.log` | |
remote: Building Interact ────→ `~/.julia/packages/Interact/SbgIk/deps/build.log` | |
remote: Precompiling project... | |
remote: Precompiling Interact | |
remote: Precompiling Mux | |
remote: WARNING: using HTTP.stack in module Mux conflicts with an existing identifier. | |
remote: -----> Discovering process types | |
remote: Procfile declares types -> web | |
remote: | |
remote: -----> Compressing... | |
remote: Done: 141.2M | |
remote: -----> Launching... | |
remote: Released v3 | |
remote: https://dumb-check.herokuapp.com/ deployed to Heroku | |
remote: | |
remote: Verifying deploy... done. | |
To https://git.heroku.com/dumb-check.git | |
* [new branch] master -> master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment