Project

glint

0.01
No commit activity in last 3 years
No release in over 3 years
Glint is a library which allows you to fire arbitrary server processes programatically and ensures the processes are shutdown when your code exit
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3
 Project Readme

Glint BuildStatus

Glint is a library which allows you to fire arbitrary TCP server processes programatically and ensures the processes are shutdown when your code exit.

It's useful when you want to test your code against real TCP server processes.

Synopsis

server = Glint::Server.new do |port|
  # Execute target server process
  exec command, args
end
server.start

# Test your code against the server process
client = MyClient.new('127.0.0.1', server.port)
client.do_something

exit
# The process executed above will be shutdown here.

Methods

Glint::Server

Glint::Server.info

server.rb:

server = Glint::Server.new do |port|
  exec 'memcached', '-p', port.to_s;
  exit 0
end
server.start

Glint::Server.info[:memcached] = "127.0.0.1:#{server.port}"

client.rb:

client = Dalli::Client.new(Glint::Server.info[:memcached])

Glint::Server.info is used to store server info globally which is retrieved and utilized by client later. It's useful when server and client codes are not in the same code.

Glint::Server#start

server = Glint::Server.new do |port|
  exec 'memcached', '-p', port.to_s;
  exit 0
end
server.start

Installation

Add this line to your application's Gemfile:

gem 'glint'

And then execute:

$ bundle

Or install it yourself as:

$ gem install glint

See Also

  • Test::TCP
    • This library is a port of Test::TCP for Perl.

Contributing

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