aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2010-01-05 13:20:49 +0100
committerLaurent Bachelier <laurent@bachelier.name>2010-01-05 13:20:49 +0100
commit622ab669ee96ff364896b98f854667ce44b4e567 (patch)
tree38ec56433b973f0c1855b3d306f2d5eec61279be
parentignore() function for ProgrammableConfigAction (diff)
downloadconfman-622ab669ee96ff364896b98f854667ce44b4e567.tar.xz
Added sample files
-rwxr-xr-xexample.py7
-rw-r--r--samples/_conf2_desktop1
-rw-r--r--samples/_conf3_test21
-rw-r--r--samples/conf2.p.py5
-rw-r--r--samples/conf3.p.py4
-rw-r--r--samples/simplefile1
6 files changed, 17 insertions, 2 deletions
diff --git a/example.py b/example.py
index 913c5ec..ccfc810 100755
--- a/example.py
+++ b/example.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-
from confman import ConfigSource
options = \
@@ -8,7 +7,11 @@ options = \
'hostname': 'test',
}
-c = ConfigSource("~/dotfiles", "/tmp/dotfiles-test", None, options)
+from sys import argv
+from os import path
+samples_path = path.join(path.dirname(argv[0]), 'samples')
+
+c = ConfigSource(samples_path, "/tmp/dotfiles-test", None, options)
c.analyze()
c.check()
c.sync()
diff --git a/samples/_conf2_desktop b/samples/_conf2_desktop
new file mode 100644
index 0000000..3664276
--- /dev/null
+++ b/samples/_conf2_desktop
@@ -0,0 +1 @@
+This file will be ignored. It could be used by a programmable config file.
diff --git a/samples/_conf3_test2 b/samples/_conf3_test2
new file mode 100644
index 0000000..10ddd6d
--- /dev/null
+++ b/samples/_conf3_test2
@@ -0,0 +1 @@
+Hello!
diff --git a/samples/conf2.p.py b/samples/conf2.p.py
new file mode 100644
index 0000000..f9ee54b
--- /dev/null
+++ b/samples/conf2.p.py
@@ -0,0 +1,5 @@
+# Only link the file if we want "desktop" files
+if "desktop" in options["tags"]:
+ redirect("conf2_desktop")
+else:
+ ignore()
diff --git a/samples/conf3.p.py b/samples/conf3.p.py
new file mode 100644
index 0000000..6e98ce8
--- /dev/null
+++ b/samples/conf3.p.py
@@ -0,0 +1,4 @@
+if "test2" == options["hostname"]:
+ redirect("conf3_test2")
+else:
+ ignore()
diff --git a/samples/simplefile b/samples/simplefile
new file mode 100644
index 0000000..f2c6369
--- /dev/null
+++ b/samples/simplefile
@@ -0,0 +1 @@
+Simple file, will have a symbolic link created