Skip to content

Commit 8021ac7

Browse files
authored
Merge pull request #78 from nervosnetwork/release/v0.2.1
Release/v0.2.1
2 parents a4e4c8d + 8698859 commit 8021ac7

File tree

10 files changed

+94
-10
lines changed

10 files changed

+94
-10
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,26 @@ Tippy is pre-built as self-contained .Net Core application. You don't have to in
2525
* Make `Tippy` executable: `chmod +x ./tippy-linux-x64/Tippy`
2626
* `cd tippy-linux-x64` then run `./Tippy` to start
2727

28+
We also provide a Homebrew formula to install with one-liner:
29+
30+
```
31+
brew install nervosnetwork/tap/tippy-linux
32+
```
33+
34+
Then simply run `tippy` to start
35+
2836
### On macOS:
2937

3038
* Download `Tippy.dmg`
3139
* Open the dmg file and drag `Tippy.app` to `/Applications` folder
3240
* From `/Applications` click `Tippy.app` to start
3341

42+
We also provide a Homebrew cask to install with one-liner:
43+
44+
```
45+
brew install nervosnetwork/tap/tippy
46+
```
47+
3448
### Tippy Console and UI
3549

3650
While Tippy runs as a console application, it also provides web UI. By default the dashboard UI will be opened automatically, if not you can access it by visiting [http://localhost:5000/Home](http://localhost:5000/Home) from a browser.

debugger.png

-856 Bytes
Loading

src/Tippy.Ctrl/Process/BinariesInfo.cs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ namespace Tippy.Ctrl.Process
55
{
66
internal class BinariesInfo
77
{
8-
internal string Info { get; private set; } = "";
9-
List<string> binaries = new List<string> { "ckb", "ckb-indexer", "ckb-debugger"/*, "ckb-cli"*/ };
8+
internal string Info { get; private set; } = "";
9+
internal bool HasDebuggerDeps { get; private set; } = false;
10+
11+
readonly List<string> binaries = new() { "ckb", "ckb-indexer", "ckb-debugger"/*, "ckb-cli"*/ };
1012

1113
internal void Refresh()
1214
{
@@ -37,6 +39,34 @@ internal void Refresh()
3739
process.BeginOutputReadLine();
3840
process.WaitForExit();
3941
}
42+
43+
if (!OperatingSystem.IsWindows())
44+
{
45+
RefreshDebuggerDeps();
46+
}
47+
}
48+
49+
void RefreshDebuggerDeps()
50+
{
51+
HasDebuggerDeps = true;
52+
// BUGBUG: .Net won't find commands on M1 Mac which has homebrew location at `/opt/homebrew/bin`.
53+
foreach (var dep in new List<string>() { "gdb", "ttyd" })
54+
{
55+
try
56+
{
57+
System.Diagnostics.Process process = new();
58+
process.StartInfo.UseShellExecute = false;
59+
process.StartInfo.FileName = dep;
60+
process.StartInfo.Arguments = "--version";
61+
process.StartInfo.WorkingDirectory = Core.Environment.GetAppDataFolder();
62+
process.Start();
63+
process.WaitForExit();
64+
}
65+
catch
66+
{
67+
HasDebuggerDeps = false;
68+
}
69+
}
4070
}
4171
}
4272
}

src/Tippy.Ctrl/ProcessManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class ProcessManager
2222
/// </summary>
2323
public static string Info { get; private set; } = "";
2424

25+
public static bool DebuggerDepsInstalled { get; private set; } = false;
26+
2527
public enum MinerMode
2628
{
2729
Default,
@@ -71,6 +73,7 @@ public static void FetchInfo()
7173
BinariesInfo binariesInfo = new();
7274
binariesInfo.Refresh();
7375
Info = binariesInfo.Info;
76+
DebuggerDepsInstalled = binariesInfo.HasDebuggerDeps;
7477
}
7578

7679
/// If any port is already in use, throw InvalidOperationException.

src/Tippy/Pages/FailedTransactions/Details.cshtml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,27 @@
3535
@foreach (var (input, index) in Model.DisplayInputs.Select((o, i) => (o, i)))
3636
{
3737
<div class="column is-10">
38-
<a asp-page="/Debugger/Details" asp-route-txId="@Model.ID" asp-route-ioIndex="@index" asp-route-ioType="input" asp-route-scriptType="0" class="button">Debug Input @index Lock</a>
38+
@if (Model.DebuggerDepsInstalled)
39+
{
40+
<a asp-page="/Debugger/Details" asp-route-txId="@Model.ID" asp-route-ioIndex="@index" asp-route-ioType="input" asp-route-scriptType="0" class="button">Debug Input @index Lock</a>
41+
}
42+
else
43+
{
44+
<a class="button" href="#" disabled>Debug Input @index Lock</a>
45+
}
3946
</div>
4047

4148
<div class="column is-10">
4249
@if (input.Type != null)
4350
{
44-
<a asp-page="/Debugger/Details" asp-route-txId="@Model.ID" asp-route-ioIndex="@index" asp-route-ioType="input" asp-route-scriptType="1" class="button">Debug Input @index Type</a>
51+
@if (Model.DebuggerDepsInstalled)
52+
{
53+
<a asp-page="/Debugger/Details" asp-route-txId="@Model.ID" asp-route-ioIndex="@index" asp-route-ioType="input" asp-route-scriptType="1" class="button">Debug Input @index Type</a>
54+
}
55+
else
56+
{
57+
<a class="button" href="#" disabled>Debug Input @index Type</a>
58+
}
4559
}
4660
</div>
4761
}
@@ -51,7 +65,14 @@
5165
<div class="column is-10">
5266
@if (Model.ParsedTransaction!.Outputs[index].Type != null)
5367
{
54-
<a asp-page="/Debugger/Details" asp-route-txId="@Model.ID" asp-route-ioIndex="@index" asp-route-ioType="output" asp-route-scriptType="1" class="button">Debug Output @index Type</a>
68+
@if (Model.DebuggerDepsInstalled)
69+
{
70+
<a asp-page="/Debugger/Details" asp-route-txId="@Model.ID" asp-route-ioIndex="@index" asp-route-ioType="output" asp-route-scriptType="1" class="button">Debug Output @index Type</a>
71+
}
72+
else
73+
{
74+
<a class="button" href="#" disabled>Debug Output @index Type</a>
75+
}
5576
}
5677
</div>
5778
}

src/Tippy/Pages/PageModelBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class PageModelBase : PageModel
2727
public EpochView? EpochView { get; set; }
2828
public String ProcessInfo { get; set; } = "";
2929
public bool IsDebuggerSupported = !OperatingSystem.IsWindows();
30+
public bool DebuggerDepsInstalled { get; set; } = false;
3031
public Dictionary<string, Token> Tokens { get; set; } = new(); // Token.Hash -> Token
3132

3233
protected PageModelBase(Tippy.Core.Data.TippyDbContext context)
@@ -43,6 +44,7 @@ protected PageModelBase(Tippy.Core.Data.TippyDbContext context)
4344
public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next)
4445
{
4546
ProcessInfo = ProcessManager.Info;
47+
DebuggerDepsInstalled = ProcessManager.DebuggerDepsInstalled;
4648

4749
Projects = await DbContext.Projects.Include(p => p.Tokens).ToListAsync();
4850
ActiveProject = await DbContext.Projects.FirstOrDefaultAsync(p => p.IsActive);

src/Tippy/Pages/Transactions/Details.cshtml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,14 @@
140140
@if (Model.IsDebuggerSupported)
141141
{
142142
<div class="column is-10">
143-
<a asp-page="/Debugger/Details" asp-route-txHash="@Model.Transaction.Hash" asp-route-ioIndex="@index" asp-route-ioType="input" asp-route-scriptType="0" class="button">Debug this script</a>
143+
@if (Model.DebuggerDepsInstalled)
144+
{
145+
<a asp-page="/Debugger/Details" asp-route-txHash="@Model.Transaction.Hash" asp-route-ioIndex="@index" asp-route-ioType="input" asp-route-scriptType="0" class="button">Debug this script</a>
146+
}
147+
else
148+
{
149+
<a class="button" href="#" disabled>Debug this script</a>
150+
}
144151
<Partial name="_DebuggerInfo" />
145152
</div>
146153
}
@@ -163,7 +170,14 @@
163170
@if (Model.IsDebuggerSupported)
164171
{
165172
<div class="column is-10">
166-
<a asp-page="/Debugger/Details" asp-route-txHash="@Model.Transaction.Hash" asp-route-ioIndex="@index" asp-route-ioType="input" asp-route-scriptType="1" class="button">Debug this script</a>
173+
@if (Model.DebuggerDepsInstalled)
174+
{
175+
<a asp-page="/Debugger/Details" asp-route-txHash="@Model.Transaction.Hash" asp-route-ioIndex="@index" asp-route-ioType="input" asp-route-scriptType="1" class="button">Debug this script</a>
176+
}
177+
else
178+
{
179+
<a class="button" href="#" disabled>Debug this script</a>
180+
}
167181
<Partial name="_DebuggerInfo" />
168182
</div>
169183
}

src/Tippy/Tippy.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<IsPackable>false</IsPackable>
99
<DebugType>embedded</DebugType>
1010
<UserSecretsId>6e0dc08b-01f2-47f6-8249-66ed1b18f469</UserSecretsId>
11-
<Version>0.2.0</Version>
11+
<Version>0.2.1</Version>
1212
<PackageProjectUrl>https://github.com/nervosnetwork/tippy</PackageProjectUrl>
1313
<RepositoryUrl>https://github.com/nervosnetwork/tippy</RepositoryUrl>
1414
<Copyright>Copyright (c) Nervos Foundation</Copyright>

tippy.png

13.8 KB
Loading

tools/osx/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<key>CFBundleIconFile</key>
1010
<string>Tippy.icns</string>
1111
<key>CFBundleVersion</key>
12-
<string>0.2.0</string>
12+
<string>0.2.1</string>
1313
<key>CFBundleShortVersionString</key>
14-
<string>0.2.0</string>
14+
<string>0.2.1</string>
1515
<key>CFBundleExecutable</key>
1616
<string>main</string>
1717
<key>CFBundleInfoDictionaryVersion</key>

0 commit comments

Comments
 (0)