From 8da05a5c5af7b7f6cae698b611c3ab65e0253c23 Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Tue, 19 Jul 2022 14:48:07 +0200 Subject: [PATCH] Rename AppBuilder to AppBundler (#1283) --- app_builder/README.md | 1 - app_builder/examples/wx_demo/README.md | 1 - {app_builder => app_bundler}/.formatter.exs | 0 {app_builder => app_bundler}/.gitignore | 0 app_bundler/README.md | 1 + .../wx_demo => app_bundler/demo}/.formatter.exs | 0 .../wx_demo => app_bundler/demo}/.gitignore | 0 app_bundler/demo/README.md | 1 + .../demo/example.demo | 0 .../lib/wx_demo.ex => app_bundler/demo/lib/demo.ex | 14 +++++++------- .../examples/wx_demo => app_bundler/demo}/mix.exs | 14 +++++++------- .../demo/test/demo_test.exs | 2 +- .../demo}/test/test_helper.exs | 0 .../lib/app_bundler.ex | 10 +++++----- .../lib/app_bundler}/application.ex | 6 +++--- .../lib/app_bundler}/macos.ex | 4 ++-- .../lib/app_bundler}/utils.ex | 4 ++-- .../lib/app_bundler}/windows.ex | 10 +++++----- .../lib/templates/macos/Entitlements.plist.eex | 0 .../lib/templates/macos/Info.plist.eex | 0 .../lib/templates/macos/Launcher.swift.eex | 2 +- .../lib/templates/windows/Installer.nsi.eex | 0 .../lib/templates/windows/Launcher.vb.eex | 2 +- .../lib/templates/windows/Manifest.xml.eex | 0 {app_builder => app_bundler}/mix.exs | 6 +++--- .../test/app_bundler_test.exs | 2 +- {app_builder => app_bundler}/test/test_helper.exs | 0 lib/livebook_app.ex | 6 +++--- mix.exs | 4 ++-- 29 files changed, 45 insertions(+), 45 deletions(-) delete mode 100644 app_builder/README.md delete mode 100644 app_builder/examples/wx_demo/README.md rename {app_builder => app_bundler}/.formatter.exs (100%) rename {app_builder => app_bundler}/.gitignore (100%) create mode 100644 app_bundler/README.md rename {app_builder/examples/wx_demo => app_bundler/demo}/.formatter.exs (100%) rename {app_builder/examples/wx_demo => app_bundler/demo}/.gitignore (100%) create mode 100644 app_bundler/demo/README.md rename app_builder/examples/wx_demo/example.wxdemo => app_bundler/demo/example.demo (100%) rename app_builder/examples/wx_demo/lib/wx_demo.ex => app_bundler/demo/lib/demo.ex (90%) rename {app_builder/examples/wx_demo => app_bundler/demo}/mix.exs (85%) rename app_builder/examples/wx_demo/test/wx_demo_test.exs => app_bundler/demo/test/demo_test.exs (59%) rename {app_builder/examples/wx_demo => app_bundler/demo}/test/test_helper.exs (100%) rename app_builder/lib/app_builder.ex => app_bundler/lib/app_bundler.ex (91%) rename {app_builder/lib/app_builder => app_bundler/lib/app_bundler}/application.ex (57%) rename {app_builder/lib/app_builder => app_bundler/lib/app_bundler}/macos.ex (98%) rename {app_builder/lib/app_builder => app_bundler/lib/app_bundler}/utils.ex (97%) rename {app_builder/lib/app_builder => app_bundler/lib/app_bundler}/windows.ex (95%) rename {app_builder => app_bundler}/lib/templates/macos/Entitlements.plist.eex (100%) rename {app_builder => app_bundler}/lib/templates/macos/Info.plist.eex (100%) rename {app_builder => app_bundler}/lib/templates/macos/Launcher.swift.eex (98%) rename {app_builder => app_bundler}/lib/templates/windows/Installer.nsi.eex (100%) rename {app_builder => app_bundler}/lib/templates/windows/Launcher.vb.eex (92%) rename {app_builder => app_bundler}/lib/templates/windows/Manifest.xml.eex (100%) rename {app_builder => app_bundler}/mix.exs (79%) rename app_builder/test/app_builder_test.exs => app_bundler/test/app_bundler_test.exs (55%) rename {app_builder => app_bundler}/test/test_helper.exs (100%) diff --git a/app_builder/README.md b/app_builder/README.md deleted file mode 100644 index ee582adf5..000000000 --- a/app_builder/README.md +++ /dev/null @@ -1 +0,0 @@ -# AppBuilder diff --git a/app_builder/examples/wx_demo/README.md b/app_builder/examples/wx_demo/README.md deleted file mode 100644 index 312f8e889..000000000 --- a/app_builder/examples/wx_demo/README.md +++ /dev/null @@ -1 +0,0 @@ -# WxDemo diff --git a/app_builder/.formatter.exs b/app_bundler/.formatter.exs similarity index 100% rename from app_builder/.formatter.exs rename to app_bundler/.formatter.exs diff --git a/app_builder/.gitignore b/app_bundler/.gitignore similarity index 100% rename from app_builder/.gitignore rename to app_bundler/.gitignore diff --git a/app_bundler/README.md b/app_bundler/README.md new file mode 100644 index 000000000..34dce9b64 --- /dev/null +++ b/app_bundler/README.md @@ -0,0 +1 @@ +# AppBundler diff --git a/app_builder/examples/wx_demo/.formatter.exs b/app_bundler/demo/.formatter.exs similarity index 100% rename from app_builder/examples/wx_demo/.formatter.exs rename to app_bundler/demo/.formatter.exs diff --git a/app_builder/examples/wx_demo/.gitignore b/app_bundler/demo/.gitignore similarity index 100% rename from app_builder/examples/wx_demo/.gitignore rename to app_bundler/demo/.gitignore diff --git a/app_bundler/demo/README.md b/app_bundler/demo/README.md new file mode 100644 index 000000000..0805455a2 --- /dev/null +++ b/app_bundler/demo/README.md @@ -0,0 +1 @@ +# Demo diff --git a/app_builder/examples/wx_demo/example.wxdemo b/app_bundler/demo/example.demo similarity index 100% rename from app_builder/examples/wx_demo/example.wxdemo rename to app_bundler/demo/example.demo diff --git a/app_builder/examples/wx_demo/lib/wx_demo.ex b/app_bundler/demo/lib/demo.ex similarity index 90% rename from app_builder/examples/wx_demo/lib/wx_demo.ex rename to app_bundler/demo/lib/demo.ex index beab01d5e..48b32ebc4 100644 --- a/app_builder/examples/wx_demo/lib/wx_demo.ex +++ b/app_bundler/demo/lib/demo.ex @@ -1,4 +1,4 @@ -defmodule WxDemo.Application do +defmodule Demo.Application do @moduledoc false use Application @@ -6,15 +6,15 @@ defmodule WxDemo.Application do @impl true def start(_type, _args) do children = [ - WxDemo.Window + Demo.Window ] - opts = [strategy: :one_for_one, name: WxDemo.Supervisor] + opts = [strategy: :one_for_one, name: Demo.Supervisor] Supervisor.start_link(children, opts) end end -defmodule WxDemo.Window do +defmodule Demo.Window do @moduledoc false use GenServer, restart: :transient @@ -28,9 +28,9 @@ defmodule WxDemo.Window do @impl true def init(_) do - AppBuilder.init() - app_name = "WxDemo" - os = AppBuilder.os() + AppBundler.init() + app_name = "Demo" + os = AppBundler.os() wx = :wx.new() frame = :wxFrame.new(wx, -1, app_name, size: {400, 400}) diff --git a/app_builder/examples/wx_demo/mix.exs b/app_bundler/demo/mix.exs similarity index 85% rename from app_builder/examples/wx_demo/mix.exs rename to app_bundler/demo/mix.exs index 7560b2bfa..47022b492 100644 --- a/app_builder/examples/wx_demo/mix.exs +++ b/app_bundler/demo/mix.exs @@ -1,9 +1,9 @@ -defmodule WxDemo.MixProject do +defmodule Demo.MixProject do use Mix.Project def project do [ - app: :wx_demo, + app: :demo, version: "0.1.0", elixir: "~> 1.13", start_permanent: Mix.env() == :prod, @@ -15,13 +15,13 @@ defmodule WxDemo.MixProject do def application do [ extra_applications: [:wx, :logger], - mod: {WxDemo.Application, []} + mod: {Demo.Application, []} ] end defp deps do [ - {:app_builder, path: "../.."} + {:app_bundler, path: "../.."} ] end @@ -32,14 +32,14 @@ defmodule WxDemo.MixProject do app: [ steps: [ :assemble, - &AppBuilder.bundle/1 + &AppBundler.bundle/1 ], app: [ - name: "WxDemo", + name: "Demo", url_schemes: ["wxdemo"], document_types: [ [ - name: "WxDemo", + name: "Demo", extensions: ["wxdemo"], macos: [ role: "Editor" diff --git a/app_builder/examples/wx_demo/test/wx_demo_test.exs b/app_bundler/demo/test/demo_test.exs similarity index 59% rename from app_builder/examples/wx_demo/test/wx_demo_test.exs rename to app_bundler/demo/test/demo_test.exs index d4103b2b8..7547a82e7 100644 --- a/app_builder/examples/wx_demo/test/wx_demo_test.exs +++ b/app_bundler/demo/test/demo_test.exs @@ -1,3 +1,3 @@ -defmodule WxDemoTest do +defmodule DemoTest do use ExUnit.Case, async: true end diff --git a/app_builder/examples/wx_demo/test/test_helper.exs b/app_bundler/demo/test/test_helper.exs similarity index 100% rename from app_builder/examples/wx_demo/test/test_helper.exs rename to app_bundler/demo/test/test_helper.exs diff --git a/app_builder/lib/app_builder.ex b/app_bundler/lib/app_bundler.ex similarity index 91% rename from app_builder/lib/app_builder.ex rename to app_bundler/lib/app_bundler.ex index 77bdcac88..4a6696461 100644 --- a/app_builder/lib/app_builder.ex +++ b/app_bundler/lib/app_bundler.ex @@ -1,13 +1,13 @@ -defmodule AppBuilder do +defmodule AppBundler do def bundle(release) do options = validate_options(release.options[:app] || []) case os() do :macos -> - AppBuilder.MacOS.bundle(release, options) + AppBundler.MacOS.bundle(release, options) :windows -> - AppBuilder.Windows.bundle(release, options) + AppBundler.Windows.bundle(release, options) end end @@ -19,7 +19,7 @@ defmodule AppBuilder do end def init do - {:ok, _} = Registry.register(AppBuilder.Registry, "app_event_subscribers", []) + {:ok, _} = Registry.register(AppBundler.Registry, "app_event_subscribers", []) if input = System.get_env("APP_BUILDER_INPUT") do __rpc__(input) @@ -52,7 +52,7 @@ defmodule AppBuilder do end defp dispatch(message) do - Registry.dispatch(AppBuilder.Registry, "app_event_subscribers", fn entries -> + Registry.dispatch(AppBundler.Registry, "app_event_subscribers", fn entries -> for {pid, _} <- entries, do: send(pid, message) end) end diff --git a/app_builder/lib/app_builder/application.ex b/app_bundler/lib/app_bundler/application.ex similarity index 57% rename from app_builder/lib/app_builder/application.ex rename to app_bundler/lib/app_bundler/application.ex index ddcd0580a..8a363132a 100644 --- a/app_builder/lib/app_builder/application.ex +++ b/app_bundler/lib/app_bundler/application.ex @@ -1,13 +1,13 @@ -defmodule AppBuilder.Application do +defmodule AppBundler.Application do @moduledoc false use Application def start(_type, _args) do children = [ - {Registry, keys: :duplicate, name: AppBuilder.Registry} + {Registry, keys: :duplicate, name: AppBundler.Registry} ] - Supervisor.start_link(children, strategy: :one_for_one, name: AppBuilder.Supervisor) + Supervisor.start_link(children, strategy: :one_for_one, name: AppBundler.Supervisor) end end diff --git a/app_builder/lib/app_builder/macos.ex b/app_bundler/lib/app_bundler/macos.ex similarity index 98% rename from app_builder/lib/app_builder/macos.ex rename to app_bundler/lib/app_bundler/macos.ex index 787b9057e..f74c9486b 100644 --- a/app_builder/lib/app_builder/macos.ex +++ b/app_bundler/lib/app_bundler/macos.ex @@ -1,7 +1,7 @@ -defmodule AppBuilder.MacOS do +defmodule AppBundler.MacOS do @moduledoc false - import AppBuilder.Utils + import AppBundler.Utils @templates_path "#{__ENV__.file}/../../templates" diff --git a/app_builder/lib/app_builder/utils.ex b/app_bundler/lib/app_bundler/utils.ex similarity index 97% rename from app_builder/lib/app_builder/utils.ex rename to app_bundler/lib/app_bundler/utils.ex index c49e11496..cf712eacf 100644 --- a/app_builder/lib/app_builder/utils.ex +++ b/app_bundler/lib/app_bundler/utils.ex @@ -1,4 +1,4 @@ -defmodule AppBuilder.Utils do +defmodule AppBundler.Utils do @moduledoc false require Logger @@ -86,7 +86,7 @@ defmodule AppBuilder.Utils do end def normalize_icon_path(path_per_os) when is_list(path_per_os) do - Keyword.fetch!(path_per_os, AppBuilder.os()) + Keyword.fetch!(path_per_os, AppBundler.os()) end def copy_dir(from, to, options \\ []) do diff --git a/app_builder/lib/app_builder/windows.ex b/app_bundler/lib/app_bundler/windows.ex similarity index 95% rename from app_builder/lib/app_builder/windows.ex rename to app_bundler/lib/app_bundler/windows.ex index 8323bbb74..47ad5c37c 100644 --- a/app_builder/lib/app_builder/windows.ex +++ b/app_bundler/lib/app_bundler/windows.ex @@ -1,7 +1,7 @@ -defmodule AppBuilder.Windows do +defmodule AppBundler.Windows do @moduledoc false - import AppBuilder.Utils + import AppBundler.Utils @templates_path "#{__ENV__.file}/../../templates" @@ -89,19 +89,19 @@ defmodule AppBuilder.Windows do defp ensure_vcredistx64 do url = "https://aka.ms/vs/17/release/vc_redist.x64.exe" - AppBuilder.Utils.ensure_executable(url) + AppBundler.Utils.ensure_executable(url) end defp ensure_makensis do url = "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.08/nsis-3.08.zip" sha256 = "1bb9fc85ee5b220d3869325dbb9d191dfe6537070f641c30fbb275c97051fd0c" - AppBuilder.Utils.ensure_executable(url, sha256, "nsis-3.08/makensis.exe") + AppBundler.Utils.ensure_executable(url, sha256, "nsis-3.08/makensis.exe") end defp ensure_rcedit do url = "https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe" sha256 = "02e8e8c5d430d8b768980f517b62d7792d690982b9ba0f7e04163cbc1a6e7915" - AppBuilder.Utils.ensure_executable(url, sha256) + AppBundler.Utils.ensure_executable(url, sha256) end defp ensure_magick do diff --git a/app_builder/lib/templates/macos/Entitlements.plist.eex b/app_bundler/lib/templates/macos/Entitlements.plist.eex similarity index 100% rename from app_builder/lib/templates/macos/Entitlements.plist.eex rename to app_bundler/lib/templates/macos/Entitlements.plist.eex diff --git a/app_builder/lib/templates/macos/Info.plist.eex b/app_bundler/lib/templates/macos/Info.plist.eex similarity index 100% rename from app_builder/lib/templates/macos/Info.plist.eex rename to app_bundler/lib/templates/macos/Info.plist.eex diff --git a/app_builder/lib/templates/macos/Launcher.swift.eex b/app_bundler/lib/templates/macos/Launcher.swift.eex similarity index 98% rename from app_builder/lib/templates/macos/Launcher.swift.eex rename to app_bundler/lib/templates/macos/Launcher.swift.eex index 90cde8df6..ed8f1cfdc 100644 --- a/app_builder/lib/templates/macos/Launcher.swift.eex +++ b/app_bundler/lib/templates/macos/Launcher.swift.eex @@ -72,7 +72,7 @@ func rpc(_ event: String) { let task = buildReleaseTask() task.standardInput = input input.fileHandleForWriting.write("\(event)\n".data(using: .utf8)!) - task.arguments = ["rpc", "AppBuilder.__rpc__()"] + task.arguments = ["rpc", "AppBundler.__rpc__()"] try! task.run() task.waitUntilExit() diff --git a/app_builder/lib/templates/windows/Installer.nsi.eex b/app_bundler/lib/templates/windows/Installer.nsi.eex similarity index 100% rename from app_builder/lib/templates/windows/Installer.nsi.eex rename to app_bundler/lib/templates/windows/Installer.nsi.eex diff --git a/app_builder/lib/templates/windows/Launcher.vb.eex b/app_bundler/lib/templates/windows/Launcher.vb.eex similarity index 92% rename from app_builder/lib/templates/windows/Launcher.vb.eex rename to app_bundler/lib/templates/windows/Launcher.vb.eex index b22531eba..61cd0c567 100644 --- a/app_builder/lib/templates/windows/Launcher.vb.eex +++ b/app_bundler/lib/templates/windows/Launcher.vb.eex @@ -27,7 +27,7 @@ Module Launcher Dim cmd as String ' try release rpc, if release is down, this will fail but that's ok. - cmd = "echo " & input & " | """ & script & """ rpc ""AppBuilder.__rpc__()""" + cmd = "echo " & input & " | """ & script & """ rpc ""AppBundler.__rpc__()""" Shell("cmd.exe /c " & cmd, 0) ' try release start, if release is up, this will fail but that's ok. diff --git a/app_builder/lib/templates/windows/Manifest.xml.eex b/app_bundler/lib/templates/windows/Manifest.xml.eex similarity index 100% rename from app_builder/lib/templates/windows/Manifest.xml.eex rename to app_bundler/lib/templates/windows/Manifest.xml.eex diff --git a/app_builder/mix.exs b/app_bundler/mix.exs similarity index 79% rename from app_builder/mix.exs rename to app_bundler/mix.exs index d00946313..17a48675f 100644 --- a/app_builder/mix.exs +++ b/app_bundler/mix.exs @@ -1,9 +1,9 @@ -defmodule AppBuilder.MixProject do +defmodule AppBundler.MixProject do use Mix.Project def project do [ - app: :app_builder, + app: :app_bundler, version: "0.1.0", elixir: "~> 1.13", start_permanent: Mix.env() == :prod, @@ -20,7 +20,7 @@ defmodule AppBuilder.MixProject do def application do [ - mod: {AppBuilder.Application, []}, + mod: {AppBundler.Application, []}, extra_applications: [:logger, :eex, :inets, :ssl, :crypto] ] end diff --git a/app_builder/test/app_builder_test.exs b/app_bundler/test/app_bundler_test.exs similarity index 55% rename from app_builder/test/app_builder_test.exs rename to app_bundler/test/app_bundler_test.exs index a37991f2c..6b3402bcd 100644 --- a/app_builder/test/app_builder_test.exs +++ b/app_bundler/test/app_bundler_test.exs @@ -1,3 +1,3 @@ -defmodule AppBuilderTest do +defmodule AppBundlerTest do use ExUnit.Case, async: true end diff --git a/app_builder/test/test_helper.exs b/app_bundler/test/test_helper.exs similarity index 100% rename from app_builder/test/test_helper.exs rename to app_bundler/test/test_helper.exs diff --git a/lib/livebook_app.ex b/lib/livebook_app.ex index f65da6c35..ec202f0c5 100644 --- a/lib/livebook_app.ex +++ b/lib/livebook_app.ex @@ -18,8 +18,8 @@ if Mix.target() == :app do @impl true def init(_) do - AppBuilder.init() - os = AppBuilder.os() + AppBundler.init() + os = AppBundler.os() :wx.new() # TODO: instead of embedding the icon and copying to tmp, copy the file known location. @@ -103,7 +103,7 @@ if Mix.target() == :app do def taskbar(title, icon, menu_items) do pid = self() - os = AppBuilder.os() + os = AppBundler.os() options = if os == :macos, do: [iconType: 1], else: [] # skip keyboard shortcuts diff --git a/mix.exs b/mix.exs index 9bf2b870c..be4230181 100644 --- a/mix.exs +++ b/mix.exs @@ -104,7 +104,7 @@ defmodule Livebook.MixProject do ] end - defp target_deps(:app), do: [{:app_builder, path: "app_builder"}] + defp target_deps(:app), do: [{:app_bundler, path: "app_bundler"}] defp target_deps(_), do: [] @lock (with {:ok, contents} <- File.read("mix.lock"), @@ -143,7 +143,7 @@ defmodule Livebook.MixProject do :assemble, &remove_cookie/1, &standalone_erlang_elixir/1, - &AppBuilder.bundle/1 + &AppBundler.bundle/1 ], app: [ name: "Livebook",