Search code examples
ruby-on-railsrubynode.jsredmineredmine-plugins

Run a nodeJS code in a Redmine plugin


How can I run a nodeJS code in a Redmine plugin ? With a nodeJS server or from the controller or anything else ... ?

My plugin is an HTML button in a Hook, calling an onClick javascript function. When I push this button, I want to run the nodeJs code. How can I do ?

I use Redmine 1.4.4

EDIT: maybe this can help me ? https://github.com/cowboyd/rednode


Solution

  • I found a solution here: http://www.redmine.org/boards/2/topics/41820?r=41882

    From what I know, 3 scenarios:
    
        You want to use a publicly exposed NodeJS service. 
        In that case just make an ajax call to your service (jQuery).
    
        You want to use a non-public NodeJS service Run your NodeJS 
        service on localhost (listening to 127.0.0.1) and call it from the controller 
        of your plugin.
    
        You want to use a task (executable). 
        Run a system("/my/path/executable #{param}") command from the controller 
        of your plugin.
    
    I don't like solution number 3 because there is more possibilities of something 
    going wrong.