Rename AppBuilder to AppBundler (#1283)

This commit is contained in:
Wojtek Mach 2022-07-19 14:48:07 +02:00 committed by GitHub
parent 96b39d91ed
commit 8da05a5c5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 45 additions and 45 deletions

View file

@ -1 +0,0 @@
# AppBuilder

View file

@ -1 +0,0 @@
# WxDemo

1
app_bundler/README.md Normal file
View file

@ -0,0 +1 @@
# AppBundler

View file

@ -0,0 +1 @@
# Demo

View file

@ -1,4 +1,4 @@
defmodule WxDemo.Application do defmodule Demo.Application do
@moduledoc false @moduledoc false
use Application use Application
@ -6,15 +6,15 @@ defmodule WxDemo.Application do
@impl true @impl true
def start(_type, _args) do def start(_type, _args) do
children = [ 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) Supervisor.start_link(children, opts)
end end
end end
defmodule WxDemo.Window do defmodule Demo.Window do
@moduledoc false @moduledoc false
use GenServer, restart: :transient use GenServer, restart: :transient
@ -28,9 +28,9 @@ defmodule WxDemo.Window do
@impl true @impl true
def init(_) do def init(_) do
AppBuilder.init() AppBundler.init()
app_name = "WxDemo" app_name = "Demo"
os = AppBuilder.os() os = AppBundler.os()
wx = :wx.new() wx = :wx.new()
frame = :wxFrame.new(wx, -1, app_name, size: {400, 400}) frame = :wxFrame.new(wx, -1, app_name, size: {400, 400})

View file

@ -1,9 +1,9 @@
defmodule WxDemo.MixProject do defmodule Demo.MixProject do
use Mix.Project use Mix.Project
def project do def project do
[ [
app: :wx_demo, app: :demo,
version: "0.1.0", version: "0.1.0",
elixir: "~> 1.13", elixir: "~> 1.13",
start_permanent: Mix.env() == :prod, start_permanent: Mix.env() == :prod,
@ -15,13 +15,13 @@ defmodule WxDemo.MixProject do
def application do def application do
[ [
extra_applications: [:wx, :logger], extra_applications: [:wx, :logger],
mod: {WxDemo.Application, []} mod: {Demo.Application, []}
] ]
end end
defp deps do defp deps do
[ [
{:app_builder, path: "../.."} {:app_bundler, path: "../.."}
] ]
end end
@ -32,14 +32,14 @@ defmodule WxDemo.MixProject do
app: [ app: [
steps: [ steps: [
:assemble, :assemble,
&AppBuilder.bundle/1 &AppBundler.bundle/1
], ],
app: [ app: [
name: "WxDemo", name: "Demo",
url_schemes: ["wxdemo"], url_schemes: ["wxdemo"],
document_types: [ document_types: [
[ [
name: "WxDemo", name: "Demo",
extensions: ["wxdemo"], extensions: ["wxdemo"],
macos: [ macos: [
role: "Editor" role: "Editor"

View file

@ -1,3 +1,3 @@
defmodule WxDemoTest do defmodule DemoTest do
use ExUnit.Case, async: true use ExUnit.Case, async: true
end end

View file

@ -1,13 +1,13 @@
defmodule AppBuilder do defmodule AppBundler do
def bundle(release) do def bundle(release) do
options = validate_options(release.options[:app] || []) options = validate_options(release.options[:app] || [])
case os() do case os() do
:macos -> :macos ->
AppBuilder.MacOS.bundle(release, options) AppBundler.MacOS.bundle(release, options)
:windows -> :windows ->
AppBuilder.Windows.bundle(release, options) AppBundler.Windows.bundle(release, options)
end end
end end
@ -19,7 +19,7 @@ defmodule AppBuilder do
end end
def init do 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 if input = System.get_env("APP_BUILDER_INPUT") do
__rpc__(input) __rpc__(input)
@ -52,7 +52,7 @@ defmodule AppBuilder do
end end
defp dispatch(message) do 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) for {pid, _} <- entries, do: send(pid, message)
end) end)
end end

View file

@ -1,13 +1,13 @@
defmodule AppBuilder.Application do defmodule AppBundler.Application do
@moduledoc false @moduledoc false
use Application use Application
def start(_type, _args) do def start(_type, _args) do
children = [ 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
end end

View file

@ -1,7 +1,7 @@
defmodule AppBuilder.MacOS do defmodule AppBundler.MacOS do
@moduledoc false @moduledoc false
import AppBuilder.Utils import AppBundler.Utils
@templates_path "#{__ENV__.file}/../../templates" @templates_path "#{__ENV__.file}/../../templates"

View file

@ -1,4 +1,4 @@
defmodule AppBuilder.Utils do defmodule AppBundler.Utils do
@moduledoc false @moduledoc false
require Logger require Logger
@ -86,7 +86,7 @@ defmodule AppBuilder.Utils do
end end
def normalize_icon_path(path_per_os) when is_list(path_per_os) do 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 end
def copy_dir(from, to, options \\ []) do def copy_dir(from, to, options \\ []) do

View file

@ -1,7 +1,7 @@
defmodule AppBuilder.Windows do defmodule AppBundler.Windows do
@moduledoc false @moduledoc false
import AppBuilder.Utils import AppBundler.Utils
@templates_path "#{__ENV__.file}/../../templates" @templates_path "#{__ENV__.file}/../../templates"
@ -89,19 +89,19 @@ defmodule AppBuilder.Windows do
defp ensure_vcredistx64 do defp ensure_vcredistx64 do
url = "https://aka.ms/vs/17/release/vc_redist.x64.exe" url = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
AppBuilder.Utils.ensure_executable(url) AppBundler.Utils.ensure_executable(url)
end end
defp ensure_makensis do defp ensure_makensis do
url = "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.08/nsis-3.08.zip" url = "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.08/nsis-3.08.zip"
sha256 = "1bb9fc85ee5b220d3869325dbb9d191dfe6537070f641c30fbb275c97051fd0c" 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 end
defp ensure_rcedit do defp ensure_rcedit do
url = "https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe" url = "https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe"
sha256 = "02e8e8c5d430d8b768980f517b62d7792d690982b9ba0f7e04163cbc1a6e7915" sha256 = "02e8e8c5d430d8b768980f517b62d7792d690982b9ba0f7e04163cbc1a6e7915"
AppBuilder.Utils.ensure_executable(url, sha256) AppBundler.Utils.ensure_executable(url, sha256)
end end
defp ensure_magick do defp ensure_magick do

View file

@ -72,7 +72,7 @@ func rpc(_ event: String) {
let task = buildReleaseTask() let task = buildReleaseTask()
task.standardInput = input task.standardInput = input
input.fileHandleForWriting.write("\(event)\n".data(using: .utf8)!) input.fileHandleForWriting.write("\(event)\n".data(using: .utf8)!)
task.arguments = ["rpc", "AppBuilder.__rpc__()"] task.arguments = ["rpc", "AppBundler.__rpc__()"]
try! task.run() try! task.run()
task.waitUntilExit() task.waitUntilExit()

View file

@ -27,7 +27,7 @@ Module Launcher
Dim cmd as String Dim cmd as String
' try release rpc, if release is down, this will fail but that's ok. ' 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) Shell("cmd.exe /c " & cmd, 0)
' try release start, if release is up, this will fail but that's ok. ' try release start, if release is up, this will fail but that's ok.

View file

@ -1,9 +1,9 @@
defmodule AppBuilder.MixProject do defmodule AppBundler.MixProject do
use Mix.Project use Mix.Project
def project do def project do
[ [
app: :app_builder, app: :app_bundler,
version: "0.1.0", version: "0.1.0",
elixir: "~> 1.13", elixir: "~> 1.13",
start_permanent: Mix.env() == :prod, start_permanent: Mix.env() == :prod,
@ -20,7 +20,7 @@ defmodule AppBuilder.MixProject do
def application do def application do
[ [
mod: {AppBuilder.Application, []}, mod: {AppBundler.Application, []},
extra_applications: [:logger, :eex, :inets, :ssl, :crypto] extra_applications: [:logger, :eex, :inets, :ssl, :crypto]
] ]
end end

View file

@ -1,3 +1,3 @@
defmodule AppBuilderTest do defmodule AppBundlerTest do
use ExUnit.Case, async: true use ExUnit.Case, async: true
end end

View file

@ -18,8 +18,8 @@ if Mix.target() == :app do
@impl true @impl true
def init(_) do def init(_) do
AppBuilder.init() AppBundler.init()
os = AppBuilder.os() os = AppBundler.os()
:wx.new() :wx.new()
# TODO: instead of embedding the icon and copying to tmp, copy the file known location. # 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 def taskbar(title, icon, menu_items) do
pid = self() pid = self()
os = AppBuilder.os() os = AppBundler.os()
options = if os == :macos, do: [iconType: 1], else: [] options = if os == :macos, do: [iconType: 1], else: []
# skip keyboard shortcuts # skip keyboard shortcuts

View file

@ -104,7 +104,7 @@ defmodule Livebook.MixProject do
] ]
end 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: [] defp target_deps(_), do: []
@lock (with {:ok, contents} <- File.read("mix.lock"), @lock (with {:ok, contents} <- File.read("mix.lock"),
@ -143,7 +143,7 @@ defmodule Livebook.MixProject do
:assemble, :assemble,
&remove_cookie/1, &remove_cookie/1,
&standalone_erlang_elixir/1, &standalone_erlang_elixir/1,
&AppBuilder.bundle/1 &AppBundler.bundle/1
], ],
app: [ app: [
name: "Livebook", name: "Livebook",