Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteinshouer committed Apr 25, 2023
2 parents 0d269a6 + 6fd95ff commit 9d32ed5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

## v1.1.0

- Add % prefix for magic commands to match the iPython naming scheme i.e. `%install` and `%loadjar`

## v1.0.0

- Initial release
8 changes: 4 additions & 4 deletions cfml_kernel/box_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self,repl_type = "cfscript", **kwargs):

def do_execute(self, code):

if (code[:8] == "$install"):
if (code[:8] == "$install" or code[:8] == "%install"):
# stop the repl
self._stop_repl()

Expand All @@ -26,7 +26,7 @@ def do_execute(self, code):
self._start_repl()

return output
elif (code[:8] == "$loadjar"):
elif (code[:8] == "$loadjar" or code[:8] == "%loadjar"):
#Load jar
output = self._load_jar(code)

Expand All @@ -50,7 +50,7 @@ def do_execute(self, code):
return "\n".join(response).strip()

def _box_install(self,code):
self.box_shell.stdin.write(bytes(f"install {code.replace('$install','')}\n".encode("utf-8")))
self.box_shell.stdin.write(bytes(f"install {code.replace('$install','').replace('%install','')}\n".encode("utf-8")))
self.box_shell.stdin.flush()
output = self._search_for_output()
for string in self.PROMPT_STRINGS:
Expand All @@ -67,7 +67,7 @@ def _load_jar(self,code):
self.box_shell.stdin.write(bytes(f"{loadjar_expression}\n".encode("utf-8")))
self.box_shell.stdin.flush()
self._search_for_output()
self.box_shell.stdin.write(bytes(f"loadJar('{code.replace('$loadjar','').strip()}');\n".encode("utf-8")))
self.box_shell.stdin.write(bytes(f"loadJar('{code.replace('$loadjar','').replace('%loadjar','').strip()}');\n".encode("utf-8")))
self.box_shell.stdin.flush()
output = self._search_for_output()
for string in self.PROMPT_STRINGS:
Expand Down
30 changes: 15 additions & 15 deletions notebook_examples/cfquery.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"\n",
"For this demo we are going to use SQLite so first we will use some [magic commands](https://ipython.readthedocs.io/en/stable/interactive/magics.html) to install the SQLite JDBC driver.\n",
"\n",
"The `$install` magic command calls the CommandBox `install` command and passes the parameter to it. "
"The `%install` magic command calls the CommandBox `install` command and passes the parameter to it. "
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 1,
"metadata": {
"vscode": {
"languageId": "cfml"
Expand All @@ -33,20 +33,20 @@
}
],
"source": [
"$install jar:https://github.com/xerial/sqlite-jdbc/releases/download/3.41.0.1/sqlite-jdbc-3.41.0.1.jar"
"%install jar:https://github.com/xerial/sqlite-jdbc/releases/download/3.41.0.1/sqlite-jdbc-3.41.0.1.jar"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"There is also a magic command named `$loadjar` that takes a file path as a parameter. It will load a `jar` file for us."
"There is also a magic command named `%loadjar` that takes a file path as a parameter. It will load a `jar` file for us."
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {
"vscode": {
"languageId": "cfml"
Expand All @@ -57,12 +57,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Loaded /workspace/notebooks/lib/sqlite-jdbc-3.41.0.1/sqlite-jdbc-3.41.0.1.jar\n"
"Loaded /workspace/notebook_examples/lib/sqlite-jdbc-3.41.0.1/sqlite-jdbc-3.41.0.1.jar\n"
]
}
],
"source": [
"$loadjar lib/sqlite-jdbc-3.41.0.1/sqlite-jdbc-3.41.0.1.jar"
"%loadjar lib/sqlite-jdbc-3.41.0.1/sqlite-jdbc-3.41.0.1.jar"
]
},
{
Expand All @@ -75,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {
"vscode": {
"languageId": "cfml"
Expand Down Expand Up @@ -110,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {
"vscode": {
"languageId": "cfml"
Expand All @@ -137,7 +137,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {
"vscode": {
"languageId": "cfml"
Expand All @@ -164,7 +164,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {
"vscode": {
"languageId": "cfml"
Expand Down Expand Up @@ -208,7 +208,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {
"vscode": {
"languageId": "cfml"
Expand Down Expand Up @@ -238,7 +238,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {
"vscode": {
"languageId": "cfml"
Expand Down Expand Up @@ -270,7 +270,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {
"vscode": {
"languageId": "cfml"
Expand Down Expand Up @@ -304,7 +304,7 @@
"language_info": {
"file_extension": ".cfm",
"mimetype": "text/x-javascript",
"name": "CFScript"
"name": "CFML"
},
"orig_nbformat": 4
},
Expand Down

0 comments on commit 9d32ed5

Please sign in to comment.