GithubHelp home page GithubHelp logo

soleone / campy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fnichol/campy

0.0 2.0 1.0 138 KB

Tiny Campfire Ruby client so you can get on with it.

Home Page: http://fnichol.github.com/campy/

License: MIT License

Ruby 100.00%

campy's Introduction

Campy Build Status Dependency Status

Tiny Campfire Ruby client so you can get on with it. It's implemented on top of Net::HTTP and only requires the multi_json gem for Ruby compatibilities.

Installation

Add this line to your application's Gemfile:

gem 'campy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install campy

Usage

First create a campfire.yml file in your home directory:

$ cat <<CAMPFIRE_YAML > $HOME/.campfire.yml
:account: mysubdomain
:token: mytoken123
:room: House of Hubot
CAMPFIRE_YAML

campy Command

Campy comes with the campy command so you can send messages from the command line:

$ campy speak "Campy says yello"
$ campy paste "Long pastes are long"
$ campy play ohmy

Or pipe in your message:

$ echo "Campy tries to honor unix conventions" | campy speak
$ cat ~/stackdump.log | campy paste
$ echo ohmy | campy play

Ruby Library

There's not much to the API; create a Campy::Room and go:

require 'campy'

campy = Campy::Room.new(:account => "mysubdomain",
  :token => "mytoken123", :room => "House of Hubot")
campy.speak "Campy says yello"
campy.paste "Long pastes are long"
campy.play "ohmy"

If you know the room ID and would prefer to use that instead of the name:

require 'campy'

campy = Campy::Room.new(:account => "mysubdomain",
  :token => "mytoken123", :room_id => "12345")
campy.speak "Campy says yello"
campy.paste "Long pastes are long"
campy.play "ohmy"

Why not use the campfire.yml config? Let's do that:

require 'campy'
require 'yaml'

campy = Campy::Room.new(YAML.load_file(
  File.expand_path("~/.campfire.yml")))
campy.speak "Campy says yello"
campy.paste "Long pastes are long"
campy.play "ohmy"

Development

Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make. For example:

  1. Fork the repo
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Authors

Created and maintained by Fletcher Nichol ([email protected])

License

MIT (see LICENSE)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.