koppen / redmine_github_hook

Allow your Redmine installation to be notified when changes have been pushed to a Github repository.
http://mentalized.net/journal/2009/08/03/redmine_plugin_github_hook/
MIT License
478 stars 114 forks source link

In 1.4 there can be more than one repository for a project #22

Closed azatoth closed 11 years ago

azatoth commented 12 years ago

We want to handle this in a nice way, thus we enable posibility to update "default", "specific" and "all" git repos (default might or might not be a git repo, so we'll have to handle that as well)

To update a specific repo, add parameter "repository_id=NN" to the query string. to update all repos, add "update_all=yes"

koppen commented 12 years ago

Hey, thanks for your contribution. I like the way you're handling this, by allowing it to be configured via the querystring.

One thing, though, this change massively breaks the test suite. If the failures are fixed I'll be happy to merge this in.

azatoth commented 12 years ago

I would love to, but I've failed to grasp how to actually run the tests; i.e. which environment is required etc... I actually thought the test routines was broken, as "rake test" just bailed out for me.

koppen commented 12 years ago

Yeah, testing unfortunately isn't as simple as I'd wish it was.

With Redmine Github Hook being a Redmine plugin it needs to be run inside a full Redmine installation. The plugin writing tutorial at http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial#Testing-your-plugin has some instructions for how to get it setup.

The short version is (I believe):

  1. Install Redmine
  2. Get Redmine set up for testing
  3. Add the plugin to Redmine
  4. Install mocha
  5. In the plugin directory: rake test should run the tests.

Let me know if that doesn't work out for you, and especially what messages rake test bails out with. I might need to document this in further detail.

azatoth commented 12 years ago

It bails out at the moment with following text:

[0:1][carl@carl-excito redmine_github_hook] «koppen $»$ rake test RAILS_ENV=test
/home/carl/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -I"lib:test" -I"/home/carl/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2.2/lib" "/home/carl/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/functional/github_hook_controller_test.rb" 
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- /home/carl/Downloads/redmine-1.4.4/vendor/test/test_helper (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /home/carl/Downloads/redmine-1.4.4/vendor/plugins/redmine_github_hook/test/test_helper.rb:2:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /home/carl/Downloads/redmine-1.4.4/vendor/plugins/redmine_github_hook/test/functional/github_hook_controller_test.rb:1:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /home/carl/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15:in `block in <main>'
    from /home/carl/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
    from /home/carl/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1): [/home/carl/.rvm/rubies/ruby-1.9.2-p180/bin...]

Tasks: TOP => test
(See full trace by running task with --trace)
koppen commented 12 years ago

Oh, I missed you're using Redmine 1.4.

master is currently tracking Redmine 2.x, which expects plugins to be in Rails.root/plugins, not Rails.root/vendor/plugins, which I suspect is why you're seeing that error.

You should be able to run the tests on the redmine_1.x branch, but there is no rake task for it (I think), so you'll have to do

ruby -Itest test/functional/github_hooks_controller.rb
rodrigueznicolas commented 11 years ago

Hi,

Why this correction (multi-repo problem) isn't merged on the master branch (for 2.x redmine users) ?

Thanks.

koppen commented 11 years ago

This specific pull request adds has only been tested for Redmine 1.4, thus has only been added to the Redmine 1.4 branch. Actually, I should be closing this since it was moved to pull request #28 and merged there.

@rodrigueznicolas , I'd be very happy to merge a pull request adding and testing this feature to master.