@freestyle-sh/with-ruby 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,9 +20,9 @@ const { vm } = await freestyle.vms.create({
|
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
const res = await vm.ruby.runCode(
|
|
24
|
-
"require 'json'; puts JSON.generate({ hello: 'world' })"
|
|
25
|
-
);
|
|
23
|
+
const res = await vm.ruby.runCode({
|
|
24
|
+
code: "require 'json'; puts JSON.generate({ hello: 'world' })"
|
|
25
|
+
});
|
|
26
26
|
|
|
27
27
|
console.log(res);
|
|
28
28
|
// { result: { hello: 'world' }, stdout: '{"hello":"world"}\n', statusCode: 0 }
|
|
@@ -42,7 +42,7 @@ new VmRuby({
|
|
|
42
42
|
|
|
43
43
|
## API
|
|
44
44
|
|
|
45
|
-
### `vm.ruby.runCode(code: string)`
|
|
45
|
+
### `vm.ruby.runCode({ code: string })`
|
|
46
46
|
|
|
47
47
|
Executes Ruby code in the RVM-managed Ruby runtime.
|
|
48
48
|
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ declare class VmRuby extends VmWith<RubyRuntimeInstance> implements VmRunCode<Vm
|
|
|
17
17
|
declare class RubyRuntimeInstance extends VmWithInstance implements VmRunCodeInstance {
|
|
18
18
|
builder: VmRuby;
|
|
19
19
|
constructor(builder: VmRuby);
|
|
20
|
-
runCode<Result extends JSONValue = any>(code
|
|
20
|
+
runCode<Result extends JSONValue = any>({ code, }: {
|
|
21
|
+
code: string;
|
|
22
|
+
}): Promise<RunCodeResponse<Result>>;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export { VmRuby };
|
package/dist/index.js
CHANGED
|
@@ -53,7 +53,9 @@ class RubyRuntimeInstance extends VmWithInstance {
|
|
|
53
53
|
super();
|
|
54
54
|
this.builder = builder;
|
|
55
55
|
}
|
|
56
|
-
async runCode(
|
|
56
|
+
async runCode({
|
|
57
|
+
code
|
|
58
|
+
}) {
|
|
57
59
|
const result = await this.vm.exec({
|
|
58
60
|
command: `/usr/local/rvm/rubies/ruby-${this.builder.options.version}/bin/ruby -e "${code.replace(/"/g, '\\"')}"`
|
|
59
61
|
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@freestyle-sh/with-ruby",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"freestyle-sandboxes": "^0.1.2",
|
|
7
|
-
"@freestyle-sh/with-type-run-code": "^0.
|
|
7
|
+
"@freestyle-sh/with-type-run-code": "^0.2.0"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "./dist/index.js",
|