Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:init does not work with (prodigy-callback ...) #70

Open
thomasf opened this issue May 3, 2015 · 3 comments
Open

:init does not work with (prodigy-callback ...) #70

thomasf opened this issue May 3, 2015 · 3 comments

Comments

@thomasf
Copy link

thomasf commented May 3, 2015

Is it intended or just overlooked?

My use case right now is adding a build step to build a binary before launching it.

@rejeep
Copy link
Owner

rejeep commented May 3, 2015

Is the build step sync or async?

@thomasf
Copy link
Author

thomasf commented May 3, 2015

The following modification enables it but I'm not comfortable enough with the code to create a pull request and there are still bugs in my related code..

      (-when-let (init (prodigy-service-init service))
        (prodigy-callback-with-plist init service)
        ;; (funcall init service)
        )

@thomasf
Copy link
Author

thomasf commented May 3, 2015

Given the minor patch above the following seems to work alright now.

(eval-after-load "prodigy"
  '(progn
     (prodigy-define-tag
       :name 'bin
       :hide t
       :path (lambda ()
               (file-truename default-directory)))

     (defun prodigy-go-build (service)
       (prodigy-insert-output
        service
        "- - - - - - - - - - - - - - - - - - - - - -\n")
       (let ((cmd (plist-get service :command)))
         (when (file-exists-p cmd)
           (delete-file cmd))
         (with-temp-buffer
           (let ((success (eq 0 (call-process "go" nil t nil "build"
                                              "-o"  cmd (plist-get service :go-main)))))
             (prodigy-insert-output service (buffer-string))
             (unless success
               (error "prodigy-go-build-failed"))))))

     (prodigy-define-tag
       :name 'go-build
       :hide t
       :init  (prodigy-callback (service) (prodigy-go-build service))
       :tags '(bin))

     (prodigy-define-service
       :name "project01 central"
       :cwd "/home/a00001/repos/go/src/gitlab.aOrganisation.se/project01/project01"
       :command "project01-central"
       :args '("-logtostderr" "-v=10")
       :go-main "cmd/project01-central/project01-central.go"
       :kill-signal 'sigkill
       :tags '(project01 go-build))

     (prodigy-define-service
       :name "project01 client"
       :cwd "/home/a00001/repos/go/src/gitlab.aOrganisation.se/project01/project01"
       :init  (prodigy-callback (service) (prodigy-go-build service))
       :command "project01-client"
       :go-main "cmd/project01-client/project01-client.go"
       :kill-signal 'sigkill
       :tags '(go-build project01))

     (prodigy-define-service
       :name "project01 hot"
       :cwd "/home/aUser/repos/go/src/gitlab.aOrganisation.se/project01/project01"
       :go-main "make.go"
       :command "make"
       :args '("hot")
       :kill-signal 'sigkill
       :tags '(project01 go-build))))

thomasf added a commit to thomasf/prodigy.el that referenced this issue May 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants