erik_server 0.0.2 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68ed15efc4a8e8ecdf3d7ef98ed7879e567acf8b
4
- data.tar.gz: 2f2319383f31cb36b4e5d375f3af00cd23db4402
3
+ metadata.gz: 5ac49060e35e4b763a67b8aec6576428929fa7bf
4
+ data.tar.gz: 8f278ef41b1616cd2d332d91ecdf7f4cca09fe0c
5
5
  SHA512:
6
- metadata.gz: 33ef96608d98e5ca532c6dd1af9ffef9c61e85435d9fb622cb693fca560a3ad6fbf9d09e853d510d8b85770b810e6c04061e8323c206a53526236673c75986d3
7
- data.tar.gz: af6c09a45668c0c981bda4eea479270dcd7f8a152e0a71229922ef9ff8d1054e207c9d381e991f8f4ceac4f9e49f04dc1b20b52cd58c293004390b796298565c
6
+ metadata.gz: c080beeabdadff240b04c362afebf481ffda6a6f4d8226b0e9aafea219801b98e2fecc8a26b0c5875d2e251472e54b5041dd6e4ce959b19a9031f204a1a4f546
7
+ data.tar.gz: 22367289391eca4e036a818085bb5c403573043138111b8276063e2859bbeccc123d48ba975863f2e62ca60f80d3909a9ae7041bb4e9a512415d3ce3906b93d3
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in server.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,17 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ erik_server (0.0.5)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.3.2)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 1.6)
16
+ erik_server!
17
+ rake
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Erik Nilsen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/server ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'socket'
4
+
5
+ server = TCPServer.new 1337
6
+
7
+ loop do
8
+ client = server.accept
9
+ request = clients.gets
10
+ verb, path,protocol = request.spilt(" ")
11
+ path ="." + path
12
+
13
+ if File.file?(path)
14
+ body = File.open(path, "r"){|file| file.read}
15
+ status = "200 OK"
16
+ else
17
+ body = "File not found\n"
18
+ status = "404 Not Found"
19
+ end
20
+
21
+ response = "#{protocol} #{status}\n"
22
+ response += "Content-Type: text/html\n"
23
+ response += "Content-Length: #{body.length}\n"
24
+ response += "Connection: close\n\n"
25
+ response += body
26
+
27
+ client.puts response
28
+ client.close
29
+ end
@@ -0,0 +1,3 @@
1
+ module Server
2
+ VERSION = "0.0.5"
3
+ end
data/lib/server.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "server/version"
2
+
3
+ module Server
4
+ # Your code goes here...
5
+ end
data/server.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'server/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "erik_server"
8
+ spec.version = Server::VERSION
9
+ spec.authors = ["Erik Nilsen"]
10
+ spec.email = ["enilsen16@live.com"]
11
+ spec.summary = %q{A simple server}
12
+ spec.description = %q{A simple server made with ruby}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erik_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Nilsen
@@ -41,11 +41,21 @@ dependencies:
41
41
  description: A simple server made with ruby
42
42
  email:
43
43
  - enilsen16@live.com
44
- executables: []
44
+ executables:
45
+ - server
45
46
  extensions: []
46
47
  extra_rdoc_files: []
47
48
  files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE.txt
48
53
  - README.md
54
+ - Rakefile
55
+ - bin/server
56
+ - lib/server.rb
57
+ - lib/server/version.rb
58
+ - server.gemspec
49
59
  homepage: ''
50
60
  licenses:
51
61
  - MIT