Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
gep13 committed Oct 26, 2015
2 parents 4aa92ab + 3059860 commit 2d60252
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 130 deletions.
143 changes: 20 additions & 123 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,136 +1,33 @@
# Cake.Gitter
Cake Addin that extend Cake with Gitter messaging features

## License
[![License](http://img.shields.io/:license-mit-blue.svg)](http://gep13.mit-license.org)

## Build Status

AppVeyor (develop) | AppVeyor (master)
------------- | -------------
[![AppVeyor Develop Build Status](https://ci.appveyor.com/api/projects/status/j27gftbv67vgq05r/branch/develop?svg=true)](https://ci.appveyor.com/project/GaryEwanPark/cake-gitter) | [![AppVeyor Master Build Status](https://ci.appveyor.com/api/projects/status/j27gftbv67vgq05r/branch/master?svg=true)](https://ci.appveyor.com/project/GaryEwanPark/cake-gitter)


## Chat Room

Come join in the conversation about ChocolateyGUI in our Gitter Chat Room

[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gep13/Cake.Gitter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

## Usage

### Post Message

#### Using Token

```csharp
#addin "Cake.Slack"
var gitterToken = EnvironmentVariable("GITTER_TOKEN");
var gitterRoomId = EnvironmentVariable("gitterRoomId");

try
{
var postMessageResult = Gitter.Chat.PostMessage(
message:"Hello from Cake.Gitter API",
messageSettings:new GitterChatMessageSettings { Token = gitterToken, RoomId = gitterRoomId}
);

if (postMessageResult.Ok)
{
Information("Message {0} succcessfully sent", postMessageResult.TimeStamp);
}
else
{
Error("Failed to send message: {0}", postMessageResult.Error);
}
}
catch(Exception ex)
{
Error("{0}", ex);
}
```

Cake output will be similar to below:

```
Message 2015-10-16T11:18:14.078Z successfully sent
```

This will result in a message appearing in the Gitter Room similar to the following:
Cake.Gitter is an Addin for [Cake](http://cakebuild.net/) which extends it by allowing the posting of messages to [Gitter](https://gitter.im), either:

![image](https://cloud.githubusercontent.com/assets/1271146/10540458/1c5fd648-7400-11e5-9529-1f3729850300.png)
- directly into a chat room, using a token
- into the Activity Feed for a chat room, using a webhook

#### Using Web Hook Url
## Information

```csharp
#addin "Cake.Slack"
var gitterWebHookUri = EnvironmentVariable("gitterWebHookUri");
try
{
var postMessageResult = Gitter.Chat.PostMessage(
message:"Hello from Cake.Gitter WebHook",
messageSettings:new GitterChatMessageSettings { IncomingWebHookUrl = gitterWebHookUri }
);
||Stable|Pre-release|
|:--:|:--:|:--:|
|Docs|[![Documentation Status](https://readthedocs.org/projects/cakegitter/badge/?version=stable)](http://cakegitter.readthedocs.org/en/stable/)|[![Documentation Status](https://readthedocs.org/projects/cakegitter/badge/?version=develop)](http://cakegitter.readthedocs.org/en/develop/)|
|GitHub Release|-|[![GitHub release](https://img.shields.io/github/release/gep13/Cake.Gitter.svg)](https://github.com/gep13/Cake.Gitter/releases/latest)|
|NuGet|[![NuGet](https://img.shields.io/nuget/v/Cake.Gitter.svg)](https://www.nuget.org/packages/Cake.Gitter)|[![NuGet](https://img.shields.io/nuget/vpre/Cake.Gitter.svg)](https://www.nuget.org/packages/Cake.Gitter)|

if (postMessageResult.Ok)
{
Information("Message {0} succcessfully sent", postMessageResult.TimeStamp);
}
else
{
Error("Failed to send message: {0}", postMessageResult.Error);
}
}
catch(Exception ex)
{
Error("{0}", ex);
}
```

Cake output will be similar to below:

```
Message 2015-10-16 11:26:23Z successfully sent
```

This will result in a message appearing in the Activity Feed for the Gitter Room similar to the following:

![image](https://cloud.githubusercontent.com/assets/1271146/10540466/2eb1905c-7400-11e5-89ad-6e58b6b7508b.png)

## How to find required information

### Room Id

One way, there may be others, to find the unique Gitter Room Id is the following:

1. Open [Postman](https://www.getpostman.com/)
2. Create a new GET request, pointing at `https://api.gitter.im/v1/rooms/`
3. In the headers section, add a new header with `Content-Type` of `application\json`
4. In the headers section, add a new header with `Accept` of `application\json`
5. In the headers section, add a new header with `Authorization` of `Bearer <Personal Access Token` **NOTE:** You can find your Personal Access Token by logging into [here](https://developer.gitter.im/apps)
6. Click Send

This will return a complete list of all the Rooms that you are a member of. Scroll through the list until you find the one that you are interested, and take note of the Room Id, as shown in the picture below:

![2015-10-16_1236](https://cloud.githubusercontent.com/assets/1271146/10540744/b83d5110-7402-11e5-96bd-d7557da43ee6.png)

### Web Hook Url

Use the following steps to create a Custom Web Hook Url for your Gitter Room:

1. Log into gitter.im
2. Navigate to your Room
3. Click the Settings icon at the top of the page, and click Integrations
4. Scroll down to the "Add an integration" section, and click Custom
5. In the window that opens up you will see your newly created Web Hook Url. It should look something like this
## Build Status

![2015-10-16_1240](https://cloud.githubusercontent.com/assets/1271146/10540791/31dc4814-7403-11e5-9f55-5f40dbbace84.png)
|Develop|Master|
|:--:|:--:|
|[![Build status](https://ci.appveyor.com/api/projects/status/m4d9tag4iyps7238/branch/develop?svg=true)](https://ci.appveyor.com/project/GaryEwanPark/cake-gitter/branch/develop)|[![Build status](https://ci.appveyor.com/api/projects/status/m4d9tag4iyps7238/branch/develop?svg=true)](https://ci.appveyor.com/project/GaryEwanPark/cake-gitter/branch/master)|

**NOTE:** The above Web Hook Url is a sample one, and no longer exists.
## Quick Links

### Personal Access Token
- [Documentation](http://cakegitter.readthedocs.org/en/develop/)
- [Usage](http://cakegitter.readthedocs.org/en/develop/usage/)
- [Required Information](http://cakegitter.readthedocs.org/en/develop/requiredinformation/)

In order to post directly into a Gitter Room, you need to use an Access Token. Gitter does not provide the ability to generate Personal Access Tokens on a use case basis, however, you can use your own one. You can retrieve that by doing the following:
## Chat Room
Come join in the conversation about Cake.Gitter in our Gitter Chat Room

1. Log into [https://developer.gitter.im/apps](https://developer.gitter.im/apps)
2. Your Personal Access Token will be displayed
[![Join the chat at https://gitter.im/gep13/Cake.Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gep13/Cake.Gitter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
11 changes: 4 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ environment:
secure: 0TPZJG1sql+TBGDGbZlrEC8O80MAJserulZiU/8a+VTxjSgIZh/SoNhal/DeihIx
MYGET_DEVELOP_API_KEY:
secure: e0OciROS/831nZpT5AjH4oTeHurdWoouWDfw4YzD0AAONAgZTLh0Yw4slTnJT1y8
MYGET_MASTER_SOURCE:
secure: MJizIBsfdXz+JKhvzlgcmB0isLl+NNGcJVLkQu1a2ugj1bqo9FvxvzI6dohW6lZskdukxQiKO1iQ9ZdP2qbSZg==
MYGET_DEVELOP_SOURCE:
secure: MJizIBsfdXz+JKhvzlgcmB0isLl+NNGcJVLkQu1a2ug5WB1Jmqf37/i26f2jm/FsbLcIrRWNHzeLbSqvK+nOIQ==
MYGET_MASTER_SOURCE: https://www.myget.org/F/packages_master/
MYGET_DEVELOP_SOURCE: https://www.myget.org/F/packages_develop/
NUGET_API_KEY:
secure: a/xbTgIAc+QGdAwANmenmrUJFG5hqB+jMyqB6y80KZYXfRHOVEB+1dB4CEyDednf
NUGET_SOURCE:
secure: kc+ZLsNjHz3F35FkQc5DIdYehkISa+3+8s1b9dEP4BQ=
NUGET_SOURCE: https://nuget.org/

#---------------------------------#
# Notifications Configuration #
Expand All @@ -39,4 +36,4 @@ notifications:
#---------------------------------#
cache:
- Source\packages -> Source\**\packages.config
- Tools -> Tools\packages.config
- Tools -> Tools\packages.config
6 changes: 6 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Cake.Gitter Documentation

Cake.Gitter is an Addin for [Cake](http://cakebuild.net/) which extends it by allowing the posting of messages to [Gitter](https://gitter.im), either:

- directly into a chat room, using a token
- into the Activity Feed for a chat room, using a webhook
37 changes: 37 additions & 0 deletions docs/requiredinformation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# How to find required information

## Room Id

One way, there may be others, to find the unique Gitter Room Id is the following:

1. Open [Postman](https://www.getpostman.com/)
2. Create a new GET request, pointing at `https://api.gitter.im/v1/rooms/`
3. In the headers section, add a new header with `Content-Type` of `application\json`
4. In the headers section, add a new header with `Accept` of `application\json`
5. In the headers section, add a new header with `Authorization` of `Bearer <Personal Access Token` **NOTE:** You can find your Personal Access Token by logging into [here](https://developer.gitter.im/apps)
6. Click Send

This will return a complete list of all the Rooms that you are a member of. Scroll through the list until you find the one that you are interested, and take note of the Room Id, as shown in the picture below:

![2015-10-16_1236](https://cloud.githubusercontent.com/assets/1271146/10540744/b83d5110-7402-11e5-96bd-d7557da43ee6.png)

## Web Hook Url

Use the following steps to create a Custom Web Hook Url for your Gitter Room:

1. Log into gitter.im
2. Navigate to your Room
3. Click the Settings icon at the top of the page, and click Integrations
4. Scroll down to the "Add an integration" section, and click Custom
5. In the window that opens up you will see your newly created Web Hook Url. It should look something like this

![2015-10-16_1240](https://cloud.githubusercontent.com/assets/1271146/10540791/31dc4814-7403-11e5-9f55-5f40dbbace84.png)

**NOTE:** The above Web Hook Url is a sample one, and no longer exists.

## Personal Access Token

In order to post directly into a Gitter Room, you need to use an Access Token. Gitter does not provide the ability to generate Personal Access Tokens on a use case basis, however, you can use your own one. You can retrieve that by doing the following:

1. Log into [https://developer.gitter.im/apps](https://developer.gitter.im/apps)
2. Your Personal Access Token will be displayed
77 changes: 77 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Post Message

## Using Token

```csharp
#addin "Cake.Slack"
var gitterToken = EnvironmentVariable("GITTER_TOKEN");
var gitterRoomId = EnvironmentVariable("gitterRoomId");

try
{
var postMessageResult = Gitter.Chat.PostMessage(
message:"Hello from Cake.Gitter API",
messageSettings:new GitterChatMessageSettings { Token = gitterToken, RoomId = gitterRoomId}
);

if (postMessageResult.Ok)
{
Information("Message {0} succcessfully sent", postMessageResult.TimeStamp);
}
else
{
Error("Failed to send message: {0}", postMessageResult.Error);
}
}
catch(Exception ex)
{
Error("{0}", ex);
}
```

Cake output will be similar to below:

```
Message 2015-10-16T11:18:14.078Z successfully sent
```

This will result in a message appearing in the Gitter Room similar to the following:

![image](https://cloud.githubusercontent.com/assets/1271146/10540458/1c5fd648-7400-11e5-9529-1f3729850300.png)

## Using Web Hook Url

```csharp
#addin "Cake.Slack"
var gitterWebHookUri = EnvironmentVariable("gitterWebHookUri");
try
{
var postMessageResult = Gitter.Chat.PostMessage(
message:"Hello from Cake.Gitter WebHook",
messageSettings:new GitterChatMessageSettings { IncomingWebHookUrl = gitterWebHookUri }
);

if (postMessageResult.Ok)
{
Information("Message {0} succcessfully sent", postMessageResult.TimeStamp);
}
else
{
Error("Failed to send message: {0}", postMessageResult.Error);
}
}
catch(Exception ex)
{
Error("{0}", ex);
}
```

Cake output will be similar to below:

```
Message 2015-10-16 11:26:23Z successfully sent
```

This will result in a message appearing in the Activity Feed for the Gitter Room similar to the following:

![image](https://cloud.githubusercontent.com/assets/1271146/10540466/2eb1905c-7400-11e5-89ad-6e58b6b7508b.png)```
8 changes: 8 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
site_name: Cake.Gitter
theme: readthedocs
repo_url: https://github.com/gep13/Cake.Gitter

pages:
- Home: index.md
- Usage: usage.md
- Required Information: requiredinformation.md

0 comments on commit 2d60252

Please sign in to comment.