wormhole 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog ADDED
@@ -0,0 +1,4 @@
1
+ == 0.0.1 / 2008-07-02
2
+
3
+ * initial release
4
+
data/README ADDED
@@ -0,0 +1,29 @@
1
+ = wormhole
2
+
3
+ The utility library for making a wormhole on the stack frame.
4
+
5
+ == Description
6
+
7
+ This utility gives you a wormhole which enables you to communicate from the
8
+ depth of stack to outside.
9
+
10
+ == Installation
11
+
12
+ === Archive Installation
13
+
14
+ rake install
15
+
16
+ === Gem Installation
17
+
18
+ gem install wormhole
19
+
20
+ == Features/Problems
21
+
22
+
23
+ == Synopsis
24
+
25
+ == Copyright
26
+
27
+ Author:: takiuchi <genki{at}s21g{dot}com>
28
+ Copyright:: Copyright (c) 2008 Genki Takiuchi
29
+ License:: MIT License
data/Rakefile ADDED
@@ -0,0 +1,137 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/contrib/rubyforgepublisher'
9
+ require 'rake/contrib/sshpublisher'
10
+ require 'rubyforge'
11
+ require 'fileutils'
12
+ include FileUtils
13
+
14
+ NAME = "wormhole"
15
+ AUTHOR = "Genki Takiuchi"
16
+ EMAIL = "genki@s21g.com"
17
+ DESCRIPTION = "The utility library for making a wormhole on the stack frame."
18
+ RUBYFORGE_PROJECT = "cocktail-party"
19
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
20
+ BIN_FILES = %w( )
21
+ VERS = "0.0.3"
22
+
23
+ REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
24
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config']
25
+ RDOC_OPTS = [
26
+ '--title', "#{NAME} documentation",
27
+ "--charset", "utf-8",
28
+ "--opname", "index.html",
29
+ "--line-numbers",
30
+ "--main", "README",
31
+ "--inline-source",
32
+ ]
33
+
34
+ task :default => [:test]
35
+ task :package => [:clean]
36
+
37
+ Rake::TestTask.new("test") do |t|
38
+ t.libs << "test"
39
+ t.pattern = "test/**/*_test.rb"
40
+ t.verbose = true
41
+ end
42
+
43
+ spec = Gem::Specification.new do |s|
44
+ s.name = NAME
45
+ s.version = VERS
46
+ s.platform = Gem::Platform::RUBY
47
+ s.has_rdoc = true
48
+ s.extra_rdoc_files = ["README", "ChangeLog"]
49
+ s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
50
+ s.summary = DESCRIPTION
51
+ s.description = DESCRIPTION
52
+ s.author = AUTHOR
53
+ s.email = EMAIL
54
+ s.homepage = HOMEPATH
55
+ s.executables = BIN_FILES
56
+ s.rubyforge_project = RUBYFORGE_PROJECT
57
+ s.bindir = "bin"
58
+ s.require_path = "lib"
59
+ s.autorequire = ""
60
+ s.test_files = Dir["test/test_*.rb"]
61
+
62
+ #s.add_dependency('activesupport', '>=1.3.1')
63
+ #s.required_ruby_version = '>= 1.8.2'
64
+
65
+ s.files = %w(README ChangeLog Rakefile) +
66
+ Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
67
+ Dir.glob("ext/**/*.{h,c,rb}") +
68
+ Dir.glob("examples/**/*.rb") +
69
+ Dir.glob("tools/*.rb")
70
+
71
+ s.extensions = FileList["ext/**/extconf.rb"].to_a
72
+ end
73
+
74
+ Rake::GemPackageTask.new(spec) do |p|
75
+ p.need_tar = true
76
+ p.gem_spec = spec
77
+ end
78
+
79
+ task :install do
80
+ name = "#{NAME}-#{VERS}.gem"
81
+ sh %{rake package}
82
+ sh %{sudo gem install pkg/#{name}}
83
+ end
84
+
85
+ task :uninstall => [:clean] do
86
+ sh %{sudo gem uninstall #{NAME}}
87
+ end
88
+
89
+
90
+ Rake::RDocTask.new do |rdoc|
91
+ rdoc.rdoc_dir = 'html'
92
+ rdoc.options += RDOC_OPTS
93
+ rdoc.template = "resh"
94
+ #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
95
+ if ENV['DOC_FILES']
96
+ rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
97
+ else
98
+ rdoc.rdoc_files.include('README', 'ChangeLog')
99
+ rdoc.rdoc_files.include('lib/**/*.rb')
100
+ rdoc.rdoc_files.include('ext/**/*.c')
101
+ end
102
+ end
103
+
104
+ desc "Publish to RubyForge"
105
+ task :rubyforge => [:rdoc, :package] do
106
+ require 'rubyforge'
107
+ Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'takiuchi').upload
108
+ end
109
+
110
+ desc 'Package and upload the release to rubyforge.'
111
+ task :release => [:clean, :package] do |t|
112
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
113
+ abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
114
+ pkg = "pkg/#{NAME}-#{VERS}"
115
+
116
+ rf = RubyForge.new.configure
117
+ puts "Logging in"
118
+ rf.login
119
+
120
+ c = rf.userconfig
121
+ # c["release_notes"] = description if description
122
+ # c["release_changes"] = changes if changes
123
+ c["preformatted"] = true
124
+
125
+ files = [
126
+ "#{pkg}.tgz",
127
+ "#{pkg}.gem"
128
+ ].compact
129
+
130
+ puts "Releasing #{NAME} v. #{VERS}"
131
+ rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
132
+ end
133
+
134
+ desc 'Show information about the gem.'
135
+ task :debug_gem do
136
+ puts spec.to_ruby
137
+ end
data/lib/wormhole.rb ADDED
@@ -0,0 +1,15 @@
1
+ class Wormhole < Exception
2
+ def initialize(data = {})
3
+ @data = data
4
+ callcc{|@cc|}
5
+ raise self unless @return
6
+ end
7
+
8
+ def close
9
+ @return = true
10
+ @cc.call
11
+ end
12
+
13
+ def [](key) @data[key] end
14
+ def []=(key, value) @data[key] = value end
15
+ end
@@ -0,0 +1,7 @@
1
+ require 'test/unit'
2
+ require 'rubygems'
3
+ begin
4
+ require 'redgreen'
5
+ rescue Exception
6
+ end
7
+ require File.dirname(__FILE__) + '/../lib/wormhole'
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require "test/unit"
3
+
4
+ class WormholeTest < Test::Unit::TestCase
5
+ def setup
6
+ @result = []
7
+ end
8
+
9
+ def foo
10
+ @result << "foo"
11
+ w = Wormhole.new :foo => 'hello'
12
+ @result << w[:foo]
13
+ @result << "bar"
14
+ end
15
+
16
+ def test_wormhole
17
+ foo
18
+ assert !@result.empty?
19
+ assert_equal [
20
+ 'foo',
21
+ 'hello',
22
+ 'world!',
23
+ 'bar',
24
+ ], @result
25
+ rescue Wormhole => w
26
+ @result << w[:foo]
27
+ w[:foo] = 'world!'
28
+ w.close
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wormhole
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Genki Takiuchi
8
+ autorequire: ""
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-07-03 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: The utility library for making a wormhole on the stack frame.
17
+ email: genki@s21g.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - ChangeLog
25
+ files:
26
+ - README
27
+ - ChangeLog
28
+ - Rakefile
29
+ - test/test_helper.rb
30
+ - test/wormhole_test.rb
31
+ - lib/wormhole.rb
32
+ has_rdoc: true
33
+ homepage: http://cocktail-party.rubyforge.org
34
+ post_install_message:
35
+ rdoc_options:
36
+ - --title
37
+ - wormhole documentation
38
+ - --charset
39
+ - utf-8
40
+ - --opname
41
+ - index.html
42
+ - --line-numbers
43
+ - --main
44
+ - README
45
+ - --inline-source
46
+ - --exclude
47
+ - ^(examples|extras)/
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ requirements: []
63
+
64
+ rubyforge_project: cocktail-party
65
+ rubygems_version: 1.2.0
66
+ signing_key:
67
+ specification_version: 2
68
+ summary: The utility library for making a wormhole on the stack frame.
69
+ test_files:
70
+ - test/test_helper.rb