Skip to content

Commit

Permalink
add readme and update bump
Browse files Browse the repository at this point in the history
  • Loading branch information
genaromadrid committed Mar 26, 2018
1 parent 15af5b2 commit 66b3727
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 9 deletions.
64 changes: 60 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Em::Pusher::Client

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/em/pusher/client`. To experiment with that code, run `bin/console` for an interactive prompt.
[![Gem Version][rubygems-image]][rubygems-url]
[![Build Status][travis-image]][travis-url]
[![Coverage Status][coverage-image]][coverage-url]

TODO: Delete this and the text above, and describe your gem
EventMachine client library for Pusher

## Installation

Expand All @@ -22,14 +24,68 @@ Or install it yourself as:

## Usage

TODO: Write usage instructions here
```ruby
EM.run do
opts = {
key: 'my-key',
cluster: 'us2',
port: 80,
scheme: 'ws',
}
EM::Pusher::Client.connect(opts) do |conn|
conn.connected do
puts 'connected'
end

conn.callback do
puts 'callback'
msg = {
event: 'pusher:subscribe',
data: {
channel: 'my-channel',
},
}
conn.send_msg(msg)
end

conn.errback do |e|
puts "Got error: #{e}"
end

conn.stream do |msg|
puts "stream: <#{msg}>"
case msg.event
when 'pusher:connection_established'
puts 'Connection Established'
when 'pusher_internal:subscription_succeeded'
puts "Subscribed to #{msg.json['channel']}"
when 'someevent'
puts "someevent: #{msg.data}"
end
end

conn.disconnect do
puts 'gone'
EM.stop_event_loop
end
end
end
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
After checking out the repo, run `bin/setup` to install dependencies. You can also run `rake console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/em-pusher-client.


[rubygems-image]: https://badge.fury.io/rb/em-pusher-client.svg
[rubygems-url]: https://badge.fury.io/rb/em-pusher-client
[travis-image]: https://travis-ci.org/genaromadrid/em-pusher-client.svg?branch=master
[travis-url]: https://travis-ci.org/genaromadrid/em-pusher-client
[coverage-image]: https://coveralls.io/repos/github/genaromadrid/em-pusher-client/badge.svg?branch=master
[coverage-url]: https://coveralls.io/github/genaromadrid/em-pusher-client?branch=master
6 changes: 1 addition & 5 deletions bump
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ __INITIAL__ = ['0', '0', '1']
if __name__ == "__main__":
v = []
try:
version_file = glob.glob("lib/*/version.rb")[0]
version_file = glob.glob("lib/em/pusher/client/version.rb")[0]
raw_v = re.search(r'VERSION = \'(.*)\'', open(version_file).read(), re.M|re.I|re.S).group(1)
v = re.split(re.compile("\.|-"), raw_v)
v = v[0:3]
Expand All @@ -29,10 +29,6 @@ if __name__ == "__main__":
print("failed to parse the existing VERSION file, assuming v 0.0.1")
v = ['0', '0', '1']

except FileNotFoundError:
print("failed to find a VERSION file, assuming v 0.0.0")
v = ['0', '0', '0']

op = ''
try:
op = sys.argv[1]
Expand Down

0 comments on commit 66b3727

Please sign in to comment.