Skip to content

Commit

Permalink
Feat: Adjust parser CLI for compatibility with Linux dev (#75)
Browse files Browse the repository at this point in the history
* Start: add `get-os` function

Start to build compatibility across local dev environments.

* Fix: compatibility with OS for dev

* Add: binary parser for linux, move mac version to parser-dev-darwin

* Add: Upgrade heim version to bring in more recent uom

This should fix a CI build error for linux.

* Add: move parser-dev-darwin to parser-dev-mac, per get-os

* Add: Change how the name of the mac os is handled.

Co-authored-by: holtzermann17 <[email protected]>
  • Loading branch information
holtzermann17 and holtzermann17 authored Jan 5, 2021
1 parent 0cc7124 commit cbf774a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
Binary file added clojure/resources/parser-dev-linux
Binary file not shown.
File renamed without changes.
6 changes: 4 additions & 2 deletions clojure/src/firn/org.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
(ns firn.org


"The org namespace handles all data-related to the parsing of an org file.
When an org file is parsed it is organized into a map of data.
Expand Down Expand Up @@ -50,7 +52,7 @@
[file-str]
(if (u/native-image?)
(ClojureRust/parseOrg file-str)
(let [parser (str (u/get-cwd) "/resources/parser")
(let [parser (str (u/get-cwd) "/resources/parser-dev-" (u/get-os))
stripped (s/trim-newline file-str)
res (sh/sh parser stripped)]
(if-not (= (res :exit) 0)
Expand All @@ -60,7 +62,7 @@
(defn parse-dev!
"DevXp func: Useful for testing org strings in the repl."
[s]
(let [parser (str (u/get-cwd) "/resources/parser")
(let [parser (str (u/get-cwd) "/resources/parser-dev-" (u/get-os))
stripped (s/trim-newline s)
res (sh/sh parser stripped)]
(if-not (= (res :exit) 0)
Expand Down
6 changes: 6 additions & 0 deletions clojure/src/firn/util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
[]
(System/getProperty "user.dir"))

(defn get-os
"Return the name of the host operating system."
[]
(str/replace (str/lower-case (System/getProperty "os.name"))
#" " ""))

(defn snake->kebab
"Convert strings with underscores to hyphens."
([s]
Expand Down
2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate_type = ["cdylib"]

[dependencies]
jni = "0.14.0"
heim = "0.0.10"
heim = "0.0.11"
futures = "0.3.1"
orgize = "0.8.3"
serde_json = "1.0.48"

0 comments on commit cbf774a

Please sign in to comment.