hoof 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/VERSION +1 -1
- data/hoof.gemspec +5 -5
- data/lib/hoof.rb +1 -1
- data/lib/hoof/cli.rb +1 -1
- data/lib/hoof/http_server.rb +20 -11
- data/lib/hoof/https_server.rb +1 -0
- metadata +5 -5
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,8 +3,8 @@ GEM
|
|
3
3
|
specs:
|
4
4
|
daemons (1.1.3)
|
5
5
|
eventmachine (0.12.10)
|
6
|
+
eventmachine_httpserver (0.2.1)
|
6
7
|
git (1.2.5)
|
7
|
-
http_parser (0.1.3)
|
8
8
|
jeweler (1.6.0)
|
9
9
|
bundler (~> 1.0.0)
|
10
10
|
git (>= 1.2.5)
|
@@ -26,7 +26,7 @@ DEPENDENCIES
|
|
26
26
|
bundler (~> 1.0.0)
|
27
27
|
daemons
|
28
28
|
eventmachine
|
29
|
-
|
29
|
+
eventmachine_httpserver
|
30
30
|
jeweler (~> 1.6.0)
|
31
31
|
rcov
|
32
32
|
shoulda
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/hoof.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{hoof}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["pyromaniac"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-06-08}
|
13
13
|
s.default_executable = %q{hoof}
|
14
14
|
s.description = %q{Hoof is linux variant of pow. It's based on nss, eventmachine and unicorn}
|
15
15
|
s.email = %q{kinwizard@gmail.com}
|
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
|
|
56
56
|
s.add_runtime_dependency(%q<daemons>, [">= 0"])
|
57
57
|
s.add_runtime_dependency(%q<eventmachine>, [">= 0"])
|
58
58
|
s.add_runtime_dependency(%q<unicorn>, [">= 0"])
|
59
|
-
s.add_runtime_dependency(%q<
|
59
|
+
s.add_runtime_dependency(%q<eventmachine_httpserver>, [">= 0"])
|
60
60
|
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
61
61
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
62
62
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -66,7 +66,7 @@ Gem::Specification.new do |s|
|
|
66
66
|
s.add_dependency(%q<daemons>, [">= 0"])
|
67
67
|
s.add_dependency(%q<eventmachine>, [">= 0"])
|
68
68
|
s.add_dependency(%q<unicorn>, [">= 0"])
|
69
|
-
s.add_dependency(%q<
|
69
|
+
s.add_dependency(%q<eventmachine_httpserver>, [">= 0"])
|
70
70
|
s.add_dependency(%q<thor>, [">= 0"])
|
71
71
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
72
72
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -77,7 +77,7 @@ Gem::Specification.new do |s|
|
|
77
77
|
s.add_dependency(%q<daemons>, [">= 0"])
|
78
78
|
s.add_dependency(%q<eventmachine>, [">= 0"])
|
79
79
|
s.add_dependency(%q<unicorn>, [">= 0"])
|
80
|
-
s.add_dependency(%q<
|
80
|
+
s.add_dependency(%q<eventmachine_httpserver>, [">= 0"])
|
81
81
|
s.add_dependency(%q<thor>, [">= 0"])
|
82
82
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
83
83
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
data/lib/hoof.rb
CHANGED
data/lib/hoof/cli.rb
CHANGED
@@ -32,7 +32,7 @@ module Hoof
|
|
32
32
|
D
|
33
33
|
def init name = nil
|
34
34
|
name ||= File.basename Dir.getwd
|
35
|
-
create_link File.expand_path(File.join("~/.hoof", name)),
|
35
|
+
create_link File.expand_path(File.join("~/.hoof", name)), Dir.getwd
|
36
36
|
append_to_file 'Gemfile', "\ngem 'unicorn'"
|
37
37
|
end
|
38
38
|
|
data/lib/hoof/http_server.rb
CHANGED
@@ -1,29 +1,38 @@
|
|
1
1
|
module Hoof
|
2
2
|
class HttpServer < EventMachine::Connection
|
3
|
+
include EventMachine::HttpServer
|
3
4
|
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
def post_init
|
6
|
+
super
|
7
|
+
no_environment_strings
|
8
|
+
@buffer = ''
|
9
|
+
end
|
8
10
|
|
9
|
-
|
11
|
+
def receive_data data
|
12
|
+
@buffer << data
|
13
|
+
super
|
14
|
+
end
|
10
15
|
|
16
|
+
def process_http_request
|
17
|
+
p 'DATA'
|
18
|
+
p @buffer
|
19
|
+
begin
|
20
|
+
host = @http_headers.scan(/Host:\s*([-a-zA-z.]*)\000/)[0][0].gsub(/:\d+$/, '')
|
11
21
|
close_connection and return unless host =~ /.dev$/
|
12
22
|
|
13
23
|
name = host.gsub(/.dev$/, '')
|
14
|
-
path = parser.path.split('?', 2)[0]
|
15
24
|
application = Hoof.find name
|
16
25
|
|
17
26
|
if application
|
18
|
-
if application.static_file?
|
19
|
-
puts "Serve static #{host}#{
|
20
|
-
send_data application.serve_static(
|
27
|
+
if application.static_file? @http_path_info
|
28
|
+
puts "Serve static #{host}#{@http_request_uri}"
|
29
|
+
send_data application.serve_static(@http_path_info)
|
21
30
|
close_connection_after_writing
|
22
31
|
else
|
23
32
|
application.start
|
24
|
-
puts "Serve #{host}#{
|
33
|
+
puts "Serve #{host}#{@http_request_uri}"
|
25
34
|
EventMachine.defer(proc {
|
26
|
-
application.serve
|
35
|
+
application.serve @buffer
|
27
36
|
}, proc { |result|
|
28
37
|
send_data result
|
29
38
|
close_connection_after_writing
|
data/lib/hoof/https_server.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- pyromaniac
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-08 00:00:00 +04:00
|
19
19
|
default_executable: hoof
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
requirement: *id004
|
74
74
|
prerelease: false
|
75
75
|
type: :runtime
|
76
|
-
name:
|
76
|
+
name: eventmachine_httpserver
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
79
79
|
none: false
|