Redmine plugin activation - ruby-on-rails

I'm developing a Redmine plugin, and I want to add a custom field programmatically when I'm activating my plugin, but i don't find the plugin activation method in the core Redmine, which I want to wrap.
Can anyone help me?

Well, I am not really sure what you are looking for as a Redmine plugin is something that you don't really activate as Redmine user at runtime.
Your plugin is 'active' and will be loaded on Redmine start when it resides in the plugins folder.
The first executed code is in the init.rb of your plugin.
Also you should clarify what you mean by "add a custom field":
create a new custom field
add a custom field to a tracker and/or project
create a new custom field type
Maybe you should elaborate more in detail on what you are trying to achieve.
Just came to my mind:
If by 'plugin' you mean 'project module' (which is in fact something you can (de-)activate) then you probably should patch the project class and add an after_save hook where you check if your project module is active and program your actions accordingly...

Related

Custom Jenkins Plugin - how can I override values loaded from older versions of the plugin?

I'm develping custom Jenkins plugin.
As part of the development I had to make some changes to the classes and fields of my custom build step.
As a result, each client that updates the plugin has to re-enter the configuration of some of the fields.
I wonder if there is a way to load the old values and map them to the new fields?
Any help will be appreciated.
Cheers,
Nadv
See Hint on retaining backward compatibility in the Jenkins wiki. It covers all relevant cases, e.g. adding/removing/renaming fields.

Auto assign to team lead/developer on bug reopen

In my implementation of JIRA, I have a custom field called Developer which gets populated automatically (username) whenever someone move the JIRA from Open to Fixed state. Now I want something similar for the Fixed to Reopen transition. That is, whenever the tester changes the status to Reopen, it should go back to the Developer or the Project Lead (in case the field isnt populated as the custom field can be overridden).
I tried to implement a post function, but there isn't a way where I can use OR criteria. Or is there a way?
You can do a Post Function on the transition using the Script Runner plugin if its a self-hosted JIRA instance which will allow you great flexibility in the logic to fill the target field in.
I finally managed to find a workaround for this.
Download the Workflow Enhancer for JIRA plugin (FREE). You would also need JIRA Suite Utilities (I had it installed already for some other customization)
In the Fixed to Reopen transition, add a Post Function and use Copy Value From Other Field to update Assignee from Developer field
Then add another Post Function underneath this where you need to use Universal Post Function. Here make the boolean condition as {Assignee}=="" and select Choose post function to execute: as Assign to Lead Developer
Publish the draft.

How can I have persistence Modifying a Grails plugin?

I'm developing a grails application that uses export:1.6 plugin, but for particular reasons in some cases the result of an action using services is wrong, so I had to get in the methods of the plugin and I had to make son modifications inside the plugin, trouble comes when I want to commit it in our SVN repository (because we are working in a develop team), I'm going to update the app with the plugin modified, but when another person downloads it, the original plugin is going to be originally installed. So I thought to create a new plug in, but, do you have any another suggestion? or if the best way is to create a new plugin, how can I publish it in our Repo? oris it possible to download it with my changes?
This question is similar to this one. In your case, you are better off creating a new plugin.

How to configure db-reverse-engineer plugin

I am a total Grails noob trying to configure the db-reverse-engineer plugin for my first project. Documentation for the plugin indicates that I need to configure it, but I don't see where I am supposed to edit configuration.
Is there a configuration file in my project I need to edit? I have searched through the ./grails-app/conf folder for grails.plugin (the prefix for this plugin's configuration) and found nothing. An SO or Google search for how to configure grails plugins also returns void. I know this is a lame question, but how do I configure this plugin? Is there a UI I need to use, or are there files somewhere to edit?
You need to configure your database in grails-app/conf/DataSource.groovy. In particular, you'll need to provide the JDBC URL, the database dialect and the databases's username and password.
You'll also have to add some extra db-reverse-engineer configuration to grails-app/conf/Config.groovy. This file will already exist. Just append the new properties at the end.
Finally, run the reverse engineer script to generate your domain classes:
grails db-reverse-engineer
The right place for that would be the file grails-app/conf/Config.groovy.
Just add what you need at the bottom.

How do I add variables to a velcoity template JIRA page?

I am looking to capture values from the 'affected version' field of New Bug screen along with the project name and dynamically add these values to the table in my new screen, which was created using a velocity template. I have recently checkout an uploaded the plugin WebWork tutorial plugin but I am having difficulty working out how to utilise this as I very new to JIRA.
As always grateful for any help.
The base class for all custom fields in JIRA is
http://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/customfields/CustomFieldType.html
and it has a method getVelocityParameters that can be used to add variables to the context used in velocity templates, e.g. $mynewvariable. I'd suggest poking around the source looking at some of the CFType.java files for examples of how this can work.
~Matt

Resources