hoof 0.0.5 → 0.0.6

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hoof}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["pyromaniac"]
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
37
37
  "lib/hoof/cli.rb",
38
38
  "lib/hoof/control_server.rb",
39
39
  "lib/hoof/http_server.rb",
40
+ "lib/hoof/https_server.rb",
40
41
  "lib/hoof/unicorn_config.rb",
41
42
  "test/helper.rb",
42
43
  "test/test_hoof.rb"
@@ -3,6 +3,7 @@ require 'unicorn/launcher'
3
3
  require 'http/parser'
4
4
 
5
5
  require 'hoof/http_server'
6
+ require 'hoof/https_server'
6
7
  require 'hoof/control_server'
7
8
  require 'hoof/application'
8
9
  require 'hoof/application_pool'
@@ -28,7 +29,7 @@ module Hoof
28
29
  trap("INT") { stop }
29
30
 
30
31
  EventMachine::start_server "127.0.0.1", http_port, Hoof::HttpServer
31
- EventMachine::start_server "127.0.0.1", https_port, Hoof::HttpServer
32
+ EventMachine::start_server "127.0.0.1", https_port, Hoof::HttpsServer
32
33
  EventMachine::start_server sock, Hoof::ControlServer
33
34
  end
34
35
  end
@@ -39,7 +40,7 @@ module Hoof
39
40
  end
40
41
 
41
42
  def self.sock
42
- '/tmp/hoof.sock'
43
+ File.expand_path(File.join('~/.hoof', 'hoof.sock'))
43
44
  end
44
45
 
45
46
  def self.http_port
@@ -75,7 +75,7 @@ module Hoof
75
75
  s.write comand
76
76
  puts s.read
77
77
  end
78
- rescue Errno::ECONNREFUSED
78
+ rescue Errno::ECONNREFUSED, Errno::ENOENT
79
79
  puts 'Hoof is not running'
80
80
  end
81
81
  end
@@ -11,17 +11,24 @@ module Hoof
11
11
  close_connection and return unless host =~ /.dev$/
12
12
 
13
13
  name = host.gsub(/.dev$/, '')
14
+ path = parser.path.split('?', 2)[0]
14
15
  application = Hoof.find name
15
16
 
16
17
  if application
17
- application.start
18
- puts "Serve #{host}#{parser.path}"
19
- EventMachine.defer(proc {
20
- application.serve data
21
- }, proc { |result|
22
- send_data result
18
+ if application.static_file? path
19
+ puts "Serve static #{host}#{parser.path}"
20
+ send_data application.serve_static(path)
23
21
  close_connection_after_writing
24
- })
22
+ else
23
+ application.start
24
+ puts "Serve #{host}#{parser.path}"
25
+ EventMachine.defer(proc {
26
+ application.serve data
27
+ }, proc { |result|
28
+ send_data result
29
+ close_connection_after_writing
30
+ })
31
+ end
25
32
  else
26
33
  close_connection
27
34
  end
@@ -0,0 +1,9 @@
1
+ module Hoof
2
+ class HttpsServer < HttpServer
3
+
4
+ def post_init
5
+ start_tls
6
+ end
7
+
8
+ end
9
+ end
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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - pyromaniac
@@ -176,6 +176,7 @@ files:
176
176
  - lib/hoof/cli.rb
177
177
  - lib/hoof/control_server.rb
178
178
  - lib/hoof/http_server.rb
179
+ - lib/hoof/https_server.rb
179
180
  - lib/hoof/unicorn_config.rb
180
181
  - test/helper.rb
181
182
  - test/test_hoof.rb