From 0c2715bf453498c2702538972b446e6ffa5e8c7b Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Tue, 18 Mar 2014 12:04:26 +0100 Subject: [PATCH 001/104] initial commit --- CHANGELOG.md | 3 ++ README.md | 7 ++++ app/controllers/webhooks_controller.rb | 51 ++++++++++++++++++++++++++ config/routes.rb | 6 +++ lib/open_project/webhooks.rb | 42 +++++++++++++++++++++ lib/open_project/webhooks/engine.rb | 21 +++++++++++ lib/open_project/webhooks/hook.rb | 23 ++++++++++++ lib/open_project/webhooks/version.rb | 5 +++ lib/openproject-webhooks.rb | 1 + openproject-webhooks.gemspec | 20 ++++++++++ 10 files changed, 179 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 README.md create mode 100644 app/controllers/webhooks_controller.rb create mode 100644 config/routes.rb create mode 100644 lib/open_project/webhooks.rb create mode 100644 lib/open_project/webhooks/engine.rb create mode 100644 lib/open_project/webhooks/hook.rb create mode 100644 lib/open_project/webhooks/version.rb create mode 100644 lib/openproject-webhooks.rb create mode 100644 openproject-webhooks.gemspec diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..832c0c3eca --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog + +* `#` Create plugin diff --git a/README.md b/README.md new file mode 100644 index 0000000000..610e8d32ca --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# OpenProject Webhooks Plugin + +FIXME Add description and check issue tracker link below + +## Issue Tracker + +https://www.openproject.org/projects/webhooks/issues diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb new file mode 100644 index 0000000000..de9f4f13ef --- /dev/null +++ b/app/controllers/webhooks_controller.rb @@ -0,0 +1,51 @@ +#-- encoding: UTF-8 +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# 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. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +require 'json' + +class WebhooksController < ApplicationController + def handle_hook + hook = OpenProject::Webhooks.find(params.require 'hook_name') + if hook + code = hook.handle(env, params, find_current_user, find_project) + head code.is_a?(Integer) ? code : 200 + else + head :not_found + end + end + +private + # overwritten from ApplicationController to allow optional project + # and read params[:project_identifier] instead of params[:id] + def find_project + Project.find(params['project_identifier']) + rescue ActiveRecord::RecordNotFound + nil + end +end diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000000..a5845dd498 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,6 @@ +OpenProject::Application.routes.draw do + scope "", as: "webhooks" do + post "webhooks/:hook_name" => 'webhooks#handle_hook' + get "webhooks/:hook_name" => 'webhooks#handle_hook' + end +end diff --git a/lib/open_project/webhooks.rb b/lib/open_project/webhooks.rb new file mode 100644 index 0000000000..3e41e0a6f8 --- /dev/null +++ b/lib/open_project/webhooks.rb @@ -0,0 +1,42 @@ +module OpenProject + module Webhooks + require "open_project/webhooks/engine" + require "open_project/webhooks/hook" + + @@registered_hooks = [] + + ## + # Returns a list of currently active webhooks. + def self.registered_hooks + @@registered_hooks.dup + end + + ## + # Registeres a webhook having name and a callback. + # The name will be part of the webhook-url and may be used to unregister a webhook later. + # The callback is executed with two parameters when the webhook was called. + # The parameters are the hook object, an environment-variables hash and a params hash of the current request. + # The callback may return an Integer, which is interpreted as a http return code. + # + # Returns the newly created hook + def self.register_hook(name, &callback) + raise "A hook named '#{name}' is already registered!" if find(name) + Rails.logger.warn "hook registered" + hook = Hook.new(name, &callback) + @@registered_hooks << hook + hook + end + + # Unregisters a webhook. Might be usefull for tests only, because routes can not + # be redrawn in a running instance + def self.unregister_hook(name) + hook = find(name) + raise "A hook named '#{name}' was not registered!" unless find(name) + @@registered_hooks.delete hook + end + + def self.find(name) + @@registered_hooks.find {|h| h.name == name} + end + end +end diff --git a/lib/open_project/webhooks/engine.rb b/lib/open_project/webhooks/engine.rb new file mode 100644 index 0000000000..5964fe6d19 --- /dev/null +++ b/lib/open_project/webhooks/engine.rb @@ -0,0 +1,21 @@ +# PreventĀ load-order problems in case openproject-plugins is listed after a plugin in the Gemfile +# or not at all +require 'open_project/plugins' + +module OpenProject::Webhooks + class Engine < ::Rails::Engine + engine_name :openproject_webhooks + + include OpenProject::Plugins::ActsAsOpEngine + + register 'openproject-webhooks', + :author_url => 'http://finn.de', + :requires_openproject => '>= 3.0.0pre43' + + config.before_configuration do |app| + # This is required for the routes to be loaded first as the routes should + # be prepended so they take precedence over the core. + app.config.paths['config/routes'].unshift File.join(File.dirname(__FILE__), "..", "..", "..", "config", "routes.rb") + end + end +end diff --git a/lib/open_project/webhooks/hook.rb b/lib/open_project/webhooks/hook.rb new file mode 100644 index 0000000000..63569908be --- /dev/null +++ b/lib/open_project/webhooks/hook.rb @@ -0,0 +1,23 @@ +module OpenProject::Webhooks + class Hook + attr_accessor :name, :callback + + def initialize(name, &callback) + super() + @name = name + @callback = callback + end + + def relative_url + "webhooks/#{name}" + end + + def handle(environment = Hash.new, params = Hash.new, user = nil, project = nil) + callback.call self, environment, params, user, project + end + + def send_event(event_name, payload) + ActiveSupport::Notifications.instrument event_name, payload + end + end +end diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb new file mode 100644 index 0000000000..9a360234ea --- /dev/null +++ b/lib/open_project/webhooks/version.rb @@ -0,0 +1,5 @@ +module OpenProject + module Webhooks + VERSION = "1.0.0" + end +end diff --git a/lib/openproject-webhooks.rb b/lib/openproject-webhooks.rb new file mode 100644 index 0000000000..3c0d3e8d72 --- /dev/null +++ b/lib/openproject-webhooks.rb @@ -0,0 +1 @@ +require 'open_project/webhooks' diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec new file mode 100644 index 0000000000..932936c31c --- /dev/null +++ b/openproject-webhooks.gemspec @@ -0,0 +1,20 @@ +# encoding: UTF-8 +$:.push File.expand_path("../lib", __FILE__) + +require 'open_project/webhooks/version' +# Describe your gem and declare its dependencies: +Gem::Specification.new do |s| + s.name = "openproject-webhooks" + s.version = OpenProject::Webhooks::VERSION + s.authors = "Finn GmbH" + s.email = "info@finn.de" + s.homepage = "https://www.openproject.org/projects/webhooks" + s.summary = 'OpenProject Webhooks' + s.description = 'Provides a plug-in API to support OpenProject webhooks for better 3rd party integration' + s.license = 'GPLv3' + + s.files = Dir["{app,config,db,lib}/**/*"] + %w(CHANGELOG.md README.md) + + s.add_dependency "rails", "~> 3.2.14" + s.add_dependency "openproject-plugins", "~> 1.0.6" +end From e0b583de748f10f13bd59f4bca2ae0d843b21503 Mon Sep 17 00:00:00 2001 From: Michael Frister Date: Fri, 21 Mar 2014 14:16:02 +0100 Subject: [PATCH 002/104] Add key-based authentication (like API) and clean up a bit --- app/controllers/webhooks_controller.rb | 23 +++++++++++++---------- lib/open_project/webhooks.rb | 2 +- lib/open_project/webhooks/hook.rb | 7 ++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb index de9f4f13ef..53191596b8 100644 --- a/app/controllers/webhooks_controller.rb +++ b/app/controllers/webhooks_controller.rb @@ -30,22 +30,25 @@ require 'json' class WebhooksController < ApplicationController + accept_key_auth :handle_hook + + def api_request? + # OpenProject only allows API requests based on an Accept request header. + # Webhooks (at least GitHub) don't send an Accept header as they're not interested + # in any part of the response except the HTTP status code. + # Also handling requests with a application/json Content-Type as API requests + # should be safe regarding CSRF as browsers don't send forms as JSON. + super || request.content_type == "application/json" + end + def handle_hook hook = OpenProject::Webhooks.find(params.require 'hook_name') + if hook - code = hook.handle(env, params, find_current_user, find_project) + code = hook.handle(env, params, find_current_user) head code.is_a?(Integer) ? code : 200 else head :not_found end end - -private - # overwritten from ApplicationController to allow optional project - # and read params[:project_identifier] instead of params[:id] - def find_project - Project.find(params['project_identifier']) - rescue ActiveRecord::RecordNotFound - nil - end end diff --git a/lib/open_project/webhooks.rb b/lib/open_project/webhooks.rb index 3e41e0a6f8..247554ceb7 100644 --- a/lib/open_project/webhooks.rb +++ b/lib/open_project/webhooks.rb @@ -12,7 +12,7 @@ module OpenProject end ## - # Registeres a webhook having name and a callback. + # Registers a webhook having name and a callback. # The name will be part of the webhook-url and may be used to unregister a webhook later. # The callback is executed with two parameters when the webhook was called. # The parameters are the hook object, an environment-variables hash and a params hash of the current request. diff --git a/lib/open_project/webhooks/hook.rb b/lib/open_project/webhooks/hook.rb index 63569908be..f1ea80449b 100644 --- a/lib/open_project/webhooks/hook.rb +++ b/lib/open_project/webhooks/hook.rb @@ -12,12 +12,9 @@ module OpenProject::Webhooks "webhooks/#{name}" end - def handle(environment = Hash.new, params = Hash.new, user = nil, project = nil) - callback.call self, environment, params, user, project + def handle(environment = Hash.new, params = Hash.new, user = nil) + callback.call self, environment, params, user end - def send_event(event_name, payload) - ActiveSupport::Notifications.instrument event_name, payload - end end end From cb67ce0bf2799cf9661144d26ee0dda8e609f943 Mon Sep 17 00:00:00 2001 From: Michael Frister Date: Fri, 21 Mar 2014 14:16:09 +0100 Subject: [PATCH 003/104] Add specs --- spec/controllers/webhooks_controller_spec.rb | 36 +++++++++++++++++ spec/lib/hook_spec.rb | 25 ++++++++++++ spec/lib/webhooks_spec.rb | 41 ++++++++++++++++++++ spec/spec_helper.rb | 1 + 4 files changed, 103 insertions(+) create mode 100644 spec/controllers/webhooks_controller_spec.rb create mode 100644 spec/lib/hook_spec.rb create mode 100644 spec/lib/webhooks_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/spec/controllers/webhooks_controller_spec.rb b/spec/controllers/webhooks_controller_spec.rb new file mode 100644 index 0000000000..3c9831a7f0 --- /dev/null +++ b/spec/controllers/webhooks_controller_spec.rb @@ -0,0 +1,36 @@ +require File.expand_path('../../spec_helper', __FILE__) + + +describe WebhooksController do + let(:hook) { double(OpenProject::Webhooks::Hook) } + let(:user) { double(User).as_null_object } + + describe '#handle_hook' do + before do + OpenProject::Webhooks.should_receive(:find).with('testhook').and_return(hook) + controller.stub(:find_current_user).and_return(user) + end + + after do + # ApplicationController before filter user_setup sets a user + User.current = nil + end + + it 'should be successful' do + hook.should_receive(:handle) + + post :handle_hook, :hook_name => 'testhook' + + expect(response).to be_success + end + + it 'should call the hook with a user' do + hook.should_receive(:handle).with do |env, params, user| + expect(user).to equal(user) + end + + post :handle_hook, :hook_name => 'testhook' + end + + end +end diff --git a/spec/lib/hook_spec.rb b/spec/lib/hook_spec.rb new file mode 100644 index 0000000000..af60547f49 --- /dev/null +++ b/spec/lib/hook_spec.rb @@ -0,0 +1,25 @@ +require File.expand_path('../../spec_helper', __FILE__) + + +describe OpenProject::Webhooks::Hook do + describe :relative_url do + let(:hook) { OpenProject::Webhooks::Hook.new('myhook')} + + it "should return the correct URL" do + expect(hook.relative_url).to eql('webhooks/myhook') + end + end + + describe :handle do + let(:probe) { lambda{} } + let(:hook) { OpenProject::Webhooks::Hook.new('myhook', &probe) } + + before do + probe.should_receive(:call).with(hook, 1, 2, 3, 4) + end + + it 'should execute the callback with the correct parameters' do + hook.handle(1, 2, 3, 4) + end + end +end diff --git a/spec/lib/webhooks_spec.rb b/spec/lib/webhooks_spec.rb new file mode 100644 index 0000000000..1ee25a286a --- /dev/null +++ b/spec/lib/webhooks_spec.rb @@ -0,0 +1,41 @@ +require File.expand_path('../../spec_helper', __FILE__) + + +describe OpenProject::Webhooks do + describe '.register_hook' do + after do + OpenProject::Webhooks.unregister_hook('testhook1') + end + + it 'should succeed' do + OpenProject::Webhooks.register_hook('testhook1') {} + end + end + + describe '.find' do + let!(:hook) { OpenProject::Webhooks.register_hook('testhook3') {} } + + after do + OpenProject::Webhooks.unregister_hook('testhook3') + end + + it 'should succeed' do + expect(OpenProject::Webhooks.find('testhook3')).to equal(hook) + end + end + + describe '.unregister_hook' do + let(:probe) { lambda{} } + + before do + OpenProject::Webhooks.register_hook('testhook2', &probe) + + end + + it 'should result in the hook no longer being found' do + OpenProject::Webhooks.unregister_hook('testhook2') + expect(OpenProject::Webhooks.find('testhook2')).to be_nil + end + end + +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000000..f8ec36959d --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1 @@ +require 'spec_helper' From 4cbaccc3777f205961e8fb2a4272432db5124dad Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Tue, 25 Mar 2014 15:33:51 +0100 Subject: [PATCH 004/104] copyright things --- CHANGELOG.md | 3 - app/controllers/webhooks_controller.rb | 18 +- config/routes.rb | 14 + doc/CHANGELOG.md | 18 + doc/COPYRIGHT.md | 16 + doc/COPYRIGHT_short.md | 11 + doc/GPL.txt | 674 +++++++++++++++++++ lib/open_project/webhooks.rb | 14 + lib/open_project/webhooks/engine.rb | 14 + lib/open_project/webhooks/hook.rb | 14 + lib/open_project/webhooks/version.rb | 14 + lib/openproject-webhooks.rb | 14 + spec/controllers/webhooks_controller_spec.rb | 14 + spec/lib/hook_spec.rb | 14 + spec/lib/webhooks_spec.rb | 14 + spec/spec_helper.rb | 14 + 16 files changed, 861 insertions(+), 19 deletions(-) delete mode 100644 CHANGELOG.md create mode 100644 doc/CHANGELOG.md create mode 100644 doc/COPYRIGHT.md create mode 100644 doc/COPYRIGHT_short.md create mode 100644 doc/GPL.txt diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 832c0c3eca..0000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -# Changelog - -* `#` Create plugin diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb index 53191596b8..571c822e8d 100644 --- a/app/controllers/webhooks_controller.rb +++ b/app/controllers/webhooks_controller.rb @@ -1,30 +1,16 @@ #-- encoding: UTF-8 #-- copyright # OpenProject is a project management system. -# Copyright (C) 2012-2014 the OpenProject Foundation (OPF) +# Copyright (C) 2014 the OpenProject Foundation (OPF) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# 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. # -# See doc/COPYRIGHT.rdoc for more details. +# See doc/COPYRIGHT.md for more details. #++ require 'json' diff --git a/config/routes.rb b/config/routes.rb index a5845dd498..4d2413d370 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,17 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + OpenProject::Application.routes.draw do scope "", as: "webhooks" do post "webhooks/:hook_name" => 'webhooks#handle_hook' diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md new file mode 100644 index 0000000000..af70c3faef --- /dev/null +++ b/doc/CHANGELOG.md @@ -0,0 +1,18 @@ + + +# Changelog + +* `#` Create plugin diff --git a/doc/COPYRIGHT.md b/doc/COPYRIGHT.md new file mode 100644 index 0000000000..3e6aac464e --- /dev/null +++ b/doc/COPYRIGHT.md @@ -0,0 +1,16 @@ +OpenProject is a project management system. + +Copyright (C) 2013 the OpenProject Foundation (OPF) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +version 3. + +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. diff --git a/doc/COPYRIGHT_short.md b/doc/COPYRIGHT_short.md new file mode 100644 index 0000000000..01c04a91d2 --- /dev/null +++ b/doc/COPYRIGHT_short.md @@ -0,0 +1,11 @@ +OpenProject is a project management system. +Copyright (C) 2014 the OpenProject Foundation (OPF) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 3. + +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. + +See doc/COPYRIGHT.md for more details. diff --git a/doc/GPL.txt b/doc/GPL.txt new file mode 100644 index 0000000000..94a9ed024d --- /dev/null +++ b/doc/GPL.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 3 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, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/lib/open_project/webhooks.rb b/lib/open_project/webhooks.rb index 247554ceb7..685d5e0479 100644 --- a/lib/open_project/webhooks.rb +++ b/lib/open_project/webhooks.rb @@ -1,3 +1,17 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + module OpenProject module Webhooks require "open_project/webhooks/engine" diff --git a/lib/open_project/webhooks/engine.rb b/lib/open_project/webhooks/engine.rb index 5964fe6d19..2b818c3d24 100644 --- a/lib/open_project/webhooks/engine.rb +++ b/lib/open_project/webhooks/engine.rb @@ -1,3 +1,17 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + # PreventĀ load-order problems in case openproject-plugins is listed after a plugin in the Gemfile # or not at all require 'open_project/plugins' diff --git a/lib/open_project/webhooks/hook.rb b/lib/open_project/webhooks/hook.rb index f1ea80449b..52034fef82 100644 --- a/lib/open_project/webhooks/hook.rb +++ b/lib/open_project/webhooks/hook.rb @@ -1,3 +1,17 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + module OpenProject::Webhooks class Hook attr_accessor :name, :callback diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 9a360234ea..d20b9c8476 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -1,3 +1,17 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + module OpenProject module Webhooks VERSION = "1.0.0" diff --git a/lib/openproject-webhooks.rb b/lib/openproject-webhooks.rb index 3c0d3e8d72..337180425f 100644 --- a/lib/openproject-webhooks.rb +++ b/lib/openproject-webhooks.rb @@ -1 +1,15 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + require 'open_project/webhooks' diff --git a/spec/controllers/webhooks_controller_spec.rb b/spec/controllers/webhooks_controller_spec.rb index 3c9831a7f0..835dcb9c6b 100644 --- a/spec/controllers/webhooks_controller_spec.rb +++ b/spec/controllers/webhooks_controller_spec.rb @@ -1,3 +1,17 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + require File.expand_path('../../spec_helper', __FILE__) diff --git a/spec/lib/hook_spec.rb b/spec/lib/hook_spec.rb index af60547f49..13bdfe8717 100644 --- a/spec/lib/hook_spec.rb +++ b/spec/lib/hook_spec.rb @@ -1,3 +1,17 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + require File.expand_path('../../spec_helper', __FILE__) diff --git a/spec/lib/webhooks_spec.rb b/spec/lib/webhooks_spec.rb index 1ee25a286a..21217d6a98 100644 --- a/spec/lib/webhooks_spec.rb +++ b/spec/lib/webhooks_spec.rb @@ -1,3 +1,17 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + require File.expand_path('../../spec_helper', __FILE__) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f8ec36959d..be3099880b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1,15 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + require 'spec_helper' From bc28ce05b0933b3437cf91fb6f161a51fc75113c Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Tue, 25 Mar 2014 15:35:54 +0100 Subject: [PATCH 005/104] add license, collaboration and contact parts to readme --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 610e8d32ca..56674b8e58 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,21 @@ FIXME Add description and check issue tracker link below -## Issue Tracker +## Get in Contact -https://www.openproject.org/projects/webhooks/issues +OpenProject is supported by its community members, both companies as well as individuals. There are different possibilities of getting help: +* OpenProject [support page](https://www.openproject.org/projects/openproject/wiki/Support) +* E-Mail Support - info@openproject.org + +## Start Collaborating + +Join the OpenProject community and start collaborating. We envision building a platform to share ideas, contributions, and discussions around OpenProject and project collaboration. Each commitment is noteworthy as it helps to improve the software and the project. +More details will be added on the OpenProject Community [contribution page](https://www.openproject.org/projects/openproject/wiki/Contribution). + +In case you find a bug or need a feature, please report at https://www.openproject.org/projects/webhooks/work_packages + +## License + +Copyright (C) 2013 the OpenProject Foundation (OPF) + +This plugin is licensed under the GNU GPL v3. See doc/COPYRIGHT.md for details. From 17561de080d3f3aedbec10777fda8c9359259946 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Tue, 25 Mar 2014 17:26:47 +0100 Subject: [PATCH 006/104] extend README --- README.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 56674b8e58..fbd0128ddc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,35 @@ # OpenProject Webhooks Plugin -FIXME Add description and check issue tracker link below +`openproject-webhooks` is an OpenProject plugin, which adds a webhook API to OpenProject. Other plugins may build upon this plugin to implement their functionality. + +External services like GitHub or Travis could be integrated with the help of this plugin. + +**Note:** This is an infrastructure-only plugin. With this plugin alone, you will not notice any difference in your OpenProject installation. + +## Requirements + +* OpenProject version **3.1.0 or higher** ( or a current installation from the `dev` branch) + +## Installation and Setup: + +This is an OpenProject plugin, thus we follow the usual OpenProject plugin installation mechanism. +Because we depend on the [`openproject-webhooks`](https://github.com/finnlabs/openproject-webhooks) plugin, we also install that plugin. + +### Plugin Installation + +Edit the `Gemfile.plugins` file in your openproject-installation directory to contain the following lines: + +
+gem "openproject-webhooks", :git => 'https://github.com/finnlabs/openproject-github_integration.git', :branch => 'stable'
+
+ +Then update your bundle with: + +
+bundle install
+
+ +and restart the OpenProject server. ## Get in Contact @@ -17,6 +46,6 @@ In case you find a bug or need a feature, please report at https://www.openproje ## License -Copyright (C) 2013 the OpenProject Foundation (OPF) +Copyright (C) 2014 the OpenProject Foundation (OPF) This plugin is licensed under the GNU GPL v3. See doc/COPYRIGHT.md for details. From c0c80e27ac24c210fcb8c5f22528f0bad81f061f Mon Sep 17 00:00:00 2001 From: Michael Frister Date: Wed, 26 Mar 2014 10:47:26 +0100 Subject: [PATCH 007/104] Improve README (similar to core README) --- README.md | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index fbd0128ddc..05586d2ae4 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,24 @@ `openproject-webhooks` is an OpenProject plugin, which adds a webhook API to OpenProject. Other plugins may build upon this plugin to implement their functionality. -External services like GitHub or Travis could be integrated with the help of this plugin. +External services like [GitHub](https://github.com/finnlabs/openproject-github_integration) or Travis could be integrated with the help of this plugin. **Note:** This is an infrastructure-only plugin. With this plugin alone, you will not notice any difference in your OpenProject installation. -## Requirements +## Installation -* OpenProject version **3.1.0 or higher** ( or a current installation from the `dev` branch) +This is an OpenProject plugin, thus we follow the usual OpenProject plugin installation mechanism. -## Installation and Setup: +### Requirements -This is an OpenProject plugin, thus we follow the usual OpenProject plugin installation mechanism. -Because we depend on the [`openproject-webhooks`](https://github.com/finnlabs/openproject-webhooks) plugin, we also install that plugin. +* OpenProject version **3.1.0 or higher** ( or a current installation from the `dev` branch) ### Plugin Installation Edit the `Gemfile.plugins` file in your openproject-installation directory to contain the following lines:
-gem "openproject-webhooks", :git => 'https://github.com/finnlabs/openproject-github_integration.git', :branch => 'stable'
+gem "openproject-webhooks", :git => 'https://github.com/finnlabs/openproject-webhooks.git', :branch => 'stable'
 
Then update your bundle with: @@ -31,21 +30,35 @@ bundle install and restart the OpenProject server. -## Get in Contact +## Contact + +OpenProject is supported by its community members, both companies and individuals. + +Please find ways to contact us on the OpenProject [support page](https://www.openproject.org/support). + +## Contributing + +This OpenProject plugin is an open source project and we encourage you to help us out. We'd be happy if you do one of these things: + +* Create a new [work package in the Webhooks plugin project on openproject.org](https://www.openproject.org/projects/webhooks/work_packages) if you find a bug or need a feature +* Help out other people on our [forums](https://www.openproject.org/projects/openproject/boards) +* Help us [translate this plugin to more languages](https://www.openproject.org/projects/openproject/wiki/Translations) +* Contribute code via GitHub Pull Requests, see our [contribution page](https://www.openproject.org/projects/openproject/wiki/Contribution) for more information + +## Community -OpenProject is supported by its community members, both companies as well as individuals. There are different possibilities of getting help: -* OpenProject [support page](https://www.openproject.org/projects/openproject/wiki/Support) -* E-Mail Support - info@openproject.org +OpenProject is driven by an active group of open source enthusiasts: software engineers, project managers, creatives, and consultants. OpenProject is supported by companies as well as individuals. We share the vision to build great open source project collaboration software. +The [OpenProject Foundation (OPF)](https://www.openproject.org/projects/openproject/wiki/OpenProject_Foundation) will give official guidance to the project and the community and oversees contributions and decisions. -## Start Collaborating +## Repository -Join the OpenProject community and start collaborating. We envision building a platform to share ideas, contributions, and discussions around OpenProject and project collaboration. Each commitment is noteworthy as it helps to improve the software and the project. -More details will be added on the OpenProject Community [contribution page](https://www.openproject.org/projects/openproject/wiki/Contribution). +This repository contains two main branches: -In case you find a bug or need a feature, please report at https://www.openproject.org/projects/webhooks/work_packages +* `dev`: The main development branch. We try to keep it stable in the sense of all tests are passing, but we don't recommend it for production systems. +* `stable`: Contains the latest stable release that we recommend for production use. Use this if you always want the latest version of this plugin. ## License Copyright (C) 2014 the OpenProject Foundation (OPF) -This plugin is licensed under the GNU GPL v3. See doc/COPYRIGHT.md for details. +This plugin is licensed under the GNU GPL v3. See [doc/COPYRIGHT.md](doc/COPYRIGHT.md) for details. From 8d8f977ce857ca15199564f39766b121de84b363 Mon Sep 17 00:00:00 2001 From: Michael Frister Date: Wed, 26 Mar 2014 10:51:42 +0100 Subject: [PATCH 008/104] Fix hook spec --- spec/lib/hook_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/lib/hook_spec.rb b/spec/lib/hook_spec.rb index 13bdfe8717..639cfc38e1 100644 --- a/spec/lib/hook_spec.rb +++ b/spec/lib/hook_spec.rb @@ -29,11 +29,11 @@ describe OpenProject::Webhooks::Hook do let(:hook) { OpenProject::Webhooks::Hook.new('myhook', &probe) } before do - probe.should_receive(:call).with(hook, 1, 2, 3, 4) + probe.should_receive(:call).with(hook, 1, 2, 3) end it 'should execute the callback with the correct parameters' do - hook.handle(1, 2, 3, 4) + hook.handle(1, 2, 3) end end end From e8798cd280a039f8f279c245181b5ab8d30d895c Mon Sep 17 00:00:00 2001 From: Michael Frister Date: Thu, 27 Mar 2014 16:25:49 +0100 Subject: [PATCH 009/104] gemspec: Fix files --- openproject-webhooks.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec index 932936c31c..c1243a1b3d 100644 --- a/openproject-webhooks.gemspec +++ b/openproject-webhooks.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.description = 'Provides a plug-in API to support OpenProject webhooks for better 3rd party integration' s.license = 'GPLv3' - s.files = Dir["{app,config,db,lib}/**/*"] + %w(CHANGELOG.md README.md) + s.files = Dir["{app,config,db,doc,lib}/**/*"] + %w(README.md) s.add_dependency "rails", "~> 3.2.14" s.add_dependency "openproject-plugins", "~> 1.0.6" From fce38f750f4dc47c46acb22934bce4560654c091 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Thu, 12 Jun 2014 16:02:38 +0200 Subject: [PATCH 010/104] Convert specs to RSpec 2.99.0 syntax with Transpec This conversion is done by Transpec 1.12.0 with the following command: transpec * 4 conversions from: obj.should_receive(:message) to: expect(obj).to receive(:message) * 1 conversion from: obj.stub(:message) to: allow(obj).to receive(:message) --- spec/controllers/webhooks_controller_spec.rb | 10 +++++----- spec/lib/hook_spec.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/controllers/webhooks_controller_spec.rb b/spec/controllers/webhooks_controller_spec.rb index 835dcb9c6b..4a933844e3 100644 --- a/spec/controllers/webhooks_controller_spec.rb +++ b/spec/controllers/webhooks_controller_spec.rb @@ -21,8 +21,8 @@ describe WebhooksController do describe '#handle_hook' do before do - OpenProject::Webhooks.should_receive(:find).with('testhook').and_return(hook) - controller.stub(:find_current_user).and_return(user) + expect(OpenProject::Webhooks).to receive(:find).with('testhook').and_return(hook) + allow(controller).to receive(:find_current_user).and_return(user) end after do @@ -31,7 +31,7 @@ describe WebhooksController do end it 'should be successful' do - hook.should_receive(:handle) + expect(hook).to receive(:handle) post :handle_hook, :hook_name => 'testhook' @@ -39,9 +39,9 @@ describe WebhooksController do end it 'should call the hook with a user' do - hook.should_receive(:handle).with do |env, params, user| + expect(hook).to receive(:handle).with { |env, params, user| expect(user).to equal(user) - end + } post :handle_hook, :hook_name => 'testhook' end diff --git a/spec/lib/hook_spec.rb b/spec/lib/hook_spec.rb index 639cfc38e1..4bf72156c9 100644 --- a/spec/lib/hook_spec.rb +++ b/spec/lib/hook_spec.rb @@ -29,7 +29,7 @@ describe OpenProject::Webhooks::Hook do let(:hook) { OpenProject::Webhooks::Hook.new('myhook', &probe) } before do - probe.should_receive(:call).with(hook, 1, 2, 3) + expect(probe).to receive(:call).with(hook, 1, 2, 3) end it 'should execute the callback with the correct parameters' do From 53cce8b8add0056ae0f8b5b0dc5e5a4401a9b271 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Sun, 29 Jun 2014 20:21:18 +0200 Subject: [PATCH 011/104] Convert specs to RSpec 2.99.0 syntax with Transpec This conversion is done by Transpec 2.3.1 with the following command: transpec * 1 conversion from: describe 'some controller' { } to: describe 'some controller', :type => :controller { } For more details: https://github.com/yujinakayama/transpec#supported-conversions --- spec/controllers/webhooks_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/webhooks_controller_spec.rb b/spec/controllers/webhooks_controller_spec.rb index 4a933844e3..22c65f8d0a 100644 --- a/spec/controllers/webhooks_controller_spec.rb +++ b/spec/controllers/webhooks_controller_spec.rb @@ -15,7 +15,7 @@ require File.expand_path('../../spec_helper', __FILE__) -describe WebhooksController do +describe WebhooksController, :type => :controller do let(:hook) { double(OpenProject::Webhooks::Hook) } let(:user) { double(User).as_null_object } From 821a12e2e976a328684a57f00dda481cda9ceaaa Mon Sep 17 00:00:00 2001 From: Christian Ratz Date: Mon, 30 Jun 2014 11:30:18 +0200 Subject: [PATCH 012/104] Adapted gemsepc dependencies to new version scheme --- openproject-webhooks.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec index c1243a1b3d..f375e17590 100644 --- a/openproject-webhooks.gemspec +++ b/openproject-webhooks.gemspec @@ -16,5 +16,5 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,doc,lib}/**/*"] + %w(README.md) s.add_dependency "rails", "~> 3.2.14" - s.add_dependency "openproject-plugins", "~> 1.0.6" + s.add_dependency "openproject-plugins", "~> 4.0" end From 2512f1c1a21cbe3a4bb87788b8b0c745c69743bb Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Thu, 24 Jul 2014 18:10:32 +0200 Subject: [PATCH 013/104] Remove obsolete openproject-plugins dependency Signed-off-by: Alex Coles --- openproject-webhooks.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec index f375e17590..42a7510b7b 100644 --- a/openproject-webhooks.gemspec +++ b/openproject-webhooks.gemspec @@ -16,5 +16,5 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,doc,lib}/**/*"] + %w(README.md) s.add_dependency "rails", "~> 3.2.14" - s.add_dependency "openproject-plugins", "~> 4.0" + end From 353940e88592f7b9fb22cd749bac03af9577e1a0 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Fri, 25 Jul 2014 11:58:58 +0200 Subject: [PATCH 014/104] Remove superfluous comment in engine.rb Signed-off-by: Alex Coles --- lib/open_project/webhooks/engine.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/open_project/webhooks/engine.rb b/lib/open_project/webhooks/engine.rb index 2b818c3d24..d71b6ffdca 100644 --- a/lib/open_project/webhooks/engine.rb +++ b/lib/open_project/webhooks/engine.rb @@ -12,8 +12,6 @@ # See doc/COPYRIGHT.md for more details. #++ -# PreventĀ load-order problems in case openproject-plugins is listed after a plugin in the Gemfile -# or not at all require 'open_project/plugins' module OpenProject::Webhooks From 8ce4fe641086b6c0b3555473447eba8c99fdf5f4 Mon Sep 17 00:00:00 2001 From: kgalli Date: Wed, 22 Oct 2014 17:36:48 +0200 Subject: [PATCH 015/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index d20b9c8476..1cf6421641 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "1.0.0" + VERSION = "4.0.0" end end From 9d0f199f8d1bfbd65180740ce40b6b3b9e03e7ad Mon Sep 17 00:00:00 2001 From: kgalli Date: Tue, 2 Dec 2014 11:05:35 +0100 Subject: [PATCH 016/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 1cf6421641..2c9df3246c 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "4.0.0" + VERSION = "4.1.0" end end From 07fb50df3089c1d0a1a5e9ee5b40441fd5d3135a Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Tue, 31 Mar 2015 00:40:38 +0200 Subject: [PATCH 017/104] Use #describe with String arg not symbol See core commit: http://github.com/opf/openproject/commit/3785fdc9edb187b9e5239879d6f5e411a10ae3df1a10ae3df Signed-off-by: Alex Coles --- spec/lib/hook_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/lib/hook_spec.rb b/spec/lib/hook_spec.rb index 4bf72156c9..98640de50e 100644 --- a/spec/lib/hook_spec.rb +++ b/spec/lib/hook_spec.rb @@ -16,7 +16,7 @@ require File.expand_path('../../spec_helper', __FILE__) describe OpenProject::Webhooks::Hook do - describe :relative_url do + describe '#relative_url' do let(:hook) { OpenProject::Webhooks::Hook.new('myhook')} it "should return the correct URL" do @@ -24,7 +24,7 @@ describe OpenProject::Webhooks::Hook do end end - describe :handle do + describe '#handle' do let(:probe) { lambda{} } let(:hook) { OpenProject::Webhooks::Hook.new('myhook', &probe) } From 07547b3a213956ac987efa0f54e2594d90915043 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Tue, 31 Mar 2015 13:26:29 +0200 Subject: [PATCH 018/104] Remove #with: fix arbitrary argument matching Signed-off-by: Alex Coles --- spec/controllers/webhooks_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/webhooks_controller_spec.rb b/spec/controllers/webhooks_controller_spec.rb index 22c65f8d0a..bee21aa802 100644 --- a/spec/controllers/webhooks_controller_spec.rb +++ b/spec/controllers/webhooks_controller_spec.rb @@ -39,7 +39,7 @@ describe WebhooksController, :type => :controller do end it 'should call the hook with a user' do - expect(hook).to receive(:handle).with { |env, params, user| + expect(hook).to receive(:handle) { |env, params, user| expect(user).to equal(user) } From 967f1e64bbce37b8596e3d157e108a0edd1e90a3 Mon Sep 17 00:00:00 2001 From: kgalli Date: Fri, 10 Apr 2015 14:35:32 +0000 Subject: [PATCH 019/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 2c9df3246c..89fc084a12 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "4.1.0" + VERSION = "4.1.0-beta" end end From 8316372d8f8c5d85418a4a23d9435340dc100564 Mon Sep 17 00:00:00 2001 From: kgalli Date: Fri, 10 Apr 2015 15:04:02 +0000 Subject: [PATCH 020/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 89fc084a12..1d44a33701 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "4.1.0-beta" + VERSION = "4.2.0-alpha" end end From b122f3f70a78f0485bea945dfd57bafb651c3043 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Wed, 27 May 2015 15:14:51 +0200 Subject: [PATCH 021/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 1d44a33701..12e8a1bc55 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "4.2.0-alpha" + VERSION = "4.3.0-alpha" end end From 90f1d8f3082b69298e740e2e5a9d77afb6be93c7 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Sat, 6 Jun 2015 10:17:26 +0200 Subject: [PATCH 022/104] Bump Rails dependency to latest 4.0.x Signed-off-by: Alex Coles --- openproject-webhooks.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec index 42a7510b7b..66cd0a7c87 100644 --- a/openproject-webhooks.gemspec +++ b/openproject-webhooks.gemspec @@ -15,6 +15,6 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,doc,lib}/**/*"] + %w(README.md) - s.add_dependency "rails", "~> 3.2.14" + s.add_dependency 'rails', '~> 4.0.13' end From 67204b2d61bd6134d8f92499960d3ef3984cc7f3 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Sat, 6 Jun 2015 12:22:25 +0200 Subject: [PATCH 023/104] Fix Engine app.config.paths key Analog to core commit: https://github.com/opf/openproject/commit/b1fb3693b23d01df151c7eebe9d4f6fdd55bc546 Signed-off-by: Alex Coles --- lib/open_project/webhooks/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/engine.rb b/lib/open_project/webhooks/engine.rb index d71b6ffdca..4bb5baa13c 100644 --- a/lib/open_project/webhooks/engine.rb +++ b/lib/open_project/webhooks/engine.rb @@ -27,7 +27,7 @@ module OpenProject::Webhooks config.before_configuration do |app| # This is required for the routes to be loaded first as the routes should # be prepended so they take precedence over the core. - app.config.paths['config/routes'].unshift File.join(File.dirname(__FILE__), "..", "..", "..", "config", "routes.rb") + app.config.paths['config/routes.rb'].unshift File.join(File.dirname(__FILE__), "..", "..", "..", "config", "routes.rb") end end end From 0fa7e9dad175064d83c77756d643b27248cc54bd Mon Sep 17 00:00:00 2001 From: kgalli Date: Wed, 8 Jul 2015 13:54:05 +0000 Subject: [PATCH 024/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 12e8a1bc55..06fed42ded 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "4.3.0-alpha" + VERSION = "4.3.0" end end From 87bca6044fdaa4738335b09edc0f3fb6ba3771b2 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Thu, 16 Jul 2015 14:18:25 +0200 Subject: [PATCH 025/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 12e8a1bc55..edb84a4dec 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "4.3.0-alpha" + VERSION = "4.4.0-alpha" end end From f922006794855b051e6ed142d7246f696bcda849 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Thu, 6 Aug 2015 15:24:40 +0200 Subject: [PATCH 026/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index edb84a4dec..b880a987ae 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "4.4.0-alpha" + VERSION = "5.0.0-alpha" end end From a051416382eb785022ac8afba38bf35c5f860dc8 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Mon, 29 Jun 2015 18:27:34 +0200 Subject: [PATCH 027/104] Bump Rails dependency to latest 4.1.x Signed-off-by: Alex Coles --- openproject-webhooks.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec index 66cd0a7c87..8f814f8b6f 100644 --- a/openproject-webhooks.gemspec +++ b/openproject-webhooks.gemspec @@ -15,6 +15,6 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,doc,lib}/**/*"] + %w(README.md) - s.add_dependency 'rails', '~> 4.0.13' + s.add_dependency 'rails', '~> 4.1.11' end From 22f37e48e9c6321ea99b4c8fbea2094a91fd9d17 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Thu, 27 Aug 2015 10:23:15 +0200 Subject: [PATCH 028/104] Bump Rails dependency to latest 4.2.x Signed-off-by: Alex Coles --- openproject-webhooks.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec index 8f814f8b6f..382fbab4da 100644 --- a/openproject-webhooks.gemspec +++ b/openproject-webhooks.gemspec @@ -15,6 +15,6 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,doc,lib}/**/*"] + %w(README.md) - s.add_dependency 'rails', '~> 4.1.11' + s.add_dependency 'rails', '~> 4.2.4' end From 4119e0f7253b8cef618a34f486f61602caeea0cd Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Thu, 29 Oct 2015 10:48:48 +0100 Subject: [PATCH 029/104] Rename company --- openproject-webhooks.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec index 382fbab4da..e523275959 100644 --- a/openproject-webhooks.gemspec +++ b/openproject-webhooks.gemspec @@ -6,8 +6,8 @@ require 'open_project/webhooks/version' Gem::Specification.new do |s| s.name = "openproject-webhooks" s.version = OpenProject::Webhooks::VERSION - s.authors = "Finn GmbH" - s.email = "info@finn.de" + s.authors = "OpenProject GmbH" + s.email = "info@openproject.com" s.homepage = "https://www.openproject.org/projects/webhooks" s.summary = 'OpenProject Webhooks' s.description = 'Provides a plug-in API to support OpenProject webhooks for better 3rd party integration' From a8e06f4b355448942ec5fae923a2a97851c4a8a9 Mon Sep 17 00:00:00 2001 From: Niels Lindenthal Date: Tue, 17 Nov 2015 20:11:14 +0100 Subject: [PATCH 030/104] Update openproject-webhooks.gemspec [skip ci] --- openproject-webhooks.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec index e523275959..97366c2aef 100644 --- a/openproject-webhooks.gemspec +++ b/openproject-webhooks.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |s| s.version = OpenProject::Webhooks::VERSION s.authors = "OpenProject GmbH" s.email = "info@openproject.com" - s.homepage = "https://www.openproject.org/projects/webhooks" + s.homepage = "https://community.openproject.org/projects/webhooks" s.summary = 'OpenProject Webhooks' s.description = 'Provides a plug-in API to support OpenProject webhooks for better 3rd party integration' s.license = 'GPLv3' From fe9a1302816d5452e65b8ba8685a4d26b01015c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 18 Nov 2015 21:10:15 +0100 Subject: [PATCH 031/104] Bump version to 5.0.0 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index b880a987ae..354563e180 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.0-alpha" + VERSION = "5.0.0" end end From fc8aea9ec328d11aac1d3bb051c166942d710bda Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Wed, 18 Nov 2015 21:37:20 +0100 Subject: [PATCH 032/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 354563e180..325ab59a37 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.0" + VERSION = "5.0.1" end end From d8a3e37342e2a9b194c3cd7c14038c7925f99e26 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Fri, 20 Nov 2015 16:22:23 +0100 Subject: [PATCH 033/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index b880a987ae..2234f71660 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.0-alpha" + VERSION = "5.1.0" end end From 556fec61201e8473fb38dfe8865588213d7e970b Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Fri, 20 Nov 2015 18:20:58 +0100 Subject: [PATCH 034/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 325ab59a37..a1a27429c4 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.1" + VERSION = "5.0.2" end end From 60b1820a0ae0745235b0ad3ef4fefef71efc58bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 24 Nov 2015 13:41:11 +0100 Subject: [PATCH 035/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index a1a27429c4..04d969a47b 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.2" + VERSION = "5.0.3" end end From 5050027534fce70f62a8d81f17c7d1e9cc063f4e Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Tue, 24 Nov 2015 17:05:24 +0100 Subject: [PATCH 036/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 04d969a47b..943b288b75 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.3" + VERSION = "5.0.4" end end From ffc3a886309f9c6811dbaca29d781ee04bf1d452 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Fri, 27 Nov 2015 16:56:33 +0100 Subject: [PATCH 037/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 943b288b75..48d3742339 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.4" + VERSION = "5.0.5" end end From 9bf4336d1a8e55235101de38b52e716599e0cc57 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Wed, 2 Dec 2015 17:22:28 +0100 Subject: [PATCH 038/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 48d3742339..bdd3e9e23c 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.5" + VERSION = "5.0.6" end end From 1e1e676a5f829ffd7782abc53227b6dffcc75985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 9 Dec 2015 09:43:22 +0100 Subject: [PATCH 039/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index bdd3e9e23c..bf0e736c21 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.6" + VERSION = "5.0.7" end end From 5ceb2a3e4cb7826534cd02d0a1d17c1d4c37775e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 11 Dec 2015 16:39:18 +0100 Subject: [PATCH 040/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index bf0e736c21..67d3ee3dd6 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.7" + VERSION = "5.0.8" end end From 012a57cc0373f410bd4960d08da1f8abe01c701a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 8 Jan 2016 16:50:10 +0100 Subject: [PATCH 041/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 67d3ee3dd6..d79a0214a7 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.8" + VERSION = "5.0.9" end end From 23edcf48401f075407a489824688ada593f5c3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 13 Jan 2016 16:44:00 +0100 Subject: [PATCH 042/104] Adapt version to corresponding OpenProject core version. --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index d79a0214a7..1ed2463c88 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.9" + VERSION = "5.0.10" end end From 5e1eb664a34efde19e57bc5b77c046d496bd24e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 22 Jan 2016 16:55:43 +0100 Subject: [PATCH 043/104] Bump VERSION to 5.0.11 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 1ed2463c88..90a4db35e1 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.10" + VERSION = "5.0.11" end end From 798a36139c87cc1da34e5d8c8c950be8b40134d6 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Tue, 26 Jan 2016 16:13:40 +0100 Subject: [PATCH 044/104] Bump VERSION to 5.0.12 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 90a4db35e1..9afbea12c0 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.11" + VERSION = "5.0.12" end end From c8ea59c714c4757d61f12c8f7706ce79fe81a208 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Fri, 29 Jan 2016 14:36:38 +0000 Subject: [PATCH 045/104] Bump VERSION to 5.0.13 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 9afbea12c0..b69f7ec2cd 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.12" + VERSION = "5.0.13" end end From a63d6971e3825c412ac81e84fb26da20e8d5d801 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Fri, 29 Jan 2016 16:06:12 +0000 Subject: [PATCH 046/104] Bump VERSION to 5.0.14 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index b69f7ec2cd..64f350c282 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.13" + VERSION = "5.0.14" end end From 09a53cfe4cac4a23de348a12a5111c8b724c4e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 5 Feb 2016 13:29:15 +0100 Subject: [PATCH 047/104] Bump VERSION to 5.0.15 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 64f350c282..abd06a1460 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.14" + VERSION = "5.0.15" end end From 399fe161e9618c72b775f24467a004f53bc0bfe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 15 Feb 2016 11:36:42 +0100 Subject: [PATCH 048/104] Bump VERSION to 5.0.16 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index abd06a1460..ac151fc676 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.15" + VERSION = "5.0.16" end end From 5358f86d07d88afbe0c38ac8323495b225591d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 8 Mar 2016 07:54:16 +0100 Subject: [PATCH 049/104] Bump VERSION to 5.0.17 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index ac151fc676..6f5fdc4a0c 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.16" + VERSION = "5.0.17" end end From 42752e9791d1e376bc9da4279b1d17876e6ec9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 1 Apr 2016 12:05:13 +0200 Subject: [PATCH 050/104] Add .travis.yml with core tests enabled --- .travis.yml | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..93d28d4675 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,115 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2015 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# 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. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +# Travis configuration based on the respective OpenProject core configuration. +# Everything save for the matrix section and additional `before_install` +# instructions is copied and pasted from the core. + +language: ruby + +rvm: + - 2.2.3 + +sudo: false + +cache: + - bundler: true + - directories: + - frontend/node_modules + - frontend/bower_components + +bundler_args: --without development production + +branches: + only: + - master + - dev + - /^(stable|release)\/.*$/ + +env: + global: + - CI=true + - RAILS_ENV=test + - COVERAGE=true + + matrix: + - "TEST_SUITE=plugins:spec DB=mysql" + - "TEST_SUITE=plugins:cucumber DB=mysql" + + - "TEST_SUITE=npm" + + - "TEST_SUITE=spec_legacy DB=mysql GROUP_SIZE=2 GROUP=1" + - "TEST_SUITE=spec_legacy DB=mysql GROUP_SIZE=2 GROUP=2" + - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=3 GROUP=1" + - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=3 GROUP=2" + - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=3 GROUP=3" + - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=1" + - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=2" + - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=3" + - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=4" + - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=5" + - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=6" + +before_install: + # Custom plugin instructions follow. + + # Move the plugin into a subfolder. The plugin-provided Gemfile.plugins + # must refer to this folder. + - mkdir -p plugins/this + - echo `ls -a | tail -n+3 | grep -v plugins` plugins/this/ | xargs mv + + # Get OpenProject. + # Doing the fetch detour as you cannot clone into the current directory. + - git init + - git remote add openproject https://github.com/opf/openproject.git + - git fetch --depth=1 openproject + - git checkout openproject/$TRAVIS_BRANCH + + # End of custom plugin instructions. + + - "echo `firefox -v`" + - "export DISPLAY=:99.0" + - "/sbin/start-stop-daemon --start -v --pidfile ./tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1920x1080x16" + - "echo `xdpyinfo -display :99 | grep 'dimensions' | awk '{ print $2 }'`" + - travis_retry npm install + + # We need phantomjs 2.0 to get tests passing + - mkdir travis-phantomjs + - wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 + - tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs + - export PATH=$PWD/travis-phantomjs:$PATH + +before_script: + - sh script/ci_setup.sh $DB + +script: + - sh script/ci_runner.sh $TEST_SUITE $GROUP_SIZE $GROUP + +addons: + firefox: "45.0esr" + postgresql: "9.3" \ No newline at end of file From a98c8a2a5c1fadc7b63e21398775476125646b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 11 Apr 2016 09:43:25 +0200 Subject: [PATCH 051/104] Bump VERSION to 5.0.18 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 6f5fdc4a0c..6eab93d75f 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.17" + VERSION = "5.0.18" end end From ed420b96f8e2a2fa2d67f7052c77e1db6f949a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 27 May 2016 12:36:15 +0200 Subject: [PATCH 052/104] Bump VERSION to 5.0.19 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 6eab93d75f..459583c56e 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.18" + VERSION = "5.0.19" end end From e94c56352f5e76808c15e4dcfe231f068d233b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 20 Jun 2016 11:11:28 +0200 Subject: [PATCH 053/104] Bump VERSION to 5.0.20 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 459583c56e..47712484f9 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.0.19" + VERSION = "5.0.20" end end From db1dcbe7ddca4dc9ec5f40b1256528fcc70f6b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 19 Jul 2016 14:59:21 +0200 Subject: [PATCH 054/104] Bump version to 6.0.0 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 2234f71660..4306b8b3f9 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "5.1.0" + VERSION = "6.0.0" end end From 4a9f9f4ff704ccbae866891fd72360baabe2356b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 20 Jul 2016 21:41:02 +0200 Subject: [PATCH 055/104] Bump VERSION to 6.0.1 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 4306b8b3f9..630c2dd82d 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.0.0" + VERSION = "6.0.1" end end From 93b826af4ac982a8145c32e35ceba6dbb09ab1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 26 Jul 2016 11:12:19 +0200 Subject: [PATCH 056/104] Bump version to 6.1.0 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 630c2dd82d..bef1b4580c 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.0.1" + VERSION = "6.1.0" end end From e6303ee7234b41510bed8d1330e221215154bab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 1 Aug 2016 08:45:03 +0200 Subject: [PATCH 057/104] Bump VERSION to 6.0.2 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 630c2dd82d..b4cf881f34 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.0.1" + VERSION = "6.0.2" end end From 33719bb71b8e6a725f10952b42072c8812bf41a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 10 Aug 2016 16:33:10 +0200 Subject: [PATCH 058/104] Bump VERSION to 6.0.3 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index b4cf881f34..3ccf216d93 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.0.2" + VERSION = "6.0.3" end end From 07ee5a59d526472b232c885f9cb1753a7360e1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 16 Aug 2016 11:00:29 +0200 Subject: [PATCH 059/104] Bump VERSION to 6.0.4 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 3ccf216d93..1161ba80d2 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.0.3" + VERSION = "6.0.4" end end From 7ed331b1074491cde532f9d954ce62885208faf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 30 Aug 2016 11:53:25 +0200 Subject: [PATCH 060/104] Bump VERSION to 6.0.5 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 1161ba80d2..d5beaa4be0 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.0.4" + VERSION = "6.0.5" end end From 38890f20db1e7b7304f4a661dfa23e4373727ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 4 Oct 2016 13:49:51 +0200 Subject: [PATCH 061/104] Bump rails to 5.0.0 --- openproject-webhooks.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openproject-webhooks.gemspec b/openproject-webhooks.gemspec index 97366c2aef..1b1445aede 100644 --- a/openproject-webhooks.gemspec +++ b/openproject-webhooks.gemspec @@ -15,6 +15,6 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,doc,lib}/**/*"] + %w(README.md) - s.add_dependency 'rails', '~> 4.2.4' + s.add_dependency 'rails', '~> 5.0' end From c469e881afa00879d476fb3d412357f09e78eb42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 9 Nov 2016 15:50:08 +0100 Subject: [PATCH 062/104] Bump VERSION to 6.1.1 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index bef1b4580c..c55cb0cc6d 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.1.0" + VERSION = "6.1.1" end end From f572efd5ac4a22f1cac46657470cbd0c3da32bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 21 Nov 2016 15:11:32 +0100 Subject: [PATCH 063/104] Bump version to 6.2.0 [ci skip] --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index c55cb0cc6d..4a3fffde88 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.1.1" + VERSION = "6.2.0" end end From 339416e32df29d16e3a96bebe2ff9993d2dcc73a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 29 Nov 2016 15:55:26 +0100 Subject: [PATCH 064/104] Bump VERSION to 6.1.2 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index c55cb0cc6d..158e28d010 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.1.1" + VERSION = "6.1.2" end end From e8ebc81420c861a02efc9f65fc8942bc6e64697b Mon Sep 17 00:00:00 2001 From: Markus Kahl Date: Wed, 21 Dec 2016 18:59:58 +0100 Subject: [PATCH 065/104] Bump VERSION to 6.1.3 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 158e28d010..e194189a72 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.1.2" + VERSION = "6.1.3" end end From f8df3736e5c0eae742033f3df97ee3df922da95c Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Thu, 22 Dec 2016 16:26:06 +0100 Subject: [PATCH 066/104] Bump VERSION to 6.1.4 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index e194189a72..a3d99b133e 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.1.3" + VERSION = "6.1.4" end end From e214a5484e90d20a0cc7d6fdd3b9ac00e705d663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 25 Apr 2017 15:17:54 +0200 Subject: [PATCH 067/104] Bump version to 7.0.0 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 4a3fffde88..c0a65b5a45 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "6.2.0" + VERSION = "7.0.0" end end From eb5496ce72b6ba6e9f7d6c9e9640703700efac90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 1 Jun 2017 21:05:15 +0200 Subject: [PATCH 068/104] Bump VERSION to 7.0.1 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index c0a65b5a45..0848b53f64 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.0.0" + VERSION = "7.0.1" end end From 292733879c447fb0797af5114cab29c06b96b023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 2 Jun 2017 09:18:30 +0200 Subject: [PATCH 069/104] Bump version to 7.1.0 [ci skip] --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index c0a65b5a45..ffa2c666d2 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.0.0" + VERSION = "7.1.0" end end From 9fd9599715ffcd856710fe25e995b87f604de2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 8 Jun 2017 14:03:09 +0200 Subject: [PATCH 070/104] Bump VERSION to 7.0.2 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 0848b53f64..a852e2600f 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.0.1" + VERSION = "7.0.2" end end From f45b902d2cddbc3dd202481cef669ec1ffaf9357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 12 Jun 2017 16:30:27 +0200 Subject: [PATCH 071/104] Bump VERSION to 7.0.3 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index a852e2600f..2451ccc68e 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.0.2" + VERSION = "7.0.3" end end From 053336d35b4345f9f74af28e6b046e57ce977176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 20 Jun 2017 09:15:44 +0200 Subject: [PATCH 072/104] Bump version to 7.1.0 [ci skip] --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 2451ccc68e..ffa2c666d2 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.0.3" + VERSION = "7.1.0" end end From 45066c337f9a6774217d242871ada0956080b6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 14 Aug 2017 14:44:51 +0200 Subject: [PATCH 073/104] Bump version to 7.3.0 [ci skip] --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 33577304f4..18483b025f 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.2.0" + VERSION = "7.3.0" end end From 771e893e18b842f5e0b53ab97dafce0ab06d4ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 10 Oct 2017 14:13:18 +0200 Subject: [PATCH 074/104] Bump VERSION to 7.4.0 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 18483b025f..0ab39bd210 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.3.0" + VERSION = "7.4.0" end end From 6a312c612cdf7164ed4f409844c5df6db707a06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 3 Nov 2017 15:54:28 +0100 Subject: [PATCH 075/104] Updated travis.yml for geckodriver --- .travis.yml | 79 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93d28d4675..16393d5683 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ #-- copyright # OpenProject is a project management system. -# Copyright (C) 2012-2015 the OpenProject Foundation (OPF) +# Copyright (C) 2012-2017 the OpenProject Foundation (OPF) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2006-2017 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or @@ -33,17 +33,17 @@ language: ruby rvm: - - 2.2.3 + - 2.4.2 + +sudo: false +dist: trusty sudo: false cache: - - bundler: true - - directories: + bundler: true + directories: - frontend/node_modules - - frontend/bower_components - -bundler_args: --without development production branches: only: @@ -55,25 +55,23 @@ env: global: - CI=true - RAILS_ENV=test - - COVERAGE=true matrix: - - "TEST_SUITE=plugins:spec DB=mysql" - - "TEST_SUITE=plugins:cucumber DB=mysql" + - "TEST_SUITE=plugins:specs DB=mysql GROUP_SIZE=1 GROUP=1" + - "TEST_SUITE=plugins:features DB=mysql GROUP_SIZE=1 GROUP=1" - "TEST_SUITE=npm" - - "TEST_SUITE=spec_legacy DB=mysql GROUP_SIZE=2 GROUP=1" - - "TEST_SUITE=spec_legacy DB=mysql GROUP_SIZE=2 GROUP=2" - - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=3 GROUP=1" - - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=3 GROUP=2" - - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=3 GROUP=3" - - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=1" - - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=2" - - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=3" - - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=4" - - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=5" - - "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=6" + - "TEST_SUITE=spec_legacy DB=mysql" + - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=1 GROUP=1" + - "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=1" + - "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=2" + - "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=3" + - "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=4" + - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=1" + - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=2" + - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=3" + - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=4" before_install: # Custom plugin instructions follow. @@ -91,25 +89,42 @@ before_install: - git checkout openproject/$TRAVIS_BRANCH # End of custom plugin instructions. - - "echo `firefox -v`" - "export DISPLAY=:99.0" - "/sbin/start-stop-daemon --start -v --pidfile ./tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1920x1080x16" - "echo `xdpyinfo -display :99 | grep 'dimensions' | awk '{ print $2 }'`" - - travis_retry npm install - # We need phantomjs 2.0 to get tests passing - - mkdir travis-phantomjs - - wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 - - tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs - - export PATH=$PWD/travis-phantomjs:$PATH + # Install geckodriver + - wget https://github.com/mozilla/geckodriver/releases/download/v0.19.0/geckodriver-v0.19.0-linux64.tar.gz + - mkdir geckodriver + - tar -xzf geckodriver-v0.19.0-linux64.tar.gz -C geckodriver + - export PATH=$PATH:$PWD/geckodriver + + # Install Node LTS Boron (6.9.1) + - "nvm install 6.9.1" + +bundler_args: --binstubs --without development production docker before_script: - - sh script/ci_setup.sh $DB + - sh script/ci_setup.sh $TEST_SUITE $DB script: - - sh script/ci_runner.sh $TEST_SUITE $GROUP_SIZE $GROUP + - sh script/ci_runner.sh + +notifications: + email: false + slack: + on_success: change + on_failure: always + on_pull_requests: false + rooms: + # CE + - secure: "mQqyZRjOix72MAAcjIanPOCfzMlQOqMhYOEd+6SNCcK7nb9ku0rPtFYWtifvp3+ajA5YKVJZ/W2qRn+Flw99zg8SfhPBV89SALXapUnjuZW0rcPexP0vrQW/AR6176DG3+WQOM8BFOYmN1yuGsz7YZK3xZo7yPp8XHKwzWoEYS6BOEUyfyE5T8dGJGqIKwpGEnnpBJf+CVsXeX56xg6wL+9CPVIEDb7IcrPoYQ5K6Kh9gq+7Ube7I7lbsSpdm1TAS4si7G9A6IaJ4WD1QvnUDrajGz2IM/bkP0zs50kGSrbagm707QMC8P4aLzJ64aUOfziyeYA1BSiDl5dZCUc3/dJtjMkUoRlmErwe6x8N5mwn6iVQ5LtWQeJIiy+wrBvjnghkl2/B7z3iZvEsDl6Uip6Dtv7ccmSskkh0ulsEykxWdAsRddpSaEYHv5pqex9aVgIMljM8o3DFTQclhVyGM0nrryDiMjhkCR5spighp/uR7nHEULlmJMGilyjqy6iB3/S6O1CXY110jpgYEAqhxkY9VA1hYYVLsoKV90uUGlnJcQRqQPoP3q1OqUGlRT5Y2ydM2FTBvsBGB+bhMQgZhZORqlkfIYzWDoUs4v6vM9v16XsP6TeXzNd0BPCZ+WamtOZBpwvSXZl85lqIEFONZ12uIr1R/sPsv6bQndN6gLk=" + # EE + - secure: "P6co7i4H73ZBjH/zRt5a+OuZp+x0aDUOorXRKO3RmCfgR2cu02+MB0nHkXrbKsfzFMBLjEEi3nqVUBhC2vxW+vpPrYuhlxp3it7hVwGhTgghjRjI1/0ybAUZjxYgeTt+QhUJsKEuE3tlwPq/YQ5hqhcO/AtEpORn9W11oi0NGaCmSzcKKoXgPWSfiU1DZZV//lpvkGzxaaYWL9GgmiQOEKN8PSRT0RH1HjAYug7X3D6fkPdyYkwmzL5buBO6r1/hJb+zCXtoak5xbCSy2dT3qN3FSbjlUZc2r5mgXSYgThM6KCHuQiT8zI1eRhHXMPxY47SpEGk1NuRMFqhSUkbYe+CgbLo9qjVG4mbt2We6MCbNmAW1lYDAvFefxOP5Kg6kjp1t7Ghs26IWcqlWHP200ujrPbl28bO3FtBKvhXDf/DXNQfVSk1G3EaDq9UgF/XlDZc2LScj8iuu03iJNdLJLL9WDj6FM3z1F9zMd8zYwPq9VHoZHqJbYc8GVfaeV3PQQk56GU4GsfeemH8oqSyVQkFLQDtVPEAHputJ85I0JR67VNFEdUklb9Ab3Xqs8iCtZvFx/Frfqsfh99SCm+Z4ABKOOTWepVigPKp4JH0t03zXiVmgNwd92UBvYcw0cc1rHr2GhROzGx0qUDdrK+6gOskBl8TvQLWkpmNsSlRGYzo=" + # MP + - secure: "dkVCNYSedLfeuqTboRPx/iWmXldhoHZpSp83cpkG6ZL81Psut2ZEHg6aBiWgqQWdfNAca4a51hWXs6utRqdgnxo51YAB/pMy0/b+jEOjZvuShOVz6TVqn5W5JLTNZJeVZL+BgvwXZWbIujH/cSuUv+h7GTnS+8Y4b2ZrCYilP35sAck2bbbAsKzbuW2yZZqK7X0UnSjoxg+KeT9DuK1zjjJJ6CZig1/n5ZjciQIv7JD50hmqFxBgjyBi71Loh/iohUF89EoQRXm0KkSmEhCINld5s+7SP4jSmnqyrNamNNw2ZGCgg3OXhcvDqOHjPwpCNNhrtzTExt/Z2cTzHz4FnV9ncJj9i1pkbjveuudVUTeaSHHXjw/X496OKLP3LwEZYggUCyc3nu9qR2zSs6zdG4ijhclOVzNrXDDixjpYGmOg8mVunG2cwFUSjtmX8nyPNXQvRnvsfnVYalprqXJHGmQW07nFE/2lbjdmnQiCEExNsKXO5vqrqo6RYOtTfka9B5s3ZkTkXgZkTWuEgWbaMC/fZhi0NCu2Ow3XOzQrs8hVLF4w1zngjqOLjk+LftqWwT42D47RKW3SZfVEVm8Vw+JGfh/uJUNAsPsu+Mybw8k0aDmLjPTlRZD+dYvQ2EPizgc2+cf+0GVoaGzKZF+cJ8I0ut8kO13M9ZmjiHU0se4=" addons: firefox: "45.0esr" - postgresql: "9.3" \ No newline at end of file + postgresql: "9.3" From f056da4668b194970f8c3456a751ad98ef341df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 28 Nov 2017 10:56:55 +0100 Subject: [PATCH 076/104] Updating generated .travis.yml from devkit --- .travis.yml | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 16393d5683..94f8f56b51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,20 +26,14 @@ # See doc/COPYRIGHT.rdoc for more details. #++ -# Travis configuration based on the respective OpenProject core configuration. -# Everything save for the matrix section and additional `before_install` -# instructions is copied and pasted from the core. - language: ruby rvm: - 2.4.2 -sudo: false +sudo: required dist: trusty -sudo: false - cache: bundler: true directories: @@ -55,13 +49,12 @@ env: global: - CI=true - RAILS_ENV=test + - GECKODRIVER_VERSION="0.19.1" matrix: - "TEST_SUITE=plugins:specs DB=mysql GROUP_SIZE=1 GROUP=1" - "TEST_SUITE=plugins:features DB=mysql GROUP_SIZE=1 GROUP=1" - - "TEST_SUITE=npm" - - "TEST_SUITE=spec_legacy DB=mysql" - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=1 GROUP=1" - "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=1" @@ -73,9 +66,10 @@ env: - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=3" - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=4" -before_install: - # Custom plugin instructions follow. + +before_install: + ## Custom plugin instructions follow. # Move the plugin into a subfolder. The plugin-provided Gemfile.plugins # must refer to this folder. - mkdir -p plugins/this @@ -88,18 +82,17 @@ before_install: - git fetch --depth=1 openproject - git checkout openproject/$TRAVIS_BRANCH - # End of custom plugin instructions. - "echo `firefox -v`" - "export DISPLAY=:99.0" - "/sbin/start-stop-daemon --start -v --pidfile ./tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1920x1080x16" - "echo `xdpyinfo -display :99 | grep 'dimensions' | awk '{ print $2 }'`" - # Install geckodriver - - wget https://github.com/mozilla/geckodriver/releases/download/v0.19.0/geckodriver-v0.19.0-linux64.tar.gz + - echo "Installing geckodriver ${GECKODRIVER_VERSION}" + - wget https://github.com/mozilla/geckodriver/releases/download/v${GECKODRIVER_VERSION}/geckodriver-v${GECKODRIVER_VERSION}-linux64.tar.gz - mkdir geckodriver - - tar -xzf geckodriver-v0.19.0-linux64.tar.gz -C geckodriver + - tar -xzf geckodriver-v${GECKODRIVER_VERSION}-linux64.tar.gz -C geckodriver - export PATH=$PATH:$PWD/geckodriver - + - echo `geckodriver --version` # Install Node LTS Boron (6.9.1) - "nvm install 6.9.1" @@ -126,5 +119,8 @@ notifications: - secure: "dkVCNYSedLfeuqTboRPx/iWmXldhoHZpSp83cpkG6ZL81Psut2ZEHg6aBiWgqQWdfNAca4a51hWXs6utRqdgnxo51YAB/pMy0/b+jEOjZvuShOVz6TVqn5W5JLTNZJeVZL+BgvwXZWbIujH/cSuUv+h7GTnS+8Y4b2ZrCYilP35sAck2bbbAsKzbuW2yZZqK7X0UnSjoxg+KeT9DuK1zjjJJ6CZig1/n5ZjciQIv7JD50hmqFxBgjyBi71Loh/iohUF89EoQRXm0KkSmEhCINld5s+7SP4jSmnqyrNamNNw2ZGCgg3OXhcvDqOHjPwpCNNhrtzTExt/Z2cTzHz4FnV9ncJj9i1pkbjveuudVUTeaSHHXjw/X496OKLP3LwEZYggUCyc3nu9qR2zSs6zdG4ijhclOVzNrXDDixjpYGmOg8mVunG2cwFUSjtmX8nyPNXQvRnvsfnVYalprqXJHGmQW07nFE/2lbjdmnQiCEExNsKXO5vqrqo6RYOtTfka9B5s3ZkTkXgZkTWuEgWbaMC/fZhi0NCu2Ow3XOzQrs8hVLF4w1zngjqOLjk+LftqWwT42D47RKW3SZfVEVm8Vw+JGfh/uJUNAsPsu+Mybw8k0aDmLjPTlRZD+dYvQ2EPizgc2+cf+0GVoaGzKZF+cJ8I0ut8kO13M9ZmjiHU0se4=" addons: - firefox: "45.0esr" - postgresql: "9.3" + # Setting latest here due to the switch from old selenium bindings + # to Marionette. At the date of this writing, ESR is Firefox 52 and has + # bad support for it. Thus we use latest (57.0 as of this writing) + firefox: "latest" + postgresql: "9.6" From e8ac75b1a1c4b323e2a476ed392702939113ac3b Mon Sep 17 00:00:00 2001 From: Markus Kahl Date: Mon, 8 Jan 2018 11:29:02 +0000 Subject: [PATCH 077/104] Outgoing webhooks Adds outgoing webhooks for work package events. https://community.openproject.com/projects/openproject/work_packages/24832/activity --- Gemfile.plugins | 9 + app/assets/javascripts/webhooks/webhooks.js | 12 + app/assets/stylesheets/webhooks/webhooks.sass | 18 ++ app/cells/views/response_body.erb | 29 +++ .../webhooks/outgoing/deliveries/row_cell.rb | 21 ++ .../outgoing/deliveries/table_cell.rb | 27 +++ .../webhooks/outgoing/webhooks/row_cell.rb | 83 +++++++ .../webhooks/outgoing/webhooks/table_cell.rb | 43 ++++ .../webhooks/incoming/hooks_controller.rb | 44 ++++ .../webhooks/outgoing/admin_controller.rb | 84 +++++++ app/controllers/webhooks_controller.rb | 40 ---- app/models/webhooks.rb | 5 + app/models/webhooks/event.rb | 7 + app/models/webhooks/log.rb | 19 ++ app/models/webhooks/project.rb | 8 + app/models/webhooks/webhook.rb | 46 ++++ .../outgoing/update_webhook_service.rb | 50 ++++ .../webhooks/outgoing/admin/_form.html.erb | 98 ++++++++ .../outgoing/admin/_header_tags.html.erb | 4 + .../webhooks/outgoing/admin/edit.html.erb | 23 ++ .../webhooks/outgoing/admin/index.html.erb | 19 ++ .../webhooks/outgoing/admin/new.html.erb | 23 ++ .../webhooks/outgoing/admin/show.html.erb | 74 ++++++ app/workers/webhook_job.rb | 34 +++ app/workers/work_package_webhook_job.rb | 107 +++++++++ config/locales/en.yml | 57 +++++ config/routes.rb | 12 +- db/migrate/20171218205557_add_webhooks.rb | 24 ++ .../20171219145752_create_webhook_logs.rb | 19 ++ lib/open_project/webhooks/engine.rb | 18 +- lib/open_project/webhooks/event_resources.rb | 41 ++++ .../webhooks/event_resources/base.rb | 77 ++++++ .../webhooks/event_resources/work_package.rb | 31 +++ .../outgoing/admin_controller_spec.rb | 223 ++++++++++++++++++ spec/controllers/webhooks_controller_spec.rb | 6 +- spec/factories/webhook_factory.rb | 38 +++ spec/factories/webhook_log_factory.rb | 40 ++++ spec/features/manage_webhooks_spec.rb | 102 ++++++++ spec/models/webhook_spec.rb | 57 +++++ .../outgoing/admin_controller_spec.rb | 63 +++++ spec/workers/work_package_webhook_job.rb | 125 ++++++++++ 41 files changed, 1812 insertions(+), 48 deletions(-) create mode 100644 Gemfile.plugins create mode 100644 app/assets/javascripts/webhooks/webhooks.js create mode 100644 app/assets/stylesheets/webhooks/webhooks.sass create mode 100644 app/cells/views/response_body.erb create mode 100644 app/cells/webhooks/outgoing/deliveries/row_cell.rb create mode 100644 app/cells/webhooks/outgoing/deliveries/table_cell.rb create mode 100644 app/cells/webhooks/outgoing/webhooks/row_cell.rb create mode 100644 app/cells/webhooks/outgoing/webhooks/table_cell.rb create mode 100644 app/controllers/webhooks/incoming/hooks_controller.rb create mode 100644 app/controllers/webhooks/outgoing/admin_controller.rb delete mode 100644 app/controllers/webhooks_controller.rb create mode 100644 app/models/webhooks.rb create mode 100644 app/models/webhooks/event.rb create mode 100644 app/models/webhooks/log.rb create mode 100644 app/models/webhooks/project.rb create mode 100644 app/models/webhooks/webhook.rb create mode 100644 app/services/webhooks/outgoing/update_webhook_service.rb create mode 100644 app/views/webhooks/outgoing/admin/_form.html.erb create mode 100644 app/views/webhooks/outgoing/admin/_header_tags.html.erb create mode 100644 app/views/webhooks/outgoing/admin/edit.html.erb create mode 100644 app/views/webhooks/outgoing/admin/index.html.erb create mode 100644 app/views/webhooks/outgoing/admin/new.html.erb create mode 100644 app/views/webhooks/outgoing/admin/show.html.erb create mode 100644 app/workers/webhook_job.rb create mode 100644 app/workers/work_package_webhook_job.rb create mode 100644 config/locales/en.yml create mode 100644 db/migrate/20171218205557_add_webhooks.rb create mode 100644 db/migrate/20171219145752_create_webhook_logs.rb create mode 100644 lib/open_project/webhooks/event_resources.rb create mode 100644 lib/open_project/webhooks/event_resources/base.rb create mode 100644 lib/open_project/webhooks/event_resources/work_package.rb create mode 100644 spec/controllers/outgoing/admin_controller_spec.rb create mode 100644 spec/factories/webhook_factory.rb create mode 100644 spec/factories/webhook_log_factory.rb create mode 100644 spec/features/manage_webhooks_spec.rb create mode 100644 spec/models/webhook_spec.rb create mode 100644 spec/routing/webhooks/outgoing/admin_controller_spec.rb create mode 100644 spec/workers/work_package_webhook_job.rb diff --git a/Gemfile.plugins b/Gemfile.plugins new file mode 100644 index 0000000000..a1118a1656 --- /dev/null +++ b/Gemfile.plugins @@ -0,0 +1,9 @@ +# Used by travis to bundle this plugin with the OpenProject core. +# The tested plugin will be moved to the path `./plugins/this` +# whereas OpenProject will be checked out to `.`. + +group :opf_plugins do + gem 'openproject-webhooks', path: 'plugins/this' +end + +# If the plugin has any dependencies declare them here: diff --git a/app/assets/javascripts/webhooks/webhooks.js b/app/assets/javascripts/webhooks/webhooks.js new file mode 100644 index 0000000000..ce14ad1dbe --- /dev/null +++ b/app/assets/javascripts/webhooks/webhooks.js @@ -0,0 +1,12 @@ +jQuery(function ($) { + + // Toggle selector for new/edit webhooks projects + $('input[name="webhook[project_ids]"]').change(function(){ + $('.webhooks--selected-project-ids').prop('disabled', $(this).val() === 'all'); + }); + + $('input[name="webhook[type_ids]"]').change(function(){ + $('.webhooks--selected-type-ids').prop('disabled', $(this).val() === 'all'); + }); + +}); \ No newline at end of file diff --git a/app/assets/stylesheets/webhooks/webhooks.sass b/app/assets/stylesheets/webhooks/webhooks.sass new file mode 100644 index 0000000000..8751825f24 --- /dev/null +++ b/app/assets/stylesheets/webhooks/webhooks.sass @@ -0,0 +1,18 @@ +// Add some paddings to action links +.webhooks--outgoing-webhook-row td.buttons + a:not(:last-child):after + content: "," + padding: 0 1px + +.webhooks--delivery-success + color: #019875 + +.webhooks--delivery-error + color: #c0392b + +.webhooks--response-body-modal + min-width: 25vw + + pre + background: #f1f1f1 + padding: 5px \ No newline at end of file diff --git a/app/cells/views/response_body.erb b/app/cells/views/response_body.erb new file mode 100644 index 0000000000..19b420aaaa --- /dev/null +++ b/app/cells/views/response_body.erb @@ -0,0 +1,29 @@ + + + <%= op_icon('icon-info1') %> + <%= t(:button_show) %> + + + \ No newline at end of file diff --git a/app/cells/webhooks/outgoing/deliveries/row_cell.rb b/app/cells/webhooks/outgoing/deliveries/row_cell.rb new file mode 100644 index 0000000000..42068c8d94 --- /dev/null +++ b/app/cells/webhooks/outgoing/deliveries/row_cell.rb @@ -0,0 +1,21 @@ +module ::Webhooks + module Outgoing + module Deliveries + class RowCell < ::RowCell + include ::IconsHelper + + def log + model + end + + def time + model.updated_at.to_s # Force ISO8601 + end + + def response_body + render locals: { log_entry: log }, prefixes: ["#{::OpenProject::Webhooks::Engine.root}/app/cells/views"] + end + end + end + end +end \ No newline at end of file diff --git a/app/cells/webhooks/outgoing/deliveries/table_cell.rb b/app/cells/webhooks/outgoing/deliveries/table_cell.rb new file mode 100644 index 0000000000..66bab5a586 --- /dev/null +++ b/app/cells/webhooks/outgoing/deliveries/table_cell.rb @@ -0,0 +1,27 @@ +module ::Webhooks + module Outgoing + module Deliveries + class TableCell < ::TableCell + columns :id, :event_name, :time, :response_code, :response_body + + def sortable? + false + end + + def empty_row_message + I18n.t 'webhooks.outgoing.deliveries.no_results_table' + end + + def headers + [ + ['id', caption: I18n.t('attributes.id')], + ['event_name', caption: ::Webhooks::Log.human_attribute_name('event_name')], + ['time', caption: I18n.t('webhooks.outgoing.deliveries.time')], + ['response_code', caption: ::Webhooks::Log.human_attribute_name('response_code')], + ['response_body', caption: ::Webhooks::Log.human_attribute_name('response_body')], + ] + end + end + end + end +end diff --git a/app/cells/webhooks/outgoing/webhooks/row_cell.rb b/app/cells/webhooks/outgoing/webhooks/row_cell.rb new file mode 100644 index 0000000000..c39bbc38df --- /dev/null +++ b/app/cells/webhooks/outgoing/webhooks/row_cell.rb @@ -0,0 +1,83 @@ +module ::Webhooks + module Outgoing + module Webhooks + class RowCell < ::RowCell + include ::IconsHelper + + def webhook + model + end + + def name + link_to webhook.name, + { controller: table.target_controller, action: :show, webhook_id: webhook.id } + end + + def enabled + if webhook.enabled? + op_icon 'icon-yes' + end + end + + def events + selected_events = + webhook + .events + .pluck(:name) + .map(&method(:lookup_event_name)) + .compact + .uniq + + count = selected_events.count + if count <= 3 + selected_events.join(', ') + else + content_tag('span', count, class: 'badge -border-only') + end + end + + def lookup_event_name(name) + OpenProject::Webhooks::EventResources.lookup_resource_name(name) + end + + def selected_projects + selected = webhook.projects.map(&:name) + + if selected.empty? + "(#{I18n.t(:label_all)})" + elsif selected.size <= 3 + webhook.projects.pluck(:name).join(', ') + else + content_tag('span', selected, class: 'badge -border-only') + end + end + + def row_css_class + [ + 'webhooks--outgoing-webhook-row', + "webhooks--outgoing-webhook-row-#{model.id}" + ].join(' ') + end + + ### + + def button_links + [edit_link, delete_link] + end + + def edit_link + link_to I18n.t(:button_edit), + { controller: table.target_controller, action: :edit, webhook_id: webhook.id }, + class: 'button--link' + end + + def delete_link + link_to I18n.t(:button_delete), + { controller: table.target_controller, action: :destroy, webhook_id: webhook.id }, + data: { method: 'delete', confirm: I18n.t(:text_are_you_sure) }, + class: 'button--link' + end + end + end + end +end diff --git a/app/cells/webhooks/outgoing/webhooks/table_cell.rb b/app/cells/webhooks/outgoing/webhooks/table_cell.rb new file mode 100644 index 0000000000..53628da9ee --- /dev/null +++ b/app/cells/webhooks/outgoing/webhooks/table_cell.rb @@ -0,0 +1,43 @@ +module ::Webhooks + module Outgoing + module Webhooks + class TableCell < ::TableCell + columns :name, :enabled, :selected_projects, :events, :description + + def initial_sort + [:id, :asc] + end + + def target_controller + 'webhooks/outgoing/admin' + end + + def sortable? + false + end + + def inline_create_link + link_to({ controller: target_controller, action: :new }, + class: 'webhooks--add-row wp-inline-create--add-link', + title: I18n.t('webhooks.outgoing.label_add_new')) do + op_icon('icon icon-add') + end + end + + def empty_row_message + I18n.t 'webhooks.outgoing.no_results_table' + end + + def headers + [ + ['name', caption: I18n.t('attributes.name')], + ['enabled', caption: I18n.t(:label_active)], + ['selected_projects', caption: ::Webhooks::Webhook.human_attribute_name('projects')], + ['events', caption: I18n.t('webhooks.outgoing.label_event_resources')], + ['description', caption: I18n.t('attributes.description')] + ] + end + end + end + end +end \ No newline at end of file diff --git a/app/controllers/webhooks/incoming/hooks_controller.rb b/app/controllers/webhooks/incoming/hooks_controller.rb new file mode 100644 index 0000000000..fbb9f94c1d --- /dev/null +++ b/app/controllers/webhooks/incoming/hooks_controller.rb @@ -0,0 +1,44 @@ +#-- encoding: UTF-8 +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + +require 'json' + +module Webhooks + module Incoming + class HooksController < ApplicationController + accept_key_auth :handle_hook + + def api_request? + # OpenProject only allows API requests based on an Accept request header. + # Webhooks (at least GitHub) don't send an Accept header as they're not interested + # in any part of the response except the HTTP status code. + # Also handling requests with a application/json Content-Type as API requests + # should be safe regarding CSRF as browsers don't send forms as JSON. + super || request.content_type == "application/json" + end + + def handle_hook + hook = OpenProject::Webhooks.find(params.require 'hook_name') + + if hook + code = hook.handle(env, params, find_current_user) + head code.is_a?(Integer) ? code : 200 + else + head :not_found + end + end + end + end +end diff --git a/app/controllers/webhooks/outgoing/admin_controller.rb b/app/controllers/webhooks/outgoing/admin_controller.rb new file mode 100644 index 0000000000..4338babf67 --- /dev/null +++ b/app/controllers/webhooks/outgoing/admin_controller.rb @@ -0,0 +1,84 @@ +module Webhooks + module Outgoing + class AdminController < ::ApplicationController + layout 'admin' + menu_item :plugin_webhooks + + before_action :require_admin + before_action :find_webhook, only: [:show, :edit, :update, :destroy] + + def index + @webhooks = webhook_class.all + end + + def show; end + def edit; end + + def new + @webhook = webhook_class.new_default + end + + def create + service = ::Webhooks::Outgoing::UpdateWebhookService.new(webhook_class.new_default, current_user: current_user) + action = service.call(attributes: permitted_webhooks_params) + if action.success? + flash[:notice] = I18n.t(:notice_successful_create) + redirect_to action: :index + else + @webhook = action.result + render action: :new + end + end + + def update + service = ::Webhooks::Outgoing::UpdateWebhookService.new(@webhook, current_user: current_user) + action = service.call(attributes: permitted_webhooks_params) + if action.success? + flash[:notice] = I18n.t(:notice_successful_update) + redirect_to action: :index + else + @webhook = action.result + render action: :edit + end + end + + def destroy + if @webhook.destroy + flash[:notice] = I18n.t(:notice_successful_delete) + else + flash[:error] = I18n.t(:error_failed_to_delete_entry) + end + + redirect_to action: :index + end + + private + + def find_webhook + @webhook = webhook_class.find(params[:webhook_id]) + rescue ActiveRecord::RecordNotFound + render_404 + end + + def webhook_class + ::Webhooks::Webhook + end + + def permitted_webhooks_params + params + .require(:webhook) + .permit(:name, :description, :url, :secret, :enabled, + :project_ids, selected_project_ids: [], events: []) + + end + + def show_local_breadcrumb + true + end + + def default_breadcrumb + [] + end + end + end +end \ No newline at end of file diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb deleted file mode 100644 index 571c822e8d..0000000000 --- a/app/controllers/webhooks_controller.rb +++ /dev/null @@ -1,40 +0,0 @@ -#-- encoding: UTF-8 -#-- copyright -# OpenProject is a project management system. -# Copyright (C) 2014 the OpenProject Foundation (OPF) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# 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. -# -# See doc/COPYRIGHT.md for more details. -#++ - -require 'json' - -class WebhooksController < ApplicationController - accept_key_auth :handle_hook - - def api_request? - # OpenProject only allows API requests based on an Accept request header. - # Webhooks (at least GitHub) don't send an Accept header as they're not interested - # in any part of the response except the HTTP status code. - # Also handling requests with a application/json Content-Type as API requests - # should be safe regarding CSRF as browsers don't send forms as JSON. - super || request.content_type == "application/json" - end - - def handle_hook - hook = OpenProject::Webhooks.find(params.require 'hook_name') - - if hook - code = hook.handle(env, params, find_current_user) - head code.is_a?(Integer) ? code : 200 - else - head :not_found - end - end -end diff --git a/app/models/webhooks.rb b/app/models/webhooks.rb new file mode 100644 index 0000000000..aac358193c --- /dev/null +++ b/app/models/webhooks.rb @@ -0,0 +1,5 @@ +module Webhooks + def self.table_name_prefix + 'webhooks_' + end +end \ No newline at end of file diff --git a/app/models/webhooks/event.rb b/app/models/webhooks/event.rb new file mode 100644 index 0000000000..5484285d8b --- /dev/null +++ b/app/models/webhooks/event.rb @@ -0,0 +1,7 @@ +module Webhooks + class Event < ActiveRecord::Base + belongs_to :webhook + validates_associated :webhook + validates_presence_of :name + end +end \ No newline at end of file diff --git a/app/models/webhooks/log.rb b/app/models/webhooks/log.rb new file mode 100644 index 0000000000..242cc6759f --- /dev/null +++ b/app/models/webhooks/log.rb @@ -0,0 +1,19 @@ +module Webhooks + class Log < ActiveRecord::Base + belongs_to :webhook, foreign_key: :webhooks_webhook_id, class_name: '::Webhooks::Webhook', dependent: :destroy + + validates :url, presence: true + validates :event_name, presence: true + validates :response_code, presence: true + + serialize :response_headers, Hash + serialize :request_headers, Hash + + validates :request_headers, presence: true + validates :request_body, presence: true + + def self.newest(limit: 10) + order(updated_at: :desc).limit(limit) + end + end +end \ No newline at end of file diff --git a/app/models/webhooks/project.rb b/app/models/webhooks/project.rb new file mode 100644 index 0000000000..7740b515cb --- /dev/null +++ b/app/models/webhooks/project.rb @@ -0,0 +1,8 @@ +module Webhooks + class Project < ActiveRecord::Base + belongs_to :webhook + belongs_to :project, class_name: '::Project' + + validates_presence_of :project + end +end \ No newline at end of file diff --git a/app/models/webhooks/webhook.rb b/app/models/webhooks/webhook.rb new file mode 100644 index 0000000000..6735ee2a48 --- /dev/null +++ b/app/models/webhooks/webhook.rb @@ -0,0 +1,46 @@ +module Webhooks + class Webhook < ActiveRecord::Base + default_scope { order(id: :asc) } + + validates_presence_of :name + validates_presence_of :url + + validates_uniqueness_of :name + validates :url, url: true + + has_many :events, foreign_key: :webhooks_webhook_id, class_name: '::Webhooks::Event', dependent: :delete_all + has_many :webhook_projects, foreign_key: :webhooks_webhook_id, class_name: '::Webhooks::Project', dependent: :delete_all + has_many :projects, through: :webhook_projects + has_many :deliveries, foreign_key: :webhooks_webhook_id, class_name: '::Webhooks::Log', dependent: :delete_all + + def self.enabled + where(enabled: true) + end + + def self.with_event_name(event_name) + enabled + .joins(:events) + .where("#{::Webhooks::Event.table_name}.name" => event_name) + end + + def self.new_default + new all_projects: true, enabled: true + end + + def all_projects? + !!all_projects + end + + def enabled? + !!enabled + end + + def event_names + events.pluck(:name) + end + + def event_names=(names) + self.events = names.map { |name| events.build(name: name) } + end + end +end \ No newline at end of file diff --git a/app/services/webhooks/outgoing/update_webhook_service.rb b/app/services/webhooks/outgoing/update_webhook_service.rb new file mode 100644 index 0000000000..327d9d39c9 --- /dev/null +++ b/app/services/webhooks/outgoing/update_webhook_service.rb @@ -0,0 +1,50 @@ +module Webhooks + module Outgoing + class UpdateWebhookService + attr_reader :current_user + attr_reader :webhook + + def initialize(webhook, current_user:) + @current_user = current_user + @webhook = webhook + end + + def call(attributes: {}) + ::Webhooks::Webhook.transaction do + set_attributes attributes + raise ActiveRecord::Rollback unless (webhook.errors.empty? && webhook.save) + end + + ServiceResult.new success: webhook.errors.empty? , errors: webhook.errors, result: webhook + end + + private + + def set_attributes(params) + set_selected_projects!(params) + set_selected_events!(params) + + webhook.attributes = params + end + + def set_selected_events!(params) + webhook.event_names = params.delete(:events).select(&:present?) + end + + def set_selected_projects!(params) + option = params.delete :project_ids + selected = params.delete :selected_project_ids + + if option == 'all' + webhook.all_projects = true + else + webhook.all_projects = false + webhook.project_ids = selected + end + rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotFound => e + Rails.logger.error "Failed to set project association on webhook: #{e}" + webhook.errors.add :project_ids, :invalid + end + end + end +end \ No newline at end of file diff --git a/app/views/webhooks/outgoing/admin/_form.html.erb b/app/views/webhooks/outgoing/admin/_form.html.erb new file mode 100644 index 0000000000..e2a953dfcd --- /dev/null +++ b/app/views/webhooks/outgoing/admin/_form.html.erb @@ -0,0 +1,98 @@ +
+

+ <%= t 'webhooks.outgoing.form.introduction' %> +
+ <%= link_to t('webhooks.outgoing.form.apiv3_doc_url'), OpenProject::Static::Links.links[:api_docs][:href] %> +

+ +
+ <%= f.text_field :name, required: true, container_class: '-middle' %> +
+ +
+ <%= f.url_field :url, required: true, container_class: '-wide' %> +
+ +
+ <%= f.text_area :description, placeholder: t('webhooks.outgoing.form.description.placeholder'), container_class: '-wide' %> +
+ +
+ <%= f.text_field :secret, container_class: '-wide' %> +
+ <%= t('webhooks.outgoing.form.secret.description') %> +
+
+ +
+ <%= f.check_box :enabled %> +
+ <%= t('webhooks.outgoing.form.enabled.description') %> +
+
+
+ +
+ + <%= t 'webhooks.outgoing.form.events.title' %> + +
+ + (<%= check_all_links 'webhooks-selected-events' %>) + +
+ + <% event_names = @webhook.event_names %> + <% OpenProject::Webhooks::EventResources.available_events_map.each do |resource_label, events| %> +
+ +
+ <% events.each do |key, label| %> + + <% end %> +
+
+ <% end %> +
+ +
+ + <%= t 'webhooks.outgoing.form.project_ids.title' %> + +

<%= t('webhooks.outgoing.form.project_ids.description') %>

+
+ <%= f.radio_button :project_ids, + 'all', + checked: @webhook.all_projects?, + label: t('webhooks.outgoing.form.project_ids.all'), + container_class: '-wide' %> +
+
+ <%= f.radio_button :project_ids, + 'selection', + checked: !@webhook.all_projects?, + label: t('webhooks.outgoing.form.project_ids.selected'), + container_class: '-wide' %> +
+ +
+ +
+ <% Project.pluck(:id, :name).each do |id, name| %> + + <% end %> +
+
+
diff --git a/app/views/webhooks/outgoing/admin/_header_tags.html.erb b/app/views/webhooks/outgoing/admin/_header_tags.html.erb new file mode 100644 index 0000000000..5188ae094f --- /dev/null +++ b/app/views/webhooks/outgoing/admin/_header_tags.html.erb @@ -0,0 +1,4 @@ +<% content_for :header_tags do %> + <%= stylesheet_link_tag('webhooks/webhooks.css') %> + <%= javascript_include_tag('webhooks/webhooks.js') %> +<% end %> \ No newline at end of file diff --git a/app/views/webhooks/outgoing/admin/edit.html.erb b/app/views/webhooks/outgoing/admin/edit.html.erb new file mode 100644 index 0000000000..89fef9e624 --- /dev/null +++ b/app/views/webhooks/outgoing/admin/edit.html.erb @@ -0,0 +1,23 @@ + +<%= render partial: 'header_tags' %> +<% html_title(t(:label_administration), t('webhooks.outgoing.label_edit')) -%> +<% local_assigns[:additional_breadcrumb] = [ + link_to(t('webhooks.plural'), admin_outgoing_webhooks_path), + t('webhooks.outgoing.label_edit') + ] +%> + +<%= toolbar title: t('webhooks.outgoing.label_edit') %> + +<%= error_messages_for @webhook %> + +<%= labelled_tabular_form_for @webhook, + url: { action: :update }, + as: 'webhook', + html: { class: 'form', autocomplete: 'off' } do |f| %> + <%= render partial: "form", locals: { f: f, webhook: @webhook } %> +

+ <%= styled_button_tag l(:button_save), class: '-highlight -with-icon icon-checkmark' %> + <%= link_to t(:button_cancel), { action: :index }, class: 'button' %> +

+<% end %> \ No newline at end of file diff --git a/app/views/webhooks/outgoing/admin/index.html.erb b/app/views/webhooks/outgoing/admin/index.html.erb new file mode 100644 index 0000000000..8031849b79 --- /dev/null +++ b/app/views/webhooks/outgoing/admin/index.html.erb @@ -0,0 +1,19 @@ +<%= render partial: 'header_tags' %> + +<% html_title(t(:label_administration), t('webhooks.plural')) -%> +<% local_assigns[:additional_breadcrumb] = t('webhooks.plural') %> + +<%= toolbar title: t('webhooks.plural') do %> +
  • + <%= link_to new_admin_outgoing_webhook_path, + { class: 'button -alt-highlight', + aria: {label: t('webhooks.outgoing.label_add_new')}, + title: t('webhooks.outgoing.label_add_new')} do %> + <%= op_icon('button--icon icon-add') %> + <%= t('webhooks.singular') %> + <% end %> +
  • +<% end %> + +<%= cell ::Webhooks::Outgoing::Webhooks::TableCell, @webhooks %> + diff --git a/app/views/webhooks/outgoing/admin/new.html.erb b/app/views/webhooks/outgoing/admin/new.html.erb new file mode 100644 index 0000000000..e5194ea829 --- /dev/null +++ b/app/views/webhooks/outgoing/admin/new.html.erb @@ -0,0 +1,23 @@ + +<%= render partial: 'header_tags' %> +<% html_title(t(:label_administration), t('webhooks.outgoing.label_add_new')) -%> +<% local_assigns[:additional_breadcrumb] = [ + link_to(t('webhooks.plural'), admin_outgoing_webhooks_path), + t('webhooks.outgoing.label_add_new') + ] +%> + +<%= toolbar title: t('webhooks.outgoing.label_add_new') %> + +<%= error_messages_for @webhook %> + +<%= labelled_tabular_form_for @webhook, + url: { action: :create }, + as: 'webhook', + html: { class: 'form', autocomplete: 'off' } do |f| %> + <%= render partial: "form", locals: { f: f, webhook: @webhook } %> +

    + <%= styled_button_tag l(:button_create), class: '-highlight -with-icon icon-checkmark' %> + <%= link_to t(:button_cancel), { action: :index }, class: 'button' %> +

    +<% end %> \ No newline at end of file diff --git a/app/views/webhooks/outgoing/admin/show.html.erb b/app/views/webhooks/outgoing/admin/show.html.erb new file mode 100644 index 0000000000..31b5395eb5 --- /dev/null +++ b/app/views/webhooks/outgoing/admin/show.html.erb @@ -0,0 +1,74 @@ + +<%= render partial: 'header_tags' %> +<% html_title(t(:label_administration), t('webhooks.singular'), @webhook.name) -%> +<% local_assigns[:additional_breadcrumb] = [ + link_to(t('webhooks.plural'), admin_outgoing_webhooks_path), + @webhook.name + ] +%> + +<%= toolbar title: "#{t('webhooks.singular')} - #{@webhook.name}" do %> +
  • + <%= link_to edit_admin_outgoing_webhook_path(@webhook), + { class: 'button', + aria: {label: t(:label_edit)}, + title: t(:label_edit)} do %> + <%= op_icon('button--icon icon-edit') %> + <%= t(:label_edit) %> + <% end %> +
  • +
  • + <%= link_to admin_outgoing_webhook_path(@webhook), + class: 'button -danger', + data: { method: 'delete', confirm: I18n.t(:text_are_you_sure) } do %> + <%= op_icon('button--icon icon-delete') %> + <%= t(:button_delete) %> + <% end %> +
  • +<% end %> + +<%= cell ::Components::OnOffStatusCell, + is_on: @webhook.enabled?, + on_text: t('webhooks.outgoing.status.enabled'), + on_description: t('webhooks.outgoing.status.enabled_text'), + off_text: t('webhooks.outgoing.status.disabled'), + off_description: t('webhooks.outgoing.status.disabled_text') %> + + + + \ No newline at end of file diff --git a/app/workers/webhook_job.rb b/app/workers/webhook_job.rb new file mode 100644 index 0000000000..11466caf5d --- /dev/null +++ b/app/workers/webhook_job.rb @@ -0,0 +1,34 @@ +#-- encoding: UTF-8 +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2017 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# 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. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +class WebhookJob < ApplicationJob + def perform + + end +end diff --git a/app/workers/work_package_webhook_job.rb b/app/workers/work_package_webhook_job.rb new file mode 100644 index 0000000000..64b6d4c4c8 --- /dev/null +++ b/app/workers/work_package_webhook_job.rb @@ -0,0 +1,107 @@ +require 'rest-client' + +#-- encoding: UTF-8 +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2017 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# 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. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +class WorkPackageWebhookJob < WebhookJob + attr_reader :webhook_id + attr_reader :journal_id + attr_reader :event_name + + def initialize(webhook_id, journal_id, event_name) + @webhook_id = webhook_id + @journal_id = journal_id + @event_name = event_name + end + + def perform + body = request_body + exception = nil + + if signature = request_signature(body) + headers['HTTP_X_OP_SIGNATURE'] = signature + end + + response = RestClient.post webhook.url, request_body, request_headers + rescue RestClient::Exception => e + response = e.response + + raise e + rescue => e + exception = e + + raise e + ensure + ::Webhooks::Log.create( + webhook: webhook, + event_name: event_name, + url: webhook.url, + request_headers: request_headers, + request_body: body, + response_code: response.try(:code).to_i, + response_headers: response.try(:headers), + response_body: response.try(:to_s) || exception.try(:message) + ) + end + + def request_signature(request_body) + if secret = webhook.secret.presence + 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), secret, request_body) + end + end + + def request_headers + { + content_type: "application/json", + accept: "application/json" + } + end + + def request_body + '{"action":"' + event_name + '","work_package":' + work_package_json + '}' + end + + def work_package_json + ::API::V3::WorkPackages::WorkPackageRepresenter + .create(work_package, current_user: User.admin.first, embed_links: true) + .to_json + end + + def work_package + journal.journable + end + + def journal + @journal ||= Journal.find(journal_id) + end + + def webhook + @webhook ||= Webhooks::Webhook.find(webhook_id) + end +end diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000000..aa048ff74e --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,57 @@ +en: + activerecord: + attributes: + webhooks/webhook: + url: 'Payload URL' + secret: 'Signature secret' + events: 'Events' + projects: 'Enabled projects' + webhooks/log: + event_name: 'Event name' + url: 'Payload URL' + response_code: 'Response code' + response_body: 'Response' + models: + webhooks/outgoing_webhook: "Outgoing webhook" + webhooks: + singular: Webhook + plural: Webhooks + outgoing: + no_results_table: No webhooks have been defined yet. + label_add_new: Add new webhook + label_edit: Edit webhook + label_event_resources: Event resources + events: + created: "Created" + updated: "Updated" + status: + enabled: 'Webhook is enabled' + disabled: 'Webhook is disabled' + enabled_text: 'The webhook will emit payloads for the defined events below.' + disabled_text: 'Click the edit button to activate the webhook.' + deliveries: + no_results_table: No deliveries have been made for this webhook. + title: 'Recent deliveries' + time: 'Delivery time' + form: + introduction: > + Send a POST request to the payload URL below for any event in the project your subscribe. + Payload will correspond to the APIv3 representation of the object being modified. + apiv3_doc_url: For more information, visit the API documentation + description: + placeholder: 'Optional description for the webhook.' + enabled: + description: > + When checked, the webhook will trigger on the selected events. Uncheck to disable the webhook. + events: + title: 'Enabled events' + project_ids: + title: 'Enabled projects' + description: 'Select for which projects this webhook should be executed for.' + all: 'All projects' + selected: 'Selected projects only' + selected_project_ids: + title: 'Selected projects' + secret: + description: > + If set, this secret value is used by OpenProject to sign the webhook payload. diff --git a/config/routes.rb b/config/routes.rb index 4d2413d370..5438d72e39 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,8 +13,14 @@ #++ OpenProject::Application.routes.draw do - scope "", as: "webhooks" do - post "webhooks/:hook_name" => 'webhooks#handle_hook' - get "webhooks/:hook_name" => 'webhooks#handle_hook' + namespace 'webhooks' do + match ":hook_name", to: 'incoming/hooks#handle_hook', via: %i(get post) + end + + scope 'admin' do + resources :webhooks, + param: :webhook_id, + controller: 'webhooks/outgoing/admin', + as: 'admin_outgoing_webhooks' end end diff --git a/db/migrate/20171218205557_add_webhooks.rb b/db/migrate/20171218205557_add_webhooks.rb new file mode 100644 index 0000000000..eb77e4f6ab --- /dev/null +++ b/db/migrate/20171218205557_add_webhooks.rb @@ -0,0 +1,24 @@ +class AddWebhooks < ActiveRecord::Migration[5.0] + def change + create_table :webhooks_webhooks do |t| + t.string :name + t.text :url + t.text :description, null: false + t.string :secret, null: true + t.boolean :enabled, null: false + t.boolean :all_projects, null: false + + t.timestamps + end + + create_table :webhooks_events do |t| + t.string :name + t.references :webhooks_webhook, index: true, foreign_key: true + end + + create_table :webhooks_projects do |t| + t.references :project, index: true, foreign_key: true + t.references :webhooks_webhook, index: true, foreign_key: true + end + end +end diff --git a/db/migrate/20171219145752_create_webhook_logs.rb b/db/migrate/20171219145752_create_webhook_logs.rb new file mode 100644 index 0000000000..f811b5075a --- /dev/null +++ b/db/migrate/20171219145752_create_webhook_logs.rb @@ -0,0 +1,19 @@ +class CreateWebhookLogs < ActiveRecord::Migration[5.0] + def change + create_table :webhooks_logs do |t| + t.references :webhooks_webhook, foreign_key: { on_delete: :cascade } + + t.string :event_name + t.string :url + + t.text :request_headers + t.text :request_body + + t.integer :response_code + t.text :response_headers + t.text :response_body + + t.timestamps + end + end +end diff --git a/lib/open_project/webhooks/engine.rb b/lib/open_project/webhooks/engine.rb index 4bb5baa13c..3ef83e0763 100644 --- a/lib/open_project/webhooks/engine.rb +++ b/lib/open_project/webhooks/engine.rb @@ -21,13 +21,27 @@ module OpenProject::Webhooks include OpenProject::Plugins::ActsAsOpEngine register 'openproject-webhooks', - :author_url => 'http://finn.de', - :requires_openproject => '>= 3.0.0pre43' + author_url: 'https://github.com/opf/openproject-webhooks' do + menu :admin_menu, + :plugin_webhooks, + { controller: 'webhooks/outgoing/admin', action: :index }, + after: :plugins, + caption: ->(*) { I18n.t('webhooks.plural') }, + icon: 'icon2 icon-relations' + end config.before_configuration do |app| # This is required for the routes to be loaded first as the routes should # be prepended so they take precedence over the core. app.config.paths['config/routes.rb'].unshift File.join(File.dirname(__FILE__), "..", "..", "..", "config", "routes.rb") end + + initializer 'webhooks.subscribe_to_notifications' do + ::OpenProject::Webhooks::EventResources.subscribe! + end + + initializer 'webhooks.precompile_assets' do |app| + app.config.assets.precompile += %w(webhooks/webhooks.css webhooks/webhooks.js) + end end end diff --git a/lib/open_project/webhooks/event_resources.rb b/lib/open_project/webhooks/event_resources.rb new file mode 100644 index 0000000000..6c69917efd --- /dev/null +++ b/lib/open_project/webhooks/event_resources.rb @@ -0,0 +1,41 @@ +module OpenProject::Webhooks + module EventResources + class << self + def subscribe! + resource_modules.each do |handler| + handler.subscribe! + end + end + + ## + # Return a complete mapping of all resource modules + # in the form { label => { event1: label , event2: label } } + def available_events_map + @available_events ||= Hash[resource_modules.map { |m| [m.resource_name, m.available_events_map] }] + end + + ## + # Find a module based on the event name + def lookup_resource_name(event_name) + resource = resource_modules.detect { |m| m.available_events_map.key?(event_name) } + resource.try(:resource_name) + end + + def resource_modules + @resource_modules ||= begin + resources.map do |name| + begin + "OpenProject::Webhooks::EventResources::#{name.to_s.camelize}".constantize + rescue NameError => e + raise ArgumentError, "Failed to initialize resources module for #{name}: #{e}" + end + end + end + end + + def resources + %i(work_package) + end + end + end +end \ No newline at end of file diff --git a/lib/open_project/webhooks/event_resources/base.rb b/lib/open_project/webhooks/event_resources/base.rb new file mode 100644 index 0000000000..7a2abfcb8c --- /dev/null +++ b/lib/open_project/webhooks/event_resources/base.rb @@ -0,0 +1,77 @@ +module OpenProject::Webhooks::EventResources + class Base + class << self + + ## + # Subscribe for events on this resource schedule the respective + # webhooks, if any. + def subscribe! + notification_names.each do |key| + OpenProject::Notifications.subscribe(key) do |payload| + begin + Rails.logger.debug { "[Webhooks Plugin] Handling notification for '#{key}'." } + handle_notification(payload, key) + rescue => e + Rails.logger.error { "[Webhooks Plugin] Failed notification handling for '#{key}': #{e}" } + end + end + end + end + + ## + # Return a mapping of event key to its localized name + def available_events_map + Hash[available_actions.map { |symbol| [ prefixed_event_name(symbol), localize_event_name(symbol) ] }] + end + + ## + # Get the prefix key for this module + def prefix_key + name.demodulize.underscore + end + + ## + # Create a prefixed event name + def prefixed_event_name(action) + "#{prefix_key}:#{action}" + end + + + def available_actions + raise NotImplementedError + end + + ## + # Localize the given event name + def localize_event_name(key) + I18n.t(key, scope: 'webhooks.outgoing.events') + end + + ## + # Get the name of this resource + def resource_name + raise NotImplementedError + end + + ## + # Get the subscriptions for OP::Notifications + def notification_names + raise NotImplementedError + end + + protected + + ## + # Callback for OP::Notification + def handle_notification(payload, event_name) + raise NotImplementedError + end + + ## + # Base scope for active webhooks, helper for subclasses + def active_webhooks + ::Webhooks::Webhook.where(enabled: true) + end + end + end +end \ No newline at end of file diff --git a/lib/open_project/webhooks/event_resources/work_package.rb b/lib/open_project/webhooks/event_resources/work_package.rb new file mode 100644 index 0000000000..2c10dabf1a --- /dev/null +++ b/lib/open_project/webhooks/event_resources/work_package.rb @@ -0,0 +1,31 @@ +require_relative 'base' + +module OpenProject::Webhooks::EventResources + class WorkPackage < Base + class << self + def notification_names + [ + OpenProject::Events::AGGREGATED_WORK_PACKAGE_JOURNAL_READY + ] + end + + def available_actions + %i(updated created) + end + + def resource_name + I18n.t :label_work_package_plural + end + + protected + + def handle_notification(payload, event_name) + action = payload[:initial] ? "created" : "updated" + event_name = prefixed_event_name(action) + active_webhooks.with_event_name(event_name).pluck(:id).each do |id| + Delayed::Job.enqueue WorkPackageWebhookJob.new(id, payload[:journal_id], event_name) + end + end + end + end +end \ No newline at end of file diff --git a/spec/controllers/outgoing/admin_controller_spec.rb b/spec/controllers/outgoing/admin_controller_spec.rb new file mode 100644 index 0000000000..8922c47697 --- /dev/null +++ b/spec/controllers/outgoing/admin_controller_spec.rb @@ -0,0 +1,223 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2014 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# 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. +# +# See doc/COPYRIGHT.md for more details. +#++ + +require 'spec_helper' + +describe ::Webhooks::Outgoing::AdminController, type: :controller do + let(:user) { FactoryGirl.build_stubbed :admin } + + before do + login_as user + end + + context 'when not admin' do + let(:user) { FactoryGirl.build_stubbed :user } + + it 'renders 403' do + get :index + expect(response.status).to eq 403 + end + end + + context 'when not logged in' do + let(:user) { User.anonymous } + + it 'renders 403' do + get :index + expect(response.status).to redirect_to(signin_url(back_url: admin_outgoing_webhooks_url)) + end + end + + describe '#index' do + it 'renders the index page' do + get :index + expect(response).to be_success + expect(response).to render_template 'index' + end + end + + describe '#new' do + it 'renders the new page' do + get :new + expect(response).to be_success + expect(assigns[:webhook]).to be_new_record + expect(response).to render_template 'new' + end + end + + describe '#create' do + let(:service) { double(::Webhooks::Outgoing::UpdateWebhookService) } + let(:webhook_params) do + { + name: 'foo', + enabled: true + } + end + + describe 'with invalid params' do + it 'renders an error' do + post :create, params: { foo: 'bar' } + expect(response).not_to be_success + end + end + + describe 'Calling the service' do + before do + expect(::Webhooks::Outgoing::UpdateWebhookService) + .to receive(:new) + .and_return service + + expect(service) + .to receive(:call) + .and_return(ServiceResult.new success: success) + + post :create, params: { webhook: webhook_params} + end + + context 'when success' do + let(:success) { true } + + it 'renders success' do + expect(flash[:notice]).to be_present + expect(response).to redirect_to(action: :index) + end + end + + context 'when not success' do + let(:success) { false } + it 'renders the form again' do + expect(flash[:notice]).not_to be_present + expect(response).to render_template 'new' + end + end + end + end + + describe '#edit' do + context 'when found' do + before do + expect(::Webhooks::Webhook) + .to receive(:find) + .and_return(double(::Webhooks::Webhook)) + end + + it 'renders the edit page' do + get :edit, params: { webhook_id: 'mocked' } + expect(response).to be_success + expect(assigns[:webhook]).to be_present + expect(response).to render_template 'edit' + end + end + + context 'when not found' do + it 'renders 404' do + get :edit, params: { webhook_id: '1234' } + expect(response).not_to be_success + expect(response.status).to eq 404 + end + end + end + + describe '#update' do + let(:service) { double(::Webhooks::Outgoing::UpdateWebhookService) } + let(:webhook_params) do + { + name: 'foo', + enabled: true + } + end + + describe 'when not found' do + it 'renders an error' do + put :update, params: { foo: 'bar' } + expect(response).not_to be_success + expect(response.status).to eq 404 + end + end + + describe 'Calling the service' do + let(:webhook) { double(::Webhooks::Webhook) } + + before do + allow(::Webhooks::Webhook) + .to receive(:find) + .and_return(webhook) + + expect(::Webhooks::Outgoing::UpdateWebhookService) + .to receive(:new) + .and_return service + + expect(service) + .to receive(:call) + .and_return(ServiceResult.new success: success) + + put :update, params: { webhook_id: '1234', webhook: webhook_params} + end + + context 'when success' do + let(:success) { true } + + it 'renders success' do + expect(flash[:notice]).to be_present + expect(response).to redirect_to(action: :index) + end + end + + context 'when not success' do + let(:success) { false } + + it 'renders the form again' do + expect(flash[:notice]).not_to be_present + expect(response).to render_template 'edit' + end + end + end + end + + describe '#destroy' do + let(:webhook) { double(::Webhooks::Webhook) } + + context 'when found' do + before do + expect(::Webhooks::Webhook) + .to receive(:find) + .and_return(webhook) + + expect(webhook) + .to receive(:destroy) + .and_return(success) + end + + context 'when delete failed' do + let(:success) { false } + + it 'redirects to index' do + delete :destroy, params: { webhook_id: 'mocked' } + expect(response).to be_redirect + expect(flash[:notice]).not_to be_present + expect(flash[:error]).to be_present + end + end + + context 'when delete success' do + let(:success) { true } + it 'destroys the object' do + delete :destroy, params: { webhook_id: 'mocked' } + expect(response).to be_redirect + expect(flash[:notice]).to be_present + end + end + end + end +end diff --git a/spec/controllers/webhooks_controller_spec.rb b/spec/controllers/webhooks_controller_spec.rb index bee21aa802..8d97f9a52f 100644 --- a/spec/controllers/webhooks_controller_spec.rb +++ b/spec/controllers/webhooks_controller_spec.rb @@ -15,7 +15,7 @@ require File.expand_path('../../spec_helper', __FILE__) -describe WebhooksController, :type => :controller do +describe Webhooks::Incoming::HooksController, :type => :controller do let(:hook) { double(OpenProject::Webhooks::Hook) } let(:user) { double(User).as_null_object } @@ -33,7 +33,7 @@ describe WebhooksController, :type => :controller do it 'should be successful' do expect(hook).to receive(:handle) - post :handle_hook, :hook_name => 'testhook' + post :handle_hook, params: { hook_name: 'testhook' } expect(response).to be_success end @@ -43,7 +43,7 @@ describe WebhooksController, :type => :controller do expect(user).to equal(user) } - post :handle_hook, :hook_name => 'testhook' + post :handle_hook, params: { hook_name: 'testhook' } end end diff --git a/spec/factories/webhook_factory.rb b/spec/factories/webhook_factory.rb new file mode 100644 index 0000000000..b1da5562fd --- /dev/null +++ b/spec/factories/webhook_factory.rb @@ -0,0 +1,38 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2017 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# 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. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +FactoryGirl.define do + factory :webhook, class: Webhooks::Webhook do + name "Example Webhook" + url "http://example.net/webhook_receiver/42" + description "This is an example webhook" + secret "42" + enabled true + all_projects true + end +end diff --git a/spec/factories/webhook_log_factory.rb b/spec/factories/webhook_log_factory.rb new file mode 100644 index 0000000000..ba5fd77dc3 --- /dev/null +++ b/spec/factories/webhook_log_factory.rb @@ -0,0 +1,40 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2017 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# 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. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +FactoryGirl.define do + factory :webhook_log, class: Webhooks::Log do + webhook factory: :webhook + url "http://example.net/webhook_receiver/42" + event_name 'foobar' + response_code '200' + request_headers({ foo: :bar }) + request_body 'Request body' + response_headers({ response: :foo }) + response_body 'Response body' + end +end diff --git a/spec/features/manage_webhooks_spec.rb b/spec/features/manage_webhooks_spec.rb new file mode 100644 index 0000000000..b46bb066cb --- /dev/null +++ b/spec/features/manage_webhooks_spec.rb @@ -0,0 +1,102 @@ +require 'spec_helper' + +describe 'Manage webhooks through UI', type: :feature, js: true do + before do + login_as user + end + + context 'as regular user' do + let(:user) { FactoryGirl.create :user } + + it 'forbids accessing the webhooks management view' do + visit admin_outgoing_webhooks_path + expect(page).to have_selector('h2', text: '403') + end + end + + context 'as admin' do + let(:user) { FactoryGirl.create :admin } + let!(:project) { FactoryGirl.create :project } + + it 'allows the management flow' do + visit admin_outgoing_webhooks_path + expect(page).to have_selector('.generic-table--empty-row') + + # Visit inline create + find('.wp-inline-create--add-link').click + + # Fill in elements + fill_in 'webhook_name', with: 'My webhook' + fill_in 'webhook_url', with: 'http://example.org' + + # Check one event + find('.form--check-box[value="work_package:created"]').set true + + # Create + click_on 'Create' + + # + # 1st webhook created + # + + expect(page).to have_selector('.flash.notice', text: I18n.t(:notice_successful_create)) + expect(page).to have_selector('.webhooks--outgoing-webhook-row .name', text: 'My webhook') + webhook = ::Webhooks::Webhook.last + expect(webhook.event_names).to eq %w(work_package:created) + expect(webhook.all_projects).to be_truthy + + expect(page).to have_selector('.webhooks--outgoing-webhook-row .enabled .icon-yes') + expect(page).to have_selector('.webhooks--outgoing-webhook-row .selected_projects', text: '(all)') + expect(page).to have_selector('.webhooks--outgoing-webhook-row .events', text: 'Work packages') + expect(page).to have_selector('.webhooks--outgoing-webhook-row .description', text: webhook.description) + + # Edit this webhook + find(".webhooks--outgoing-webhook-row-#{webhook.id} a", text: 'Edit').click + + # Check the other event + find('.form--check-box[value="work_package:created"]').set false + find('.form--check-box[value="work_package:updated"]').set true + + # Check a subset of projects + choose 'webhook_project_ids_selection' + find(".webhooks--selected-project-ids[value='#{project.id}']").set true + + click_on 'Save' + expect(page).to have_selector('.flash.notice', text: I18n.t(:notice_successful_update)) + expect(page).to have_selector('.webhooks--outgoing-webhook-row .name', text: 'My webhook') + webhook = ::Webhooks::Webhook.last + expect(webhook.event_names).to eq %w(work_package:updated) + expect(webhook.projects.all).to eq [project] + expect(webhook.all_projects).to be_falsey + + # Delete webhook + find(".webhooks--outgoing-webhook-row-#{webhook.id} a", text: 'Delete').click + page.driver.browser.switch_to.alert.accept + + expect(page).to have_selector('.flash.notice', text: I18n.t(:notice_successful_delete)) + expect(page).to have_selector('.generic-table--empty-row') + end + + context 'with existing webhook' do + let!(:webhook) { FactoryGirl.create :webhook, name: 'testing' } + let!(:log) { FactoryGirl.create :webhook_log, response_headers: { test: :foo }, webhook: webhook } + + it 'shows the delivery' do + visit admin_outgoing_webhooks_path + find('.webhooks--outgoing-webhook-row .name a', text: 'testing').click + + expect(page).to have_selector('.on-off-status.-enabled') + expect(page).to have_selector('td.event_name', text: 'foo') + expect(page).to have_selector('td.response_code', text: '200') + + # Open modal + find('td.response_body a', text: 'Show').click + + page.within('.webhooks--response-body-modal') do + expect(page).to have_selector('.webhooks--response-headers strong', text: 'test') + expect(page).to have_selector('.webhooks--response-body', text: log.response_body) + end + end + end + end +end \ No newline at end of file diff --git a/spec/models/webhook_spec.rb b/spec/models/webhook_spec.rb new file mode 100644 index 0000000000..f8d8c15816 --- /dev/null +++ b/spec/models/webhook_spec.rb @@ -0,0 +1,57 @@ +require 'spec_helper' + +describe ::Webhooks::Webhook, type: :model do + subject { FactoryGirl.build :webhook } + + describe 'attributes' do + describe '#url' do + it 'accepts http' do + subject.url = 'http://foo.example.org' + expect(subject).to be_valid + end + + it 'accepts http' do + subject.url = 'https://foo.example.org' + expect(subject).to be_valid + end + + it 'accepts other schemas' do + subject.url = 'ftp://foo.example.org' + expect(subject).not_to be_valid + expect(subject.errors).to have_key(:url) + end + end + end + + describe '#events' do + let(:events) { %w(work_package:updated work_package:created) } + before do + subject.event_names = events + subject.save! + end + + it 'has an event association' do + expect(subject.events.count).to eq 2 + expect(subject.event_names).to eq events + end + + it 'finds the webhook with the saved events' do + expect(described_class.with_event_name(events[0]).first).to eq(subject) + expect(described_class.with_event_name(events[1]).first).to eq(subject) + end + end + + describe '#projects' do + let(:project1) { FactoryGirl.create :project } + + before do + subject.projects << project1 + subject.save! + end + + it 'has an event association' do + expect(subject.projects.count).to eq 1 + expect(subject.project_ids).to eq([project1.id]) + end + end +end \ No newline at end of file diff --git a/spec/routing/webhooks/outgoing/admin_controller_spec.rb b/spec/routing/webhooks/outgoing/admin_controller_spec.rb new file mode 100644 index 0000000000..fae2cbaf8c --- /dev/null +++ b/spec/routing/webhooks/outgoing/admin_controller_spec.rb @@ -0,0 +1,63 @@ +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2015 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# 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. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +require 'spec_helper' + +describe 'Outgoing webhooks administration', type: :routing do + it 'route to index' do + expect(get('/admin/webhooks')).to route_to('webhooks/outgoing/admin#index') + end + + it 'route to new' do + expect(get('/admin/webhooks/new')).to route_to('webhooks/outgoing/admin#new') + end + + it 'route to show' do + expect(get('/admin/webhooks/1')).to route_to(controller: 'webhooks/outgoing/admin', + action: 'show', + webhook_id: '1') + end + + it 'route to edit' do + expect(get('/admin/webhooks/1/edit')).to route_to(controller: 'webhooks/outgoing/admin', + action: 'edit', + webhook_id: '1') + end + + it 'route to PUT update' do + expect(put('/admin/webhooks/1')).to route_to(controller: 'webhooks/outgoing/admin', + action: 'update', + webhook_id: '1') + end + + it 'route to DELETE destroy' do + expect(delete('/admin/webhooks/1')).to route_to(controller: 'webhooks/outgoing/admin', + action: 'destroy', + webhook_id: '1') + end +end diff --git a/spec/workers/work_package_webhook_job.rb b/spec/workers/work_package_webhook_job.rb new file mode 100644 index 0000000000..697c87ed83 --- /dev/null +++ b/spec/workers/work_package_webhook_job.rb @@ -0,0 +1,125 @@ +#-- encoding: UTF-8 +#-- copyright +# OpenProject is a project management system. +# Copyright (C) 2012-2017 the OpenProject Foundation (OPF) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# 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. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + +require 'spec_helper' + +describe WorkPackageWebhookJob, type: :model, webmock: true do + shared_examples "a work package webhook call" do |*flags| + let(:title) { "Some workpackage subject" } + let(:work_package) { FactoryGirl.create :work_package, subject: title } + + let(:secret) { nil } + let(:webhook) { FactoryGirl.create :webhook, url: request_url, secret: secret } + + let(:user) { FactoryGirl.create :admin } + + let(:event) { "work_package:created" } + let(:job) { WorkPackageWebhookJob.new webhook.id, work_package.journals.last.id, event } + + let(:request_url) { "http://example.net/test/42" } + let(:stubbed_url) { request_url } + + let(:request_headers) do + { content_type: "application/json", accept: "application/json" } + end + + let(:response_code) { 200 } + let(:response_body) { "hook called" } + let(:response_headers) do + { content_type: "text/plain", x_spec: "foobar" } + end + + let(:stub) do + stub_request(:post, stubbed_url.sub("http://", "")) + .with( + body: hash_including( + "action" => event, + "work_package" => hash_including( + "_type" => "WorkPackage", + "subject" => title + ) + ), + headers: request_headers + ) + .to_return( + status: response_code, + body: response_body, + headers: response_headers + ) + end + + before do + User.current = user + + stub + + begin + job.perform + rescue + # ignoring it as it's expected to throw exceptions in certain scenarios + end + end + + it "calls the webhook url" do + expect(stub).to have_been_requested + end + + it "creates a log for the call" do + log = Webhooks::Log.last + + expect(log.webhook).to eq webhook + expect(log.url).to eq webhook.url + expect(log.event_name).to eq event + expect(log.request_headers).to eq request_headers + expect(log.response_code).to eq response_code + expect(log.response_body).to eq response_body + expect(log.response_headers).to eq response_headers + end + end + + describe "triggering a work package update" do + it_behaves_like "a work package webhook call" do + let(:event) { "work_package:updated" } + end + end + + describe "triggering a work package creation" do + it_behaves_like "a work package webhook call" do + let(:event) { "work_package:created" } + end + end + + describe "triggering a work package update with an invalid url" do + it_behaves_like "a work package webhook call" do + let(:event) { "work_package:updated" } + let(:response_code) { 404 } + let(:response_body) { "not found" } + end + end +end From 4ce833463b986a2d4da5f2205ef00f7d94fa6c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 19 Jan 2018 11:08:37 +0100 Subject: [PATCH 078/104] Fix invalid route [ci skip] --- spec/controllers/outgoing/admin_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/outgoing/admin_controller_spec.rb b/spec/controllers/outgoing/admin_controller_spec.rb index 8922c47697..f4f1a6c39a 100644 --- a/spec/controllers/outgoing/admin_controller_spec.rb +++ b/spec/controllers/outgoing/admin_controller_spec.rb @@ -140,7 +140,7 @@ describe ::Webhooks::Outgoing::AdminController, type: :controller do describe 'when not found' do it 'renders an error' do - put :update, params: { foo: 'bar' } + put :update, params: { webhook_id: 'bar' } expect(response).not_to be_success expect(response.status).to eq 404 end From 7836a05996da3dae7611f0711487d2afc5de2068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 1 Feb 2018 14:32:48 +0100 Subject: [PATCH 079/104] Bump VERSION to 7.4.1 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 0ab39bd210..11bc0b213d 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.4.0" + VERSION = "7.4.1" end end From 89842ce1a5d74894242097c3ffa9d4d9c5c95ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 8 Feb 2018 14:02:01 +0100 Subject: [PATCH 080/104] Bumped version to 8.0.0 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 0ab39bd210..9f34acc769 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.4.0" + VERSION = "8.0.0" end end From 91288aed95bff26a269620e5ccdb2ec1c41cce29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 13 Feb 2018 12:15:21 +0100 Subject: [PATCH 081/104] Bump VERSION to 7.4.2 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 11bc0b213d..4bfee7cd17 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.4.1" + VERSION = "7.4.2" end end From d8bfef03aff7296874147c5004ac6b1dfea16dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 21 Feb 2018 08:45:28 +0100 Subject: [PATCH 082/104] Fix rendering of webhook log entry --- app/cells/webhooks/outgoing/deliveries/row_cell.rb | 3 ++- app/workers/work_package_webhook_job.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/cells/webhooks/outgoing/deliveries/row_cell.rb b/app/cells/webhooks/outgoing/deliveries/row_cell.rb index 42068c8d94..8314c9a3ca 100644 --- a/app/cells/webhooks/outgoing/deliveries/row_cell.rb +++ b/app/cells/webhooks/outgoing/deliveries/row_cell.rb @@ -13,7 +13,8 @@ module ::Webhooks end def response_body - render locals: { log_entry: log }, prefixes: ["#{::OpenProject::Webhooks::Engine.root}/app/cells/views"] + render(locals: { log_entry: log }, + prefixes: ["#{::OpenProject::Webhooks::Engine.root}/app/cells/views"]).html_safe end end end diff --git a/app/workers/work_package_webhook_job.rb b/app/workers/work_package_webhook_job.rb index 64b6d4c4c8..cf4baa9fe4 100644 --- a/app/workers/work_package_webhook_job.rb +++ b/app/workers/work_package_webhook_job.rb @@ -45,7 +45,7 @@ class WorkPackageWebhookJob < WebhookJob exception = nil if signature = request_signature(body) - headers['HTTP_X_OP_SIGNATURE'] = signature + request_headers['HTTP_X_OP_SIGNATURE'] = signature end response = RestClient.post webhook.url, request_body, request_headers From c303ba58dfd9d6205015fd73414ebc125210cb73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 9 Mar 2018 18:23:06 +0100 Subject: [PATCH 083/104] Bump VERSION to 7.4.3 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 4bfee7cd17..9720389c7e 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.4.2" + VERSION = "7.4.3" end end From 5f0701086bda37d53c118a49b33d42d01273b50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 26 Mar 2018 08:05:40 +0200 Subject: [PATCH 084/104] Fix reference to ENV [ci skip] --- app/controllers/webhooks/incoming/hooks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/webhooks/incoming/hooks_controller.rb b/app/controllers/webhooks/incoming/hooks_controller.rb index fbb9f94c1d..9489b4029b 100644 --- a/app/controllers/webhooks/incoming/hooks_controller.rb +++ b/app/controllers/webhooks/incoming/hooks_controller.rb @@ -33,7 +33,7 @@ module Webhooks hook = OpenProject::Webhooks.find(params.require 'hook_name') if hook - code = hook.handle(env, params, find_current_user) + code = hook.handle(ENV, params, find_current_user) head code.is_a?(Integer) ? code : 200 else head :not_found From a44ab3efedc874871b03c5526f6758db4cd365dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 3 Apr 2018 10:40:12 +0200 Subject: [PATCH 085/104] Bump VERSION to 7.4.4 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 9720389c7e..b66d64958e 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.4.3" + VERSION = "7.4.4" end end From 3176a57c9087d69d7e7e62818936f17220e6919d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 3 May 2018 14:26:02 +0200 Subject: [PATCH 086/104] Fix webhooks incoming params overriding action --- app/controllers/webhooks/incoming/hooks_controller.rb | 9 ++++++++- lib/open_project/webhooks/hook.rb | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/webhooks/incoming/hooks_controller.rb b/app/controllers/webhooks/incoming/hooks_controller.rb index fbb9f94c1d..65191c2ea9 100644 --- a/app/controllers/webhooks/incoming/hooks_controller.rb +++ b/app/controllers/webhooks/incoming/hooks_controller.rb @@ -20,6 +20,13 @@ module Webhooks class HooksController < ApplicationController accept_key_auth :handle_hook + # Disable CSRF detection since we openly welcome POSTs here! + skip_before_action :verify_authenticity_token + + # Wrap the JSON body as 'payload' param + # making it available as params[:payload] + wrap_parameters :payload + def api_request? # OpenProject only allows API requests based on an Accept request header. # Webhooks (at least GitHub) don't send an Accept header as they're not interested @@ -33,7 +40,7 @@ module Webhooks hook = OpenProject::Webhooks.find(params.require 'hook_name') if hook - code = hook.handle(env, params, find_current_user) + code = hook.handle(request, params, find_current_user) head code.is_a?(Integer) ? code : 200 else head :not_found diff --git a/lib/open_project/webhooks/hook.rb b/lib/open_project/webhooks/hook.rb index 52034fef82..83bc6e7026 100644 --- a/lib/open_project/webhooks/hook.rb +++ b/lib/open_project/webhooks/hook.rb @@ -26,8 +26,8 @@ module OpenProject::Webhooks "webhooks/#{name}" end - def handle(environment = Hash.new, params = Hash.new, user = nil) - callback.call self, environment, params, user + def handle(request = Hash.new, params = Hash.new, user = nil) + callback.call self, request, params, user end end From 7ac96aad8d2e159c38892112f51e97215abc83fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 7 May 2018 11:17:07 +0200 Subject: [PATCH 087/104] Bump VERSION to 7.4.5 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index b66d64958e..7b804b19f9 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.4.4" + VERSION = "7.4.5" end end From f161a8dff0055498f4ec537ee7025a8277de82fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 7 May 2018 15:20:59 +0200 Subject: [PATCH 088/104] FactoryGirl => FactoryBot (opf/openproject#6304) --- spec/controllers/outgoing/admin_controller_spec.rb | 4 ++-- spec/factories/webhook_factory.rb | 2 +- spec/factories/webhook_log_factory.rb | 2 +- spec/features/manage_webhooks_spec.rb | 10 +++++----- spec/models/webhook_spec.rb | 4 ++-- spec/workers/work_package_webhook_job.rb | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/spec/controllers/outgoing/admin_controller_spec.rb b/spec/controllers/outgoing/admin_controller_spec.rb index f4f1a6c39a..40520a7121 100644 --- a/spec/controllers/outgoing/admin_controller_spec.rb +++ b/spec/controllers/outgoing/admin_controller_spec.rb @@ -15,14 +15,14 @@ require 'spec_helper' describe ::Webhooks::Outgoing::AdminController, type: :controller do - let(:user) { FactoryGirl.build_stubbed :admin } + let(:user) { FactoryBot.build_stubbed :admin } before do login_as user end context 'when not admin' do - let(:user) { FactoryGirl.build_stubbed :user } + let(:user) { FactoryBot.build_stubbed :user } it 'renders 403' do get :index diff --git a/spec/factories/webhook_factory.rb b/spec/factories/webhook_factory.rb index b1da5562fd..64c63e9a39 100644 --- a/spec/factories/webhook_factory.rb +++ b/spec/factories/webhook_factory.rb @@ -26,7 +26,7 @@ # See doc/COPYRIGHT.rdoc for more details. #++ -FactoryGirl.define do +FactoryBot.define do factory :webhook, class: Webhooks::Webhook do name "Example Webhook" url "http://example.net/webhook_receiver/42" diff --git a/spec/factories/webhook_log_factory.rb b/spec/factories/webhook_log_factory.rb index ba5fd77dc3..2716ba180b 100644 --- a/spec/factories/webhook_log_factory.rb +++ b/spec/factories/webhook_log_factory.rb @@ -26,7 +26,7 @@ # See doc/COPYRIGHT.rdoc for more details. #++ -FactoryGirl.define do +FactoryBot.define do factory :webhook_log, class: Webhooks::Log do webhook factory: :webhook url "http://example.net/webhook_receiver/42" diff --git a/spec/features/manage_webhooks_spec.rb b/spec/features/manage_webhooks_spec.rb index b46bb066cb..a4c192df9f 100644 --- a/spec/features/manage_webhooks_spec.rb +++ b/spec/features/manage_webhooks_spec.rb @@ -6,7 +6,7 @@ describe 'Manage webhooks through UI', type: :feature, js: true do end context 'as regular user' do - let(:user) { FactoryGirl.create :user } + let(:user) { FactoryBot.create :user } it 'forbids accessing the webhooks management view' do visit admin_outgoing_webhooks_path @@ -15,8 +15,8 @@ describe 'Manage webhooks through UI', type: :feature, js: true do end context 'as admin' do - let(:user) { FactoryGirl.create :admin } - let!(:project) { FactoryGirl.create :project } + let(:user) { FactoryBot.create :admin } + let!(:project) { FactoryBot.create :project } it 'allows the management flow' do visit admin_outgoing_webhooks_path @@ -78,8 +78,8 @@ describe 'Manage webhooks through UI', type: :feature, js: true do end context 'with existing webhook' do - let!(:webhook) { FactoryGirl.create :webhook, name: 'testing' } - let!(:log) { FactoryGirl.create :webhook_log, response_headers: { test: :foo }, webhook: webhook } + let!(:webhook) { FactoryBot.create :webhook, name: 'testing' } + let!(:log) { FactoryBot.create :webhook_log, response_headers: { test: :foo }, webhook: webhook } it 'shows the delivery' do visit admin_outgoing_webhooks_path diff --git a/spec/models/webhook_spec.rb b/spec/models/webhook_spec.rb index f8d8c15816..58676628a2 100644 --- a/spec/models/webhook_spec.rb +++ b/spec/models/webhook_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe ::Webhooks::Webhook, type: :model do - subject { FactoryGirl.build :webhook } + subject { FactoryBot.build :webhook } describe 'attributes' do describe '#url' do @@ -42,7 +42,7 @@ describe ::Webhooks::Webhook, type: :model do end describe '#projects' do - let(:project1) { FactoryGirl.create :project } + let(:project1) { FactoryBot.create :project } before do subject.projects << project1 diff --git a/spec/workers/work_package_webhook_job.rb b/spec/workers/work_package_webhook_job.rb index 697c87ed83..5283f9f11b 100644 --- a/spec/workers/work_package_webhook_job.rb +++ b/spec/workers/work_package_webhook_job.rb @@ -32,12 +32,12 @@ require 'spec_helper' describe WorkPackageWebhookJob, type: :model, webmock: true do shared_examples "a work package webhook call" do |*flags| let(:title) { "Some workpackage subject" } - let(:work_package) { FactoryGirl.create :work_package, subject: title } + let(:work_package) { FactoryBot.create :work_package, subject: title } let(:secret) { nil } - let(:webhook) { FactoryGirl.create :webhook, url: request_url, secret: secret } + let(:webhook) { FactoryBot.create :webhook, url: request_url, secret: secret } - let(:user) { FactoryGirl.create :admin } + let(:user) { FactoryBot.create :admin } let(:event) { "work_package:created" } let(:job) { WorkPackageWebhookJob.new webhook.id, work_package.journals.last.id, event } From 526d01d9263dadbd60138fa69550d4775b3fbbeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 7 May 2018 23:13:45 +0200 Subject: [PATCH 089/104] Updating generated .travis.yml from devkit [ci skip] --- .travis.yml | 50 ++++++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index 94f8f56b51..ae64999e15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ #-- copyright # OpenProject is a project management system. -# Copyright (C) 2012-2017 the OpenProject Foundation (OPF) +# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2017 Jean-Philippe Lang +# Copyright (C) 2006-2018 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or @@ -26,10 +26,20 @@ # See doc/COPYRIGHT.rdoc for more details. #++ + +################################### +# +# This file was generated by +# openproject-devkit. +# +# Do not modify this file directly! +# +################################### + language: ruby rvm: - - 2.4.2 + - 2.5.1 sudo: required dist: trusty @@ -49,7 +59,6 @@ env: global: - CI=true - RAILS_ENV=test - - GECKODRIVER_VERSION="0.19.1" matrix: - "TEST_SUITE=plugins:specs DB=mysql GROUP_SIZE=1 GROUP=1" @@ -82,19 +91,12 @@ before_install: - git fetch --depth=1 openproject - git checkout openproject/$TRAVIS_BRANCH - - "echo `firefox -v`" - - "export DISPLAY=:99.0" - - "/sbin/start-stop-daemon --start -v --pidfile ./tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1920x1080x16" - - "echo `xdpyinfo -display :99 | grep 'dimensions' | awk '{ print $2 }'`" - # Install geckodriver - - echo "Installing geckodriver ${GECKODRIVER_VERSION}" - - wget https://github.com/mozilla/geckodriver/releases/download/v${GECKODRIVER_VERSION}/geckodriver-v${GECKODRIVER_VERSION}-linux64.tar.gz - - mkdir geckodriver - - tar -xzf geckodriver-v${GECKODRIVER_VERSION}-linux64.tar.gz -C geckodriver - - export PATH=$PATH:$PWD/geckodriver - - echo `geckodriver --version` # Install Node LTS Boron (6.9.1) - "nvm install 6.9.1" + # work around https://github.com/travis-ci/travis-ci/issues/8969 + - travis_retry gem update --system + - gem install bundler + bundler_args: --binstubs --without development production docker @@ -104,23 +106,7 @@ before_script: script: - sh script/ci_runner.sh -notifications: - email: false - slack: - on_success: change - on_failure: always - on_pull_requests: false - rooms: - # CE - - secure: "mQqyZRjOix72MAAcjIanPOCfzMlQOqMhYOEd+6SNCcK7nb9ku0rPtFYWtifvp3+ajA5YKVJZ/W2qRn+Flw99zg8SfhPBV89SALXapUnjuZW0rcPexP0vrQW/AR6176DG3+WQOM8BFOYmN1yuGsz7YZK3xZo7yPp8XHKwzWoEYS6BOEUyfyE5T8dGJGqIKwpGEnnpBJf+CVsXeX56xg6wL+9CPVIEDb7IcrPoYQ5K6Kh9gq+7Ube7I7lbsSpdm1TAS4si7G9A6IaJ4WD1QvnUDrajGz2IM/bkP0zs50kGSrbagm707QMC8P4aLzJ64aUOfziyeYA1BSiDl5dZCUc3/dJtjMkUoRlmErwe6x8N5mwn6iVQ5LtWQeJIiy+wrBvjnghkl2/B7z3iZvEsDl6Uip6Dtv7ccmSskkh0ulsEykxWdAsRddpSaEYHv5pqex9aVgIMljM8o3DFTQclhVyGM0nrryDiMjhkCR5spighp/uR7nHEULlmJMGilyjqy6iB3/S6O1CXY110jpgYEAqhxkY9VA1hYYVLsoKV90uUGlnJcQRqQPoP3q1OqUGlRT5Y2ydM2FTBvsBGB+bhMQgZhZORqlkfIYzWDoUs4v6vM9v16XsP6TeXzNd0BPCZ+WamtOZBpwvSXZl85lqIEFONZ12uIr1R/sPsv6bQndN6gLk=" - # EE - - secure: "P6co7i4H73ZBjH/zRt5a+OuZp+x0aDUOorXRKO3RmCfgR2cu02+MB0nHkXrbKsfzFMBLjEEi3nqVUBhC2vxW+vpPrYuhlxp3it7hVwGhTgghjRjI1/0ybAUZjxYgeTt+QhUJsKEuE3tlwPq/YQ5hqhcO/AtEpORn9W11oi0NGaCmSzcKKoXgPWSfiU1DZZV//lpvkGzxaaYWL9GgmiQOEKN8PSRT0RH1HjAYug7X3D6fkPdyYkwmzL5buBO6r1/hJb+zCXtoak5xbCSy2dT3qN3FSbjlUZc2r5mgXSYgThM6KCHuQiT8zI1eRhHXMPxY47SpEGk1NuRMFqhSUkbYe+CgbLo9qjVG4mbt2We6MCbNmAW1lYDAvFefxOP5Kg6kjp1t7Ghs26IWcqlWHP200ujrPbl28bO3FtBKvhXDf/DXNQfVSk1G3EaDq9UgF/XlDZc2LScj8iuu03iJNdLJLL9WDj6FM3z1F9zMd8zYwPq9VHoZHqJbYc8GVfaeV3PQQk56GU4GsfeemH8oqSyVQkFLQDtVPEAHputJ85I0JR67VNFEdUklb9Ab3Xqs8iCtZvFx/Frfqsfh99SCm+Z4ABKOOTWepVigPKp4JH0t03zXiVmgNwd92UBvYcw0cc1rHr2GhROzGx0qUDdrK+6gOskBl8TvQLWkpmNsSlRGYzo=" - # MP - - secure: "dkVCNYSedLfeuqTboRPx/iWmXldhoHZpSp83cpkG6ZL81Psut2ZEHg6aBiWgqQWdfNAca4a51hWXs6utRqdgnxo51YAB/pMy0/b+jEOjZvuShOVz6TVqn5W5JLTNZJeVZL+BgvwXZWbIujH/cSuUv+h7GTnS+8Y4b2ZrCYilP35sAck2bbbAsKzbuW2yZZqK7X0UnSjoxg+KeT9DuK1zjjJJ6CZig1/n5ZjciQIv7JD50hmqFxBgjyBi71Loh/iohUF89EoQRXm0KkSmEhCINld5s+7SP4jSmnqyrNamNNw2ZGCgg3OXhcvDqOHjPwpCNNhrtzTExt/Z2cTzHz4FnV9ncJj9i1pkbjveuudVUTeaSHHXjw/X496OKLP3LwEZYggUCyc3nu9qR2zSs6zdG4ijhclOVzNrXDDixjpYGmOg8mVunG2cwFUSjtmX8nyPNXQvRnvsfnVYalprqXJHGmQW07nFE/2lbjdmnQiCEExNsKXO5vqrqo6RYOtTfka9B5s3ZkTkXgZkTWuEgWbaMC/fZhi0NCu2Ow3XOzQrs8hVLF4w1zngjqOLjk+LftqWwT42D47RKW3SZfVEVm8Vw+JGfh/uJUNAsPsu+Mybw8k0aDmLjPTlRZD+dYvQ2EPizgc2+cf+0GVoaGzKZF+cJ8I0ut8kO13M9ZmjiHU0se4=" addons: - # Setting latest here due to the switch from old selenium bindings - # to Marionette. At the date of this writing, ESR is Firefox 52 and has - # bad support for it. Thus we use latest (57.0 as of this writing) - firefox: "latest" + chrome: stable postgresql: "9.6" From 25dc5874a7b856225c19ccfdfba1c8bc6d78afd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 25 May 2018 15:45:14 +0200 Subject: [PATCH 090/104] Bump VERSION to 7.4.6 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 7b804b19f9..f11d74fde1 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.4.5" + VERSION = "7.4.6" end end From 19292229acdafbc38c24d2a21b88f0aca0160829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 25 Jun 2018 13:21:44 +0200 Subject: [PATCH 091/104] Replace modal-wrapper with service --- app/cells/views/response_body.erb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/cells/views/response_body.erb b/app/cells/views/response_body.erb index 19b420aaaa..740821e3f4 100644 --- a/app/cells/views/response_body.erb +++ b/app/cells/views/response_body.erb @@ -1,4 +1,4 @@ - +
    <%= op_icon('icon-info1') %> <%= t(:button_show) %> @@ -18,12 +18,11 @@ - \ No newline at end of file +
    \ No newline at end of file From 95a21390e18e4db80d202e3f1e047b19f9b99722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 26 Jun 2018 07:36:26 +0200 Subject: [PATCH 092/104] Updating generated .travis.yml from devkit [ci skip] --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ae64999e15..b1f6a8e9c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -91,8 +91,8 @@ before_install: - git fetch --depth=1 openproject - git checkout openproject/$TRAVIS_BRANCH - # Install Node LTS Boron (6.9.1) - - "nvm install 6.9.1" + # Install Node latest LTS + - "nvm install --lts" # work around https://github.com/travis-ci/travis-ci/issues/8969 - travis_retry gem update --system - gem install bundler From 5959ee42100c7942fd1ff553837566afd2590519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 10 Jul 2018 10:03:28 +0200 Subject: [PATCH 093/104] Bump VERSION to 7.4.7 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index f11d74fde1..ba27be61a1 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "7.4.6" + VERSION = "7.4.7" end end From 4023da75428f99214ebc31e50836e14f1868b9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 18 Jul 2018 10:13:22 +0200 Subject: [PATCH 094/104] Updating generated .travis.yml from devkit [ci skip] --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b1f6a8e9c5..98c2879c46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,7 +95,8 @@ before_install: - "nvm install --lts" # work around https://github.com/travis-ci/travis-ci/issues/8969 - travis_retry gem update --system - - gem install bundler + # Don't install 1.16.3 + - gem install bundler -v 1.16.2 bundler_args: --binstubs --without development production docker From e0b482adaed297ff4447a271a39beb8bc0e5effe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 1 Aug 2018 08:55:24 +0200 Subject: [PATCH 095/104] Updating generated .travis.yml from devkit [ci skip] --- .travis.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 98c2879c46..87f0d2152e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,19 +61,8 @@ env: - RAILS_ENV=test matrix: - - "TEST_SUITE=plugins:specs DB=mysql GROUP_SIZE=1 GROUP=1" - - "TEST_SUITE=plugins:features DB=mysql GROUP_SIZE=1 GROUP=1" - - "TEST_SUITE=npm" - - "TEST_SUITE=spec_legacy DB=mysql" - - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=1 GROUP=1" - - "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=1" - - "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=2" - - "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=3" - - "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=4" - - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=1" - - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=2" - - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=3" - - "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=4" + - "TEST_SUITE=plugins:specs DB=mysql GROUP_SIZE=1 GROUP=1 DB=none" + - "TEST_SUITE=plugins:features DB=mysql GROUP_SIZE=1 GROUP=1 DB=none" @@ -91,6 +80,10 @@ before_install: - git fetch --depth=1 openproject - git checkout openproject/$TRAVIS_BRANCH + # Install pandoc for testing textile migration + - sudo apt-get update -qq + - sudo apt-get install -qq pandoc + # Install Node latest LTS - "nvm install --lts" # work around https://github.com/travis-ci/travis-ci/issues/8969 @@ -102,10 +95,10 @@ before_install: bundler_args: --binstubs --without development production docker before_script: - - sh script/ci_setup.sh $TEST_SUITE $DB + - bash script/ci_setup.sh $TEST_SUITE $DB script: - - sh script/ci_runner.sh + - bash script/ci_runner.sh addons: From 4371342582a1286b5280f1e75c43abb13db90f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 2 Aug 2018 08:10:37 +0200 Subject: [PATCH 096/104] Updating generated .travis.yml from devkit [ci skip] --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 87f0d2152e..a857f824c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,8 +61,8 @@ env: - RAILS_ENV=test matrix: - - "TEST_SUITE=plugins:specs DB=mysql GROUP_SIZE=1 GROUP=1 DB=none" - - "TEST_SUITE=plugins:features DB=mysql GROUP_SIZE=1 GROUP=1 DB=none" + - "TEST_SUITE=plugins:specs DB=mysql GROUP_SIZE=1 GROUP=1" + - "TEST_SUITE=plugins:features DB=mysql GROUP_SIZE=1 GROUP=1" From bfb683d345f30a00cddcad8e66a79e73f38d8f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 10 Aug 2018 09:20:07 +0200 Subject: [PATCH 097/104] Updating generated .travis.yml from devkit [ci skip] --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a857f824c2..5237b09744 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,8 +81,8 @@ before_install: - git checkout openproject/$TRAVIS_BRANCH # Install pandoc for testing textile migration - - sudo apt-get update -qq - - sudo apt-get install -qq pandoc + - travis_retry sudo apt-get update -qq + - travis_retry sudo apt-get install -qq pandoc # Install Node latest LTS - "nvm install --lts" From 28b7c240c7c0b33bf74404fa62edf6e1a293458e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 17 Sep 2018 19:10:44 +0200 Subject: [PATCH 098/104] Bumped version to 8.1.0 --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 9f34acc769..9bcdf85261 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "8.0.0" + VERSION = "8.1.0" end end From 1202a7298e550be7ed51fa4f4a5302fab408ad47 Mon Sep 17 00:00:00 2001 From: Rodrigo Polo Date: Mon, 24 Sep 2018 15:19:11 -0300 Subject: [PATCH 099/104] Add signature secret on request header --- app/workers/work_package_webhook_job.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/workers/work_package_webhook_job.rb b/app/workers/work_package_webhook_job.rb index cf4baa9fe4..724dfe5ad3 100644 --- a/app/workers/work_package_webhook_job.rb +++ b/app/workers/work_package_webhook_job.rb @@ -42,13 +42,14 @@ class WorkPackageWebhookJob < WebhookJob def perform body = request_body + headers = request_headers exception = nil if signature = request_signature(body) - request_headers['HTTP_X_OP_SIGNATURE'] = signature + headers['X-OP-Signature'] = signature end - response = RestClient.post webhook.url, request_body, request_headers + response = RestClient.post webhook.url, request_body, headers rescue RestClient::Exception => e response = e.response @@ -62,7 +63,7 @@ class WorkPackageWebhookJob < WebhookJob webhook: webhook, event_name: event_name, url: webhook.url, - request_headers: request_headers, + request_headers: headers, request_body: body, response_code: response.try(:code).to_i, response_headers: response.try(:headers), From 7156c5f828f88f9e4572c5eded0c77a17fac4927 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Tue, 2 Oct 2018 15:27:35 +0200 Subject: [PATCH 100/104] Updating generated .travis.yml from devkit [ci skip] --- .travis.yml | 66 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5237b09744..d97b5295d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,10 @@ dist: trusty cache: bundler: true directories: - - frontend/node_modules + - frontend/node_modules/foundation-apps + - public/assets + - app/assets/javascripts/bundles + - app/assets/javascripts/locales branches: only: @@ -60,11 +63,6 @@ env: - CI=true - RAILS_ENV=test - matrix: - - "TEST_SUITE=plugins:specs DB=mysql GROUP_SIZE=1 GROUP=1" - - "TEST_SUITE=plugins:features DB=mysql GROUP_SIZE=1 GROUP=1" - - before_install: ## Custom plugin instructions follow. @@ -80,25 +78,59 @@ before_install: - git fetch --depth=1 openproject - git checkout openproject/$TRAVIS_BRANCH - # Install pandoc for testing textile migration - - travis_retry sudo apt-get update -qq - - travis_retry sudo apt-get install -qq pandoc - - # Install Node latest LTS - - "nvm install --lts" # work around https://github.com/travis-ci/travis-ci/issues/8969 - travis_retry gem update --system # Don't install 1.16.3 - gem install bundler -v 1.16.2 + # Install Node latest LTS + # This should only be necessary when preparing the cache or for npm test runs + # but installing later fails for unknown reasons. + - nvm install --lts bundler_args: --binstubs --without development production docker -before_script: - - bash script/ci_setup.sh $TEST_SUITE $DB - -script: - - bash script/ci_runner.sh +stages: + - prepare cache + - test + +jobs: + include: + - stage: prepare cache + name: 'Prepare cache' + script: + - bash script/ci/cache_prepare.sh + + - stage: test + name: 'plugins:specs (1/1) - mysql' + script: + - bash script/ci/setup.sh plugins:specs mysql + - bash script/ci/runner.sh plugins:specs 1 1 + - stage: test + name: 'plugins:specs (1/1) - postgres' + script: + - bash script/ci/setup.sh plugins:specs postgres + - bash script/ci/runner.sh plugins:specs 1 1 + - stage: test + name: 'plugins:features (1/1) - mysql' + script: + - bash script/ci/setup.sh plugins:features mysql + - bash script/ci/runner.sh plugins:features 1 1 + - stage: test + name: 'plugins:features (1/1) - postgres' + script: + - bash script/ci/setup.sh plugins:features postgres + - bash script/ci/runner.sh plugins:features 1 1 + - stage: test + name: 'plugins:cucumber (1/1) - mysql' + script: + - bash script/ci/setup.sh plugins:cucumber mysql + - bash script/ci/runner.sh plugins:cucumber 1 1 + - stage: test + name: 'plugins:cucumber (1/1) - postgres' + script: + - bash script/ci/setup.sh plugins:cucumber postgres + - bash script/ci/runner.sh plugins:cucumber 1 1 addons: From 1c8c1a3cf26e7fbb0cefa6d44e806f7397e51469 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Tue, 2 Oct 2018 15:51:29 +0200 Subject: [PATCH 101/104] Updating generated .travis.yml from devkit [ci skip] --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d97b5295d4..f877d60b96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -102,15 +102,15 @@ jobs: - bash script/ci/cache_prepare.sh - stage: test - name: 'plugins:specs (1/1) - mysql' + name: 'plugins:units (1/1) - mysql' script: - - bash script/ci/setup.sh plugins:specs mysql - - bash script/ci/runner.sh plugins:specs 1 1 + - bash script/ci/setup.sh plugins:units mysql + - bash script/ci/runner.sh plugins:units 1 1 - stage: test - name: 'plugins:specs (1/1) - postgres' + name: 'plugins:units (1/1) - postgres' script: - - bash script/ci/setup.sh plugins:specs postgres - - bash script/ci/runner.sh plugins:specs 1 1 + - bash script/ci/setup.sh plugins:units postgres + - bash script/ci/runner.sh plugins:units 1 1 - stage: test name: 'plugins:features (1/1) - mysql' script: From 5ce83844328211ac4d3c6ace10ec0f23a87165f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 24 Oct 2018 09:42:19 +0200 Subject: [PATCH 102/104] Bumped version to 8.2.0 [ci skip] --- lib/open_project/webhooks/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/version.rb b/lib/open_project/webhooks/version.rb index 9bcdf85261..83194ce213 100644 --- a/lib/open_project/webhooks/version.rb +++ b/lib/open_project/webhooks/version.rb @@ -14,6 +14,6 @@ module OpenProject module Webhooks - VERSION = "8.1.0" + VERSION = "8.2.0" end end From 2a18a066b385f594854e7da1a9efe0a5724021cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 14 Nov 2018 11:29:40 +0100 Subject: [PATCH 103/104] [28961] Don't globally cache event names --- lib/open_project/webhooks/event_resources.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_project/webhooks/event_resources.rb b/lib/open_project/webhooks/event_resources.rb index 6c69917efd..196e4b1f63 100644 --- a/lib/open_project/webhooks/event_resources.rb +++ b/lib/open_project/webhooks/event_resources.rb @@ -11,7 +11,7 @@ module OpenProject::Webhooks # Return a complete mapping of all resource modules # in the form { label => { event1: label , event2: label } } def available_events_map - @available_events ||= Hash[resource_modules.map { |m| [m.resource_name, m.available_events_map] }] + Hash[resource_modules.map { |m| [m.resource_name, m.available_events_map] }] end ## From c67cc392ce18d80ece708f15ad83e034c2ace115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 14 Nov 2018 13:57:26 +0100 Subject: [PATCH 104/104] Prepare for core integration --- .travis.yml | 138 ------------------ .../webhooks/Gemfile.plugins | 0 README.md => modules/webhooks/README.md | 0 .../assets/javascripts/webhooks/webhooks.js | 0 .../assets/stylesheets/webhooks/webhooks.sass | 0 .../app}/cells/views/response_body.erb | 0 .../webhooks/outgoing/deliveries/row_cell.rb | 0 .../outgoing/deliveries/table_cell.rb | 0 .../webhooks/outgoing/webhooks/row_cell.rb | 0 .../webhooks/outgoing/webhooks/table_cell.rb | 0 .../webhooks/incoming/hooks_controller.rb | 0 .../webhooks/outgoing/admin_controller.rb | 0 .../webhooks/app}/models/webhooks.rb | 0 .../webhooks/app}/models/webhooks/event.rb | 0 .../webhooks/app}/models/webhooks/log.rb | 0 .../webhooks/app}/models/webhooks/project.rb | 0 .../webhooks/app}/models/webhooks/webhook.rb | 0 .../outgoing/update_webhook_service.rb | 0 .../webhooks/outgoing/admin/_form.html.erb | 0 .../outgoing/admin/_header_tags.html.erb | 0 .../webhooks/outgoing/admin/edit.html.erb | 0 .../webhooks/outgoing/admin/index.html.erb | 0 .../webhooks/outgoing/admin/new.html.erb | 0 .../webhooks/outgoing/admin/show.html.erb | 0 .../webhooks/app}/workers/webhook_job.rb | 0 .../app}/workers/work_package_webhook_job.rb | 0 .../webhooks/config}/locales/en.yml | 0 {config => modules/webhooks/config}/routes.rb | 0 .../migrate/20171218205557_add_webhooks.rb | 0 .../20171219145752_create_webhook_logs.rb | 0 {doc => modules/webhooks/doc}/CHANGELOG.md | 0 {doc => modules/webhooks/doc}/COPYRIGHT.md | 0 .../webhooks/doc}/COPYRIGHT_short.md | 0 {doc => modules/webhooks/doc}/GPL.txt | 0 .../webhooks/lib}/open_project/webhooks.rb | 0 .../lib}/open_project/webhooks/engine.rb | 0 .../open_project/webhooks/event_resources.rb | 0 .../webhooks/event_resources/base.rb | 0 .../webhooks/event_resources/work_package.rb | 0 .../lib}/open_project/webhooks/hook.rb | 0 .../lib}/open_project/webhooks/version.rb | 0 .../webhooks/lib}/openproject-webhooks.rb | 0 .../webhooks/openproject-webhooks.gemspec | 0 .../outgoing/admin_controller_spec.rb | 0 .../controllers/webhooks_controller_spec.rb | 0 .../spec}/factories/webhook_factory.rb | 0 .../spec}/factories/webhook_log_factory.rb | 0 .../spec}/features/manage_webhooks_spec.rb | 0 .../webhooks/spec}/lib/hook_spec.rb | 0 .../webhooks/spec}/lib/webhooks_spec.rb | 0 .../webhooks/spec}/models/webhook_spec.rb | 0 .../outgoing/admin_controller_spec.rb | 0 .../webhooks/spec}/spec_helper.rb | 0 .../spec}/workers/work_package_webhook_job.rb | 0 54 files changed, 138 deletions(-) delete mode 100644 .travis.yml rename Gemfile.plugins => modules/webhooks/Gemfile.plugins (100%) rename README.md => modules/webhooks/README.md (100%) rename {app => modules/webhooks/app}/assets/javascripts/webhooks/webhooks.js (100%) rename {app => modules/webhooks/app}/assets/stylesheets/webhooks/webhooks.sass (100%) rename {app => modules/webhooks/app}/cells/views/response_body.erb (100%) rename {app => modules/webhooks/app}/cells/webhooks/outgoing/deliveries/row_cell.rb (100%) rename {app => modules/webhooks/app}/cells/webhooks/outgoing/deliveries/table_cell.rb (100%) rename {app => modules/webhooks/app}/cells/webhooks/outgoing/webhooks/row_cell.rb (100%) rename {app => modules/webhooks/app}/cells/webhooks/outgoing/webhooks/table_cell.rb (100%) rename {app => modules/webhooks/app}/controllers/webhooks/incoming/hooks_controller.rb (100%) rename {app => modules/webhooks/app}/controllers/webhooks/outgoing/admin_controller.rb (100%) rename {app => modules/webhooks/app}/models/webhooks.rb (100%) rename {app => modules/webhooks/app}/models/webhooks/event.rb (100%) rename {app => modules/webhooks/app}/models/webhooks/log.rb (100%) rename {app => modules/webhooks/app}/models/webhooks/project.rb (100%) rename {app => modules/webhooks/app}/models/webhooks/webhook.rb (100%) rename {app => modules/webhooks/app}/services/webhooks/outgoing/update_webhook_service.rb (100%) rename {app => modules/webhooks/app}/views/webhooks/outgoing/admin/_form.html.erb (100%) rename {app => modules/webhooks/app}/views/webhooks/outgoing/admin/_header_tags.html.erb (100%) rename {app => modules/webhooks/app}/views/webhooks/outgoing/admin/edit.html.erb (100%) rename {app => modules/webhooks/app}/views/webhooks/outgoing/admin/index.html.erb (100%) rename {app => modules/webhooks/app}/views/webhooks/outgoing/admin/new.html.erb (100%) rename {app => modules/webhooks/app}/views/webhooks/outgoing/admin/show.html.erb (100%) rename {app => modules/webhooks/app}/workers/webhook_job.rb (100%) rename {app => modules/webhooks/app}/workers/work_package_webhook_job.rb (100%) rename {config => modules/webhooks/config}/locales/en.yml (100%) rename {config => modules/webhooks/config}/routes.rb (100%) rename {db => modules/webhooks/db}/migrate/20171218205557_add_webhooks.rb (100%) rename {db => modules/webhooks/db}/migrate/20171219145752_create_webhook_logs.rb (100%) rename {doc => modules/webhooks/doc}/CHANGELOG.md (100%) rename {doc => modules/webhooks/doc}/COPYRIGHT.md (100%) rename {doc => modules/webhooks/doc}/COPYRIGHT_short.md (100%) rename {doc => modules/webhooks/doc}/GPL.txt (100%) rename {lib => modules/webhooks/lib}/open_project/webhooks.rb (100%) rename {lib => modules/webhooks/lib}/open_project/webhooks/engine.rb (100%) rename {lib => modules/webhooks/lib}/open_project/webhooks/event_resources.rb (100%) rename {lib => modules/webhooks/lib}/open_project/webhooks/event_resources/base.rb (100%) rename {lib => modules/webhooks/lib}/open_project/webhooks/event_resources/work_package.rb (100%) rename {lib => modules/webhooks/lib}/open_project/webhooks/hook.rb (100%) rename {lib => modules/webhooks/lib}/open_project/webhooks/version.rb (100%) rename {lib => modules/webhooks/lib}/openproject-webhooks.rb (100%) rename openproject-webhooks.gemspec => modules/webhooks/openproject-webhooks.gemspec (100%) rename {spec => modules/webhooks/spec}/controllers/outgoing/admin_controller_spec.rb (100%) rename {spec => modules/webhooks/spec}/controllers/webhooks_controller_spec.rb (100%) rename {spec => modules/webhooks/spec}/factories/webhook_factory.rb (100%) rename {spec => modules/webhooks/spec}/factories/webhook_log_factory.rb (100%) rename {spec => modules/webhooks/spec}/features/manage_webhooks_spec.rb (100%) rename {spec => modules/webhooks/spec}/lib/hook_spec.rb (100%) rename {spec => modules/webhooks/spec}/lib/webhooks_spec.rb (100%) rename {spec => modules/webhooks/spec}/models/webhook_spec.rb (100%) rename {spec => modules/webhooks/spec}/routing/webhooks/outgoing/admin_controller_spec.rb (100%) rename {spec => modules/webhooks/spec}/spec_helper.rb (100%) rename {spec => modules/webhooks/spec}/workers/work_package_webhook_job.rb (100%) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f877d60b96..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,138 +0,0 @@ -#-- copyright -# OpenProject is a project management system. -# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2018 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# 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. -# -# See doc/COPYRIGHT.rdoc for more details. -#++ - - -################################### -# -# This file was generated by -# openproject-devkit. -# -# Do not modify this file directly! -# -################################### - -language: ruby - -rvm: - - 2.5.1 - -sudo: required -dist: trusty - -cache: - bundler: true - directories: - - frontend/node_modules/foundation-apps - - public/assets - - app/assets/javascripts/bundles - - app/assets/javascripts/locales - -branches: - only: - - master - - dev - - /^(stable|release)\/.*$/ - -env: - global: - - CI=true - - RAILS_ENV=test - - -before_install: - ## Custom plugin instructions follow. - # Move the plugin into a subfolder. The plugin-provided Gemfile.plugins - # must refer to this folder. - - mkdir -p plugins/this - - echo `ls -a | tail -n+3 | grep -v plugins` plugins/this/ | xargs mv - - # Get OpenProject. - # Doing the fetch detour as you cannot clone into the current directory. - - git init - - git remote add openproject https://github.com/opf/openproject.git - - git fetch --depth=1 openproject - - git checkout openproject/$TRAVIS_BRANCH - - # work around https://github.com/travis-ci/travis-ci/issues/8969 - - travis_retry gem update --system - # Don't install 1.16.3 - - gem install bundler -v 1.16.2 - - # Install Node latest LTS - # This should only be necessary when preparing the cache or for npm test runs - # but installing later fails for unknown reasons. - - nvm install --lts - -bundler_args: --binstubs --without development production docker - -stages: - - prepare cache - - test - -jobs: - include: - - stage: prepare cache - name: 'Prepare cache' - script: - - bash script/ci/cache_prepare.sh - - - stage: test - name: 'plugins:units (1/1) - mysql' - script: - - bash script/ci/setup.sh plugins:units mysql - - bash script/ci/runner.sh plugins:units 1 1 - - stage: test - name: 'plugins:units (1/1) - postgres' - script: - - bash script/ci/setup.sh plugins:units postgres - - bash script/ci/runner.sh plugins:units 1 1 - - stage: test - name: 'plugins:features (1/1) - mysql' - script: - - bash script/ci/setup.sh plugins:features mysql - - bash script/ci/runner.sh plugins:features 1 1 - - stage: test - name: 'plugins:features (1/1) - postgres' - script: - - bash script/ci/setup.sh plugins:features postgres - - bash script/ci/runner.sh plugins:features 1 1 - - stage: test - name: 'plugins:cucumber (1/1) - mysql' - script: - - bash script/ci/setup.sh plugins:cucumber mysql - - bash script/ci/runner.sh plugins:cucumber 1 1 - - stage: test - name: 'plugins:cucumber (1/1) - postgres' - script: - - bash script/ci/setup.sh plugins:cucumber postgres - - bash script/ci/runner.sh plugins:cucumber 1 1 - - -addons: - chrome: stable - postgresql: "9.6" diff --git a/Gemfile.plugins b/modules/webhooks/Gemfile.plugins similarity index 100% rename from Gemfile.plugins rename to modules/webhooks/Gemfile.plugins diff --git a/README.md b/modules/webhooks/README.md similarity index 100% rename from README.md rename to modules/webhooks/README.md diff --git a/app/assets/javascripts/webhooks/webhooks.js b/modules/webhooks/app/assets/javascripts/webhooks/webhooks.js similarity index 100% rename from app/assets/javascripts/webhooks/webhooks.js rename to modules/webhooks/app/assets/javascripts/webhooks/webhooks.js diff --git a/app/assets/stylesheets/webhooks/webhooks.sass b/modules/webhooks/app/assets/stylesheets/webhooks/webhooks.sass similarity index 100% rename from app/assets/stylesheets/webhooks/webhooks.sass rename to modules/webhooks/app/assets/stylesheets/webhooks/webhooks.sass diff --git a/app/cells/views/response_body.erb b/modules/webhooks/app/cells/views/response_body.erb similarity index 100% rename from app/cells/views/response_body.erb rename to modules/webhooks/app/cells/views/response_body.erb diff --git a/app/cells/webhooks/outgoing/deliveries/row_cell.rb b/modules/webhooks/app/cells/webhooks/outgoing/deliveries/row_cell.rb similarity index 100% rename from app/cells/webhooks/outgoing/deliveries/row_cell.rb rename to modules/webhooks/app/cells/webhooks/outgoing/deliveries/row_cell.rb diff --git a/app/cells/webhooks/outgoing/deliveries/table_cell.rb b/modules/webhooks/app/cells/webhooks/outgoing/deliveries/table_cell.rb similarity index 100% rename from app/cells/webhooks/outgoing/deliveries/table_cell.rb rename to modules/webhooks/app/cells/webhooks/outgoing/deliveries/table_cell.rb diff --git a/app/cells/webhooks/outgoing/webhooks/row_cell.rb b/modules/webhooks/app/cells/webhooks/outgoing/webhooks/row_cell.rb similarity index 100% rename from app/cells/webhooks/outgoing/webhooks/row_cell.rb rename to modules/webhooks/app/cells/webhooks/outgoing/webhooks/row_cell.rb diff --git a/app/cells/webhooks/outgoing/webhooks/table_cell.rb b/modules/webhooks/app/cells/webhooks/outgoing/webhooks/table_cell.rb similarity index 100% rename from app/cells/webhooks/outgoing/webhooks/table_cell.rb rename to modules/webhooks/app/cells/webhooks/outgoing/webhooks/table_cell.rb diff --git a/app/controllers/webhooks/incoming/hooks_controller.rb b/modules/webhooks/app/controllers/webhooks/incoming/hooks_controller.rb similarity index 100% rename from app/controllers/webhooks/incoming/hooks_controller.rb rename to modules/webhooks/app/controllers/webhooks/incoming/hooks_controller.rb diff --git a/app/controllers/webhooks/outgoing/admin_controller.rb b/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb similarity index 100% rename from app/controllers/webhooks/outgoing/admin_controller.rb rename to modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb diff --git a/app/models/webhooks.rb b/modules/webhooks/app/models/webhooks.rb similarity index 100% rename from app/models/webhooks.rb rename to modules/webhooks/app/models/webhooks.rb diff --git a/app/models/webhooks/event.rb b/modules/webhooks/app/models/webhooks/event.rb similarity index 100% rename from app/models/webhooks/event.rb rename to modules/webhooks/app/models/webhooks/event.rb diff --git a/app/models/webhooks/log.rb b/modules/webhooks/app/models/webhooks/log.rb similarity index 100% rename from app/models/webhooks/log.rb rename to modules/webhooks/app/models/webhooks/log.rb diff --git a/app/models/webhooks/project.rb b/modules/webhooks/app/models/webhooks/project.rb similarity index 100% rename from app/models/webhooks/project.rb rename to modules/webhooks/app/models/webhooks/project.rb diff --git a/app/models/webhooks/webhook.rb b/modules/webhooks/app/models/webhooks/webhook.rb similarity index 100% rename from app/models/webhooks/webhook.rb rename to modules/webhooks/app/models/webhooks/webhook.rb diff --git a/app/services/webhooks/outgoing/update_webhook_service.rb b/modules/webhooks/app/services/webhooks/outgoing/update_webhook_service.rb similarity index 100% rename from app/services/webhooks/outgoing/update_webhook_service.rb rename to modules/webhooks/app/services/webhooks/outgoing/update_webhook_service.rb diff --git a/app/views/webhooks/outgoing/admin/_form.html.erb b/modules/webhooks/app/views/webhooks/outgoing/admin/_form.html.erb similarity index 100% rename from app/views/webhooks/outgoing/admin/_form.html.erb rename to modules/webhooks/app/views/webhooks/outgoing/admin/_form.html.erb diff --git a/app/views/webhooks/outgoing/admin/_header_tags.html.erb b/modules/webhooks/app/views/webhooks/outgoing/admin/_header_tags.html.erb similarity index 100% rename from app/views/webhooks/outgoing/admin/_header_tags.html.erb rename to modules/webhooks/app/views/webhooks/outgoing/admin/_header_tags.html.erb diff --git a/app/views/webhooks/outgoing/admin/edit.html.erb b/modules/webhooks/app/views/webhooks/outgoing/admin/edit.html.erb similarity index 100% rename from app/views/webhooks/outgoing/admin/edit.html.erb rename to modules/webhooks/app/views/webhooks/outgoing/admin/edit.html.erb diff --git a/app/views/webhooks/outgoing/admin/index.html.erb b/modules/webhooks/app/views/webhooks/outgoing/admin/index.html.erb similarity index 100% rename from app/views/webhooks/outgoing/admin/index.html.erb rename to modules/webhooks/app/views/webhooks/outgoing/admin/index.html.erb diff --git a/app/views/webhooks/outgoing/admin/new.html.erb b/modules/webhooks/app/views/webhooks/outgoing/admin/new.html.erb similarity index 100% rename from app/views/webhooks/outgoing/admin/new.html.erb rename to modules/webhooks/app/views/webhooks/outgoing/admin/new.html.erb diff --git a/app/views/webhooks/outgoing/admin/show.html.erb b/modules/webhooks/app/views/webhooks/outgoing/admin/show.html.erb similarity index 100% rename from app/views/webhooks/outgoing/admin/show.html.erb rename to modules/webhooks/app/views/webhooks/outgoing/admin/show.html.erb diff --git a/app/workers/webhook_job.rb b/modules/webhooks/app/workers/webhook_job.rb similarity index 100% rename from app/workers/webhook_job.rb rename to modules/webhooks/app/workers/webhook_job.rb diff --git a/app/workers/work_package_webhook_job.rb b/modules/webhooks/app/workers/work_package_webhook_job.rb similarity index 100% rename from app/workers/work_package_webhook_job.rb rename to modules/webhooks/app/workers/work_package_webhook_job.rb diff --git a/config/locales/en.yml b/modules/webhooks/config/locales/en.yml similarity index 100% rename from config/locales/en.yml rename to modules/webhooks/config/locales/en.yml diff --git a/config/routes.rb b/modules/webhooks/config/routes.rb similarity index 100% rename from config/routes.rb rename to modules/webhooks/config/routes.rb diff --git a/db/migrate/20171218205557_add_webhooks.rb b/modules/webhooks/db/migrate/20171218205557_add_webhooks.rb similarity index 100% rename from db/migrate/20171218205557_add_webhooks.rb rename to modules/webhooks/db/migrate/20171218205557_add_webhooks.rb diff --git a/db/migrate/20171219145752_create_webhook_logs.rb b/modules/webhooks/db/migrate/20171219145752_create_webhook_logs.rb similarity index 100% rename from db/migrate/20171219145752_create_webhook_logs.rb rename to modules/webhooks/db/migrate/20171219145752_create_webhook_logs.rb diff --git a/doc/CHANGELOG.md b/modules/webhooks/doc/CHANGELOG.md similarity index 100% rename from doc/CHANGELOG.md rename to modules/webhooks/doc/CHANGELOG.md diff --git a/doc/COPYRIGHT.md b/modules/webhooks/doc/COPYRIGHT.md similarity index 100% rename from doc/COPYRIGHT.md rename to modules/webhooks/doc/COPYRIGHT.md diff --git a/doc/COPYRIGHT_short.md b/modules/webhooks/doc/COPYRIGHT_short.md similarity index 100% rename from doc/COPYRIGHT_short.md rename to modules/webhooks/doc/COPYRIGHT_short.md diff --git a/doc/GPL.txt b/modules/webhooks/doc/GPL.txt similarity index 100% rename from doc/GPL.txt rename to modules/webhooks/doc/GPL.txt diff --git a/lib/open_project/webhooks.rb b/modules/webhooks/lib/open_project/webhooks.rb similarity index 100% rename from lib/open_project/webhooks.rb rename to modules/webhooks/lib/open_project/webhooks.rb diff --git a/lib/open_project/webhooks/engine.rb b/modules/webhooks/lib/open_project/webhooks/engine.rb similarity index 100% rename from lib/open_project/webhooks/engine.rb rename to modules/webhooks/lib/open_project/webhooks/engine.rb diff --git a/lib/open_project/webhooks/event_resources.rb b/modules/webhooks/lib/open_project/webhooks/event_resources.rb similarity index 100% rename from lib/open_project/webhooks/event_resources.rb rename to modules/webhooks/lib/open_project/webhooks/event_resources.rb diff --git a/lib/open_project/webhooks/event_resources/base.rb b/modules/webhooks/lib/open_project/webhooks/event_resources/base.rb similarity index 100% rename from lib/open_project/webhooks/event_resources/base.rb rename to modules/webhooks/lib/open_project/webhooks/event_resources/base.rb diff --git a/lib/open_project/webhooks/event_resources/work_package.rb b/modules/webhooks/lib/open_project/webhooks/event_resources/work_package.rb similarity index 100% rename from lib/open_project/webhooks/event_resources/work_package.rb rename to modules/webhooks/lib/open_project/webhooks/event_resources/work_package.rb diff --git a/lib/open_project/webhooks/hook.rb b/modules/webhooks/lib/open_project/webhooks/hook.rb similarity index 100% rename from lib/open_project/webhooks/hook.rb rename to modules/webhooks/lib/open_project/webhooks/hook.rb diff --git a/lib/open_project/webhooks/version.rb b/modules/webhooks/lib/open_project/webhooks/version.rb similarity index 100% rename from lib/open_project/webhooks/version.rb rename to modules/webhooks/lib/open_project/webhooks/version.rb diff --git a/lib/openproject-webhooks.rb b/modules/webhooks/lib/openproject-webhooks.rb similarity index 100% rename from lib/openproject-webhooks.rb rename to modules/webhooks/lib/openproject-webhooks.rb diff --git a/openproject-webhooks.gemspec b/modules/webhooks/openproject-webhooks.gemspec similarity index 100% rename from openproject-webhooks.gemspec rename to modules/webhooks/openproject-webhooks.gemspec diff --git a/spec/controllers/outgoing/admin_controller_spec.rb b/modules/webhooks/spec/controllers/outgoing/admin_controller_spec.rb similarity index 100% rename from spec/controllers/outgoing/admin_controller_spec.rb rename to modules/webhooks/spec/controllers/outgoing/admin_controller_spec.rb diff --git a/spec/controllers/webhooks_controller_spec.rb b/modules/webhooks/spec/controllers/webhooks_controller_spec.rb similarity index 100% rename from spec/controllers/webhooks_controller_spec.rb rename to modules/webhooks/spec/controllers/webhooks_controller_spec.rb diff --git a/spec/factories/webhook_factory.rb b/modules/webhooks/spec/factories/webhook_factory.rb similarity index 100% rename from spec/factories/webhook_factory.rb rename to modules/webhooks/spec/factories/webhook_factory.rb diff --git a/spec/factories/webhook_log_factory.rb b/modules/webhooks/spec/factories/webhook_log_factory.rb similarity index 100% rename from spec/factories/webhook_log_factory.rb rename to modules/webhooks/spec/factories/webhook_log_factory.rb diff --git a/spec/features/manage_webhooks_spec.rb b/modules/webhooks/spec/features/manage_webhooks_spec.rb similarity index 100% rename from spec/features/manage_webhooks_spec.rb rename to modules/webhooks/spec/features/manage_webhooks_spec.rb diff --git a/spec/lib/hook_spec.rb b/modules/webhooks/spec/lib/hook_spec.rb similarity index 100% rename from spec/lib/hook_spec.rb rename to modules/webhooks/spec/lib/hook_spec.rb diff --git a/spec/lib/webhooks_spec.rb b/modules/webhooks/spec/lib/webhooks_spec.rb similarity index 100% rename from spec/lib/webhooks_spec.rb rename to modules/webhooks/spec/lib/webhooks_spec.rb diff --git a/spec/models/webhook_spec.rb b/modules/webhooks/spec/models/webhook_spec.rb similarity index 100% rename from spec/models/webhook_spec.rb rename to modules/webhooks/spec/models/webhook_spec.rb diff --git a/spec/routing/webhooks/outgoing/admin_controller_spec.rb b/modules/webhooks/spec/routing/webhooks/outgoing/admin_controller_spec.rb similarity index 100% rename from spec/routing/webhooks/outgoing/admin_controller_spec.rb rename to modules/webhooks/spec/routing/webhooks/outgoing/admin_controller_spec.rb diff --git a/spec/spec_helper.rb b/modules/webhooks/spec/spec_helper.rb similarity index 100% rename from spec/spec_helper.rb rename to modules/webhooks/spec/spec_helper.rb diff --git a/spec/workers/work_package_webhook_job.rb b/modules/webhooks/spec/workers/work_package_webhook_job.rb similarity index 100% rename from spec/workers/work_package_webhook_job.rb rename to modules/webhooks/spec/workers/work_package_webhook_job.rb