flowdock/flowdock-svn-hook

语言: Ruby

git: https://github.com/flowdock/flowdock-svn-hook

Subversion hook将事件发送到Flowdock
Subversion hook sending events to Flowdock
README.md (中文)

flowdock - svn的挂机

Subversion钩子,它向Flowdock发送事件

如果您已经了解Ruby和Subversion提交挂钩, flowdock提交 - hook.rb 是你在找什么。

要求

该软件需要可供托管存储库的用户使用。

  • ruby - 支持1.8.7和1.9.x.

使用操作系统的软件包管理器安装或更新,或按照说明进行操作   在http://www.ruby-lang.org/en/downloads/。   注意,使用rvm可能很棘手,因为没有运行提交挂钩 一个真正的shell环境!

  • rubygems - 仅适用于1.8.7,rubygems包含在标准1.9.x红宝石中

按照https://rubygems.org/pages/download上的安装说明进行操作。

TL; DR;目前:

    wget http://production.cf.rubygems.org/rubygems/rubygems-2.4.5.zip
    unzip rubygems-1.8.24.zip
    cd rubygems-1.8.24
    ruby setup.rb
  • svn和multi_json gemsgem安装svn multi_json --no-ri --no-rdoc

注意:当前版本的svn gem(0.2.0)在某些操作中被破坏   系统包括Mac OS X和RedHat Enterprise Linux / CentOS。你需要   从Github源手动安装gem。

安装

找出存储库在文件系统中的位置。我们将参考它 稍后挂钩子目录为HOOKS_DIR。

复制flowdock-commit-hook.rb 到你的HOOKS_DIR。

更改flowdock-commit-hook.rb文件顶部的配置变量:

  • FLOW_TOKEN(强制性)

登录到Flowdock并通过单击侧栏中当前流名称旁边的齿轮来创建源。选择Integrations,从列表中找到Subversion,然后单击Add new。可以在那里创建令牌。

  • REPOSITORY_NAME(可选)

在团队收件箱中用作源名称。如果它是nil,那么目录名称为   使用存储库(/ var / www / repos / foo将显示为foo)。

  • REPOSITORY_URL(可选)

在团队收件箱中用作项目源的链接。   例如。 https://svn.example.com/repository/trunk

  • REVISION_URL(可选)

在团队收件箱消息中用作指向特定修订的链接。字符串 :修订版本替换为修订版号。例如。 http://svn.example.com/repo/trunk?p=:revision与r1234成为链接 在Flowdock团队收件箱中http://svn.example.com/repo/trunk?p=1234。

  • 用户(可选)

将Subversion用户名映射到真实姓名和电子邮件地址。   Flowdock使用这些来丰富您的团队收件箱邮件的默认内容。

  • 标签(可选)

指定要添加到每个团队收件箱消息的一组标记   库。应该作为字符串数组输入。没有#字符   标签所必需的。

  • VERIFY_SSL(可选)

如果您不关心某些第三方可能会得到,请将此设置为false   看看你的流量令牌。

如果您还没有发布提交脚本,则必须创建调用 脚本:

cat > HOOKS_DIR/post-commit <<EOF
#!/bin/sh
EOF
chmod u+x HOOKS_DIR/post-commit

在HOOKS_DIR / post-commit文件的底部添加此行

ruby HOOKS_DIR/flowdock-commit-hook.rb "$1" "$2"

其中'ruby'是安装的ruby解释器的绝对路径。

笔记

为了充分利用Flowdock post commit钩子,我们鼓励您 遵循SVN最佳实践。

顺便说一下,还有另一个SCM工具Git。

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

flowdock-svn-hook

Subversion hook that sends events to Flowdock

If you already know about Ruby and Subversion commit hooks,
flowdock-commit-hook.rb
is what you are looking for.

Requirements

This software needs to be available for the user that hosts the repository.

  • ruby - 1.8.7 and 1.9.x are supported

Install or update using your OS's package manager or follow the instructions
at http://www.ruby-lang.org/en/downloads/.
Note, that using rvm could be tricky, because commit hooks are not run on
a real shell environment!

  • rubygems - only for 1.8.7, rubygems is included in standard 1.9.x ruby

Follow the installation instructions at https://rubygems.org/pages/download.

TL;DR; Currently:

    wget http://production.cf.rubygems.org/rubygems/rubygems-2.4.5.zip
    unzip rubygems-1.8.24.zip
    cd rubygems-1.8.24
    ruby setup.rb
  • svn and multi_json gems
    gem install svn multi_json --no-ri --no-rdoc
    

NOTE: The current version of the svn gem (0.2.0) is broken on some operating
systems including Mac OS X and RedHat Enterprise Linux/CentOS. You need to
install the gem manually from Github sources.

Install

Find out where your repository is located in the filesystem. We'll refer to its
hooks subdirectory as HOOKS_DIR later on.

Copy flowdock-commit-hook.rb
to your HOOKS_DIR.

Change the configuration variables at the top of the flowdock-commit-hook.rb file:

  • FLOW_TOKEN (mandatory)

Log in to Flowdock and create a source by clicking on the cog wheel next to the current flow's name in the sidebar. Choose Integrations, find Subversion from the list and click Add new. The token can be created there.

  • REPOSITORY_NAME (optional)

Used in the team inbox as a source name. If it's nil, then the directory name of
the repository is used (/var/www/repos/foo will show up as foo).

  • REPOSITORY_URL (optional)

Used in the team inbox as a link to the project source.
Eg. https://svn.example.com/repository/trunk

  • REVISION_URL (optional)

Used in team inbox messages as a link to a specific revision. The string
:revision is replaced with the revision number. E.g.
http://svn.example.com/repo/trunk?p=:revision with r1234 becomes a link to
http://svn.example.com/repo/trunk?p=1234 in Flowdock team inbox.

  • USERS (optional)

Map your Subversion usernames to real names and email addresses.
Flowdock uses these to enrich your team inbox messages' default content.

  • TAGS (optional)

Specify a set of tags to be added to each team inbox message from this
repository. Should be entered as an array of strings. No # character is
necessary for the tags.

  • VERIFY_SSL (optional)

Set this to false if you do not care that some third party might get
ahold of your flow token.

In case you don't yet have post commit scripts, you have to create the invoking
script:

cat > HOOKS_DIR/post-commit <<EOF
#!/bin/sh
EOF
chmod u+x HOOKS_DIR/post-commit

Add this line at the bottom of HOOKS_DIR/post-commit file

ruby HOOKS_DIR/flowdock-commit-hook.rb "$1" "$2"

where 'ruby' is an absolute path to your installed ruby interpreter.

Notes

To get the most out of the Flowdock post commit hook, we encourage you to
follow SVN best practices.

By the way, there is also another SCM tool, Git.