Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add print.hs

  • Loading branch information...
commit e55698810b0f98594b7bc8f970a03f3ad43a1da6 1 parent 836708a
@wavewave authored
Showing with 56 additions and 0 deletions.
  1. +56 −0 test/print.hs
View
56 test/print.hs
@@ -0,0 +1,56 @@
+module Main where
+
+import Application.DevAdmin.Config
+import Application.DevAdmin.Refactor.Job
+
+import Control.Monad
+import Data.Maybe
+
+import Distribution.PackageDescription
+import Distribution.PackageDescription.Parse
+import Distribution.Verbosity
+import Distribution.ModuleName hiding (main)
+
+import Application.DevAdmin.Refactor.ProgType
+import Application.DevAdmin.Cabal
+import Application.DevAdmin.Refactor.Parse.Import
+
+import Text.Parsec
+import System.FilePath
+import System.Directory
+import System.Process
+
+import qualified System.IO.Strict as Strict
+import Data.List
+
+makeMangledFileName :: FilePath -> String
+makeMangledFileName fp = intercalate "." (splitDirectories fp)
+
+main :: IO ()
+main = do
+ cdir <- getCurrentDirectory
+ let pkgpath = "/Users/iankim/mac/prog/hxournal"
+ pkgname = "hxournal"
+ putStrLn "print"
+ gdesc <- readPackageDescription normal (pkgpath </> pkgname <.> "cabal")
+ let Just (CondNode lib y z) = condLibrary gdesc
+ lbi = libBuildInfo lib
+ srcdir = head (hsSourceDirs lbi)
+ -- putStrLn $ show lbi
+ setCurrentDirectory (pkgpath)
+ putStrLn $ srcdir
+
+ filenames <- mapM (getFileName srcdir) (exposedModules lib)
+ setCurrentDirectory (cdir </> "working")
+
+ forM_ filenames $ \n -> do
+ let srcpath = pkgpath</>srcdir</>n
+ nfilename = makeMangledFileName n
+ command1 = "a2ps --pro=color -M letterdj " ++ srcpath ++ " -o " ++ nfilename <.> "ps"
+ command2 = "ps2pdf " ++ (nfilename <.> "ps")
+ system command1
+ system command2
+
+
+ -- srcpath
+
Please sign in to comment.
Something went wrong with that request. Please try again.