packages feed

nemesis-titan 2013.6.14 → 2013.6.22

raw patch · 4 files changed

+81/−10 lines, 4 filesdep ~airPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: air

API changes (from Hackage documentation)

+ System.Nemesis.Titan: angel_live_template :: StringTemplate String
+ System.Nemesis.Titan: guard_arg_string :: Config -> String
+ System.Nemesis.Titan: guard_default_arg_string :: Config -> String
- System.Nemesis.Titan: Config :: String -> String -> String -> String -> String -> String -> String -> String -> Config
+ System.Nemesis.Titan: Config :: String -> String -> String -> String -> String -> String -> String -> String -> String -> String -> Config

Files

nemesis-titan.cabal view
@@ -1,5 +1,5 @@ Name:                 nemesis-titan-Version:              2013.6.14+Version:              2013.6.22 Build-type:           Simple Synopsis:             A collection of Nemesis tasks to bootstrap a Haskell project with a focus on continuous integration Description:          @@ -12,11 +12,26 @@ Cabal-version:        >= 1.2 category:             Web homepage:             http://github.com/nfjinjing/nemesis-titan-data-files:           readme.md, changelog.md, known-issues.md, Nemesis, vendor/Nemesis, src/Main.hs+data-files:           readme.md+                    , changelog.md+                    , known-issues.md+                    , Nemesis+                    , src/Main.hs+                    , vendor/Nemesis+                    , vendor/post-receive  library   ghc-options: -Wall-  build-depends:      base >= 4 && < 100, nemesis, air >= 2011.6.19, uuid, random, directory, bytestring, filepath, HStringTemplate, hspec+  build-depends:      base >= 4 && < 100+                    , nemesis+                    , air+                    , uuid+                    , random+                    , directory+                    , bytestring+                    , filepath+                    , HStringTemplate+                    , hspec                          hs-source-dirs: src/   exposed-modules:  
readme.md view
@@ -24,6 +24,9 @@ ------------        cabal install nemesis-titan+    +    # install hspec if not present+    cabal install hspec  Usage -----
src/System/Nemesis/Titan.hs view
@@ -39,19 +39,43 @@     stderr = "/dev/stderr"     delay = 0 }- |] +-- Live mode without auto recompile, e.g. `runghc Nemesis compile-and-kill` is run inside git-post-receive-hook+angel_live_template :: StringTemplate String+angel_live_template = newSTMP - [here|+server {+    exec = "runghc Nemesis $label$/run"+    stdout = "/dev/stdout"+    stderr = "/dev/stderr"+    delay = 0+}+|]  guard_template :: StringTemplate String guard_template = newSTMP - [here| guard :shell do+  event_time = Time.now+  update_time = Time.now+  update_interval = 0.1+     watch(%r{^src/.+hs\$}) do |m|     puts "Changed #{m[0]}"-    `runghc Nemesis $label$/compile && runghc Nemesis $label$/kill`+    event_time = Time.now   end-end +  # compile at most once for every \$update_interval seconds+  Thread.new do +    while true+      sleep update_interval+      if event_time > update_time +        update_time = Time.now+        system("runghc Nemesis $label$/compile-and-kill")+      end+    end+  end+  +end |]  @@ -96,6 +120,8 @@   , file_name :: String   , ghc_arg_string :: String   , ghc_default_arg_string :: String+  , guard_arg_string :: String+  , guard_default_arg_string :: String   }   deriving (Show, Eq) @@ -110,6 +136,7 @@     , config_directory = "config"     , haskell_source_directory = "src"     , ghc_default_arg_string = "-threaded"+    , guard_default_arg_string = "--no-bundler-warning --no-interactions"     }  titan_with_config :: Config -> Unit@@ -120,6 +147,7 @@       _label = config.label       config_label_directory = config.config_directory / _label       angel_path = config_label_directory / "Angel.conf"+      angel_live_path = config_label_directory / "AngelLive.conf"       guard_path = config_label_directory / "Guardfile"              pid_directory = config.bin_directory / _label@@ -134,6 +162,7 @@              let          angel_file_content = render - setAttribute "label" _label angel_template+        angel_live_file_content = render - setAttribute "label" _label angel_live_template         guard_file_content = render - setAttribute "label" _label guard_template         haskell_file_content = render - setAttribute "label" _label haskell_template       @@ -149,6 +178,7 @@       }              write_if_not_exist angel_path angel_file_content +      write_if_not_exist angel_live_path angel_live_file_content        write_if_not_exist guard_path guard_file_content        write_if_not_exist haskell_source_path haskell_file_content     @@ -162,7 +192,6 @@       if pid_exist         then do           uuid <- B.readFile pid_path ^ B.unpack-          puts - "UPID: " + uuid           return uuid               else do           uuid <- randomIO ^ UUID.toString@@ -179,7 +208,10 @@     desc "Start the Titan managed process"     task "titan:uuid compile" - do       sh - "angel " + angel_path-+    +    desc "Start the Titan managed process for deployment (no auto recompile)"+    task "titan-live:uuid compile" - do+      sh - "angel " + angel_live_path        desc "Create a uuid for this process if not already exist"     task "uuid" - do@@ -208,11 +240,17 @@     desc "Kill the process"     task "kill" - do       upid <- get_and_create_if_missing_upid-      sh - "killall " + upid + "; true"+      sh - "killall -SIGTERM " + upid + "; true"   +    desc "Compile and Kill"+    task "compile-and-kill: compile kill" - return ()+         desc "Start the Guard process"     task "guard" - do-      sh - "guard --no-bundler-warning -i -G " + guard_path+      sh - printf "guard %s %s -G %s" +        (config.guard_default_arg_string)+        (config.guard_arg_string)+        guard_path     
+ vendor/post-receive view
@@ -0,0 +1,15 @@+#!/bin/sh+++export GIT_DIR=`pwd`+export GIT_WORK_TREE=$GIT_DIR/..++cd ..++# cd $PROJECT_PATH+# runghc Nemesis clean++git merge master++# comment this if not using titan-live+runghc Nemesis Main/compile-and-kill