commit d1fcac827d344bd97a8e6da3006dc87b52808910 Author: Yessiest Date: Tue Apr 11 18:06:10 2023 +0400 Initial commit diff --git a/hyde.rb b/hyde.rb new file mode 100644 index 0000000..1348f18 --- /dev/null +++ b/hyde.rb @@ -0,0 +1,15 @@ +require 'webrick' + +module Hyde + class Pathspec + def initialize (path, &block) + @path = path.split "/" if path.kind_of? String + @path = [path] if path.kind_of? Regexp + @chain = [] + self.instance_eval &block + end + def path(*a, **b, &block) + @chain.append Hyde::Pathspec.new *a, **b, &block + end + end +end diff --git a/test_webrick.rb b/test_webrick.rb new file mode 100644 index 0000000..456b6be --- /dev/null +++ b/test_webrick.rb @@ -0,0 +1,12 @@ +require 'webrick' + +root = File.expand_path '~/hyde/' +server = WEBrick::HTTPServer.new :Port => 8000, :DocumentRoot => root + +trap 'INT' do server.shutdown end +server.mount_proc '/' do |req, res| + res.body = 'Hello, world!' +end +server.start + +