Permalink
Browse files

split out resources into files

  • Loading branch information...
1 parent 1ed37f4 commit 64663d4564117928e546e730abebc58f28098c91 @defn defn committed Oct 10, 2012
Showing with 39 additions and 35 deletions.
  1. +1 −0 .poop/bin
  2. +2 −35 bin/_poop
  3. +36 −0 lib/_directory
View
View
@@ -4,41 +4,6 @@ function do_ {
true
}
-function directory {
- _poop_name="$1"; shift
- _poop_resource="directory"
-}
-
-function do_directory {
- : ${_poop_action:=create}
- : ${_poop_path:=${_poop_name}}
- : ${_poop_recursive:=false}
-
- eval "do_${_poop_resource}_${_poop_action}"
-}
-
-function do_directory_create {
- # since install -d recursively creates directories, check for intermediate
- # directories manually when recursion is not desired
- if [[ "$_poop_recursive" = false ]]; then
- local dname="$(dirname "${_poop_path}")"
- if [[ ! -d "$dname" ]]; then
- logger_fatal "while creating ${_poop_path}, $dname is not a directory"
- exit 1
- fi
- fi
-
- install -v -d $(install_options)"${_poop_path}"
-}
-
-function do_directory_delete {
- if [[ "$_poop_recursive" = false ]]; then
- rm -vd "${_poop_path}"
- else
- rm -vrf "${_poop_path}"
- fi
-}
-
function end_ {
true
}
@@ -99,3 +64,5 @@ attr_accessor group
attr_accessor path
end
+
+require 'poop/directory'
View
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+function directory {
+ _poop_name="$1"; shift
+ _poop_resource="directory"
+}
+
+function do_directory {
+ : ${_poop_action:=create}
+ : ${_poop_path:=${_poop_name}}
+ : ${_poop_recursive:=false}
+
+ eval "do_${_poop_resource}_${_poop_action}"
+}
+
+function do_directory_create {
+ # since install -d recursively creates directories, check for intermediate
+ # directories manually when recursion is not desired
+ if [[ "$_poop_recursive" = false ]]; then
+ local dname="$(dirname "${_poop_path}")"
+ if [[ ! -d "$dname" ]]; then
+ logger_fatal "while creating ${_poop_path}, $dname is not a directory"
+ exit 1
+ fi
+ fi
+
+ install -v -d $(install_options)"${_poop_path}"
+}
+
+function do_directory_delete {
+ if [[ "$_poop_recursive" = false ]]; then
+ rm -vd "${_poop_path}"
+ else
+ rm -vrf "${_poop_path}"
+ fi
+}

0 comments on commit 64663d4

Please sign in to comment.