Browse files

implemented clean action

  • Loading branch information...
1 parent 5f6b9dc commit 15822c6290c234fd6ece3b5a92a8612517cad794 @bkidwell committed Dec 4, 2011
Showing with 11 additions and 4 deletions.
  1. +0 −1 TODO.md
  2. +11 −2 mdepub/actions/clean.py
  3. +0 −1 mdepub/actions/epub.py
View
1 TODO.md
@@ -1,6 +1,5 @@
# Todo
-* add checks for error conditions (missing source file, etc.)
* add action to insert/update epub file in Calibre
* add action to extract epub file from Calibre
* finalize template css file
View
13 mdepub/actions/clean.py
@@ -1,8 +1,17 @@
import logging
-
-# TODO: implement 'clean' action
+import os.path
+import mdepub
+from mdepub import project_path
+from mdepub.filename import getFN
log = logging.getLogger('clean')
def run():
log.debug("run()")
+ mdepub.require_opts_file()
+ os.chdir(project_path)
+
+ for ext in ['epub', 'html', 'zip']:
+ f = getFN(ext)
+ if os.path.exists(f):
+ os.remove(f)
View
1 mdepub/actions/epub.py
@@ -19,7 +19,6 @@ def quote(text):
def run():
log.debug("run()")
mdepub.require_opts_file()
-
os.chdir(project_path)
# Get source and dest file times

0 comments on commit 15822c6

Please sign in to comment.