Skip to content

Commit

Permalink
#17 header
Browse files Browse the repository at this point in the history
  • Loading branch information
ojow committed Jun 15, 2018
1 parent 033cf90 commit 281133a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions re/src/re/handler/json2orc.clj
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
(ns re.handler.json2orc
(:require [integrant.core :as ig])
(:require [clojure.java.shell :as shell]))
(:require [clojure.java.shell :as shell]
[clojure.string :as string :refer [join] :rename {join j}]))

(defn compile-orc [orc]
(shell/sh
"/usr/oam-compiler/_build/default/bin/orc.exe" "compile" "-prelude" "-i" "prelude"
:dir "/usr/oam-compiler"
:in orc))

(defn header [campaign]
(j ["{-\n"
" - campaign_id: " (:campaign_id campaign) "\n"
" - name: " (:name campaign) "\n"
" - app_id: " (:app_id campaign) "\n"
" - type: " (:type campaign) "\n"
" -}\n"]))

(defn add-segments [campaign]
campaign)

(defn convert [json]
(let [orc "1>>2"
(let [campaign (add-segments json)
orc (j [(header campaign)
"\n1>>2"])
compile-result (compile-orc orc)
result {:orc orc}]
(if (= (:exit compile-result) 0)
Expand Down

0 comments on commit 281133a

Please sign in to comment.