tsion-jekyll 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.gitignore +6 -0
  2. data/History.txt +151 -0
  3. data/README.textile +42 -0
  4. data/Rakefile +92 -0
  5. data/VERSION.yml +5 -0
  6. data/bin/jekyll +150 -0
  7. data/features/create_sites.feature +46 -0
  8. data/features/embed_filters.feature +60 -0
  9. data/features/pagination.feature +40 -0
  10. data/features/permalinks.feature +65 -0
  11. data/features/post_data.feature +153 -0
  12. data/features/site_configuration.feature +63 -0
  13. data/features/site_data.feature +82 -0
  14. data/features/step_definitions/jekyll_steps.rb +136 -0
  15. data/features/support/env.rb +16 -0
  16. data/lib/jekyll.rb +85 -0
  17. data/lib/jekyll/albino.rb +122 -0
  18. data/lib/jekyll/converters/csv.rb +26 -0
  19. data/lib/jekyll/converters/mephisto.rb +79 -0
  20. data/lib/jekyll/converters/mt.rb +59 -0
  21. data/lib/jekyll/converters/textpattern.rb +50 -0
  22. data/lib/jekyll/converters/typo.rb +49 -0
  23. data/lib/jekyll/converters/wordpress.rb +54 -0
  24. data/lib/jekyll/convertible.rb +84 -0
  25. data/lib/jekyll/core_ext.rb +30 -0
  26. data/lib/jekyll/filters.rb +47 -0
  27. data/lib/jekyll/layout.rb +36 -0
  28. data/lib/jekyll/page.rb +112 -0
  29. data/lib/jekyll/pager.rb +45 -0
  30. data/lib/jekyll/post.rb +251 -0
  31. data/lib/jekyll/site.rb +265 -0
  32. data/lib/jekyll/tags/highlight.rb +56 -0
  33. data/lib/jekyll/tags/include.rb +31 -0
  34. data/test/helper.rb +27 -0
  35. data/test/source/_includes/sig.markdown +3 -0
  36. data/test/source/_layouts/default.html +27 -0
  37. data/test/source/_layouts/simple.html +1 -0
  38. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  39. data/test/source/_posts/2008-02-02-published.textile +8 -0
  40. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  41. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  42. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  43. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  44. data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
  45. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  46. data/test/source/_posts/2009-01-27-category.textile +7 -0
  47. data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
  48. data/test/source/_posts/2009-05-18-tag.textile +6 -0
  49. data/test/source/_posts/2009-05-18-tags.textile +9 -0
  50. data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
  51. data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
  52. data/test/source/about.html +6 -0
  53. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  54. data/test/source/contacts.html +5 -0
  55. data/test/source/css/screen.css +76 -0
  56. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  57. data/test/source/index.html +22 -0
  58. data/test/source/sitemap.xml +23 -0
  59. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
  60. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  61. data/test/suite.rb +9 -0
  62. data/test/test_configuration.rb +29 -0
  63. data/test/test_filters.rb +49 -0
  64. data/test/test_generated_site.rb +40 -0
  65. data/test/test_page.rb +98 -0
  66. data/test/test_pager.rb +47 -0
  67. data/test/test_post.rb +302 -0
  68. data/test/test_site.rb +85 -0
  69. data/test/test_tags.rb +116 -0
  70. data/tsion-jekyll.gemspec +138 -0
  71. metadata +193 -0
@@ -0,0 +1,6 @@
1
+ test/dest
2
+ *.gem
3
+ pkg/
4
+ *.swp
5
+ *~
6
+ _site/
@@ -0,0 +1,151 @@
1
+ == 0.5.4 / 2009-08-23
2
+ * Bug Fixes
3
+ * Do not allow symlinks (security vulnerability)
4
+
5
+ == 0.5.3 / 2009-07-14
6
+ * Bug Fixes
7
+ * Solving the permalink bug where non-html files wouldn't work [github.com/jeffrydegrande]
8
+
9
+ == 0.5.2 / 2009-06-24
10
+ * Enhancements
11
+ * Added --paginate option to the executable along with a paginator object for the payload [github.com/calavera]
12
+ * Upgraded RedCloth to 4.2.1, which makes <notextile> tags work once again.
13
+ * Configuration options set in config.yml are now available through the site payload [github.com/vilcans]
14
+ * Posts can now have an empty YAML front matter or none at all [github.com/bahuvrihi]
15
+ * Bug Fixes
16
+ * Fixing Ruby 1.9 issue that requires to_s on the err object [github.com/Chrononaut]
17
+ * Fixes for pagination and ordering posts on the same day [github.com/ujh]
18
+ * Made pages respect permalinks style and permalinks in yml front matter [github.com/eugenebolshakov]
19
+ * Index.html file should always have index.html permalink [github.com/eugenebolshakov]
20
+ * Added trailing slash to pretty permalink style so Apache is happy [github.com/eugenebolshakov]
21
+ * Bad markdown processor in config fails sooner and with better message [github.com/gcnovus]
22
+ * Allow CRLFs in yaml frontmatter [github.com/juretta]
23
+ * Added Date#xmlschema for Ruby versions < 1.9
24
+
25
+ == 0.5.1 / 2009-05-06
26
+ * Major Enhancements
27
+ * Next/previous posts in site payload [github.com/pantulis, github.com/tomo]
28
+ * Permalink templating system
29
+ * Moved most of the README out to the GitHub wiki
30
+ * Exclude option in configuration so specified files won't be brought over with generated site [github.com/duritong]
31
+ * Bug Fixes
32
+ * Making sure config.yaml references are all gone, using only config.yml
33
+ * Fixed syntax highlighting breaking for UTF-8 code [github.com/henrik]
34
+ * Worked around RDiscount bug that prevents Markdown from getting parsed after highlight [github.com/henrik]
35
+ * CGI escaped post titles [github.com/Chrononaut]
36
+
37
+ == 0.5.0 / 2009-04-07
38
+ * Minor Enhancements
39
+ * Ability to set post categories via YAML [github.com/qrush]
40
+ * Ability to set prevent a post from publishing via YAML [github.com/qrush]
41
+ * Add textilize filter [github.com/willcodeforfoo]
42
+ * Add 'pretty' permalink style for wordpress-like urls [github.com/dysinger]
43
+ * Made it possible to enter categories from YAML as an array [github.com/Chrononaut]
44
+ * Ignore Emacs autosave files [github.com/Chrononaut]
45
+ * Bug Fixes
46
+ * Use block syntax of popen4 to ensure that subprocesses are properly disposed [github.com/jqr]
47
+ * Close open4 streams to prevent zombies [github.com/rtomayko]
48
+ * Only query required fields from the WP Database [github.com/ariejan]
49
+ * Prevent _posts from being copied to the destination directory [github.com/bdimcheff]
50
+ * Refactors
51
+ * Factored the filtering code into a method [github.com/Chrononaut]
52
+ * Fix tests and convert to Shoulda [github.com/qrush, github.com/technicalpickles]
53
+ * Add Cucumber acceptance test suite [github.com/qrush, github.com/technicalpickles]
54
+
55
+ == 0.4.1
56
+ * Minor Enhancements
57
+ * Changed date format on wordpress converter (zeropadding) [github.com/dysinger]
58
+ * Bug Fixes
59
+ * Add jekyll binary as executable to gemspec [github.com/dysinger]
60
+
61
+ == 0.4.0 / 2009-02-03
62
+ * Major Enhancements
63
+ * Switch to Jeweler for packaging tasks
64
+ * Minor Enhancements
65
+ * Type importer [github.com/codeslinger]
66
+ * site.topics accessor [github.com/baz]
67
+ * Add array_to_sentence_string filter [github.com/mchung]
68
+ * Add a converter for textpattern [github.com/PerfectlyNormal]
69
+ * Add a working Mephisto / MySQL converter [github.com/ivey]
70
+ * Allowing .htaccess files to be copied over into the generated site [github.com/briandoll]
71
+ * Add option to not put file date in permalink URL [github.com/mreid]
72
+ * Add line number capabilities to highlight blocks [github.com/jcon]
73
+ * Bug Fixes
74
+ * Fix permalink behavior [github.com/cavalle]
75
+ * Fixed an issue with pygments, markdown, and newlines [github.com/zpinter]
76
+ * Ampersands need to be escaped [github.com/pufuwozu, github.com/ap]
77
+ * Test and fix the site.categories hash [github.com/zzot]
78
+ * Fix site payload available to files [github.com/matrix9180]
79
+
80
+ == 0.3.0 / 2008-12-24
81
+ * Major Enhancements
82
+ * Added --server option to start a simple WEBrick server on destination directory [github.com/johnreilly and github.com/mchung]
83
+ * Minor Enhancements
84
+ * Added post categories based on directories containing _posts [github.com/mreid]
85
+ * Added post topics based on directories underneath _posts
86
+ * Added new date filter that shows the full month name [github.com/mreid]
87
+ * Merge Post's YAML front matter into its to_liquid payload [github.com/remi]
88
+ * Restrict includes to regular files underneath _includes
89
+ * Bug Fixes
90
+ * Change YAML delimiter matcher so as to not chew up 2nd level markdown headers [github.com/mreid]
91
+ * Fix bug that meant page data (such as the date) was not available in templates [github.com/mreid]
92
+ * Properly reject directories in _layouts
93
+
94
+ == 0.2.1 / 2008-12-15
95
+ * Major Changes
96
+ * Use Maruku (pure Ruby) for Markdown by default [github.com/mreid]
97
+ * Allow use of RDiscount with --rdiscount flag
98
+ * Minor Enhancements
99
+ * Don't load directory_watcher unless it's needed [github.com/pjhyett]
100
+
101
+ == 0.2.0 / 2008-12-14
102
+ * Major Changes
103
+ * related_posts is now found in site.related_posts
104
+
105
+ == 0.1.6 / 2008-12-13
106
+ * Major Features
107
+ * Include files in _includes with {% include x.textile %}
108
+
109
+ == 0.1.5 / 2008-12-12
110
+ * Major Features
111
+ * Code highlighting with Pygments if --pygments is specified
112
+ * Disable true LSI by default, enable with --lsi
113
+ * Minor Enhancements
114
+ * Output informative message if RDiscount is not available [github.com/JackDanger]
115
+ * Bug Fixes
116
+ * Prevent Jekyll from picking up the output directory as a source [github.com/JackDanger]
117
+ * Skip related_posts when there is only one post [github.com/JackDanger]
118
+
119
+ == 0.1.4 / 2008-12-08
120
+ * Bug Fixes
121
+ * DATA does not work properly with rubygems
122
+
123
+ == 0.1.3 / 2008-12-06
124
+ * Major Features
125
+ * Markdown support [github.com/vanpelt]
126
+ * Mephisto and CSV converters [github.com/vanpelt]
127
+ * Code hilighting [github.com/vanpelt]
128
+ * Autobuild
129
+ * Bug Fixes
130
+ * Accept both \r\n and \n in YAML header [github.com/vanpelt]
131
+
132
+ == 0.1.2 / 2008-11-22
133
+ * Major Features
134
+ * Add a real "related posts" implementation using Classifier
135
+ * Command Line Changes
136
+ * Allow cli to be called with 0, 1, or 2 args intuiting dir paths
137
+ if they are omitted
138
+
139
+ == 0.1.1 / 2008-11-22
140
+ * Minor Additions
141
+ * Posts now support introspectional data e.g. {{ page.url }}
142
+
143
+ == 0.1.0 / 2008-11-05
144
+ * First release
145
+ * Converts posts written in Textile
146
+ * Converts regular site pages
147
+ * Simple copy of binary files
148
+
149
+ == 0.0.0 / 2008-10-19
150
+ * Birthday!
151
+
@@ -0,0 +1,42 @@
1
+ h1. Jekyll
2
+
3
+ By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
4
+
5
+ Jekyll is a simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile or Markdown and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server. This is also the engine behind "GitHub Pages":http://pages.github.com, which you can use to host your project's page or blog right here from GitHub.
6
+
7
+ h2. Getting Started
8
+
9
+ * "Install":http://wiki.github.com/mojombo/jekyll/install the gem
10
+ * Read up about its "Usage":http://wiki.github.com/mojombo/jekyll/usage and "Configuration":http://wiki.github.com/mojombo/jekyll/configuration
11
+ * Take a gander at some existing "Sites":http://wiki.github.com/mojombo/jekyll/sites
12
+ * Fork and "Contribute":http://wiki.github.com/mojombo/jekyll/contribute your own modifications
13
+ * Have questions? Post them on the "Mailing List":http://groups.google.com/group/jekyll-rb
14
+
15
+ h2. Diving In
16
+
17
+ * "Migrate":http://wiki.github.com/mojombo/jekyll/blog-migrations from your previous system
18
+ * Learn how the "YAML Front Matter":http://wiki.github.com/mojombo/jekyll/yaml-front-matter works
19
+ * Put information on your site with "Template Data":http://wiki.github.com/mojombo/jekyll/template-data
20
+ * Customize the "Permalinks":http://wiki.github.com/mojombo/jekyll/permalinks your posts are generated with
21
+ * Use the built-in "Liquid Extensions":http://wiki.github.com/mojombo/jekyll/liquid-extensions to make your life easier
22
+
23
+ h2. Dependencies
24
+
25
+ * RedCloth: Textile support
26
+ * Liquid: Templating system
27
+ * Classifier: Generating related posts
28
+ * Maruku: Default markdown engine
29
+ * Directory Watcher: Auto-regeneration of sites
30
+ * Open4: Talking to pygments for syntax highlighting
31
+
32
+ h2. License
33
+
34
+ (The MIT License)
35
+
36
+ Copyright (c) 2008 Tom Preston-Werner
37
+
38
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,92 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ begin
6
+ gem 'jeweler', '>= 0.11.0'
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |s|
9
+ s.name = "tsion-jekyll"
10
+ s.summary = %Q{Jekyll is a simple, blog aware, static site generator.}
11
+ s.email = "scott@scott-olson.org"
12
+ s.homepage = "http://github.com/tsion/jekyll"
13
+ s.description = "Jekyll is a simple, blog aware, static site generator."
14
+ s.authors = ["Tom Preston-Werner", "Scott Olson"]
15
+ s.files.exclude 'test/dest'
16
+ s.test_files.exclude 'test/dest'
17
+ s.add_dependency('RedCloth', '>= 4.2.1')
18
+ s.add_dependency('liquid', '>= 1.9.0')
19
+ s.add_dependency('classifier', '>= 1.3.1')
20
+ s.add_dependency('maruku', '>= 0.5.9')
21
+ s.add_dependency('directory_watcher', '>= 1.1.1')
22
+ s.add_dependency('open4', '>= 0.9.6')
23
+ end
24
+
25
+ Jeweler::GemcutterTasks.new
26
+ rescue LoadError
27
+ puts "Jeweler not available. Install it with: sudo gem install jeweler --version '>= 0.11.0'"
28
+ exit(1)
29
+ end
30
+
31
+ Rake::TestTask.new do |t|
32
+ t.libs << 'lib'
33
+ t.pattern = 'test/**/test_*.rb'
34
+ t.verbose = false
35
+ end
36
+
37
+ Rake::RDocTask.new do |rdoc|
38
+ rdoc.rdoc_dir = 'rdoc'
39
+ rdoc.title = 'jekyll'
40
+ rdoc.options << '--line-numbers' << '--inline-source'
41
+ rdoc.rdoc_files.include('README*')
42
+ rdoc.rdoc_files.include('lib/**/*.rb')
43
+ end
44
+
45
+ begin
46
+ require 'rcov/rcovtask'
47
+ Rcov::RcovTask.new do |t|
48
+ t.libs << 'test'
49
+ t.test_files = FileList['test/**/test_*.rb']
50
+ t.verbose = true
51
+ end
52
+ rescue LoadError
53
+ end
54
+
55
+ task :default => [:test, :features]
56
+
57
+ # console
58
+
59
+ desc "Open an irb session preloaded with this library"
60
+ task :console do
61
+ sh "irb -rubygems -I lib -r jekyll.rb"
62
+ end
63
+
64
+ # converters
65
+
66
+ namespace :convert do
67
+ desc "Migrate from mephisto in the current directory"
68
+ task :mephisto do
69
+ sh %q(ruby -r './lib/jekyll/converters/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")')
70
+ end
71
+ desc "Migrate from Movable Type in the current directory"
72
+ task :mt do
73
+ sh %q(ruby -r './lib/jekyll/converters/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
74
+ end
75
+ desc "Migrate from Typo in the current directory"
76
+ task :typo do
77
+ sh %q(ruby -r './lib/jekyll/converters/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
78
+ end
79
+ end
80
+
81
+ begin
82
+ require 'cucumber/rake/task'
83
+
84
+ Cucumber::Rake::Task.new(:features) do |t|
85
+ t.cucumber_opts = "--format progress"
86
+ end
87
+ rescue LoadError
88
+ desc 'Cucumber rake task not available'
89
+ task :features do
90
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
91
+ end
92
+ end
@@ -0,0 +1,5 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 5
4
+ :patch: 5
5
+ :build:
@@ -0,0 +1,150 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
5
+ help = <<HELP
6
+ Jekyll is a blog-aware, static site generator.
7
+
8
+ Basic Command Line Usage:
9
+ jekyll # . -> ./_site
10
+ jekyll <path to write generated site> # . -> <path>
11
+ jekyll <path to source> <path to write generated site> # <path> -> <path>
12
+
13
+ Configuration is read from '<source>/_config.yml' but can be overriden
14
+ using the following options:
15
+
16
+ HELP
17
+
18
+ require 'optparse'
19
+ require 'jekyll'
20
+
21
+ exec = {}
22
+ options = {}
23
+ opts = OptionParser.new do |opts|
24
+ opts.banner = help
25
+
26
+ opts.on("--auto", "Auto-regenerate") do
27
+ options['auto'] = true
28
+ end
29
+
30
+ opts.on("--no-auto", "No auto-regenerate") do
31
+ options['auto'] = false
32
+ end
33
+
34
+ opts.on("--server [PORT]", "Start web server (default port 4000)") do |port|
35
+ options['server'] = true
36
+ options['server_port'] = port unless port.nil?
37
+ end
38
+
39
+ opts.on("--lsi", "Use LSI for better related posts") do
40
+ options['lsi'] = true
41
+ end
42
+
43
+ opts.on("--pygments", "Use pygments to highlight code") do
44
+ options['pygments'] = true
45
+ end
46
+
47
+ opts.on("--rdiscount", "Use rdiscount gem for Markdown") do
48
+ options['markdown'] = 'rdiscount'
49
+ end
50
+
51
+ opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
52
+ options['permalink'] = style unless style.nil?
53
+ end
54
+
55
+ opts.on("--paginate [POSTS_PER_PAGE]", "Paginate a blog's posts") do |per_page|
56
+ begin
57
+ options['paginate'] = per_page.to_i
58
+ raise ArgumentError if options['paginate'] == 0
59
+ rescue
60
+ puts 'you must specify a number of posts by page bigger than 0'
61
+ exit 0
62
+ end
63
+ end
64
+
65
+ opts.on("--version", "Display current version") do
66
+ puts "Jekyll " + Jekyll.version
67
+ exit 0
68
+ end
69
+ end
70
+
71
+ # Read command line options into `options` hash
72
+ opts.parse!
73
+
74
+ # Get source and destintation from command line
75
+ case ARGV.size
76
+ when 0
77
+ when 1
78
+ options['destination'] = ARGV[0]
79
+ when 2
80
+ options['source'] = ARGV[0]
81
+ options['destination'] = ARGV[1]
82
+ else
83
+ puts "Invalid options. Run `jekyll --help` for assistance."
84
+ exit(1)
85
+ end
86
+
87
+ options = Jekyll.configuration(options)
88
+
89
+ # Get source and destination directories (possibly set by config file)
90
+ source = options['source']
91
+ destination = options['destination']
92
+
93
+ # Files to watch
94
+ def globs(source)
95
+ Dir.chdir(source) do
96
+ dirs = Dir['*'].select { |x| File.directory?(x) }
97
+ dirs -= ['_site']
98
+ dirs = dirs.map { |x| "#{x}/**/*" }
99
+ dirs += ['*']
100
+ end
101
+ end
102
+
103
+ # Create the Site
104
+ site = Jekyll::Site.new(options)
105
+
106
+ # Run the directory watcher for auto-generation, if required
107
+ if options['auto']
108
+ require 'directory_watcher'
109
+
110
+ puts "Auto-regenerating enabled: #{source} -> #{destination}"
111
+
112
+ dw = DirectoryWatcher.new(source)
113
+ dw.interval = 1
114
+ dw.glob = globs(source)
115
+
116
+ dw.add_observer do |*args|
117
+ t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
118
+ puts "[#{t}] regeneration: #{args.size} files changed"
119
+ site.process
120
+ end
121
+
122
+ dw.start
123
+
124
+ unless options['server']
125
+ loop { sleep 1000 }
126
+ end
127
+ else
128
+ puts "Building site: #{source} -> #{destination}"
129
+ site.process
130
+ puts "Successfully generated site: #{source} -> #{destination}"
131
+ end
132
+
133
+ # Run the server on the specified port, if required
134
+ if options['server']
135
+ require 'webrick'
136
+ include WEBrick
137
+
138
+ FileUtils.mkdir_p(destination)
139
+
140
+ s = HTTPServer.new(
141
+ :Port => options['server_port'],
142
+ :DocumentRoot => destination
143
+ )
144
+ t = Thread.new {
145
+ s.start
146
+ }
147
+
148
+ trap("INT") { s.shutdown }
149
+ t.join()
150
+ end