From: Andreas Gerler Date: Tue, 13 Nov 2018 14:06:06 +0000 (+0100) Subject: update ob-cfengine3. X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=874382bf0b61132b6e94aef90a50f803099e11d6;p=emacsconfig.git update ob-cfengine3. Signed-off-by: Andreas Gerler --- diff --git a/elpa/ob-cfengine3-20170915.634/ob-cfengine3-autoloads.el b/elpa/ob-cfengine3-20170915.634/ob-cfengine3-autoloads.el deleted file mode 100644 index 65aec3c2..00000000 --- a/elpa/ob-cfengine3-20170915.634/ob-cfengine3-autoloads.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; ob-cfengine3-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) - -;;;### (autoloads nil nil ("ob-cfengine3.el") (23082 53516 115159 -;;;;;; 478000)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; ob-cfengine3-autoloads.el ends here diff --git a/elpa/ob-cfengine3-20170915.634/ob-cfengine3-pkg.el b/elpa/ob-cfengine3-20170915.634/ob-cfengine3-pkg.el deleted file mode 100644 index c0396496..00000000 --- a/elpa/ob-cfengine3-20170915.634/ob-cfengine3-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "ob-cfengine3" "20170915.634" "Org Babel functions for CFEngine 3" 'nil :commit "f38f87256efcb2b02f5c7042900087be941c1ddc" :url "https://github.com/nickanderson/ob-cfengine3" :keywords '("tools" "convenience")) diff --git a/elpa/ob-cfengine3-20170915.634/ob-cfengine3.el b/elpa/ob-cfengine3-20170915.634/ob-cfengine3.el deleted file mode 100644 index e2939a09..00000000 --- a/elpa/ob-cfengine3-20170915.634/ob-cfengine3.el +++ /dev/null @@ -1,90 +0,0 @@ -;;; ob-cfengine3.el --- Org Babel functions for CFEngine 3 - -;; Copyright (C) 2017 Nick Anderson - -;; Permission is hereby granted, free of charge, to any person obtaining a copy -;; of this software and associated documentation files (the "Software"), to deal -;; in the Software without restriction, including without limitation the rights -;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -;; copies of the Software, and to permit persons to whom the Software is -;; furnished to do so, subject to the following conditions: -;; The above copyright notice and this permission notice shall be included in -;; all copies or substantial portions of the Software. - -;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -;; THE SOFTWARE. - -;; Author: Nick Anderson -;; Keywords: tools, convenience -;; Package-Version: 20170915.634 -;; URL: https://github.com/nickanderson/ob-cfengine3 -;; Version: 0.0.1 - - -;;; Commentary: -;; Execute CFEngine 3 policy inside org-mode src blocks. - -;;; Code: - -(defvar ob-cfengine3-command "cf-agent" - "Name of command to use for executing cfengine policy.") - -(defvar ob-cfengine3-command-options "" - "Option string that should be passed to the agent. -Note that --file will be appended to the options.") - -(defvar ob-cfengine3-file-control-stdlib "body file control{ inputs => { '$(sys.libdir)/stdlib.cf' };}\n" - "File control body to include the standard libriary from $(sys.libdir). -It is useful to inject into an example source block before execution.") - -(defconst ob-cfengine3-header-args-cfengine3 - '( - (no-lock . :any) - (include-stdlib . :any) - (define . :any) - (bundlesequence . :any)) - "CFEngine specific header arguments.") - -(defun org-babel-execute:cfengine3 (body params) - "Actuate a block of CFEngine 3 policy. -This function is called by `org-babel-execute-src-block'. - - A temporary file is constructed containing - `ob-cfengine3-file-control-stdlib and the BODY of the src - block. `ob-cfengine3-command' is used to execute the - temporary file." - - (let* ((temporary-file-directory ".") - (use-locks (cdr (assoc :use-locks params))) - (include-stdlib (not (string= "no" (cdr (assoc :include-stdlib params))))) - (define (cdr (assoc :define params))) - (bundlesequence (cdr (assoc :bundlesequence params))) - (tempfile (make-temp-file "cfengine3-"))) - (with-temp-file tempfile - (when include-stdlib (insert ob-cfengine3-file-control-stdlib)) - (insert body)) - (unwind-protect - (shell-command-to-string - (concat - ob-cfengine3-command - " " - (when bundlesequence (concat "--bundlesequence " bundlesequence )) - " " - (when define (concat "--define " define )) - " " - (unless use-locks "--no-lock") - ob-cfengine3-command-options - " " - (format " --file %s" (shell-quote-argument tempfile)))) - (delete-file tempfile)))) - -(add-to-list 'org-src-lang-modes '("cfengine3" . cfengine3)) -(add-to-list 'org-babel-tangle-lang-exts '("cfengine3" . "cf")) - -(provide 'ob-cfengine3) -;;; ob-cfengine3.el ends here diff --git a/elpa/ob-cfengine3-20180102.1812/ob-cfengine3-autoloads.el b/elpa/ob-cfengine3-20180102.1812/ob-cfengine3-autoloads.el new file mode 100644 index 00000000..babc2b37 --- /dev/null +++ b/elpa/ob-cfengine3-20180102.1812/ob-cfengine3-autoloads.el @@ -0,0 +1,22 @@ +;;; ob-cfengine3-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "ob-cfengine3" "ob-cfengine3.el" (0 0 0 0)) +;;; Generated autoloads from ob-cfengine3.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-cfengine3" '("ob-cfengine3-" "org-babel-execute:cfengine3"))) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; ob-cfengine3-autoloads.el ends here diff --git a/elpa/ob-cfengine3-20180102.1812/ob-cfengine3-pkg.el b/elpa/ob-cfengine3-20180102.1812/ob-cfengine3-pkg.el new file mode 100644 index 00000000..90efdc18 --- /dev/null +++ b/elpa/ob-cfengine3-20180102.1812/ob-cfengine3-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "ob-cfengine3" "20180102.1812" "Org Babel functions for CFEngine 3" 'nil :commit "93ebcfceec3734f4bd187ae123686187d66fd401" :keywords '("tools" "convenience") :authors '(("Nick Anderson" . "nick@cmdln.org")) :maintainer '("Nick Anderson" . "nick@cmdln.org") :url "https://github.com/nickanderson/ob-cfengine3") diff --git a/elpa/ob-cfengine3-20180102.1812/ob-cfengine3.el b/elpa/ob-cfengine3-20180102.1812/ob-cfengine3.el new file mode 100644 index 00000000..34c60afb --- /dev/null +++ b/elpa/ob-cfengine3-20180102.1812/ob-cfengine3.el @@ -0,0 +1,105 @@ +;;; ob-cfengine3.el --- Org Babel functions for CFEngine 3 + +;; Copyright (C) 2017 Nick Anderson + +;; Permission is hereby granted, free of charge, to any person obtaining a copy +;; of this software and associated documentation files (the "Software"), to deal +;; in the Software without restriction, including without limitation the rights +;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +;; copies of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +;; THE SOFTWARE. + +;; Author: Nick Anderson +;; Keywords: tools, convenience +;; Package-Version: 20180102.1812 +;; URL: https://github.com/nickanderson/ob-cfengine3 +;; Version: 0.0.2 + +;;; Commentary: +;; Execute CFEngine 3 policy inside org-mode src blocks. + +;;; Code: + +(defvar ob-cfengine3-command "cf-agent" + "Name of command to use for executing cfengine policy.") + +(defvar ob-cfengine3-command-options "" + "Option string that should be passed to the agent. +Note that --file will be appended to the options.") + +(defvar ob-cfengine3-file-control-stdlib "body file control{ inputs => { '$(sys.libdir)/stdlib.cf' };}\n" + "File control body to include the standard libriary from $(sys.libdir). +It is useful to inject into an example source block before execution.") + +(defconst ob-cfengine3-header-args-cfengine3 + '( + (no-lock . :any) + (debug . :any) + (verbose . :any) + (info . :any) + (include-stdlib . :any) + (define . :any) + (bundlesequence . :any)) + "CFEngine specific header arguments.") + +(defun org-babel-execute:cfengine3 (body params) + "Actuate a block of CFEngine 3 policy. +This function is called by `org-babel-execute-src-block'. + + A temporary file is constructed containing + `ob-cfengine3-file-control-stdlib and the BODY of the src + block. `ob-cfengine3-command' is used to execute the + temporary file." + + (let* ((temporary-file-directory ".") + (debug (cdr (assoc :debug params))) + (verbose (cdr (assoc :verbose params))) + (info (cdr (assoc :info params))) + (use-locks (cdr (assoc :use-locks params))) + (include-stdlib (not (string= "no" (cdr (assoc :include-stdlib params))))) + (define (cdr (assoc :define params))) + (bundlesequence (cdr (assoc :bundlesequence params))) + (tempfile (make-temp-file "cfengine3-"))) + (with-temp-file tempfile + (when include-stdlib (insert ob-cfengine3-file-control-stdlib)) + (insert body)) + (unwind-protect + (shell-command-to-string + (concat + ob-cfengine3-command + " " + (when bundlesequence (concat "--bundlesequence " bundlesequence )) + " " + (when define (concat "--define " define )) + " " + (unless use-locks "--no-lock ") + + ;; When info header arg is yes add --info to the command string and throw away the args + (when info (concat "--info ")) + " " + ;; When verbose header arg is yes add --verbose to the command string and throw away the args + (when verbose (concat "--verbose ")) + " " + ;; When debug header arg is yes add --debug with all log modules enabled to the command string and throw away the args + (when debug (concat "--debug --log-modules=all ")) + " " + ob-cfengine3-command-options + " " + (format " --file %s" (shell-quote-argument tempfile)))) + (delete-file tempfile)))) + +(add-to-list 'org-src-lang-modes '("cfengine3" . cfengine3)) +(add-to-list 'org-babel-tangle-lang-exts '("cfengine3" . "cf")) + +(provide 'ob-cfengine3) +;;; ob-cfengine3.el ends here