Skip to content

Commit 11aac6b

Browse files
author
Eric Swann
committed
Adding package and publish as well as a test case in Web.Api
1 parent 01036b5 commit 11aac6b

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

deploy/Package.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {.\archive.ps1;
66
powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {.\package.ps1 -PackageName 'ClearScript.Manager'; exit $error.Count}"
77

88

9+
powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {.\package.ps1 -PackageName 'ClearScript.Manager.Http'; exit $error.Count}"
10+
11+
912

1013
pause

deploy/Publish.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {.\archive.ps1;
77
powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {.\publish.ps1 -PackageName 'ClearScript.Manager'; exit $error.Count}"
88

99

10+
powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {.\publish.ps1 -PackageName 'ClearScript.Manager.Http'; exit $error.Count}"
11+
12+
1013
pause

src/ClearScript.Manager.WebDemo/Controllers/ValuesController.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
using System.Threading.Tasks;
88
using System.Web.Http;
99
using ClearScript.Manager.WebDemo.Models;
10+
using Microsoft.ClearScript;
11+
using Microsoft.ClearScript.V8;
1012

1113
namespace ClearScript.Manager.WebDemo.Controllers
1214
{
@@ -28,18 +30,22 @@ public string Get(int id)
2830
public async Task<dynamic> Post([FromBody]Script script)
2931
{
3032
var scriptId = Guid.NewGuid();
31-
using (var scope = new ManagerScope())
32-
{
33+
//using (var scope = new ManagerScope())
34+
//{
3335
//dynamic host = new ExpandoObject();
3436
var host = new TestModel();
3537
var option = new ExecutionOptions
3638
{
3739
HostObjects = new List<HostObject> {new HostObject {Name = "host", Target = host}}
3840
};
39-
await scope.RuntimeManager.ExecuteAsync(scriptId.ToString(), script.Text, option);
41+
42+
var engine = new V8ScriptEngine();
43+
engine.AddHostObject("host", HostItemFlags.None, host);
44+
engine.Execute(script.Text);
45+
//await scope.RuntimeManager.ExecuteAsync(scriptId.ToString(), script.Text, option);
4046

4147
return host;
42-
}
48+
//}
4349
}
4450

4551
// PUT api/values/5

0 commit comments

Comments
 (0)