-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* dev: (29 commits) add an option to control wether to generate datapackage.json more tests fix build problem properly close the progress bar update the last_update time after loading other optional info add serving section in output of to_recipe update hy funcs add modeline for syntax remove gitattribute more examples fix name try to add syntax highlight for hy file add example recipes serve entities not in any entity set add hy format support add ddf_dir option in run_recipe update tests new api function don't remove datapackage.json in cleanup comments and logging ...
- Loading branch information
Showing
160 changed files
with
1,233 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import hy | ||
|
||
from .funcs import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(import [ddf_utils.chef.api [Chef]]) | ||
|
||
;; (defn init [] | ||
;; (global *chef*) | ||
;; (setv *chef* (Chef))) | ||
|
||
(defn info [chef &kwargs kwargs] | ||
(apply (. chef add_metadata) [] kwargs)) | ||
|
||
(defn config [chef &kwargs kwargs] | ||
(apply (. chef add_config) [] kwargs)) | ||
|
||
;; (defn ingredients [ingreds] | ||
;; (for [i ingreds] (do | ||
;; (print i) | ||
;; (apply (. *chef* add_ingredient) [] i)))) | ||
|
||
;; (defn show [&optional how] | ||
;; (cond [(= how "recipe") (.to_recipe *chef*)] | ||
;; [True (print (. *chef* metadata))])) | ||
|
||
(defn procedure [chef result collection &kwargs kwargs] | ||
(do | ||
(setv (. kwargs ["collection"]) collection) | ||
(setv (. kwargs ["result"]) result) | ||
(setv kwargs (convert_keyword kwargs)) | ||
; (pprint.pprint kwargs))) | ||
(apply (. chef add_procedure) [] kwargs))) | ||
|
||
(defn get_name [k] | ||
;;; convert keyword to string. because the default `name` function will | ||
;;; replace underscroce, we create a new function here. | ||
(.replace (name k) "-" "_")) | ||
|
||
(defn convert_keyword [d] | ||
(setv new_dict (dict)) | ||
(for [(, k v) (.items d)] | ||
(if (instance? dict v) | ||
(setv v_new (convert_keyword v)) | ||
(setv v_new v)) | ||
(if (keyword? k) | ||
(setv (. new_dict [(get_name k)]) v_new) | ||
(setv (. new_dict [k]) v_new))) | ||
new_dict) | ||
|
||
(defn ingredient [chef &kwargs kwargs] | ||
(apply (. chef add_ingredient) [] kwargs)) | ||
|
||
(defn serve [chef &kwargs kwargs] | ||
(setv (. kwargs ["collection"]) "") | ||
(setv (. kwargs ["procedure"]) "serve") | ||
(apply (. chef add_procedure) [] kwargs)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
(defmacro init [] | ||
`(do | ||
(import [ddf_utils.chef.api [Chef]]) | ||
(import [ddf_utils.chef.hy_mod.funcs :as _f]) | ||
(setv *chef* (Chef)))) | ||
|
||
(defmacro info [&rest code] | ||
`(_f.info *chef* ~@code)) | ||
|
||
(defmacro config [&rest code] | ||
`(_f.config *chef* ~@code)) | ||
|
||
(defmacro ingredient [&rest code] | ||
`(_f.ingredient *chef* ~@code)) | ||
|
||
(defmacro procedure [&rest code] | ||
`(_f.procedure *chef* ~@code)) | ||
|
||
(defmacro serve [&rest code] | ||
`(_f.serve *chef* ~@code)) | ||
|
||
(defmacro run [&rest code] | ||
`(setv res (*chef*.run ~@code))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.