├── .gitignore ├── COPYING ├── README.md ├── RELEASE_NOTES.md ├── app ├── controllers │ ├── release_notes_controller.rb │ └── release_notes_formats_controller.rb ├── helpers │ ├── release_notes_formats_helper.rb │ ├── release_notes_helper.rb │ └── release_notes_settings_helper.rb ├── models │ ├── release_note.rb │ ├── release_notes_format.rb │ └── release_notes_generator.rb └── views │ ├── hooks │ └── release_notes │ │ ├── _failed_find_issue_custom_field.html.erb │ │ ├── _version_show_bottom.html.erb │ │ └── _view_issues_show_description_bottom.html.erb │ ├── issues │ └── _release_notes.html.erb │ ├── release_notes │ ├── _dashboard.html.erb │ ├── _dashboard_list_error.html.erb │ ├── _dashboard_list_not_required.html.erb │ ├── _dashboard_list_required.html.erb │ ├── _generated_release_notes.html.erb │ ├── _warnings.html.erb │ ├── generate.html.erb │ ├── index.html.erb │ ├── no_formats.html.erb │ └── update.js.erb │ ├── release_notes_formats │ ├── _form.html.erb │ ├── edit.html.erb │ └── new.html.erb │ └── settings │ ├── _release_notes_formats.html.erb │ ├── _release_notes_general.html.erb │ └── plugin_release_notes.html.erb ├── assets └── stylesheets │ └── release_notes.css ├── config ├── locales │ ├── de.yml │ ├── en.yml │ ├── fr.yml │ ├── pt-BR.yml │ └── ru.yml └── routes.rb ├── db ├── migrate │ ├── 001_create_release_notes.rb │ ├── 002_increase_release_notes_length_limit.rb │ ├── 003_do_everything_for_version_130.rb │ ├── 004_do_everything_for_version_131.rb │ └── 005_do_everything_for_version_132.rb └── seeds.yml ├── gems ├── init.rb ├── lib ├── redmine_release_notes │ ├── hooks.rb │ ├── issue_patch.rb │ ├── issues_controller_patch.rb │ ├── settings_controller_patch.rb │ └── version_patch.rb └── tasks │ └── redmine.rake └── test ├── factories.rb ├── functional ├── issue_hook_test.rb ├── release_notes_controller_test.rb ├── release_notes_formats_controller_test.rb └── settings_controller_patch_test.rb ├── test_helper.rb └── unit ├── issue_patch_test.rb └── release_note_test.rb /.gitignore: -------------------------------------------------------------------------------- 1 | coverage 2 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # redmine release notes 2 | 3 | **Notice**: This project is unmaintained. The last time I personally used it was a few years ago, and I haven't been in contact with any Redmine instances since then either. If it works for you, great! If not, you're on your own, sorry. 4 | 5 | --- 6 | 7 | Do any of the following apply? 8 | 9 | * You have to produce release notes for your projects 10 | * You end up going through the roadmap issue by issue, writing release notes 11 | for each one, and you feel there's got to be a better way 12 | * You wish it was easier to check whether all the release notes have been done 13 | for a particular version 14 | 15 | If so, then this plugin may be just what you need. 16 | 17 | ## requirements 18 | 19 | Just Redmine 2.1.0 or higher. 20 | 21 | ## features 22 | 23 | * Store release notes with each issue. 24 | * See how close the release notes for a certain version are to being finished. 25 | * Generate release notes for a particular version. 26 | * Define templates for generated release notes. 27 | * Localizable; currently available in English, German, Russian, French, and 28 | Brazilian Portuguese.\* 29 | 30 | \* Actually all of the languages other than English are a bit out of date now. 31 | Pull requests welcome! 32 | 33 | ## install 34 | 35 | Clone it. 36 | 37 | git clone git://github.com/hdgarrood/redmine_release_notes \ 38 | /path/to/redmine/plugins/redmine_release_notes 39 | 40 | Do the migrations. 41 | 42 | rake redmine:plugins:migrate 43 | 44 | Load the default formats (optional, recommended). If you've been using earlier 45 | versions, this will read your formats.yml and put them into the database (which 46 | is what you want). 47 | 48 | rake redmine:plugins:release_notes:load_default_formats 49 | 50 | Restart redmine. 51 | 52 | ## setup 53 | 54 | Before you can use it, you need to: 55 | 56 | * Do first-time configuration (Inside Redmine, go to Administration > Plugins 57 | > Redmine release notes > Configure) 58 | * Enable the release notes module for any relevant projects 59 | * Enable the release notes custom field for the appropriate trackers 60 | 61 | ## use 62 | 63 | Create release notes from the issue page; a section will appear under the 64 | description, allowing you to add release notes. Use the issue custom field to 65 | mark whether the release notes are done, todo, or not required. 66 | 67 | Once a version is nearing completion, click on the Release notes tab on the 68 | project menu to see a list of versions (like the roadmap) together with a 69 | progress bar, showing how many release notes are done, and how many are still 70 | left to do. 71 | 72 | Once a version is complete, generate release notes from the same place. You can 73 | also get the release notes raw: 74 | 75 | GET /versions/:id/generate_release_notes?raw=true 76 | 77 | Configure the templates used to generate release notes in Administration > 78 | Plugins (if you're an admin). 79 | 80 | ## contributing 81 | 82 | Bug reports, feature requests, and pull requests are all welcome. 83 | 84 | * [source](https://github.com/hdgarrood/redmine_release_notes) 85 | * [issue tracker](https://github.com/hdgarrood/redmine_release_notes/issues) 86 | 87 | ## licence 88 | 89 | Copyright (C) 2012-2013 Harry Garrood. 90 | 91 | This program is free software: you can redistribute it and/or modify it under 92 | the terms of the GNU General Public License as published by the Free Software 93 | Foundation, either version 3 of the License, or (at your option) any later 94 | version. 95 | 96 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 97 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 98 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 99 | 100 | You should have received a copy of the GNU General Public License along with 101 | this program. If not, see . 102 | -------------------------------------------------------------------------------- /RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | release notes 2 | ============= 3 | 4 | v1.3.1 5 | ------ 6 | 7 | * Bug fixes 8 | * Use issue custom fields again (to avoid breaking issue queries) 9 | * Improved warnings when generating release notes 10 | * UI improvements 11 | 12 | v1.3.0 13 | ------ 14 | 15 | * Loads of bugfixes 16 | * Configuration is much simpler: 17 | * No longer uses issue custom field for release notes 18 | * No longer uses a version custom field; instead, closed versions are hidden by 19 | default on the release notes index 20 | * Release notes formats and plugin configuration now stored in the database 21 | * No more yaml files 22 | * Improved form for editing release notes 23 | * Preview formats while editing them 24 | * No longer allow release notes to be marked as completed if their text is blank 25 | * Ability to choose trackers which can have release notes 26 | * Compatible with Redmine 2.1.0 or higher 27 | -------------------------------------------------------------------------------- /app/controllers/release_notes_controller.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class ReleaseNotesController < ApplicationController 18 | unloadable 19 | 20 | before_filter :find_version, :only => [:generate] 21 | before_filter :find_project, :only => [:index] 22 | 23 | helper :projects 24 | 25 | def index 26 | @with_subprojects = params[:with_subprojects].nil? ? 27 | Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') 28 | 29 | @versions = @project.shared_versions || [] 30 | @versions += @project.rolled_up_versions.visible if @with_subprojects 31 | @versions = @versions.uniq.sort 32 | 33 | # reject closed versions unless the user has specifically asked for them 34 | @versions.reject!(&:closed?) unless params[:closed] 35 | rescue ActiveRecord::RecordNotFound 36 | render_404 37 | end 38 | 39 | # we only expect this to be called with :format => :js 40 | def create 41 | @issue = Issue.find(params[:release_note][:issue_id]) 42 | @release_note = @issue.build_release_note 43 | @release_note.text = params[:release_note][:text] 44 | 45 | if @release_note.save 46 | update_custom_field(params[:mark_completed]) 47 | end 48 | 49 | render 'update' 50 | end 51 | 52 | # we only expect this to be called with :format => :js 53 | def update 54 | @issue = Issue.find(params[:release_note][:issue_id]) 55 | @release_note = @issue.release_note 56 | @release_note.text = params[:release_note][:text] 57 | 58 | if @release_note.save 59 | update_custom_field(params[:mark_completed]) 60 | end 61 | 62 | rescue ActiveRecord::RecordNotFound 63 | render_404 64 | end 65 | 66 | def destroy 67 | release_note = ReleaseNote.find(params[:id]) 68 | @issue = release_note.issue 69 | 70 | update_custom_field(false) 71 | 72 | release_note.destroy 73 | 74 | flash[:notice] = l(:notice_successful_delete) 75 | redirect_to @issue 76 | end 77 | 78 | def generate 79 | # for project menu 80 | @project = @version.project 81 | 82 | @format = release_notes_format_from_params 83 | (render 'no_formats'; return) unless @format 84 | 85 | # for 'Also available in' 86 | @formats = ReleaseNotesFormat.select(:name).all 87 | 88 | @content = ReleaseNotesGenerator.new(@version, @format).generate 89 | 90 | if params[:raw] 91 | render :text => @content, :content_type => 'text/plain' 92 | elsif params[:download] 93 | send_data @content, :content_type => 'text/plain', 94 | :filename => "release-notes-#{@project.name}-version-#{@version.name}.txt" 95 | end 96 | end 97 | 98 | private 99 | def find_version 100 | @version = Version.find(params[:id]) 101 | rescue ActiveRecord::RecordNotFound 102 | render_404 103 | end 104 | 105 | def find_project 106 | @project = Project.find(params[:project_id]) 107 | rescue ActiveRecord::RecordNotFound 108 | render_404 109 | end 110 | 111 | def update_custom_field(completed) 112 | new_value = Setting.plugin_redmine_release_notes. 113 | fetch(completed ? :field_value_done : :field_value_todo) 114 | 115 | custom_value = @issue.release_notes_custom_value 116 | 117 | # TODO: Maybe it would be better to just go ahead and create one, instead 118 | # of telling the user to do it manually 119 | if !custom_value 120 | @release_note.errors.add(:base, 121 | t('release_notes.errors.failed_find_custom_value')) 122 | return 123 | end 124 | 125 | if custom_value.value != new_value 126 | old_value = custom_value.value 127 | custom_value.value = new_value 128 | 129 | if custom_value.save 130 | # record the change to the custom field 131 | journal = @issue.init_journal(User.current) 132 | journal.details << JournalDetail.new( 133 | :property => 'cf', 134 | :prop_key => custom_value.custom_field_id, 135 | :old_value => old_value, 136 | :value => new_value) 137 | if !journal.save 138 | @release_note.errors.add(:base, 139 | t('release_notes.errors.failed_save_journal_entry_html').html_safe) 140 | end 141 | else 142 | @release_note.errors.add(:base, 143 | t('release_notes.errors.failed_save_custom_value_html').html_safe) 144 | end 145 | end 146 | end 147 | 148 | def release_notes_format_from_params 149 | if (format_name = params[:release_notes_format]) 150 | format = ReleaseNotesFormat.find_by_name(format_name) 151 | end 152 | 153 | if format.nil? 154 | id = Setting.plugin_redmine_release_notes[:default_generation_format_id] 155 | # dont raise RecordNotFound 156 | format = ReleaseNotesFormat.find_by_id(id) 157 | end 158 | 159 | # last resort -- just get the first one 160 | if format.nil? 161 | format = ReleaseNotesFormat.first 162 | end 163 | 164 | format 165 | end 166 | 167 | end 168 | -------------------------------------------------------------------------------- /app/controllers/release_notes_formats_controller.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class ReleaseNotesFormatsController < ApplicationController 18 | layout 'admin' 19 | before_filter :require_admin 20 | 21 | def new 22 | @format = ReleaseNotesFormat.new 23 | end 24 | 25 | def create 26 | params.permit! 27 | @format = ReleaseNotesFormat.new(params[:release_notes_format]) 28 | if @format.save 29 | flash[:notice] = l(:notice_successful_create) 30 | redirect_to release_notes_formats_tab_path 31 | else 32 | render 'new' 33 | end 34 | end 35 | 36 | def edit 37 | params.permit! 38 | @format = ReleaseNotesFormat.find(params[:id]) 39 | end 40 | 41 | def update 42 | params.permit! 43 | @format = ReleaseNotesFormat.find(params[:id]) 44 | if @format.update_attributes(params[:release_notes_format]) 45 | flash[:notice] = l(:notice_successful_update) 46 | redirect_to release_notes_formats_tab_path 47 | else 48 | render 'edit' 49 | end 50 | end 51 | 52 | def destroy 53 | params.permit! 54 | @format = ReleaseNotesFormat.find(params[:id]) 55 | @format.destroy 56 | flash[:notice] = l(:notice_successful_delete) 57 | redirect_to release_notes_formats_tab_path 58 | end 59 | 60 | # we only expect this with :format => :js 61 | def preview 62 | params.permit! 63 | format = ReleaseNotesFormat.new(params[:release_notes_format]) 64 | version = ReleaseNotesGenerator::MockVersion.new 65 | @text = ReleaseNotesGenerator.new(version, format).generate 66 | render :text => @text 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /app/helpers/release_notes_formats_helper.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | module ReleaseNotesFormatsHelper 18 | def release_notes_preview_link(url, form, target) 19 | content_tag 'a', l('release_notes.formats.preview'), { 20 | :href => "#", 21 | :onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); $("#release_notes_container").show(); return false;|, 22 | :accesskey => accesskey(:preview) 23 | } 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/helpers/release_notes_helper.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | module ReleaseNotesHelper 18 | def release_notes_progress_bar(version) 19 | completion = version.release_notes_percent_completion 20 | progress_bar([completion, completion], 21 | :width => '40em', 22 | :legend => '%0.0f%' % completion) 23 | end 24 | 25 | def release_notes_overview_link(text, version, project, release_notes_value = nil) 26 | opts = { 27 | :f => [:fixed_version_id, :status_id], 28 | :op => { 29 | :fixed_version_id => '=', 30 | :status_id => '*', 31 | }, 32 | :v => { 33 | :fixed_version_id => [version.id] 34 | }, 35 | :set_filter => 1 36 | } 37 | 38 | if release_notes_value 39 | opts = add_release_notes_custom_field_filters(opts, release_notes_value) 40 | end 41 | opts = add_non_eligible_tracker_filters(opts) 42 | 43 | link_to text, project_issues_path(project, opts) 44 | end 45 | 46 | # TODO: behave better when improperly configured 47 | def add_release_notes_custom_field_filters(opts, release_notes_value) 48 | orig_opts = opts.dup 49 | 50 | settings = Setting.plugin_redmine_release_notes 51 | custom_field_id = settings[:issue_custom_field_id].to_i 52 | custom_field = CustomField.find(custom_field_id) 53 | 54 | field = "cf_#{custom_field_id}" 55 | opts[:f] << field 56 | 57 | case release_notes_value 58 | when Hash 59 | values = release_notes_value[:values]. 60 | map { |v| settings["field_value_#{v}"] }. 61 | select { |v| custom_field.possible_values.include?(v) } 62 | 63 | opts[:op][field] = release_notes_value[:operator] 64 | opts[:v][field] = values 65 | when :none 66 | # if it's the symbol :none, add a filter to only show issues with no 67 | # release notes custom field value 68 | opts[:op][field] = '!*' 69 | else 70 | raise <. 72 | This is a bug. Please report it: https://github.com/hdgarrood/redmine_release_notes 73 | END 74 | end 75 | 76 | opts 77 | rescue ActiveRecord::RecordNotFound 78 | orig_opts 79 | end 80 | 81 | def add_non_eligible_tracker_filters(opts) 82 | orig_opts = opts.dup 83 | 84 | settings = Setting.plugin_redmine_release_notes 85 | custom_field_id = settings[:issue_custom_field_id].to_i 86 | custom_field = CustomField.find(custom_field_id) 87 | 88 | field = "tracker_id" 89 | opts[:f] << field 90 | opts[:op][field] = "!" 91 | 92 | tracker_query = " SELECT tracker_id FROM custom_fields_trackers" 93 | tracker_query << " WHERE custom_field_id= ?" 94 | 95 | non_eligible_trackers = Tracker.where("id NOT IN (#{tracker_query})",custom_field_id) 96 | 97 | opts[:v][field] = non_eligible_trackers.collect(&:id) 98 | 99 | opts 100 | rescue ActiveRecord::RecordNotFound 101 | orig_opts 102 | end 103 | 104 | def release_notes_overview_link_if(condition, text, version, project, opts = {}) 105 | if condition 106 | release_notes_overview_link(text, version, project, opts) 107 | else 108 | text 109 | end 110 | end 111 | 112 | def render_other_formats(formats) 113 | str = "

" 114 | str << l(:label_export_to) 115 | str << " " 116 | str << formats.map { |format| 117 | link_to(format.name, generate_release_notes_path( 118 | :release_notes_format => format.name)) 119 | }.join(' | ') 120 | str << "

" 121 | str.html_safe 122 | end 123 | end 124 | -------------------------------------------------------------------------------- /app/helpers/release_notes_settings_helper.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | module ReleaseNotesSettingsHelper 18 | def release_notes_settings_tabs 19 | [ 20 | {:name => 'general', 21 | :partial => 'settings/release_notes_general', 22 | :label => :label_general}, 23 | {:name => 'formats', 24 | :partial => 'settings/release_notes_formats', 25 | :label => 'release_notes.formats.title'} 26 | ] 27 | end 28 | 29 | def options_for_release_notes_issue_custom_field(settings) 30 | custom_fields = IssueCustomField.where(:field_format => 'list') 31 | selected = settings['issue_custom_field_id'].to_i 32 | options_from_collection_for_select(custom_fields, 'id', 'name', selected) 33 | end 34 | 35 | def options_for_release_notes_issue_custom_field_value(settings, selected) 36 | custom_field = CustomField.find(settings['issue_custom_field_id'].to_i) 37 | values = custom_field.possible_values 38 | options_for_select(values, selected) 39 | rescue ActiveRecord::RecordNotFound 40 | [] 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /app/models/release_note.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class ReleaseNote < ActiveRecord::Base 18 | unloadable 19 | belongs_to :issue 20 | 21 | # the trackers which can have release notes 22 | def self.enabled_tracker_ids 23 | (Setting.plugin_redmine_release_notes[:enabled_tracker_ids] || []). 24 | map(&:to_i). 25 | reject {|i| i == 0} 26 | end 27 | 28 | # the projects which can have release notes 29 | def self.enabled_project_ids 30 | (EnabledModule.where(:name => 'release_notes').select('project_id') || []). 31 | map(&:project_id). 32 | map(&:to_i) 33 | end 34 | 35 | attr_accessible :text 36 | 37 | validates_presence_of :issue 38 | validates_presence_of :text 39 | end 40 | -------------------------------------------------------------------------------- /app/models/release_notes_format.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class ReleaseNotesFormat < ActiveRecord::Base 18 | validates_uniqueness_of :name 19 | validates_presence_of :name 20 | end 21 | -------------------------------------------------------------------------------- /app/models/release_notes_generator.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class ReleaseNotesGenerator 18 | # for previewing formats 19 | class MockVersion 20 | class MockThingWithName 21 | attr_reader :name 22 | def initialize(name) 23 | @name = name 24 | end 25 | end 26 | class MockIssueCollection 27 | class MockIssue 28 | class MockReleaseNote 29 | attr_reader :text 30 | def initialize(text) 31 | @text = text 32 | end 33 | end 34 | 35 | attr_reader :subject, :tracker, :project, :id, :category 36 | 37 | def initialize(opts) 38 | opts.each { |k, v| instance_variable_set :"@#{k}", v } 39 | end 40 | 41 | def release_note; MockReleaseNote.new(@release_note); end 42 | def tracker; MockThingWithName.new(@tracker); end 43 | def project; MockThingWithName.new(@project); end 44 | def category; MockThingWithName.new(@category) end 45 | def custom_values; Array.new; end 46 | end 47 | 48 | def release_notes_done; self; end 49 | 50 | # yields all the MockIssues to the passed block 51 | def find_each(&blk) 52 | [ 53 | MockIssue.new(:subject => 'Crashes on startup', 54 | :tracker => 'Bug', 55 | :release_note => 'Startup crashes no longer occur.', 56 | :project => 'Recipes app', 57 | :id => 37), 58 | MockIssue.new(:subject => 'Star recipes', 59 | :tracker => 'Feature', 60 | :release_note => 'Favourite recipes can now be starred.', 61 | :project => 'Recipes app', 62 | :id => 23), 63 | MockIssue.new(:subject => 'Better performance when saving recipes', 64 | :tracker => 'Feature', 65 | :release_note => 'Performance improved when saving recipes.', 66 | :project => 'Recipes app', 67 | :id => 15) 68 | ].each(&blk) 69 | end 70 | end 71 | 72 | def fixed_issues; MockIssueCollection.new; end 73 | def name; '1.0.0'; end 74 | def id; 8; end 75 | def description; 'Release candidate'; end 76 | def effective_date; Date.tomorrow; end 77 | def project; MockThingWithName.new('Recipes app'); end 78 | def custom_values; Array.new; end 79 | 80 | end 81 | 82 | include Redmine::I18n # for format_date 83 | 84 | attr_reader :format, :version 85 | 86 | def initialize(version, format) 87 | @version = version 88 | @format = format 89 | end 90 | 91 | def generate 92 | generate_header << "\n" << generate_release_notes 93 | end 94 | 95 | private 96 | def generate_header 97 | make_substitutions(format.header, values_for_header(version)) 98 | end 99 | 100 | def generate_release_notes 101 | str = format.start 102 | str << "\n" 103 | version.fixed_issues.release_notes_done.find_each do |issue| 104 | str << make_substitutions(format.each_issue, values_for_issue(issue)) 105 | str << "\n" 106 | end 107 | str << format.end 108 | end 109 | 110 | # TODO: Performance low-hanging fruit here: lazy load these values. 111 | # hash of values for the release notes header 112 | def values_for_header(version) 113 | values = { 114 | "name" => version.name, 115 | "date" => format_date(version.effective_date), 116 | "description" => version.description, 117 | "id" => version.id, 118 | "project_name" => version.project.name 119 | } 120 | add_custom_values(version, values) 121 | values 122 | end 123 | 124 | # hash of values for the release notes for a single issue 125 | def values_for_issue(issue) 126 | values = { 127 | "subject" => issue.subject, 128 | "release_notes" => issue.release_note ? issue.release_note.text : "", 129 | "tracker" => issue.tracker.name, 130 | "project" => issue.project.name, 131 | "category" => issue.category ? issue.category.name : "", 132 | "id" => issue.id 133 | } 134 | add_custom_values(issue, values) 135 | values 136 | end 137 | 138 | def add_custom_values(object, values) 139 | object.custom_values.each do |cv| 140 | values[key_for_custom_value(cv)] = cv.value 141 | end 142 | end 143 | 144 | def key_for_custom_value(cv) 145 | "cf:#{cv.custom_field_id}" 146 | end 147 | 148 | # given a string containing placeholders like %{this} and a hash mapping 149 | # placeholders to values, substitute placeholders for values 150 | def make_substitutions(string, subs) 151 | string.gsub(/%\{.*?\}/) do |match| 152 | subs[match[2..-2]] || match[2..-2] 153 | end 154 | end 155 | end 156 | -------------------------------------------------------------------------------- /app/views/hooks/release_notes/_failed_find_issue_custom_field.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | <%= l(:failed_find_issue_custom_field) %> 4 | <% if User.current.admin? %> 5 | <%= link_to l(:button_configure), 6 | plugin_settings_path(:id => :redmine_release_notes) %> 7 | <% end %> 8 |
9 | -------------------------------------------------------------------------------- /app/views/hooks/release_notes/_version_show_bottom.html.erb: -------------------------------------------------------------------------------- 1 | 10 | 11 | -------------------------------------------------------------------------------- /app/views/hooks/release_notes/_view_issues_show_description_bottom.html.erb: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | 12 |
13 | <%= render :partial => 'issues/release_notes', 14 | :locals => { :release_note => release_note, 15 | :issue => issue } %> 16 |
17 | -------------------------------------------------------------------------------- /app/views/issues/_release_notes.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <% if release_note.persisted? %> 3 | <%= link_to_function l(:button_edit), 'toggle_release_notes()' %> | 4 | <%= link_to l(:button_delete), release_note_path(release_note), 5 | :method => :delete, :confirm => l(:text_are_you_sure) %> 6 | <% else %> 7 | <%= link_to_function l(:button_add), 'toggle_release_notes()' %> 8 | <% end %> 9 |
10 | 11 |
12 |

13 | <%= t('release_notes.title_plural') %> 14 |

15 | <% if release_note.text %> 16 |
17 |

<%= h(release_note.text).gsub(/(\r\n|\r|\n)/, "
").html_safe %>

18 |
19 | <% end %> 20 |
21 | 22 | <%= form_for(release_note, 23 | :remote => true, 24 | :url => release_note.persisted? ? 25 | release_note_path(release_note) : 26 | release_notes_path, 27 | :method => release_note.persisted? ? :put : :post, 28 | :html => {:id => 'release-notes-form', :style => 'display: none;'}) do |f| %> 29 |

<%= t('release_notes.title_plural') %>

30 |
31 | <%= error_messages_for release_note %> 32 | <%= f.hidden_field 'issue_id', :value => issue.id %> 33 | <%= f.text_area 'text', :rows => 5, 34 | :class => 'wiki-edit', 35 | :no_label => true %> 36 |
37 | <%= check_box_tag 'mark_completed', 1, issue.release_notes_done? %> 38 | <%= label_tag 'mark_completed', t('release_notes.mark_complete') %> 39 |
40 | <%= f.submit t(:button_submit), :onclick => "$('#release_notes>.flash.error').remove(); return true;" %> 41 | <%= link_to_function t(:button_cancel), 'toggle_release_notes()' %> 42 |
43 | <% end %> 44 | -------------------------------------------------------------------------------- /app/views/release_notes/_dashboard.html.erb: -------------------------------------------------------------------------------- 1 | <% stats = version.release_notes_stats %> 2 | <% cf_none_value = Setting.plugin_redmine_release_notes[:field_value_not_required] %> 3 | <% cf_name = CustomField.find_by_id(Setting.plugin_redmine_release_notes[:issue_custom_field_id]).name %> 4 | 5 |
6 | <%= l('release_notes.progress') %> 7 | 8 | 9 | <%# #1 Progress bar %> 10 | 19 | 20 | <%# #2 Requiring release notes %> 21 | 24 | 27 | 28 | <%# #3 Not requiring release notes %> 29 | 32 | 35 | 36 | <%# #4 error %> 37 | 40 | 43 | 44 | <%# #5 Generate Release notes %> 45 | 46 | 47 |
11 | <% if stats[:total] == 0 %> 12 | <%= l(:label_roadmap_no_issues) %> 13 | <% elsif stats[:required] == 0 %> 14 | <%= l('release_notes.no_issues_for_this_version') %> 15 | <% else %> 16 | <%= progress_bar([stats[:completion], stats[:completion]],:width => '20em',:legend => " #{stats[:completion]}%") %> 17 | <% end %> 18 |
22 | <%= link_to_function t('release_notes.x_requiring_release_notes', :count => stats[:required]), 23 | 'toggle_release_notes_div("release-notes-details-required")', :class => "summary" %>
25 | <%= render :partial => 'release_notes/dashboard_list_required', 26 | :locals => {:version => version, :stats => stats} %>
30 | <%= link_to_function t('release_notes.x_not_required', :count => stats[:not_required]), 31 | 'toggle_release_notes_div("release-notes-details-not-required")', :class => "summary" %>
33 | <%= render :partial => 'release_notes/dashboard_list_not_required', 34 | :locals =>{:version => version, :stats => stats} %>
38 | <%= link_to_function t('release_notes.x_invalid', :count => stats[:invalid], :cf_name => cf_name), 39 | 'toggle_release_notes_div("release-notes-details-error")', :class => "summary error-text" %>
41 | <%= render :partial => 'release_notes/dashboard_list_error', 42 | :locals =>{:version => version, :stats => stats} %>
<%= link_to t('release_notes.generate'), generate_release_notes_path(version) %>
48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /app/views/release_notes/_dashboard_list_error.html.erb: -------------------------------------------------------------------------------- 1 | 15 | 16 | -------------------------------------------------------------------------------- /app/views/release_notes/_dashboard_list_not_required.html.erb: -------------------------------------------------------------------------------- 1 | 25 | 26 | -------------------------------------------------------------------------------- /app/views/release_notes/_dashboard_list_required.html.erb: -------------------------------------------------------------------------------- 1 | 39 | 40 | -------------------------------------------------------------------------------- /app/views/release_notes/_generated_release_notes.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
<%= @content %>
3 |
4 | 5 | -------------------------------------------------------------------------------- /app/views/release_notes/_warnings.html.erb: -------------------------------------------------------------------------------- 1 | <% if version.fixed_issues.release_notes_todo.any? %> 2 | <% count = version.fixed_issues.release_notes_todo.count %> 3 |
4 | <%= t((count == 1 ? 'one' : 'other'), 5 | :count => count, 6 | :scope => 'release_notes.some_issues_not_finished') %> 7 | (<%= release_notes_overview_link( 8 | t('button_show'), version, project, { :operator => "=", :values => [:todo] }) %>) 9 |
10 | <% end %> 11 | 12 | <% if version.fixed_issues.release_notes_invalid.any? %> 13 | <% count = version.fixed_issues.release_notes_invalid.count %> 14 |
15 | <%= t((count == 1 ? 'one' : 'other'), 16 | :count => count, 17 | :scope => 'release_notes.some_issues_invalid_custom_field_value') %> 18 | (<%= release_notes_overview_link( 19 | t('button_show'), version, project, { :operator => "!", :values => [:todo, :done, :not_required] } ) %>) 20 |
21 | <% end %> 22 | 23 | <% if version.fixed_issues.done_but_release_notes_nil.any? %> 24 | <% count = version.fixed_issues.done_but_release_notes_nil.count %> 25 |
26 | <%= t((count == 1 ? 'one' : 'other'), 27 | :count => count, 28 | :scope => 'release_notes.some_issues_done_with_no_release_notes') %> 29 | (<%= link_to_function t('button_show'), 30 | '$("#issues-done-but-nil-dialog").dialog()' %>) 31 |
32 | 39 | <% end %> 40 | -------------------------------------------------------------------------------- /app/views/release_notes/generate.html.erb: -------------------------------------------------------------------------------- 1 | <% html_title l('release_notes.generate_title', :version => @version.name) %> 2 | 3 | <%= render :partial => 'warnings', 4 | :locals => { :version => @version, :project => @project } %> 5 | 6 |
7 |

<%= l('release_notes.generate_title', :version => @version.name) %>

8 |

9 | <%= link_to l('release_notes.raw'), :raw => "true", 10 | :release_notes_format => params[:release_notes_format] %> | 11 | <%= link_to l('release_notes.download'), :download => "true", 12 | :release_notes_format => params[:release_notes_format] %> 13 |

14 | 15 | <%= render_other_formats(@formats) %> 16 | 17 | <%= render :partial => 'generated_release_notes' %> 18 | -------------------------------------------------------------------------------- /app/views/release_notes/index.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('release_notes.title_plural') %>

2 | 3 | <% if @versions.empty? %> 4 |

<%= l(:label_no_data) %>

5 | <% else %> 6 |
7 | <% @versions.each do |version| %> 8 |

<%= link_to_version version %>

9 | <%= render :partial => 'release_notes/overview', :locals => {:version => version} %> 10 | <% end %> 11 |
12 | <% end %> 13 | 14 | <% content_for :sidebar do %> 15 | <%= form_tag({}, :method => :get) do %> 16 |

<%= t('release_notes.title_plural') %>

17 | 18 | 22 | 23 | <% if @project.descendants.active.any? %> 24 |
25 | 29 | <% else %> 30 | <%= hidden_field_tag 'with_subprojects', 0 %> 31 | <% end %> 32 | 33 | <%= hidden_field_tag 'project_id', @project.identifier %> 34 |

<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>

35 | <% end %> 36 | 37 |

<%= l(:label_version_plural) %>

38 | <% @versions.each do |version| %> 39 | <%= link_to format_version_name(version), "##{version.name}" %>
40 | <% end %> 41 | <% end %> 42 | 43 | <% html_title t('release_notes.title_plural') %> 44 | -------------------------------------------------------------------------------- /app/views/release_notes/no_formats.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= l('release_notes.formats.none') %> 3 | <% if User.current.admin? %> 4 | <%= link_to l(:button_add), new_release_notes_format_path %> 5 | <% end %> 6 |
7 | -------------------------------------------------------------------------------- /app/views/release_notes/update.js.erb: -------------------------------------------------------------------------------- 1 | $('#release-notes').html('<%= escape_javascript render(:partial => 'issues/release_notes', 2 | :locals => { :release_note => @release_note, 3 | :issue => @issue }) %>') 4 | <% if @release_note.errors.any? %> 5 | toggle_release_notes() 6 | <% else %> 7 | window.location.reload() 8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/views/release_notes_formats/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= error_messages_for @format %> 2 | 3 | <%= form_for(@format, :html => { :id => 'format-form' }) do |f| %> 4 |
5 |
6 |

7 | <%= f.label :name, l("release_notes.formats.attributes.name") %> 8 | <%= f.text_field :name %> 9 |

10 | <% %w(header start each_issue end).each do |attr| %> 11 |

12 | <%= f.label attr, l("release_notes.formats.attributes.#{attr}") %> 13 | <%= f.text_area attr, :cols => 40, :rows => 2 %> 14 | 15 | <%= l("release_notes.formats.explain.#{attr}") %> 16 | 17 |

18 | <% end %> 19 | 20 |
21 | <%= f.submit(@format.new_record? ? l(:button_create) : l(:button_save)) %> 22 | <%= release_notes_preview_link preview_release_notes_format_path, 23 | 'format-form', 'relnotes' %> 24 |
25 | 26 |
27 |
28 |

<%= l('release_notes.formats.subs.intro') %>

29 | 30 |

<%= l('release_notes.formats.attributes.header') %>

31 |

<%= l('release_notes.formats.subs.header') %>

32 | 33 |

<%= l('release_notes.formats.attributes.each_issue') %>

34 |

<%= l('release_notes.formats.subs.each_issue') %>

35 |
36 |
37 | 38 |
39 | 42 | <% end %> 43 | 44 | -------------------------------------------------------------------------------- /app/views/release_notes_formats/edit.html.erb: -------------------------------------------------------------------------------- 1 |

2 | <%= link_to l('release_notes.formats.title'), 3 | release_notes_formats_tab_path %> 4 | » 5 | <%= h(@format.name) %> 6 |

7 | 8 | <%= render :partial => 'form' %> 9 | -------------------------------------------------------------------------------- /app/views/release_notes_formats/new.html.erb: -------------------------------------------------------------------------------- 1 |

<%= l('release_notes.formats.new') %>

2 | 3 | <%= render :partial => 'form' %> 4 | -------------------------------------------------------------------------------- /app/views/settings/_release_notes_formats.html.erb: -------------------------------------------------------------------------------- 1 | <% if @formats.any? %> 2 | 3 | 4 | 5 | 6 | 7 | 8 | <% @formats.each do |format| %> 9 | '> 10 | 13 | 16 | 17 | <% end %> 18 | 19 |
<%= t('release_notes.formats.title') %>
11 | <%= link_to h(format.name), edit_release_notes_format_path(format) %> 12 | 14 | <%= delete_link format %> 15 |
20 | <% else %> 21 |
<%= l(:label_no_data) %>
22 | <% end %> 23 | 24 |

25 | <%= link_to l('release_notes.formats.new'), new_release_notes_format_path, :class => 'icon icon-add' %> 26 |

27 | -------------------------------------------------------------------------------- /app/views/settings/_release_notes_general.html.erb: -------------------------------------------------------------------------------- 1 | <% if @formats.any? %> 2 | <%= form_tag(:action => :plugin) do %> 3 |
4 |

5 | <%= label_tag 'settings[default_generation_format_id]', 6 | t('release_notes.formats.default_generation_format') %> 7 | <%= select_tag 'settings[default_generation_format_id]', 8 | options_from_collection_for_select(@formats, 'id', 'name', 9 | @settings[:default_generation_format_id].to_i) %> 10 |

11 |

12 | <%= label_tag 'settings_issue_custom_field_id', 13 | t('release_notes.config.issue_custom_field.name') %> 14 | <%= select_tag 'settings[issue_custom_field_id]', 15 | options_for_release_notes_issue_custom_field(@settings), 16 | :include_blank => true %> 17 | 18 | <%= t('release_notes.config.issue_custom_field.info') %> 19 | 20 |

21 | <% %w(not_required todo done).each do |x| %> 22 |

23 | <%= label_tag "settings[field_value_#{x}]", 24 | t("release_notes.config.field_value_#{x}.name") %> 25 | <%= select_tag "settings[field_value_#{x}]", 26 | options_for_release_notes_issue_custom_field_value(@settings, 27 | @settings["field_value_#{x}"]) %> 28 |

29 | <% end %> 30 |
31 | <%= submit_tag t(:button_save) %> 32 | <% end %> 33 | <% else %> 34 |
35 | <%= t('release_notes.formats.none') %>
36 | <%= link_to t('release_notes.formats.define_some'), new_release_notes_format_path %> 37 |
38 | <% end %> 39 | -------------------------------------------------------------------------------- /app/views/settings/plugin_release_notes.html.erb: -------------------------------------------------------------------------------- 1 |

<%= l(:label_settings) %>: <%= l('release_notes.title_plural') %>

2 | 3 | <%= render_tabs release_notes_settings_tabs %> 4 | 5 | <% html_title(l('release_notes.title_plural'), 6 | l(:label_settings), 7 | l(:label_administration)) -%> 8 | -------------------------------------------------------------------------------- /assets/stylesheets/release_notes.css: -------------------------------------------------------------------------------- 1 | 2 | .error-text{ 3 | color:red !important; 4 | font-style:italic; 5 | } 6 | 7 | .summary { 8 | font-weight: bold; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /config/locales/de.yml: -------------------------------------------------------------------------------- 1 | de: 2 | release_notes: 3 | title: "Release Note" 4 | title_plural: "Release Notes" 5 | 6 | release_note: "Release Note" 7 | release_note_plural: "Release Notes" 8 | 9 | mark_complete: "Sind die Release Notes vollständig angegeben?" 10 | cant_set_done_if_no_release_notes: "Der Status kann nicht auf %{value} gesetzt werden, wenn die Release Notes nicht angegeben sind" 11 | 12 | generate: "Release Notes erstellen" 13 | generate_title: "Release Notes für die Version %{version} verwalten" 14 | show_closed_versions: "Abgeschlossene Versionen anzeigen" 15 | 16 | progress: "Release Notes Fortschritt" 17 | x_issues_in_total: "%{count} Tickets gesamt" 18 | x_requiring_release_notes: "%{count} benötigen Release Notes" 19 | x_done: "%{count} erledigt" 20 | x_done_empty: "%{count} ohne Release Notes" 21 | x_to_go: "%{count} noch offen" 22 | x_not_required: "%{count} nicht erforderlich" 23 | x_not_required_cf_none: "%{count} : auf nicht erforderlich eingestellt" 24 | x_not_required_cf_not_defined: "%{count} : Tracker benötigen keine Release Notes" 25 | x_invalid: "%{count} : ungültig '%{cf_name}'" 26 | x_invalid_nil: "%{count} : leer oder nicht gesetzt" 27 | x_invalid_nil_all: "alle leer oder nicht gesetzt" 28 | none_blank: "Keine Probleme haben '%{cf_name}' als leere oder ungültige" 29 | all_done: "Alle erledigt!" 30 | percent_done: "%{count}% erledigt" 31 | not_started: "Noch nicht begonnen" 32 | 33 | no_issues_for_this_version: "Für diese Version benötigen keine Tickets Versionshinweise" 34 | 35 | some_issues_not_finished: 36 | one: "Ein Ticket benötigt noch Release Notes." 37 | other: "%{count} Tickets benötigen noch Release Notes." 38 | 39 | some_issues_invalid_custom_field_value: 40 | one: "Es gibt ein Ticket, das einen ungültigen Wert für das benutzerdefinierte Feld der Release Notes enthält" 41 | other: "Es gibt %{count} Tickets, das einen ungültigen Wert für das benutzerdefinierte Feld der Release Notes enthält" 42 | 43 | some_issues_done_with_no_release_notes: 44 | one: "Es gibt ein Ticket, das als 'erledigt' gekennzeichnet wurde, aber noch keine Release Notes enthält" 45 | other: "Es gibt %{count} Ticket, das als 'erledigt' gekennzeichnet wurde, aber noch keine Release Notes enthält" 46 | 47 | raw: "Quelltext anzeigen" 48 | download: "Herunterladen" 49 | 50 | config: 51 | issue_custom_field: 52 | name: "Benutzerdefiniertes Ticketfeld für die Release Notes" 53 | info: "Dieses Feld wird im Ticket verwendet um den Fertigstellungsstatus der Release Notes abzubilden. Für die Tickets muss ein benutzerdefiniertes Feld vom Typ Liste konfiguriert werden, welches drei Werte hat. [nicht notwendig,nicht erstellt,vollständig]" 54 | field_value_not_required: 55 | name: "Folgende Tickets benötigen keine Release Notes" 56 | field_value_todo: 57 | name: "Folgende Tickets haben noch keine Release Notes" 58 | field_value_done: 59 | name: "Folgende Tickets haben gefüllte Release Notes" 60 | 61 | formats: 62 | title: "Formate" 63 | format: "Format" 64 | new: "Neues Format" 65 | none: "Es sind bisher keine Release Notes Formate definiert." 66 | define_some: "Formate definieren" 67 | default_generation_format: "Standarderstellungsformat" 68 | preview: "Voransicht mit einer Beispielversion" 69 | attributes: 70 | name: 'Name' 71 | header: 'Kopf' 72 | start: 'Start' 73 | each_issue: 'Je Ticket' 74 | end: 'Ende' 75 | explain: 76 | header: "Erscheint zu Beginn als Kopfbereich der Release Notes." 77 | start: "Erscheint einmalig, direkt nach dem Kopf. Verwenden sie z.B. das
    Tag zur Blockformatierung." 78 | each_issue: "Erscheint einmal je Ticket." 79 | end: "Erscheint einmal als Fußbereich der Release Notes. Verwenden sie z.B. das
Tag zur Blockformatierung." 80 | subs: 81 | intro: "Verwenden sie Macros zur Textersetzungen wie beispielweise %{this} um Text in den Kopfbereich oder bei den Ticketzeilen einzufügen." 82 | header: "Die Macros bei der Textersetzung werden aus dem Versionobjeckt aufgelöst. Mögliche Macros sind: Name (name), Datum (date), ID (id) und Beschreibung (description)." 83 | each_issue: "Die Macros bei der Textersetzung werden aus den jeweiligen Ticket aufgelöst. Mögliche Macros sind: Thema (subject), Release Notes (release_notes), ID (id), Tracker (tracker), Projekt (project) und Kategorie (category)." 84 | 85 | errors: 86 | failed_find_custom_field: "Unfähig zu finden die Release Notes benutzerdefinierten Wert für dieses Problem. Versuchen Sie, die Release Notes Status manuell." 87 | failed_save_custom_value: "Speichern nicht möglich Versionshinweisen benutzerdefinierten Wert für dieses Problem. Dies ist wahrscheinlich ein Fehler.Bitte melden." 88 | failed_save_journal_entry: "Kann Änderung in Frage Geschichte zu retten. Dies ist wahrscheinlich ein Fehler.Bitte melden." 89 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | release_notes: 3 | title: "Release note" 4 | title_plural: "Release notes" 5 | 6 | release_note: "release note" 7 | release_note_plural: "release notes" 8 | 9 | mark_complete: "Release notes complete for this issue?" 10 | cant_set_done_if_no_release_notes: "can't be set to %{value} unless release notes have been written" 11 | 12 | generate: "Generate release notes" 13 | generate_title: "Manage release notes for version %{version}" 14 | show_closed_versions: "Show closed versions" 15 | 16 | progress: "Release notes progress" 17 | x_issues_in_total: "%{count} issues in total" 18 | x_requiring_release_notes: "%{count} requiring release notes" 19 | x_done: "%{count} done" 20 | x_done_empty: "%{count} with empty release notes" 21 | x_to_go: "%{count} to go" 22 | x_not_required: "%{count} not required" 23 | x_not_required_cf_none: "%{count} : set as not required" 24 | x_not_required_cf_not_defined: "%{count} : tracker doesn't need release notes" 25 | x_invalid: "%{count} : invalid '%{cf_name}'" 26 | x_invalid_nil: "%{count} : blank or NULL" 27 | x_invalid_nil_all: "all blank or NULL" 28 | none_blank: "No issues having '%{cf_name}' as blank or invalid" 29 | all_done: "All done!" 30 | percent_done: "%{count}% done" 31 | not_started: "Not started" 32 | 33 | no_issues_for_this_version: "No issues need release notes for this version" 34 | 35 | some_issues_not_finished: 36 | one: "There is 1 issue which still needs release notes" 37 | other: "There are %{count} issues which still need release notes" 38 | 39 | some_issues_invalid_custom_field_value: 40 | one: "There is 1 issue which doesn't have a valid value for the release notes custom field" 41 | other: "There are %{count} issues which don't have a valid value for the release notes custom field" 42 | 43 | some_issues_done_with_no_release_notes: 44 | one: "There is 1 issue which is marked as 'done' but doesn't have any release notes" 45 | other: "There are %{count} issues which are marked as 'done' but don't have any release notes" 46 | 47 | raw: "View raw" 48 | download: "Download" 49 | 50 | config: 51 | issue_custom_field: 52 | name: "Issue custom field for release notes" 53 | info: "This field is used to check whether release notes for issues have been completed. It should be a list type custom field with three values; indicating that either a) the issue doesn't need release notes, b) that the issue does need release notes and doesn't have them yet, or c) that the release notes for this issue are done." 54 | field_value_not_required: 55 | name: "Issues which don't need release notes are" 56 | field_value_todo: 57 | name: "Issues which still need release notes are" 58 | field_value_done: 59 | name: "Issues with finished release notes are" 60 | 61 | formats: 62 | title: "Formats" 63 | format: "Format" 64 | new: "New format" 65 | none: "No release notes formats are currently defined." 66 | define_some: "Define some" 67 | default_generation_format: "Default generation format" 68 | preview: "Preview with a sample version" 69 | attributes: 70 | name: 'Name' 71 | header: 'Header' 72 | start: 'Start' 73 | each_issue: 'Each issue' 74 | end: 'End' 75 | explain: 76 | header: "Appears at the start of the release notes." 77 | start: "Appears once, just after the header. Use for eg. a
    tag." 78 | each_issue: "Appears once for each issue." 79 | end: "Appears once at the end. Use for eg. a
tag." 80 | subs: 81 | intro: "You can use substitutions like %{this} to display some information in the Header and Each issue fields." 82 | header: "Substitutions refer to the version. Recognised values are name, date, id, and description. You can also insert the version's custom values by doing %{cf:custom_field_id}." 83 | each_issue: "Substitutions refer to the issue. Recognised values are subject, release_notes, id, tracker, project and category. You can also insert the issue's custom values by doing %{cf:custom_field_id}." 84 | 85 | errors: 86 | failed_find_custom_value: "Unable to find the release notes custom value for this issue. Try setting the release notes status manually." 87 | failed_save_custom_value_html: "Unable to save release notes custom value for this issue. This is probably a bug. Please report it." 88 | failed_save_journal_entry_html: "Unable to save change in issue history. This is probably a bug. Please report it." 89 | -------------------------------------------------------------------------------- /config/locales/fr.yml: -------------------------------------------------------------------------------- 1 | fr: 2 | Release_note: "Notification" 3 | release_note: "notification" 4 | Release_notes: "Notifications" 5 | release_notes: "notifications" 6 | 7 | generate_release_notes: "Générer notification" 8 | generate_title: "Notification pour la version: %{version}" 9 | mark_version_as_generated: "Signaler que cette version est générée" 10 | edit_release_notes: "Editer les notifications pour" 11 | mark_release_notes_complete: "Notifications complète pour cette tâche?" 12 | 13 | release_notes_destroy_confirmation: "Etes-vous sûr de vouloir supprimer ces notifications?" 14 | failed_find_custom_value: "Impossible de trouver la valeur du champ personnalisé pour cette tâche. Have you set this project up for release notes properly?" 15 | failed_find_custom_field: "Impossible de trouver le champ personnalisé: %{field}" 16 | failed_update_issue_history: "Impossible de sauvegarder %{field} field update in issue history" 17 | failed_save_field_value: "Impossible de sauvegarder la valeur du champ: %{field}" 18 | 19 | show_generated_versions: "Afficher les versions générées" 20 | 21 | x_issues_in_total: "%{count} tâches au total" 22 | x_requiring_release_notes: "%{count} requiert d'être notifié" 23 | x_done: "%{count} réalisé" 24 | x_to_go: "%{count} to go" 25 | all_done: "Tout est fait!" 26 | not_started: "non démarré" 27 | 28 | some_issues_no_release_notes_html: "Il y avait des tâches avec \"%{field}\" = \"%{value}\" mais sans notifications (Afficher)" 29 | some_issues_not_finished: 30 | one: "Il reste une 1 tâche qui nécéssite toujours des notifications" 31 | other: "Il reste %{count} de tâches qui nécéssitent toujours des notifications" 32 | 33 | select_all: "Tout sélectionner" 34 | raw: "Brut" 35 | -------------------------------------------------------------------------------- /config/locales/pt-BR.yml: -------------------------------------------------------------------------------- 1 | pt-BR: 2 | release_notes: 3 | title: "Nota de Release" 4 | title_plural: "Notas de release" 5 | 6 | release_note: "nota de release" 7 | release_note_plural: "notas de release" 8 | 9 | mark_complete: "Notas de lançamento completas para este problema?" 10 | cant_set_done_if_no_release_notes: "não pode ser ajustado para %{value} a menos que notas de lançamento foram escritas" 11 | 12 | generate: "Gerar notas de release" 13 | generate_title: "Gerenciar notas de versão para versão %{version}" 14 | show_closed_versions: "Mostrar versões finalizadas" 15 | 16 | progress: "Lançamento notas progresso" 17 | x_issues_in_total: "%{count} de tarefas no total" 18 | x_requiring_release_notes: "%{count} de tarefas precisam de notas de release" 19 | x_done: "%{count} concluídas" 20 | x_done_empty: "%{count} com notas de lançamento vazias" 21 | x_to_go: "%{count} a fazer" 22 | x_not_required: "%{count} não é necessária" 23 | x_not_required_cf_none: "%{count} : definido como não necessária" 24 | x_not_required_cf_not_defined: "%{count} : rastreador não tem notas de lançamento" 25 | x_invalid: "%{count} : '%{cf_name}' inválido" 26 | x_invalid_nil: "%{count} : em branco ou NULL" 27 | x_invalid_nil_all: "tudo em branco ou NULL" 28 | none_blank: "Não há problemas com '%{cf_name}' como em branco ou inválido" 29 | all_done: "Tudo concluído!" 30 | percent_done: "%{count}% feito" 31 | not_started: "Não iniciada" 32 | 33 | no_issues_for_this_version: "Nenhuma tarefa precisa de nota de release para essa versão" 34 | 35 | some_issues_not_finished: 36 | one: "Há 1 tarefa que precisa de notas de release" 37 | other: "Há %{count} tarefas que precisam de notas de release" 38 | 39 | some_issues_nil_custom_field_value: 40 | one: "Há 1 tarefa que não possui valor para o campo de notas de release" 41 | other: "Há %{count} tarefas que não possuem valor para o campo de notas de release" 42 | 43 | some_issues_done_with_no_release_notes: 44 | one: "Há 1 tarefa marcada como ‘concluída', mas não tem notas de release" 45 | other: "Há %{count} tarefas marcadas como 'concluídas', mas que não têm notas de release" 46 | 47 | raw: "Visualizar linha" 48 | download: "Baixar" 49 | 50 | config: 51 | issue_custom_field: 52 | name: "Campo personalizado para notas de release" 53 | info: "Esse campo é usado para checar se as notas de release foram completadas. Deve ser um campo do tipo lista com três valores; indicando que a) a tarefa não precisa de notas de release, b) a tarefa precisa de notas de release e ainda não as possuem, ou c) notas de release para essa tarefa estão concluídas." 54 | field_value_not_required: 55 | name: "As tarefas que não precisam de notas de release são" 56 | field_value_todo: 57 | name: "As tarefas que ainda precisam de notas de release são" 58 | field_value_done: 59 | name: "As tarefas com notas de release concluídas são" 60 | 61 | formats: 62 | title: "Formatos" 63 | format: "Formato" 64 | new: "Novo formato" 65 | none: "Nenhum formato de notas de release está definido atualmente." 66 | define_some: "Definir algum" 67 | default_generation_format: "Gerar formato padrão" 68 | preview: "Pré-visualizar nova versão" 69 | attributes: 70 | name: 'Nome' 71 | header: 'Cabeçalho' 72 | start: 'Início' 73 | each_issue: 'Cada tarefa' 74 | end: 'Término' 75 | explain: 76 | header: "Aparecer no início das notas de release" 77 | start: "Aparecer uma vez, somente após o cabeçalho. Usar por exemplo uma
    tag." 78 | each_issue: "Aparecer uma vez para cada tarefa." 79 | end: "Aparecer uma vez no final. Usar por exemplo uma
tag." 80 | subs: 81 | intro: "Você pode usar substituições como %{this} para mostrar informação no Cabeçalho e em Cada campo da tarefa." 82 | header: "Substituição referente à versão. Os valores conhecidos são nome, data, id e descrição." 83 | each_issue: "Subsituição referente à tarefa. Os valores conhecidos são assunto, notas de release, id, tipo e projeto." 84 | 85 | errors: 86 | failed_find_custom_value: "Incapaz de encontrar as notas de lançamento valor personalizado para este problema. Tente configurar o status de notas de versão manualmente." 87 | failed_save_custom_value_html: "Não foi possível salvar notas de lançamento valor personalizado para este problema. Este é provavelmente um bug. Por favor, informe" 88 | failed_save_journal_entry_html: "Não foi possível salvar mudança na história problema. Este é provavelmente um bug. Por favor, informe" 89 | -------------------------------------------------------------------------------- /config/locales/ru.yml: -------------------------------------------------------------------------------- 1 | ru: 2 | release_notes: 3 | title: "Примечание к релизу" 4 | title_plural: "Примечания к релизу" 5 | 6 | release_note: "примечание к релизу" 7 | release_note_plural: "примечания к релизу" 8 | 9 | mark_complete: "Примечания готовы к публикации" 10 | cant_set_done_if_no_release_notes: "не может быть установлен в %{value}, поле не заполнено" 11 | 12 | generate: "Создать примечания к релизу" 13 | generate_title: "Управлять примечаниями к релизу для версии %{version}" 14 | show_closed_versions: "Показать закрытые версии" 15 | 16 | progress: "Прогресс примечаний к релизу" 17 | x_issues_in_total: "%{count} задач всего" 18 | x_requiring_release_notes: "%{count} требуют заполнения примечаний" 19 | x_done: "%{count} готово" 20 | x_done_empty: "%{count} с пустыми примечаниями к релизу" 21 | x_to_go: "%{count} осталось" 22 | x_not_required: "%{count} не требуется" 23 | x_not_required_cf_none: "%{count} : установлено, что не требуется" 24 | x_not_required_cf_not_defined: "%{count} : трекер не использует примечания к релизу" 25 | x_invalid: "%{count} : некорректное значение поля '%{cf_name}'" 26 | x_invalid_nil: "%{count} : пустые или NULL" 27 | x_invalid_nil_all: "все пустые или NULL" 28 | none_blank: "Нет задач, в которых поле '%{cf_name}' пустое или некорректное" 29 | all_done: "Все готово!" 30 | percent_done: "%{count}% завершено" 31 | not_started: "Не начато" 32 | 33 | no_issues_for_this_version: "В этой версии нет задач, требующих примечаний к релизу." 34 | 35 | some_issues_not_finished: 36 | one: "Есть 1 задача, требующая заполнения примечаний к релизу" 37 | other: "%{count} задач(и) требуют заполнения примечаний к релизу" 38 | 39 | some_issues_invalid_custom_field_value: 40 | one: "В 1 задаче некорректно заполнено пользовательское поле с примечаниями к релизу" 41 | other: "В %{count} задачах некорректно заполнено пользовательское поле с примечаниями к релизу" 42 | 43 | some_issues_done_with_no_release_notes: 44 | one: "В 1 задаче, помеченной как 'Закрыта', нет примечаний к релизу" 45 | other: "В %{count} задачах, помеченных как 'Закрыта', нет примечаний к релизу" 46 | 47 | raw: "Посмотреть исходник" 48 | download: "Скачать" 49 | 50 | config: 51 | issue_custom_field: 52 | name: "Настраиваемое поле для примечаний к релизу" 53 | info: "Это поле используется для обозначения состояния примечаний к релизу для завершенных задач. Это должен быть список с тремя значениями: (а) задача не нуждается в примечаниях к релизу, (б) к задаче нужны примечания к релизу, но они еще не заполнены; (в) примечания к релизу для этой задачи заполнены." 54 | field_value_not_required: 55 | name: "Задачи, для которых не требуются примечания к релизу" 56 | field_value_todo: 57 | name: "Задачи, для которых нужно заполнить примечания к релизу" 58 | field_value_done: 59 | name: "Задачи с заполненными примечаниями к релизу" 60 | 61 | formats: 62 | title: "Форматы" 63 | format: "Формат" 64 | new: "Новый формат" 65 | none: "Не задано ни одного формата для примечаний." 66 | define_some: "Задать" 67 | default_generation_format: "Формат по-умолчанию для создания примечаний" 68 | preview: "Предварительный просмотр" 69 | attributes: 70 | name: 'Имя' 71 | header: 'Заголовок' 72 | start: 'Начало' 73 | each_issue: 'Строка задачи' 74 | end: 'Конец' 75 | explain: 76 | header: "Вставляется в начале примечаний к версии." 77 | start: "Вставляется один раз, сразу после заголовка. Например, для тэга
    ." 78 | each_issue: "Вставляется один раз для строки каждой задачи." 79 | end: "Вставляется в конце. Например, для тэга
." 80 | subs: 81 | intro: "Вы можете использовать подстановки, такие как %{name}, чтобы выводить информацию в поле 'Заголовок' и 'Строка задачи'." 82 | header: "Подстановки, ссылающиеся на версию. Можно использовать значения: name, date, id и description." 83 | each_issue: "Подстановки, ссылающиеся на задачу. Можно использовать значения: subject, release_notes, id, tracker, category и project." 84 | 85 | errors: 86 | failed_find_custom_field: "Не удалось найти пользовательское поле с примечаниями к релизу для этой задачи. Попробуйте установить статус примечаний к релизу вручную." 87 | failed_save_custom_value: "Не удается сохранить значение пользовательского поля с примечаниями к релизу для этой задачи. Скорее всего это ошибка. Пожалуйста сообщите об этом." 88 | failed_save_journal_entry: "Не удалось добавить примечание к истории задачи. Скорее всего это ошибка. Пожалуйста сообщите об этом." 89 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | RedmineApp::Application.routes.draw do 18 | get '/projects/:project_id/release_notes', 19 | :to => 'release_notes#index', 20 | :as => :release_notes_overview 21 | 22 | resources :release_notes, 23 | :only => [:create, :update, :destroy] 24 | 25 | get "/versions/:id/generate_release_notes", 26 | :to => "release_notes#generate", 27 | :as => :generate_release_notes 28 | 29 | patch 'release_notes_formats/preview', 30 | :to => 'release_notes_formats#preview', 31 | :as => :preview_release_notes_format 32 | 33 | resources :release_notes_formats, 34 | :except => [:index, :show] 35 | 36 | get 'settings/plugin/redmine_release_notes?tab=formats', 37 | :to => 'settings#plugin', 38 | :as => :release_notes_formats_tab 39 | end 40 | -------------------------------------------------------------------------------- /db/migrate/001_create_release_notes.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class CreateReleaseNotes < ActiveRecord::Migration 18 | def up 19 | create_table :release_notes do |t| 20 | t.column :issue_id, :integer 21 | t.column :text, :string 22 | end 23 | end 24 | 25 | def down 26 | drop_table :release_notes 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /db/migrate/002_increase_release_notes_length_limit.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class IncreaseReleaseNotesLengthLimit < ActiveRecord::Migration 18 | def up 19 | change_column :release_notes, :text, :string, :limit => 2000 20 | end 21 | 22 | def down 23 | change_column :release_notes, :text, :string, :limit => 254 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /db/migrate/003_do_everything_for_version_130.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class DoEverythingForVersion130 < ActiveRecord::Migration 18 | def up 19 | change_table :release_notes do |t| 20 | t.column :status, :string, :limit => 12 21 | t.change :text, :text, :limit => nil, :null => true 22 | end 23 | 24 | add_index :release_notes, :status 25 | add_index :release_notes, :issue_id 26 | 27 | create_table :release_notes_formats do |t| 28 | t.string :name, :null => false 29 | t.string :header, :null => false 30 | t.string :each_issue, :null => false 31 | t.string :start, :null => false 32 | t.string :end, :null => false 33 | end 34 | 35 | add_index :release_notes_formats, :name, :unique => true 36 | end 37 | 38 | def down 39 | # don't bother with changing the type of release_notes.text back 40 | remove_column :release_notes, :status 41 | remove_index :release_notes, :name => 'index_release_notes_on_issue_id' 42 | drop_table :release_notes_formats 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /db/migrate/004_do_everything_for_version_131.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class DoEverythingForVersion131 < ActiveRecord::Migration 18 | def up 19 | # remove release_notes.status => now a custom field 20 | remove_column :release_notes, :status 21 | 22 | # don't allow nulls in release_notes.text 23 | change_table :release_notes do |t| 24 | t.change :text, :text, :null => false 25 | end 26 | end 27 | 28 | def down 29 | change_table :release_notes do |t| 30 | t.column :status, :string, :limit => 12 31 | t.change :text, :text, :limit => nil, :null => true 32 | end 33 | 34 | add_index :release_notes, :status 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /db/migrate/005_do_everything_for_version_132.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | class DoEverythingForVersion132 < ActiveRecord::Migration 18 | def up 19 | change_column :release_notes_formats, :header, :text, limit: 16.megabytes - 1 20 | change_column :release_notes_formats, :each_issue, :text, limit: 16.megabytes - 1 21 | change_column :release_notes_formats, :start, :text, limit: 16.megabytes - 1 22 | change_column :release_notes_formats, :end, :text, limit: 16.megabytes - 1 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /db/seeds.yml: -------------------------------------------------------------------------------- 1 | # Seed data for release notes generation formats. You shouldn't need to do 2 | # anything with this file yourself; it's used by the rake task: 3 | # 4 | # redmine:plugins:release_notes:load_default_data 5 | # 6 | 7 | HTML: 8 | name: HTML 9 | header: "

Release notes for version %{name}

\n

Redmine

" 10 | start: "
    " 11 | each_issue: "
  • %{tracker} - %{subject}: %{release_notes}
  • " 12 | end: "
" 13 | 14 | Textile: 15 | name: Textile 16 | header: "h2. Release notes for version %{name}" 17 | start: "" 18 | each_issue: "* *%{subject}*: %{release_notes}" 19 | end: "" 20 | 21 | Markdown: 22 | name: Markdown 23 | header: "## Release notes for version %{name}" 24 | start: "" 25 | each_issue: "+ **%{subject}**: %{release_notes}" 26 | end: "" 27 | 28 | Plaintext: 29 | name: Plaintext 30 | header: "Release notes for version %{name}\n==============================" 31 | start: "" 32 | each_issue: "> %{subject}\n %{release_notes}" 33 | end: "" 34 | 35 | -------------------------------------------------------------------------------- /gems: -------------------------------------------------------------------------------- 1 | # EXTRA GEMS REQUIRED FOR TESTING 2 | # 3 | # Having a Gemfile in here as well as a Gemfile in Redmine's root seems to 4 | # cause all kind of problems. As a workaround, gems are listed here. Append the 5 | # contents of this file to #{Rails.root}/Gemfile.local if you want to run the 6 | # tests. 7 | # 8 | # If you're not planning on running the tests, don't worry about this file. 9 | group :test do 10 | gem 'factory_girl_rails', '~> 4.0' 11 | end 12 | -------------------------------------------------------------------------------- /init.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | require 'redmine' 18 | require 'redmine_release_notes/hooks' 19 | 20 | ActionDispatch::Callbacks.to_prepare do 21 | # Patches to the Redmine core. 22 | patched_classes = %w(issue issues_controller settings_controller version) 23 | patched_classes.each do |core_class| 24 | require_dependency core_class 25 | "RedmineReleaseNotes::#{core_class.camelize}Patch".constantize.perform 26 | end 27 | end 28 | 29 | Redmine::Plugin.register :redmine_release_notes do 30 | name 'Redmine release notes plugin' 31 | author 'Harry Garrood' 32 | description 'A plugin for managing release notes.' 33 | version '1.3.1' 34 | author_url 'https://github.com/hdgarrood' 35 | requires_redmine :version_or_higher => '2.1.0' 36 | 37 | # the partial won't be used, but can't be blank, because Redmine needs to 38 | # think this plugin is configurable 39 | settings :default => { 40 | :default_generation_format_id => 1, 41 | :issue_custom_field_id => 0, 42 | :field_value_todo => 'Todo', 43 | :field_value_done => 'Done', 44 | :field_value_not_required => 'Not required' 45 | }, 46 | :partial => 'not_blank' 47 | 48 | project_module :release_notes do 49 | permission :release_notes, 50 | { :release_notes => [:index, :new, :generate] }, 51 | :public => true 52 | end 53 | 54 | end 55 | -------------------------------------------------------------------------------- /lib/redmine_release_notes/hooks.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | module RedmineReleaseNotes 18 | class Hooks < Redmine::Hook::ViewListener 19 | def view_issues_show_description_bottom(context) 20 | issue, controller = context[:issue], context[:controller] 21 | 22 | if issue.eligible_for_release_notes? 23 | context[:release_note] = issue.release_note || 24 | issue.build_release_note 25 | controller.render_to_string( 26 | { :partial => 27 | 'hooks/release_notes/view_issues_show_description_bottom', 28 | :locals => context } 29 | ) 30 | else 31 | "" 32 | end 33 | end 34 | 35 | def view_versions_show_bottom(context) 36 | project, controller = context[:project], context[:controller] 37 | 38 | if project.module_enabled? :release_notes 39 | controller.render_to_string( 40 | { :partial => 41 | 'hooks/release_notes/version_show_bottom', 42 | :locals => context } 43 | ) 44 | else 45 | "" 46 | end 47 | end 48 | 49 | def view_layouts_base_html_head(context) 50 | stylesheet_link_tag('release_notes.css', 51 | :plugin => 'redmine_release_notes') 52 | end 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /lib/redmine_release_notes/issue_patch.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | module RedmineReleaseNotes 18 | module IssuePatch 19 | def self.perform 20 | Issue.class_eval do 21 | has_one :release_note, :dependent => :destroy 22 | 23 | # NB: the release_notes_* scopes will not return issues which don't 24 | # have a value for the issue custom field. 25 | 26 | # all the issues which need release notes (including ones which have 27 | # them already) 28 | def self.release_notes_required 29 | done_value = Setting.plugin_redmine_release_notes[:field_value_done] 30 | todo_value = Setting.plugin_redmine_release_notes[:field_value_todo] 31 | joins_release_notes. 32 | where('custom_values.value' => [done_value, todo_value]) 33 | end 34 | 35 | # issues which still need release notes 36 | def self.release_notes_todo 37 | todo_value = Setting.plugin_redmine_release_notes[:field_value_todo] 38 | joins_release_notes. 39 | where('custom_values.value' => todo_value) 40 | end 41 | 42 | # issues whose release notes are done 43 | def self.release_notes_done 44 | done_value = Setting.plugin_redmine_release_notes[:field_value_done] 45 | joins_release_notes. 46 | where('custom_values.value' => done_value) 47 | end 48 | 49 | # issues whose release notes are done 50 | def self.release_notes_none 51 | none_value = Setting.plugin_redmine_release_notes[:field_value_not_required] 52 | joins_release_notes. 53 | where('custom_values.value' => none_value) 54 | end 55 | 56 | # issues whose release notes are invalid 57 | def self.release_notes_invalid 58 | todo_value = Setting.plugin_redmine_release_notes[:field_value_todo] 59 | done_value = Setting.plugin_redmine_release_notes[:field_value_done] 60 | none_value = Setting.plugin_redmine_release_notes[:field_value_not_required] 61 | 62 | joins_release_notes. 63 | where('custom_values.value not in (?)', [done_value, todo_value,none_value]) 64 | end 65 | 66 | def self.release_notes_no_cf_defined 67 | includes(:custom_values).where(no_cf_defined_condition) 68 | end 69 | 70 | # issues where CF is set to 'none' OR for which custom field is not defined 71 | def self.release_notes_not_required 72 | cf_id = Setting.plugin_redmine_release_notes[:issue_custom_field_id].to_i 73 | none_value = Setting.plugin_redmine_release_notes[:field_value_not_required] 74 | 75 | conditions = "( custom_values.custom_field_id = #{cf_id}" 76 | conditions << " AND custom_values.value = '#{connection.quote_string(none_value)}' )" 77 | 78 | joins_release_notes.where( conditions + " OR " + no_cf_defined_condition ) 79 | end 80 | 81 | # issues which don't have a custom value for release notes 82 | # now it doesn't contain issues where cf is not defined 83 | # - those issues are qualified under release_notes_not_required 84 | def self.release_notes_custom_value_nil 85 | conditions = "( (custom_values.value IS NULL" 86 | conditions << " OR custom_values.value = '') )" 87 | 88 | joins_release_notes.where(conditions) 89 | end 90 | 91 | # issues which have the release notes custom field value set to 'done' 92 | # but no release notes 93 | def self.done_but_release_notes_nil 94 | conditions = "NOT EXISTS (" 95 | conditions << "SELECT 1 FROM release_notes" 96 | conditions << " WHERE issue_id = issues.id" 97 | conditions << ")" 98 | release_notes_done.where(conditions) 99 | end 100 | 101 | # can this issue have release notes? 102 | # true if the issue has the configured custom field for release notes 103 | def eligible_for_release_notes? 104 | cf_id = Setting. 105 | plugin_redmine_release_notes[:issue_custom_field_id].to_i 106 | available_custom_fields.include?(CustomField.find(cf_id)) 107 | rescue ActiveRecord::RecordNotFound 108 | false 109 | end 110 | 111 | def release_notes_done? 112 | cf = release_notes_custom_value 113 | done_value = Setting.plugin_redmine_release_notes[:field_value_done] 114 | cf.value == done_value unless cf.nil? 115 | rescue ActiveRecord::RecordNotFound 116 | false 117 | end 118 | 119 | # returns the CustomValue which describes the release notes status for 120 | # this issue 121 | def release_notes_custom_value 122 | cf_id = Setting. 123 | plugin_redmine_release_notes[:issue_custom_field_id].to_i 124 | custom_values.find_by_custom_field_id(cf_id) 125 | end 126 | 127 | private 128 | def self.joins_release_notes 129 | custom_field_id = Setting. 130 | plugin_redmine_release_notes[:issue_custom_field_id] 131 | joins(:custom_values). 132 | where('custom_values.custom_field_id' => custom_field_id) 133 | end 134 | 135 | def self.no_cf_defined_condition 136 | cf_id = Setting. 137 | plugin_redmine_release_notes[:issue_custom_field_id].to_i 138 | 139 | conditions_b = "NOT EXISTS (" 140 | conditions_b << "SELECT 1 FROM custom_values" 141 | conditions_b << " WHERE custom_values.customized_type = 'Issue'" 142 | conditions_b << " AND custom_values.custom_field_id = #{cf_id}" 143 | conditions_b << " AND custom_values.customized_id = issues.id" 144 | conditions_b << ") " 145 | 146 | conditions_b 147 | end 148 | end 149 | end 150 | end 151 | end 152 | -------------------------------------------------------------------------------- /lib/redmine_release_notes/issues_controller_patch.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | module RedmineReleaseNotes 18 | module IssuesControllerPatch 19 | def self.perform 20 | IssuesController.class_eval do 21 | helper 'release_notes' 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/redmine_release_notes/settings_controller_patch.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | module RedmineReleaseNotes 18 | module SettingsControllerPatch 19 | def self.perform 20 | SettingsController.class_eval do 21 | helper 'release_notes_settings' 22 | 23 | # tells Rails to render the 'release notes settings' view instead of the 24 | # standard plugin settings view if the plugin we're looking at is the 25 | # release notes one 26 | def plugin_with_release_notes_patch 27 | if params[:id] == 'redmine_release_notes' 28 | plugin_redmine_release_notes 29 | else 30 | plugin_without_release_notes_patch 31 | end 32 | end 33 | 34 | def plugin_redmine_release_notes 35 | if request.get? 36 | @settings = Setting.plugin_redmine_release_notes 37 | @formats = ReleaseNotesFormat.all 38 | render 'plugin_release_notes' 39 | elsif request.post? 40 | # if params looks ok, update settings in the db 41 | if (params[:settings] && 42 | params[:settings][:default_generation_format_id].to_i > 0) 43 | plugin_without_release_notes_patch 44 | else 45 | # otherwise just GET the settings again 46 | redirect_to plugin_settings_path(:id => 'redmine_release_notes') 47 | end 48 | else 49 | render_404 50 | end 51 | end 52 | 53 | alias_method_chain :plugin, :release_notes_patch 54 | end 55 | end 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /lib/redmine_release_notes/version_patch.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | module RedmineReleaseNotes 18 | module VersionPatch 19 | def self.perform 20 | Version.class_eval do 21 | # number, 0 <= n <= 100, the proportion of this version's issues' 22 | # release notes which are done 23 | def release_notes_percent_completion 24 | required_count = fixed_issues.release_notes_required.count 25 | if required_count > 0 26 | done_count = fixed_issues.release_notes_done.count 27 | 100 * done_count / required_count 28 | else 29 | 0 30 | end 31 | end 32 | 33 | def release_notes_stats 34 | stats = Hash.new 35 | stats[:required] = fixed_issues.release_notes_required.count 36 | stats[:done] = fixed_issues.release_notes_done.count 37 | stats[:done_empty] = fixed_issues.done_but_release_notes_nil.count 38 | stats[:todo] = fixed_issues.release_notes_todo.count 39 | stats[:not_required] = fixed_issues.release_notes_not_required.count 40 | stats[:none] = fixed_issues.release_notes_none.count 41 | stats[:no_cf] = fixed_issues.release_notes_no_cf_defined.count 42 | stats[:invalid] = fixed_issues.release_notes_invalid.count 43 | stats[:nil] = fixed_issues.release_notes_custom_value_nil.count 44 | stats[:total] = issues_count 45 | stats[:completion] = release_notes_percent_completion 46 | 47 | stats 48 | end 49 | end 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /lib/tasks/redmine.rake: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2013 Harry Garrood 2 | # This file is a part of redmine_release_notes. 3 | 4 | # redmine_release_notes is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation, either version 3 of the License, or (at your option) any 7 | # later version. 8 | 9 | # redmine_release_notes is distributed in the hope that it will be useful, but 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | 14 | # You should have received a copy of the GNU General Public License along with 15 | # redmine_release_notes. If not, see . 16 | 17 | require 'yaml' 18 | 19 | namespace :redmine do 20 | namespace :plugins do 21 | namespace :release_notes do 22 | desc 'run all tests for release notes plugin' 23 | task :test => 'redmine:plugins:release_notes:test:all' 24 | 25 | namespace :test do 26 | def assumes_migrated_test_task(type) 27 | Rake::TestTask.new(type) do |t| 28 | t.libs << 'test' 29 | 30 | test_subdir = case type 31 | when :units 32 | 'unit' 33 | when :functionals 34 | 'functional' 35 | when :integration 36 | 'integration' 37 | when :all 38 | '{unit,functional,integration}' 39 | end 40 | 41 | t.pattern = 42 | "plugins/redmine_release_notes/test/#{test_subdir}/**/*_test.rb" 43 | end 44 | end 45 | 46 | desc 'run unit tests' 47 | assumes_migrated_test_task :units 48 | 49 | desc 'run functional tests' 50 | assumes_migrated_test_task :functionals 51 | 52 | desc 'run integration tests' 53 | assumes_migrated_test_task :integration 54 | 55 | desc 'run all tests' 56 | assumes_migrated_test_task :all 57 | end 58 | 59 | task :load_default_formats => :environment do 60 | fail 'you already have some formats! run with FORCE to force' unless 61 | ReleaseNotesFormat.count == 0 || ENV['FORCE'] 62 | 63 | if File.exist?("plugins/redmine_release_notes/config/formats.yml") 64 | # this person was using 1.2.0 65 | upgrading_from_120 = true 66 | source_file = "plugins/redmine_release_notes/config/formats.yml" 67 | else 68 | source_file = "plugins/redmine_release_notes/db/seeds.yml" 69 | end 70 | 71 | YAML.load_file(source_file). 72 | inject({}) {|h, (k,v)| h[k] = v; h[k][:name] ||= k.to_s; h }. 73 | values.each { |v| ReleaseNotesFormat.create!(v) } 74 | 75 | if upgrading_from_120 76 | puts "formats were successfully loaded into DB." 77 | puts "you may want to delete #{source_file} now." 78 | end 79 | end 80 | end 81 | end 82 | end 83 | -------------------------------------------------------------------------------- /test/factories.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :issue do 3 | subject 'not working' 4 | project 5 | author 6 | priority 7 | status 8 | 9 | after(:build) do |i| 10 | i.tracker ||= FactoryGirl.create(:tracker, 11 | :projects => [i.project]) 12 | end 13 | end 14 | 15 | factory :issue_priority, :aliases => [:priority] do 16 | sequence(:name) {|n| "priority-#{n}"} 17 | end 18 | 19 | factory :issue_status, :aliases => [:status] do 20 | sequence(:name) {|n| "issue-status-#{n}"} 21 | is_closed false 22 | end 23 | 24 | factory :project do 25 | sequence(:name) {|n| "my-project-#{n}"} 26 | identifier { name.downcase } 27 | enabled_module_names %w(issue_tracking) 28 | 29 | factory :project_with_release_notes do 30 | enabled_module_names %w(issue_tracking release_notes) 31 | end 32 | end 33 | 34 | factory :enabled_module do 35 | name 'gantt' 36 | project 37 | end 38 | 39 | factory :user, :aliases => [:author] do 40 | firstname 'joe' 41 | lastname 'bloggs' 42 | sequence(:login) {|n| "#{firstname}.#{lastname}.#{n}".downcase.gsub(/[^0-9a-z]/, '') } 43 | mail { "#{login}@example.com" } 44 | end 45 | 46 | factory :tracker do 47 | sequence(:name) {|n| "tracker-#{n}"} 48 | end 49 | 50 | factory :release_note do 51 | text 'no longer broken' 52 | issue 53 | end 54 | 55 | factory :role do 56 | sequence(:name) {|n| "role-#{n}"} 57 | end 58 | 59 | factory :version do 60 | sequence(:name) {|n| "0.0.#{n}"} 61 | project 62 | 63 | factory :version_with_release_notes do 64 | association :project, :factory => :project_with_release_notes 65 | end 66 | end 67 | 68 | factory :release_notes_format do 69 | sequence(:name) {|n| "format-#{n}"} 70 | header 'Release notes for %{version}' 71 | start '' 72 | each_issue '* %{release_notes}' 73 | 74 | # hack -- we can't write a literal 'end' cuz it's a Ruby keyword 75 | sequence(:end) {|n| '' } 76 | end 77 | 78 | factory :issue_query do 79 | sequence(:name) {|n| "query-#{n}"} 80 | end 81 | 82 | factory :query do 83 | sequence(:name) {|n| "query-#{n}"} 84 | end 85 | end 86 | -------------------------------------------------------------------------------- /test/functional/issue_hook_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class IssueHookTest < ActionController::TestCase 4 | def setup 5 | @controller = IssuesController.new 6 | 7 | # create a release note 8 | @release_note = FactoryGirl.create(:release_note, 9 | :text => "product can now do backflips") 10 | @issue = @release_note.issue 11 | @project = @issue.project 12 | 13 | # create a user 14 | @user = FactoryGirl.create(:user) 15 | 16 | # give him the permission to view issues in @project 17 | role = FactoryGirl.create(:role, :permissions => %w(view_issues)) 18 | member = Member.new(:role_ids => [role.id], :user_id => @user.id) 19 | @project.members << member 20 | @project.save! 21 | 22 | # log him in 23 | @request.session[:user_id] = @user.id 24 | end 25 | 26 | def assert_release_notes_displayed 27 | assert_response :success 28 | assert_select '#release-notes', 29 | :text => /product can now do backflips/ 30 | end 31 | 32 | def assert_release_notes_not_displayed 33 | assert_response :success 34 | assert_select '#release-notes', false 35 | end 36 | 37 | test 'release notes displayed if issue eligible' do 38 | Issue.any_instance.stubs(:eligible_for_release_notes?).returns(true) 39 | 40 | get :show, :id => @issue.id 41 | assert_release_notes_displayed 42 | end 43 | 44 | test 'release notes not displayed if issue not eligible' do 45 | Issue.any_instance.stubs(:eligible_for_release_notes?).returns(false) 46 | 47 | get :show, :id => @issue.id 48 | assert_release_notes_not_displayed 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /test/functional/release_notes_controller_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class ReleaseNotesControllerTest < ActionController::TestCase 4 | def setup 5 | @controller = ReleaseNotesController.new 6 | 7 | # run as an admin 8 | @user = FactoryGirl.create(:user, :admin => true) 9 | @request.session[:user_id] = @user.id 10 | 11 | # create a format 12 | FactoryGirl.create(:release_notes_format) 13 | end 14 | 15 | # create a project with 3 issues with release notes todo, 4 done, and 5 16 | # not required, all assigned to the same version 17 | def make_a_version_with_some_issues_and_release_notes 18 | tracker = FactoryGirl.create(:tracker) 19 | project = FactoryGirl.create(:project_with_release_notes, 20 | :trackers => [tracker]) 21 | ReleaseNote.stubs(:enabled_tracker_ids).returns([tracker.id]) 22 | version = FactoryGirl.create(:version, :project => project) 23 | [[3, 'todo'], [4, 'done'], [5, 'not_required']].each do |n, status| 24 | n.times do 25 | issue = FactoryGirl.create(:issue, 26 | :project => project, 27 | :fixed_version => version, 28 | :tracker => tracker) 29 | issue.build_release_note 30 | issue.release_note.status = status 31 | issue.release_note.text = 'LULZ' # so that it's valid 32 | issue.release_note.save! 33 | end 34 | end 35 | version 36 | end 37 | 38 | test "don't try to generate without any formats" do 39 | ReleaseNotesFormat.destroy_all 40 | assert_equal ReleaseNotesFormat.count, 0, 41 | "this test will only work if there are no formats in the db" 42 | 43 | version = FactoryGirl.create(:version_with_release_notes) 44 | 45 | get :generate, :id => version.id 46 | assert_template 'no_formats' 47 | end 48 | 49 | test "should use default format when not specified" do 50 | version = FactoryGirl.create(:version_with_release_notes) 51 | format = FactoryGirl.create(:release_notes_format) 52 | 53 | Setting.stubs(:plugin_redmine_release_notes). 54 | returns(:default_generation_format_id => format.id) 55 | 56 | get :generate, :id => version.id 57 | assert_template 'generate' 58 | assert_equal assigns(:format), format 59 | end 60 | 61 | test "should use default format when specified format not found" do 62 | version = FactoryGirl.create(:version_with_release_notes) 63 | format = FactoryGirl.create(:release_notes_format) 64 | 65 | Setting.stubs(:plugin_redmine_release_notes). 66 | returns(:default_generation_format_id => format.id) 67 | 68 | get :generate, :id => version.id, :release_notes_format => 'garbage' 69 | assert_template 'generate' 70 | assert_equal assigns(:format), format 71 | end 72 | 73 | test "should use specified format" do 74 | version = FactoryGirl.create(:version_with_release_notes) 75 | format = FactoryGirl.create(:release_notes_format) 76 | 77 | # ensure the format is not retrieved from settings 78 | Setting.stubs(:plugin_redmine_release_notes). 79 | returns(:default_generation_format_id => 0) 80 | 81 | get :generate, :id => version.id, :release_notes_format => format.name 82 | assert_template 'generate' 83 | assert_equal assigns(:format), format 84 | end 85 | 86 | test 'should warn if some issues still need release notes' do 87 | version = make_a_version_with_some_issues_and_release_notes 88 | get :generate, :id => version.id 89 | 90 | # there should be 3 issues needing release notes 91 | assert_response :success 92 | assert_select 'div.flash.warning', 93 | :text => /3/ 94 | end 95 | end 96 | -------------------------------------------------------------------------------- /test/functional/release_notes_formats_controller_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class ReleaseNotesFormatsControllerTest < ActionController::TestCase 4 | def setup 5 | @controller = ReleaseNotesFormatsController.new 6 | end 7 | 8 | def run_as_non_admin! 9 | @user = FactoryGirl.create(:user, :admin => false) 10 | @request.session[:user_id] = @user.id 11 | end 12 | 13 | test 'may not do anything with formats if not admin' do 14 | run_as_non_admin! 15 | 16 | get :new 17 | assert_response 403 18 | 19 | format = FactoryGirl.build(:release_notes_format) 20 | post :create, :release_notes_format => format 21 | assert_response 403 22 | assert_nil ReleaseNotesFormat.find_by_name(format.name) 23 | 24 | format.save! 25 | get :edit, :id => format.id 26 | assert_response 403 27 | 28 | [:update, :preview].each do |action| 29 | put action, :id => format.id, :release_notes_format => format 30 | assert_response 403 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /test/functional/settings_controller_patch_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class SettingsControllerPatchTest < ActionController::TestCase 4 | def setup 5 | @controller = SettingsController.new 6 | 7 | # run as an admin 8 | @user = FactoryGirl.create(:user, :admin => true) 9 | @request.session[:user_id] = @user.id 10 | end 11 | 12 | test 'uses special view for release notes settings' do 13 | get :plugin, :id => 'redmine_release_notes' 14 | assert_response :success 15 | assert_template 'plugin_release_notes' 16 | end 17 | 18 | test 'doesnt break other plugin settings' do 19 | # partly copied from SettingsControllerTest 20 | Setting.stubs(:plugin_foo).returns({'setting' => 'value'}) 21 | ActionController::Base.append_view_path(File.join(Rails.root, "test/fixtures/plugins")) 22 | Redmine::Plugin.register :foo do 23 | settings :partial => "foo_plugin/foo_plugin_settings" 24 | end 25 | 26 | get :plugin, :id => 'foo' 27 | assert_response :success 28 | assert_template 'plugin' 29 | end 30 | 31 | test "doesn't choke when a non-existent plugin is requested" do 32 | get :plugin, :id => 'doesnt_exist' 33 | assert_response 404 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # Load the normal Rails helper 2 | require File.dirname(__FILE__) + '/../../../test/test_helper' 3 | 4 | class ActiveSupport::TestCase 5 | self.use_transactional_fixtures = true 6 | end 7 | 8 | require 'factory_girl_rails' 9 | require File.dirname(__FILE__) + '/factories.rb' 10 | FactoryGirl.find_definitions 11 | -------------------------------------------------------------------------------- /test/unit/issue_patch_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper.rb' 2 | 3 | class IssuePatchTest < ActiveSupport::TestCase 4 | test "issues return correct value for release_notes_done?" do 5 | # TODO 6 | end 7 | 8 | test 'should only be eligible for release notes when project and tracker are setup' do 9 | # create a tracker which is enabled for release notes 10 | enabled_tracker = FactoryGirl.create(:tracker) 11 | Setting.stubs(:plugin_redmine_release_notes). 12 | returns({:enabled_tracker_ids => [enabled_tracker.id]}) 13 | # create a project which is enabled for release notes 14 | enabled_project = FactoryGirl.create(:project_with_release_notes, 15 | :trackers => [enabled_tracker]) 16 | 17 | issue = FactoryGirl.build(:issue) 18 | issue.tracker = enabled_tracker 19 | issue.project = enabled_project 20 | assert issue.eligible_for_release_notes?, 21 | "issue should be eligible for release notes" 22 | 23 | tracker = FactoryGirl.create(:tracker) 24 | issue.tracker = tracker 25 | assert !issue.eligible_for_release_notes?, 26 | "issue should not be eligible for release notes because of the tracker" 27 | 28 | issue.tracker = enabled_tracker 29 | issue.project = FactoryGirl.create(:project) 30 | assert !issue.eligible_for_release_notes?, 31 | "issue should not be eligible for release notes because of the project" 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /test/unit/release_note_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class ReleaseNoteTest < ActiveSupport::TestCase 4 | end 5 | --------------------------------------------------------------------------------