diff --git a/MANIFEST b/MANIFEST index e23edfd..defa1c9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3,10 +3,11 @@ Changes MANIFEST Makefile.PL -README +README.textile lib/Csistck.pm lib/Csistck/Config.pm lib/Csistck/Oper.pm +lib/Csistck/Role.pm lib/Csistck/Term.pm lib/Csistck/Test.pm lib/Csistck/Test/File.pm @@ -22,5 +23,7 @@ t/01friday.t t/02hosts.t t/02options.t t/02roles.t +t/20detect.t +t/20role.t t/50bug11.t t/50bug14.t diff --git a/README.textile b/README.textile index 1770032..ef1dc8b 100644 --- a/README.textile +++ b/README.textile @@ -26,6 +26,33 @@ h1. DESCRIPTION Csistck is a small Perl framework for writing scripts to maintain system configuration and consistency. The focus of csistck is to stay lightweight, simple, and flexible. +h1. EXTENDING ROLES + +Roles can be defined using the @role@ keyword syntax, however a more flexible method is to extend a new object from Csistck::Role: + +
+    use Csistck;
+    use base 'Csistck::Role';
+
+    sub defaults {
+        my $self = shift;
+        $self->{config} = '/etc/example.conf';
+    }
+
+    sub tests {
+        my $self = shift;
+        $self->add(pkg({
+            dpkg => 'test-server',
+            pkg_info => 'net-test'
+        }),
+        template('files/example.conf', $self->{config}, { example => $self });
+    }
+
+    1;
+
+ +See Csistck::Role for information on extending roles + h1. METHODS h2. option($name, $value) @@ -97,9 +124,9 @@ Change permissions on files matching file glob pattern
     role 'test' => permission("/etc/couchdb/*", {
-      mode => '0640',
-      uid => 130,
-      gid => 130
+        mode => '0640',
+        uid => 130,
+        gid => 130
     });
 
@@ -117,14 +144,19 @@ See Csistck::Test::Script h2. pkg($package, [$type]) -Check for package using system package manager. +Check for package using system package manager. The @package@ argument may be specified as a string, or as a hashref to specify package names for multiple package managers. The package manager will be automatically detected if no package manager is specified.
     option 'pkg_type' => 'dpkg';
-    role 'test' => pkg("lighttpd");
+    role 'test' => 
+        pkg("lighttpd", 'dpkg'),
+        pkg({
+            dpkg => 'snmp-server',
+            pkg_info => 'net-snmp'
+        });
 
-See Csistck::Test::Pkg +See Csistck::Test::Pkg for more information h1. SCRIPT USAGE @@ -145,7 +177,7 @@ Toggle event reporting of errors h1. AUTHOR -Anthony Johnson, +Anthony Johnson, @@ h1. COPYRIGHT AND LICENSE