commandprompt / redmine_pastebin

A real pastebin plugin for Redmine. At last!
Other
34 stars 16 forks source link

Redmine 2.1.2 #14

Closed stylesuxx closed 11 years ago

stylesuxx commented 12 years ago

Hey, when using redmine version 2.1.2 and trying to install your Plugin, I get the following error: rake aborted! no such file to load -- dispatcher

Slydder commented 12 years ago

the "dispatcher" problem is a none issue.

However, there is an even worse problem with the module a bit deeper once you correct/recode the dispatcher block. Specifically the "route'" functions are not working as hoped. Am looking into fixing it myself atm. If I get it working before an update is made I will post here.

Slydder commented 12 years ago

So. I got it to install with the code below. However, afterwards it breaks the Activity view. So there is still work to be done. I am also not 100% certain that the routes are correct as I cannot test because of it breaking the install. Below are the init.rb and routes.rb

redmine_pastebin/init.rb:

redmine_pastebin -- A real pastebin plugin for Redmine.

#

Copyright (C) 2011 Alex Shuglin ash@commandprompt.com

#

This program is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation; either version 2 of the License, or

(at your option) any later version.

#

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

#

You should have received a copy of the GNU General Public License along

with this program; if not, write to the Free Software Foundation, Inc.,

51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

require 'redmine'

require 'dispatcher'

require_dependency 'redmine_pastebin/view_hooks'

Dispatcher.to_prepare :redmine_pastebin do

ActionDispatch::Callbacks.to_prepare do require_dependency 'project' require_dependency 'user'

unless Project.included_modules.include? RedminePastebin::ProjectPastesPatch Project.send(:include, RedminePastebin::ProjectPastesPatch) end

unless User.included_modules.include? RedminePastebin::UserPastesPatch User.send(:include, RedminePastebin::UserPastesPatch) end end

Redmine::Plugin.register :redmine_pastebin do name 'Redmine Pastebin plugin' author 'Alex Shulgin ash@commandprompt.com' description 'A real pastebin plugin for redmine' version '0.0.1' url 'https://github.com/commandprompt/redmine_pastebin/'

author_url 'http://example.com/about'

requires_redmine :version_or_higher => '1.1.0'

project_module :pastes do permission :view_pastes, :pastes => [:index, :show, :download] permission :add_pastes, :pastes => [:new, :create] permission :edit_pastes, :pastes => [:edit, :update] permission :delete_pastes, :pastes => [:destroy] end

menu :project_menu, :pastes, { :controller => 'pastes', :action => 'index' }, :caption => :label_paste_plural, :after => :label_wiki, :param => :project_id end

Redmine::Activity.map do |activity| activity.register :pastes end

Redmine::Search.map do |search| search.register :pastes end

redmine_pastebin/config/routes.rb: RedmineApp::Application.routes.draw do

new paste can be only created on a project

resources :pastes, :except => :new do get :download, :on => :member end scope "/:project_id" do resources :pastes do get :download, :on => :member end end end

a1exsh commented 11 years ago

Redmine-2.x support was added (not so) recently.