ponyhost 0.3.1 → 0.3.2
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/lib/ponyhost.rb +5 -26
- metadata +2 -2
data/lib/ponyhost.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'aws/s3'
|
3
|
-
require '
|
3
|
+
require 'webrick'
|
4
4
|
require 'digest/md5'
|
5
5
|
|
6
|
+
|
6
7
|
# monkey patch to add website to extract significant parameter
|
7
8
|
class AWS::S3::Authentication::CanonicalString
|
8
9
|
def extract_significant_parameter
|
@@ -15,7 +16,7 @@ class PonyHost
|
|
15
16
|
S3_CREDENTIAL_FILES = ["~/.ponyhost.yml"]
|
16
17
|
S3_CREDENTIAL_LINK = "https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key"
|
17
18
|
DEFAULT_DOMAIN = "ponyho.st"
|
18
|
-
VERSION = "0.3.
|
19
|
+
VERSION = "0.3.2"
|
19
20
|
class << self
|
20
21
|
|
21
22
|
|
@@ -83,30 +84,8 @@ class PonyHost
|
|
83
84
|
puts res
|
84
85
|
end
|
85
86
|
|
86
|
-
def server(port=9090)
|
87
|
-
s=
|
88
|
-
puts "Server running on http://localhost:#{port}"
|
89
|
-
loop do
|
90
|
-
_ = s.accept
|
91
|
-
requested_filename = _.gets.split[1]
|
92
|
-
requested_filename = "/index.html" if requested_filename == "/"
|
93
|
-
begin
|
94
|
-
data = File.read(".#{requested_filename}")
|
95
|
-
status = 200
|
96
|
-
rescue
|
97
|
-
status = 404
|
98
|
-
if File.exists?("404.html")
|
99
|
-
data = File.read("404.html")
|
100
|
-
else
|
101
|
-
data = "#{requested_filename} not found and no 404.html error page either."
|
102
|
-
end
|
103
|
-
end
|
104
|
-
status_msg = status == 200 ? "OK" : "NOT FOUND"
|
105
|
-
_ << "HTTP/1.0 #{status} #{status_msg}\r\n\r\n#{data}";
|
106
|
-
|
107
|
-
puts %Q{[#{Time.now}] "GET #{requested_filename}" #{status}}
|
108
|
-
_.close
|
109
|
-
end
|
87
|
+
def server(port=9090)
|
88
|
+
s = WEBrick::HTTPServer.new(:Port => port, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start
|
110
89
|
end
|
111
90
|
|
112
91
|
def md5sum(file_name)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ponyhost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Johannes Wagener
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-07-01 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|