javascript et sprocketize

トップ ページ

このメッセージに返信
著者: Frédéric
日付:  
To: Guilde
題目: javascript et sprocketize
Hello,

Toujours pour mon appli de vote, dans la partie javascript, basée sur
prototype, j'utilisais le makefile joint.

Le truc, c'est que je ne trouve plus l'utilitaire sprocketize. Il y en a
bien un sur github, mais il est noté qu'il est obsolète, et qu'il faut
utiliser celui fourni avec sprockets. Mais l'utilitaire sprockets sur
paquet gem-sprockets ne marche pas :

Only one file can be compiled to stdout at a time

Que faut-il utiliser, maintenant, du coup ? Ou comment modifier mon
makefile pour que ça marche ?

Merci d'avance.

-- 
    Frédéric

#!/bin/sh

INCLUDES=  \
    -I js/lib \
    -I js/lib/prototype \
    -I js/lib/scriptaculous \
    -I js/lib/prototip


COMMON_DIR=js/common
MODEL_DIR=js/model
VIEW_DIR=js/view
CONTROLLER_DIR=js/controller
BUILD_DIR=js/build

UPLOAD_SCRIPT=$(BUILD_DIR)/upload.js
VOTE_SCRIPT=$(BUILD_DIR)/vote.js
RESULTS_SCRIPT=$(BUILD_DIR)/results.js
ADMIN_SCRIPT=$(BUILD_DIR)/admin.js
ALL_SCRIPTS=$(UPLOAD_SCRIPT) $(VOTE_SCRIPT) $(RESULTS_SCRIPT) $(ADMIN_SCRIPT)

SCRIPTS= \
    $(COMMON_DIR)/constants.js \
    $(COMMON_DIR)/helpers.js \
    $(UPLOAD_SCRIPT) \
    $(VOTE_SCRIPT) \
    $(RESULTS_SCRIPT) \
    $(ADMIN_SCRIPT)


# Upload interface
UPLOAD_MODEL_DEPEND= \
    $(MODEL_DIR)/uploadModel.js \
    $(MODEL_DIR)/abstractModel.js


UPLOAD_VIEW_DEPEND= \
    $(VIEW_DIR)/uploadView.js \
    $(VIEW_DIR)/abstractView.js


UPLOAD_CONTROLLER_DEPEND= \
    $(CONTROLLER_DIR)/uploadController.js


UPLOAD_DEPEND= \
    $(COMMON_DIR)/constants.js \
    $(COMMON_DIR)/helpers.js \
    $(UPLOAD_MODEL_DEPEND) \
    $(UPLOAD_VIEW_DEPEND) \
    $(UPLOAD_CONTROLLER_DEPEND)


# Vote interface
VOTE_MODEL_DEPEND= \
    $(MODEL_DIR)/voteModel.js \
    $(MODEL_DIR)/baseModel.js \
    $(MODEL_DIR)/abstractModel.js \
    $(MODEL_DIR)/selectionModel.js \
    $(MODEL_DIR)/orderingModel.js


VOTE_VIEW_DEPEND= \
    $(VIEW_DIR)/voteView.js \
    $(VIEW_DIR)/abstractView.js \
        $(VIEW_DIR)/selectionView.js \
        $(VIEW_DIR)/orderingView.js \
    $(VIEW_DIR)/fullSelectionView.js \
    $(VIEW_DIR)/fullOrderingView.js \
    $(VIEW_DIR)/fullBaseView.js \
    $(VIEW_DIR)/thumbsSelectionView.js \
    $(VIEW_DIR)/thumbsOrderingView.js \
    $(VIEW_DIR)/thumbsBaseView.js \
    $(VIEW_DIR)/counterSelectionView.js \
    $(VIEW_DIR)/informationBaseView.js


VOTE_CONTROLLER_DEPEND= \
    $(CONTROLLER_DIR)/voteController.js \
    $(CONTROLLER_DIR)/abstractController.js \
        $(CONTROLLER_DIR)/selectionController.js \
        $(CONTROLLER_DIR)/orderingController.js \
    $(CONTROLLER_DIR)/fullSelectionController.js \
    $(CONTROLLER_DIR)/fullOrderingController.js \
    $(CONTROLLER_DIR)/fullBaseController.js \
    $(CONTROLLER_DIR)/thumbsSelectionController.js \
    $(CONTROLLER_DIR)/thumbsOrderingController.js \
    $(CONTROLLER_DIR)/thumbsBaseController.js \
    $(CONTROLLER_DIR)/counterSelectionController.js \
    $(CONTROLLER_DIR)/informationBaseController.js


VOTE_DEPEND= \
    $(COMMON_DIR)/constants.js \
    $(COMMON_DIR)/helpers.js \
    $(VOTE_MODEL_DEPEND) \
    $(VOTE_VIEW_DEPEND) \
    $(VOTE_CONTROLLER_DEPEND)


# Results interface
RESULTS_MODEL_DEPEND= \
    $(MODEL_DIR)/resultsModel.js \
    $(MODEL_DIR)/baseModel.js \
    $(MODEL_DIR)/abstractModel.js


RESULTS_VIEW_DEPEND= \
    $(VIEW_DIR)/resultsView.js \
    $(VIEW_DIR)/abstractView.js \
    $(VIEW_DIR)/fullResultsView.js \
    $(VIEW_DIR)/fullBaseView.js \
    $(VIEW_DIR)/thumbsResultsView.js \
    $(VIEW_DIR)/thumbsBaseView.js \
    $(VIEW_DIR)/listResultsView.js \
    $(VIEW_DIR)/listBaseView.js


RESULTS_CONTROLLER_DEPEND= \
    $(CONTROLLER_DIR)/resultsController.js \
    $(CONTROLLER_DIR)/abstractController.js \
    $(CONTROLLER_DIR)/fullResultsController.js \
    $(CONTROLLER_DIR)/fullBaseController.js \
    $(CONTROLLER_DIR)/thumbsResultsController.js \
    $(CONTROLLER_DIR)/thumbsBaseController.js \
    $(CONTROLLER_DIR)/listResultsController.js \
    $(CONTROLLER_DIR)/listBaseController.js


RESULTS_DEPEND= \
    $(COMMON_DIR)/constants.js \
    $(COMMON_DIR)/helpers.js \
    $(RESULTS_MODEL_DEPEND) \
    $(RESULTS_VIEW_DEPEND) \
    $(RESULTS_CONTROLLER_DEPEND)


# Admin interface
ADMIN_MODEL_DEPEND= \
    $(MODEL_DIR)/adminModel.js \
    $(MODEL_DIR)/baseModel.js \
    $(MODEL_DIR)/abstractModel.js


ADMIN_VIEW_DEPEND= \
    $(VIEW_DIR)/adminView.js \
    $(VIEW_DIR)/abstractView.js \
    $(VIEW_DIR)/fullAdminView.js \
    $(VIEW_DIR)/fullBaseView.js \
    $(VIEW_DIR)/thumbsAdminView.js \
    $(VIEW_DIR)/thumbsBaseView.js \
    $(VIEW_DIR)/listAdminView.js \
    $(VIEW_DIR)/listBaseView.js


ADMIN_CONTROLLER_DEPEND= \
    $(CONTROLLER_DIR)/adminController.js \
    $(CONTROLLER_DIR)/abstractController.js \
    $(CONTROLLER_DIR)/fullAdminController.js \
    $(CONTROLLER_DIR)/fullBaseController.js \
    $(CONTROLLER_DIR)/thumbsAdminController.js \
    $(CONTROLLER_DIR)/thumbsBaseController.js \
    $(CONTROLLER_DIR)/listAdminController.js \
    $(CONTROLLER_DIR)/listBaseController.js


ADMIN_DEPEND= \
    $(COMMON_DIR)/constants.js \
    $(COMMON_DIR)/helpers.js \
    $(ADMIN_MODEL_DEPEND) \
    $(ADMIN_VIEW_DEPEND) \
    $(ADMIN_CONTROLLER_DEPEND)



all: $(SCRIPTS)

$(UPLOAD_SCRIPT): $(UPLOAD_DEPEND)
    sprockets $(INCLUDES) $^ >$@


$(VOTE_SCRIPT): $(VOTE_DEPEND)
    sprockets $(INCLUDES) $^ >$@


$(RESULTS_SCRIPT): $(RESULTS_DEPEND)
    sprockets $(INCLUDES) $^ >$@


$(ADMIN_SCRIPT): $(ADMIN_DEPEND)
    sprockets $(INCLUDES) $^ >$@



clean:
    rm -f $(ALL_SCRIPTS)



.PHONY: clean