Skip to content

Fix travis #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 7 additions & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,12 @@
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- g++-4.9
- uuid-dev
- libssl-dev

language: crystal

env:
- ZMQ="4.2.2"
before_install: make build

before_install:
- export CXX=g++-4.9
- export CC=gcc-4.9
- mkdir ldlocal
- export LDHACK=`pwd`/ldlocal
- export LDFLAGS=-L$LDHACK/lib
- export CFLAGS=-I$LDHACK/include
- export LD_RUN_PATH=$LDHACK/lib
- export LD_LIBRARY_PATH=$LDHACK/lib
- export LIBRARY_PATH=$LDHACK/lib
- export PKG_CONFIG_PATH=$LDHACK/lib/pkgconfig
- echo $PKG_CONFIG_PATH
- wget https://github.com/zeromq/libzmq/releases/download/v$ZMQ/zeromq-$ZMQ.tar.gz
- tar xzvf zeromq-$ZMQ.tar.gz
- sudo apt-get update
- sudo apt-get install -y libtool pkg-config build-essential autoconf automake uuid-dev
install:
- shards install

- cd zeromq-$ZMQ
- ./configure
- sudo make
- sudo make install
- cd ..
# script:
# - bin/ameba

script:
crystal spec
sudo: required
email: false
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.PHONY: all
all:
@echo Nothing to do

build:
# build zeromq
git clone --depth=1 https://github.com/zeromq/libzmq.git
mkdir -p libzmq/build; \
cd libzmq/build; \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTS=OFF -DWITH_PERF_TOOL=OFF -DCMAKE_BUILD_TYPE="Release" ..; \
make -j8; \
sudo make install
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,26 @@ dependencies:
github: crystal-community/zeromq-crystal
```


## Usage


```crystal
require "zeromq"
```

```crystal

# Simple server
context = ZMQ::Context.new
server = context.socket(ZMQ::REP)
server.bind("tcp://127.0.0.1:5555")

loop do
puts server.receive_string
server.send_string("Got it")
end

# Simple client
context = ZMQ::Context.new
client = context.socket(ZMQ::REQ)
client.connect("tcp://127.0.0.1:5555")

client.send_string("Fetch")

puts server.receive_string
server.send_string("Got it")

puts client.receive_string
```

Expand Down
18 changes: 18 additions & 0 deletions examples/basic.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require "../src/zeromq"

# Simple server
context = ZMQ::Context.new
server = context.socket(ZMQ::REP)
server.bind("tcp://127.0.0.1:5555")

# Simple client
context = ZMQ::Context.new
client = context.socket(ZMQ::REQ)
client.connect("tcp://127.0.0.1:5555")

client.send_string("Fetch")

puts server.receive_string
server.send_string("Got it")

puts client.receive_string
8 changes: 7 additions & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: zeromq
version: 0.3.0

crystal: 0.33.0
license: MIT

authors:
- Benoist Claassen <[email protected]>
- digitalextremist <[email protected]>

license: MIT
development_dependencies:
ameba:
github: crystal-ameba/ameba
version: ~> 0.11.0