Skip to content

Commit 749efd0

Browse files
committed
1.0.82 misc
1 parent 0bfdd40 commit 749efd0

8 files changed

Lines changed: 141 additions & 117 deletions

File tree

extras/examples/java/buildjardist.fan

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Build : BuildScript
1919
{
2020
dist := JarDist(this)
2121
dist.outFile = `./fansh.jar`.toFile.normalize
22-
dist.podNames = Str["compiler", "concurrent", "fansh"]
22+
dist.podNames = Str["compiler", "concurrent", "fansh", "util"]
2323
dist.mainMethod = "fansh::Main.main"
2424
dist.run
2525
}
@@ -56,4 +56,5 @@ class Build : BuildScript
5656
// test example:
5757
// java -cp lib\java\ext\win32-x86_64\swt.jar;fwtTest.jar fanjardist.Main
5858
}
59-
}
59+
}
60+

extras/examples/js/hello.fan

Lines changed: 110 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,110 @@
1-
#! /usr/bin/env fan
2-
//
3-
// Copyright (c) 2021, Brian Frank and Andy Frank
4-
// Licensed under the Academic Free License version 3.0
5-
//
6-
// History:
7-
// 29 Jun 21 Andy Frank Creation
8-
//
9-
10-
using dom
11-
using util
12-
using web
13-
using webmod
14-
using wisp
15-
16-
*************************************************************************
17-
** JsHelloMain
18-
*************************************************************************
19-
20-
class JsHelloMain : AbstractMain
21-
{
22-
@Opt { help = "http port" }
23-
Int port := 8080
24-
25-
override Int run()
26-
{
27-
wisp := WispService
28-
{
29-
it.httpPort = this.port
30-
it.root = JsHelloMod()
31-
}
32-
return runServices([wisp])
33-
}
34-
}
35-
36-
*************************************************************************
37-
** JsHelloMod
38-
*************************************************************************
39-
40-
const class JsHelloMod : WebMod
41-
{
42-
new make()
43-
{
44-
pods := ["sys"].map |n| { Pod.find(n) }
45-
files := File[,]
46-
.addAll(FilePack.toAppJsFiles(pods))
47-
.add(compileScriptJs)
48-
this.jsPack = FilePack(files)
49-
}
50-
51-
override Void onGet()
52-
{
53-
switch (req.modRel.path.first)
54-
{
55-
case null: onIndex
56-
case "hello.js": jsPack.onGet
57-
}
58-
}
59-
60-
Void onIndex()
61-
{
62-
res.headers["Content-Type"] = "text/html; charset=utf-8"
63-
out := res.out
64-
out.docType5
65-
out.html
66-
out.head
67-
.title.w("Hello World, from Fantom JS!").titleEnd
68-
.initJs(["main":"hello::JsHello"])
69-
.includeJs(`/hello.js`)
70-
.style.w(
71-
"body {
72-
padding: 0.25em 2em;
73-
font: 16px -apple-system, BlinkMacSystemFont, sans-serif;
74-
}").styleEnd
75-
out.headEnd
76-
out.body
77-
.h1.w("Hello World, from Fantom JS!").h1End
78-
.p.w("Check your JavaScript console for <code>echo()</code> output").pEnd
79-
out.bodyEnd
80-
out.htmlEnd
81-
}
82-
83-
**
84-
** Normally your @Js code would exist in a pod, but since
85-
** this is a Fantom script, we need to compile on the fly
86-
** in order to get JS output to add to FilePack.
87-
**
88-
private File compileScriptJs()
89-
{
90-
src := Env.cur.homeDir + `examples/js/hello.fan`
91-
js := Env.cur.compileScriptToJs(src, ["podName":"hello"])
92-
temp := Env.cur.tempDir + `dom.js`
93-
temp.out.print(js).sync.close
94-
return temp
95-
}
96-
97-
private const FilePack jsPack
98-
}
99-
100-
*************************************************************************
101-
** JsHello
102-
*************************************************************************
103-
104-
@Js class JsHello
105-
{
106-
static Void main()
107-
{
108-
echo("Hello there! This is from JsHello!")
109-
}
110-
}
1+
#! /usr/bin/env fan
2+
//
3+
// Copyright (c) 2021, Brian Frank and Andy Frank
4+
// Licensed under the Academic Free License version 3.0
5+
//
6+
// History:
7+
// 29 Jun 21 Andy Frank Creation
8+
//
9+
10+
using dom
11+
using util
12+
using web
13+
using webmod
14+
using wisp
15+
16+
*************************************************************************
17+
** JsHelloMain
18+
*************************************************************************
19+
20+
class JsHelloMain : AbstractMain
21+
{
22+
@Opt { help = "http port" }
23+
Int port := 8080
24+
25+
override Int run()
26+
{
27+
wisp := WispService
28+
{
29+
it.httpPort = this.port
30+
it.root = JsHelloMod()
31+
}
32+
return runServices([wisp])
33+
}
34+
}
35+
36+
*************************************************************************
37+
** JsHelloMod
38+
*************************************************************************
39+
40+
const class JsHelloMod : WebMod
41+
{
42+
new make()
43+
{
44+
pods := ["sys"].map |n| { Pod.find(n) }
45+
files := File[,]
46+
.addAll(FilePack.toAppJsFiles(pods))
47+
.add(compileScriptJs)
48+
this.jsPack = FilePack(files)
49+
}
50+
51+
override Void onGet()
52+
{
53+
switch (req.modRel.path.first)
54+
{
55+
case null: onIndex
56+
case "hello.js": jsPack.onGet
57+
}
58+
}
59+
60+
Void onIndex()
61+
{
62+
res.headers["Content-Type"] = "text/html; charset=utf-8"
63+
out := res.out
64+
out.docType5
65+
out.html
66+
out.head
67+
.title.w("Hello World, from Fantom JS!").titleEnd
68+
.initJs(["main":"hello::JsHello"])
69+
.includeJs(`/hello.js`)
70+
.style.w(
71+
"body {
72+
padding: 0.25em 2em;
73+
font: 16px -apple-system, BlinkMacSystemFont, sans-serif;
74+
}").styleEnd
75+
out.headEnd
76+
out.body
77+
.h1.w("Hello World, from Fantom JS!").h1End
78+
.p.w("Check your JavaScript console for <code>echo()</code> output").pEnd
79+
out.bodyEnd
80+
out.htmlEnd
81+
}
82+
83+
**
84+
** Normally your @Js code would exist in a pod, but since
85+
** this is a Fantom script, we need to compile on the fly
86+
** in order to get JS output to add to FilePack.
87+
**
88+
private File compileScriptJs()
89+
{
90+
src := Env.cur.homeDir + `examples/js/hello.fan`
91+
js := Env.cur.compileScriptToJs(src, ["podName":"hello"])
92+
temp := Env.cur.tempDir + `dom.js`
93+
temp.out.print(js).sync.close
94+
return temp
95+
}
96+
97+
private const FilePack jsPack
98+
}
99+
100+
*************************************************************************
101+
** JsHello
102+
*************************************************************************
103+
104+
@Js class JsHello
105+
{
106+
static Void main()
107+
{
108+
echo("Hello there! This is from JsHello!")
109+
}
110+
}

extras/examples/web/demo.fan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class Boot : AbstractMain
3939
routes =
4040
[
4141
"index": FileMod { file = homeDir + `demo/index.html` },
42-
"flag": FileMod { file = `fan://icons/x32/flag.png`.get },
4342
"doc": FileMod { file = docDir },
4443
"logs": FileMod { file = logDir },
4544
"upload": ScriptMod { file = homeDir + `demo/upload.fan` },
@@ -84,3 +83,4 @@ const class ScriptMod : WebMod
8483
}
8584
}
8685
}
86+

extras/examples/web/demo/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ <h1>Wisp Demo Index</h1>
55

66
<ul>
77

8-
<li><a href='/flag'>/flag</a>: FileMod for single file (resource file in icon pod).</li>
9-
108
<li><a href='/doc'>/doc</a>: FileMod for directory (available
119
only if fan.home/docs found).</li>
1210

@@ -21,4 +19,5 @@ <h1>Wisp Demo Index</h1>
2119

2220
<ul>
2321

24-
</body>
22+
</body>
23+

fantom/bin/fanc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
#
4+
# fanc: Fan Compiler tools
5+
#
6+
7+
. "${0%/*}/fanlaunch"
8+
fanlaunch Fan fanc "$@"
9+

fantom/bin/fanc.bat

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@echo off
2+
REM
3+
REM Copyright (c) 2025, Brian Frank and Andy Frank
4+
REM Licensed under the Academic Free License version 3.0
5+
REM
6+
REM History:
7+
REM 12 May 2025 Brian Frank Creation
8+
REM
9+
REM fanr: Fantom compiler tools
10+
REM
11+
12+
call "%~fs0\..\fanlaunch.bat" Fan fanc %*
13+

fantom/etc/build/config.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212

1313
// default version used by build scripts
14-
buildVersion=1.0.81
14+
buildVersion=1.0.82
1515

1616
// Must be configured boot build in substitute/release installation
1717
//devHome=/work/fan/

fantom/etc/sys/ext2mime.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ js=text/javascript; charset=utf-8
3535
json=application/json
3636
jsonld=application/ld+json
3737
map=application/json
38+
md=text/markdown; charset=utf-8
39+
markdown=text/markdown; charset=utf-8
3840
mp3=audio/mpeg3
3941
mpeg=video/mpeg
4042
obix=text/xml; charset=utf-8

0 commit comments

Comments
 (0)