Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Rakefile, gemspec, LICENSE, include case gem, and get rid of Reva…
…ctor::ANY_MESSAGE in lieu of Object
- Loading branch information
Tony Arcieri
committed
Jan 16, 2008
1 parent
14d6b37
commit ac6f511
Showing
7 changed files
with
168 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.co.jp>. | ||
You can redistribute it and/or modify it under either the terms of the GPL | ||
(see COPYING.txt file), or the conditions below: | ||
|
||
1. You may make and give away verbatim copies of the source form of the | ||
software without restriction, provided that you duplicate all of the | ||
original copyright notices and associated disclaimers. | ||
|
||
2. You may modify your copy of the software in any way, provided that | ||
you do at least ONE of the following: | ||
|
||
a) place your modifications in the Public Domain or otherwise | ||
make them Freely Available, such as by posting said | ||
modifications to Usenet or an equivalent medium, or by allowing | ||
the author to include your modifications in the software. | ||
|
||
b) use the modified software only within your corporation or | ||
organization. | ||
|
||
c) rename any non-standard executables so the names do not conflict | ||
with standard executables, which must also be provided. | ||
|
||
d) make other distribution arrangements with the author. | ||
|
||
3. You may distribute the software in object code or executable | ||
form, provided that you do at least ONE of the following: | ||
|
||
a) distribute the executables and library files of the software, | ||
together with instructions (in the manual page or equivalent) | ||
on where to get the original distribution. | ||
|
||
b) accompany the distribution with the machine-readable source of | ||
the software. | ||
|
||
c) give non-standard executables non-standard names, with | ||
instructions on where to get the original software distribution. | ||
|
||
d) make other distribution arrangements with the author. | ||
|
||
4. You may modify and include the part of the software into any other | ||
software (possibly commercial). But some files in the distribution | ||
are not written by the author, so that they are not under this terms. | ||
|
||
They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some | ||
files under the ./missing directory. See each file for the copying | ||
condition. | ||
|
||
5. The scripts and library files supplied as input to or produced as | ||
output from the software do not automatically fall under the | ||
copyright of the software, but belong to whomever generated them, | ||
and may be sold commercially, and may be aggregated with this | ||
software. | ||
|
||
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR | ||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
PURPOSE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require 'rake' | ||
require 'rake/rdoctask' | ||
require 'rake/gempackagetask' | ||
load 'revactor.gemspec' | ||
|
||
# Default Rake task | ||
task :default => :rdoc | ||
|
||
# RDoc | ||
Rake::RDocTask.new(:rdoc) do |task| | ||
task.rdoc_dir = 'doc' | ||
task.title = 'Revactor' | ||
task.options = %w(--title Revactor --main README --line-numbers) | ||
task.rdoc_files.include('bin/**/*.rb') | ||
task.rdoc_files.include('lib/**/*.rb') | ||
task.rdoc_files.include('README') | ||
end | ||
|
||
# Gem | ||
Rake::GemPackageTask.new(GEMSPEC) do |pkg| | ||
pkg.need_tar = true | ||
end | ||
|
||
# RSpec | ||
begin | ||
require 'spec/rake/spectask' | ||
|
||
SPECS = FileList['spec/**/*_spec.rb'] | ||
|
||
Spec::Rake::SpecTask.new(:spec) do |task| | ||
task.spec_files = SPECS | ||
end | ||
|
||
namespace :spec do | ||
Spec::Rake::SpecTask.new(:print) do |task| | ||
task.spec_files = SPECS | ||
task.spec_opts="-f s".split | ||
end | ||
|
||
Spec::Rake::SpecTask.new(:rcov) do |task| | ||
task.spec_files = SPECS | ||
task.rcov = true | ||
task.rcov_opts = ['--exclude', 'spec'] | ||
end | ||
end | ||
|
||
rescue LoadError | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'rubygems' | ||
|
||
GEMSPEC = Gem::Specification.new do |s| | ||
s.name = "revactor" | ||
s.version = "0.1.0" | ||
s.authors = "Tony Arcieri" | ||
s.email = "tony@medioh.com" | ||
s.date = "2008-1-15" | ||
s.summary = "Revactor is an Actor implementation for writing high performance concurrent programs" | ||
s.platform = Gem::Platform::RUBY | ||
|
||
# Gem contents | ||
s.files = Dir.glob("{bin,lib,conf,status}/**/*") + ['Rakefile', 'revactor.gemspec'] | ||
|
||
# Dependencies | ||
s.add_dependency("rev", ">= 0.1.2") | ||
s.add_dependency("case", ">= 0.1") | ||
|
||
# RubyForge info | ||
s.homepage = "http://revactor.org" | ||
s.rubyforge_project = "revactor" | ||
|
||
# RDoc settings | ||
s.has_rdoc = true | ||
s.rdoc_options = %w(--title Revactor --main README --line-numbers) | ||
s.extra_rdoc_files = ["LICENSE", "README", "CHANGES"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require File.dirname(__FILE__) + '/../lib/revactor' | ||
|
||
NTIMES=100000 | ||
|
||
begin_time = Time.now | ||
|
||
puts "#{begin_time.strftime('%H:%M:%S')} -- Sending #{NTIMES} messages" | ||
|
||
Actor.start do | ||
parent = Actor.current | ||
child = Actor.spawn do | ||
(NTIMES / 2).times do | ||
Actor.receive do |f| | ||
f.when(:foo) { parent << :bar } | ||
end | ||
end | ||
end | ||
|
||
child << :foo | ||
(NTIMES / 2).times do | ||
Actor.receive do |f| | ||
f.when(:bar) { child << :foo } | ||
end | ||
end | ||
end | ||
|
||
end_time = Time.now | ||
duration = end_time - begin_time | ||
throughput = NTIMES / duration | ||
|
||
puts "#{end_time.strftime('%H:%M:%S')} -- Finished" | ||
puts "Duration: #{sprintf("%0.2f", duration)} seconds" | ||
puts "Throughput: #{sprintf("%0.2f", throughput)} messages per second" |