mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-12-27 18:23:49 +08:00
Rename AppBuilder to AppBundler (#1283)
This commit is contained in:
parent
96b39d91ed
commit
8da05a5c5a
29 changed files with 45 additions and 45 deletions
|
@ -1 +0,0 @@
|
|||
# AppBuilder
|
|
@ -1 +0,0 @@
|
|||
# WxDemo
|
1
app_bundler/README.md
Normal file
1
app_bundler/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
# AppBundler
|
1
app_bundler/demo/README.md
Normal file
1
app_bundler/demo/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
# Demo
|
|
@ -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})
|
||||
|
|
@ -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"
|
|
@ -1,3 +1,3 @@
|
|||
defmodule WxDemoTest do
|
||||
defmodule DemoTest do
|
||||
use ExUnit.Case, async: true
|
||||
end
|
|
@ -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
|
|
@ -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
|
|
@ -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"
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -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()
|
||||
|
|
@ -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.
|
|
@ -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
|
|
@ -1,3 +1,3 @@
|
|||
defmodule AppBuilderTest do
|
||||
defmodule AppBundlerTest do
|
||||
use ExUnit.Case, async: true
|
||||
end
|
|
@ -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
|
||||
|
|
4
mix.exs
4
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",
|
||||
|
|
Loading…
Reference in a new issue