...
 
Commits (2)
......@@ -8,7 +8,7 @@ CABAL := cabal
# Target directory where the compiled cgi programs, style sheets, etc
# should be stored, e.g.: $(HOME)/public_html
#WEBSERVERDIR = ../deploy
WEBSERVERDIR = ../deploy
WEBSERVERDIR = /srv/http
# Definition of the Curry installation bin directory to be used:
#export CURRYBIN=/opt/pakcs/bin/
......@@ -24,11 +24,11 @@ SOURCE_FILES := $(shell find $(SRCDIR) -type f -name "*.curry")
# The load path for the Spicey application:
export CURRYPATH := $(SRCDIR):$(SRCDIR)/Model
# Executable of CPNSD:
CPNSD := $(shell which curry-cpnsd)
# Executable of the CGI registry and submission form:
CURRYCGI := $(shell which curry-cgi)
# Executable of the makecgi:
# Executable of CPNSD:
CPNSD := $(shell which curry-cpnsd)
# Executable of the CGI registry and submission form:
CURRYCGI := $(shell which curry-cgi)
# Executable of the makecgi:
MAKECGI := $(shell which curry-makecgi)
############################################################################
......@@ -45,18 +45,18 @@ install: .cpm
$(CPM) update
$(CPM) install
# check presence of tools required for deployment and install them:
.PHONY: checkdeploy
checkdeploy:
@if [ ! -x "$(CPNSD)" ] ; then \
echo "Installing required executable 'curry-cpnsd'..." ; \
$(CPM) install cpns ; fi
@if [ ! -x "$(CURRYCGI)" ] ; then \
echo "Installing required executable 'curry-cgi'..." ; \
$(CPM) install html-cgi ; fi
@if [ ! -x "$(MAKECGI)" ] ; then \
echo "Installing required executable 'curry-makecgi'..." ; \
$(CPM) install html ; fi
# check presence of tools required for deployment and install them:
.PHONY: checkdeploy
checkdeploy:
@if [ ! -x "$(CPNSD)" ] ; then \
echo "Installing required executable 'curry-cpnsd'..." ; \
$(CPM) install cpns ; fi
@if [ ! -x "$(CURRYCGI)" ] ; then \
echo "Installing required executable 'curry-cgi'..." ; \
$(CPM) install html-cgi ; fi
@if [ ! -x "$(MAKECGI)" ] ; then \
echo "Installing required executable 'curry-makecgi'..." ; \
$(CPM) install html ; fi
# Compile the generated Spicey application:
.PHONY: compile
......@@ -92,7 +92,7 @@ $(WEBSERVERDIR)/spicey.cgi: $(SRCDIR)/FileUpload/Main.hs
.PHONY: deploy
deploy: checkdeploy $(WEBSERVERDIR)/run.cgi $(WEBSERVERDIR)/spicey.cgi public/*
cp -r public/* $(WEBSERVERDIR)
chmod -R go+rX $(WEBSERVERDIR)
# chmod -R go+rX $(WEBSERVERDIR)
# clean up generated the package directory
.PHONY: clean
......
......@@ -43,6 +43,7 @@ getRoutes =
,("Email Confirmation",Exact "Confirm",UserController, const False)
,("Password Reset",Exact "Passreset",UserController, const False)
,("Packages",Prefix "Package" "list",PackageController, const True)
,("Update Package Index", Prefix "Package" "updateIndex", PackageController, const True)
,("Categories",Prefix "Category" "list",CategoryController, const True)
,("New Category",Prefix "Category" "new",CategoryController, isAdmin)
,("CurryModules",Prefix "CurryModule" "list",CurryModuleController, const True)
......
......@@ -10,6 +10,7 @@ import Controller.Shared
import System.SessionInfo
import System.Authorization
import System.AuthorizedActions
import System.PackageUpload
import Config.UserProcesses
import View.MasalaEntitiesToHtml
import Database.CDBI.Connection
......@@ -39,6 +40,7 @@ mainPackageController =
do args <- getControllerParams
case args of
[] -> listPackageController
["updateIndex"] -> updateIndexPackageController
["list"] -> listPackageController
["show",s] ->
applyControllerOn (readPackageKey s) (runJustT . getPackage)
......@@ -109,12 +111,16 @@ listPackageControllerAdmin =
do packages <- runQ queryAllPackages
return (listPackageViewAdmin sinfo packages))
listPackageController :: Controller
listPackageController = do
packages <- runQ queryAllPackages
return (listPackageView packages)
updateIndexPackageController :: Controller
updateIndexPackageController = do
updatePackageIndex
return [htxt "Index updated"]
--- Shows a Package entity.
showPackageController :: Package -> Controller
showPackageController package =
......
module System.PackageUpload ( handleUploadNewPackageTarGz, handleUploadNewPackage, importMultiplePackages ) where
module System.PackageUpload ( handleUploadNewPackageTarGz, handleUploadNewPackage, importMultiplePackages, updatePackageIndex ) where
import System.Spicey
import HTML.Base
......@@ -19,7 +19,6 @@ import Config.Config
import IO
import List
import IOExts
import Controller.DefaultController
import Directory
import qualified CPM.Package as CPM
import FilePath --(</>)
......@@ -296,13 +295,13 @@ createTaskAsJSON n v ccs testsuite docu = JObject $ [("name", JString n)] ++
updatePackageIndex :: IO ()
updatePackageIndex = do
paths <- getPackageIndex False
evalCmd "tar" (["-C", "packages", "czf", "packages.tar.gz"] ++ paths) ""
evalCmd "tar" (["-C", "packages", "-czf", "packages.tar.gz"] ++ paths) ""
done
updateStagingPackageIndex :: IO ()
updateStagingPackageIndex = do
paths <- getPackageIndex True
evalCmd "tar" (["-C", "packages", "czf", "packages-staging.tar.gz"] ++ paths) ""
evalCmd "tar" (["-C", "packages", "-czf", "packages-staging.tar.gz"] ++ paths) ""
done
getPackageIndex :: Bool -> IO [String]
......