miron 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +2 -0
- data/CHANGELOG.md +7 -2
- data/lib/miron/auth/basic.rb +50 -0
- data/lib/miron/command/init.rb +1 -1
- data/lib/miron/command/server.rb +5 -4
- data/lib/miron/handlers/puma.rb +55 -0
- data/lib/miron/handlers/thin.rb +53 -0
- data/lib/miron/handlers/unicorn.rb +59 -0
- data/lib/miron/handlers/webrick.rb +22 -10
- data/lib/miron/mironfile.rb +38 -5
- data/lib/miron/request.rb +36 -13
- data/lib/miron/response.rb +6 -6
- data/lib/miron/server.rb +11 -8
- data/lib/miron/utils.rb +1 -1
- data/lib/miron/version.rb +1 -1
- data/lib/miron.rb +8 -0
- data/miron.gemspec +5 -0
- metadata +77 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cb072267bfc059dd87476db6a6beeef482d146b
|
4
|
+
data.tar.gz: 88d977829876a1ac2c3065b6c077a3dfc5d3cea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bcf690d497f18ed1a5c5ea21a934150c09d0e07ae6ef0d63fe05bde31204bb672ce8408a0b9d4037777a62cbdfe148646c04391dfef85441e8ec738c9959129
|
7
|
+
data.tar.gz: b73d71624ae079a8fa61d1ca5f3e842dd7a0451b0405b077b37469d9dda83428a0b04ba88d84f34ef1994a81d5e599561e140b538c3d2408f32bb92363ada9f3
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
-
### 0.0.
|
1
|
+
### 0.0.2 - Next Release
|
2
|
+
* Add `Miron::Auth::Basic` middleware to allow HTTP Basic authentication - [@maclover7](https://github.com/maclover7).
|
3
|
+
* Add `use` to Mironfile.rb to allow adding of middleware - [@maclover7](https://github.com/maclover7).
|
4
|
+
* Add Puma HTTP handler - [@maclover7](https://github.com/maclover7).
|
5
|
+
* Add Unicorn HTTP handler - [@maclover7](https://github.com/maclover7).
|
6
|
+
* Add Thin HTTP handler - [@maclover7](https://github.com/maclover7).
|
2
7
|
|
8
|
+
### 0.0.1 (9/21/2015)
|
3
9
|
* Initial public release - [@maclover7](https://github.com/maclover7).
|
4
10
|
* Add WEBrick HTTP Handler - [@maclover7](https://github.com/maclover7).
|
5
|
-
* Your contribution here.
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Miron
|
2
|
+
module Auth
|
3
|
+
class Basic
|
4
|
+
attr_reader :request
|
5
|
+
|
6
|
+
def self.call(request)
|
7
|
+
@request = request
|
8
|
+
return unauthorized if authorization_key.nil?
|
9
|
+
check_auth
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.auth_cleared
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.authorization_key
|
17
|
+
authorization_keys = ['HTTP_AUTHORIZATION', 'HTTP_X-HTTP_AUTHORIZATION', 'HTTP_X_HTTP_AUTHORIZATION']
|
18
|
+
@authorization_key ||= authorization_keys.detect { |key| @request.key?(key) } || nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.bad_request
|
22
|
+
Miron::Response.new(400, { 'Content-Type' => 'text/plain', 'Content-Length' => '0' }, '')
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.check_auth
|
26
|
+
# Get Auth Scheme and encoded username/password
|
27
|
+
auth_key = @request[authorization_key].split(' ', 2)
|
28
|
+
scheme = auth_key.first && auth_key.first.downcase
|
29
|
+
return bad_request if scheme != 'basic'
|
30
|
+
|
31
|
+
# Validate credentials
|
32
|
+
decrypted_auth_key = auth_key.last.unpack('m*').first.split(/:/, 2)
|
33
|
+
if [ENV['MIRON_BAUTH_USERNAME'], ENV['MIRON_BAUTH_PWD']] == decrypted_auth_key
|
34
|
+
return auth_cleared
|
35
|
+
else
|
36
|
+
return unauthorized
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.unauthorized
|
41
|
+
Miron::Response.new(401,
|
42
|
+
{ 'Content-Type' => 'text/plain',
|
43
|
+
'Content-Length' => '0',
|
44
|
+
'WWW-Authenticate' => 'Basic realm="Login"'
|
45
|
+
},
|
46
|
+
'')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/miron/command/init.rb
CHANGED
data/lib/miron/command/server.rb
CHANGED
@@ -12,10 +12,11 @@ module Miron
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def initialize(argv)
|
15
|
-
@
|
15
|
+
@mironfile = Miron::Mironfile.from_dir(Pathname.pwd)
|
16
16
|
@options = {}
|
17
|
-
@options['port'] = argv.option('port') ||
|
18
|
-
@options['
|
17
|
+
@options['port'] = argv.option('port') || 9290
|
18
|
+
@options['handler'] = argv.option('handler')
|
19
|
+
@options['mironfile_path'] = Pathname.pwd + 'Mironfile'
|
19
20
|
super
|
20
21
|
end
|
21
22
|
|
@@ -25,7 +26,7 @@ module Miron
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def run
|
28
|
-
server = Miron::Server.new(@
|
29
|
+
server = Miron::Server.new(@mironfile, @options)
|
29
30
|
server.start
|
30
31
|
end
|
31
32
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'puma'
|
2
|
+
|
3
|
+
module Miron
|
4
|
+
class Handler
|
5
|
+
class Puma
|
6
|
+
def self.run(mironfile, options = {})
|
7
|
+
Puma::Proxy.new(mironfile, options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(mironfile)
|
11
|
+
@mironfile = mironfile
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
# Get response
|
16
|
+
miron_request = env
|
17
|
+
miron_response = Miron::Request.new(miron_request, @mironfile).fetch_response
|
18
|
+
# Process response
|
19
|
+
response_http_status = miron_response.http_status
|
20
|
+
# Add cookies to headers
|
21
|
+
miron_response.cookies.each do |k, v|
|
22
|
+
miron_response.headers['Set-Cookie'] = "#{k}=#{v}"
|
23
|
+
end
|
24
|
+
response_body = [miron_response.body]
|
25
|
+
[response_http_status, miron_response.headers, response_body]
|
26
|
+
end
|
27
|
+
|
28
|
+
class Proxy
|
29
|
+
def initialize(mironfile, options)
|
30
|
+
@mironfile = mironfile
|
31
|
+
@options = options
|
32
|
+
@serv = ::Puma::Server.new(Puma.new(@mironfile))
|
33
|
+
listen(@options['host'], @options['port'].to_i)
|
34
|
+
end
|
35
|
+
|
36
|
+
def stop
|
37
|
+
@serv.stop
|
38
|
+
end
|
39
|
+
|
40
|
+
def listen(address, port)
|
41
|
+
@serv.add_tcp_listener(address, port)
|
42
|
+
@serv.run
|
43
|
+
puts "Puma #{::Puma::Const::PUMA_VERSION} starting..."
|
44
|
+
puts "* Environment: #{@options['environment']}"
|
45
|
+
puts "* Listening on #{@options['host']}:#{@options['port']}"
|
46
|
+
begin
|
47
|
+
sleep
|
48
|
+
rescue Interrupt
|
49
|
+
puts '* Shutting down...'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'thin'
|
2
|
+
|
3
|
+
module Miron
|
4
|
+
class Handler
|
5
|
+
class Thin < Thin::Server
|
6
|
+
def self.run(mironfile, options = {})
|
7
|
+
Thin::Proxy.new(mironfile, options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(mironfile, *args)
|
11
|
+
@mironfile = mironfile
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
# Get response
|
17
|
+
miron_request = env
|
18
|
+
miron_response = Miron::Request.new(miron_request, @mironfile).fetch_response
|
19
|
+
# Process response
|
20
|
+
response_http_status = miron_response.http_status
|
21
|
+
# Add cookies to headers
|
22
|
+
miron_response.cookies.each do |k, v|
|
23
|
+
miron_response.headers['Set-Cookie'] = "#{k}=#{v}"
|
24
|
+
end
|
25
|
+
response_body = [miron_response.body]
|
26
|
+
# Write back to Unicorn
|
27
|
+
[response_http_status, miron_response.headers, response_body]
|
28
|
+
end
|
29
|
+
|
30
|
+
def start
|
31
|
+
@app = self
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
class Proxy
|
36
|
+
def initialize(mironfile, options)
|
37
|
+
@mironfile = mironfile
|
38
|
+
@options = options
|
39
|
+
listen(@options['host'], @options['port'].to_i)
|
40
|
+
end
|
41
|
+
|
42
|
+
def listen(address, port)
|
43
|
+
args = [address, port, nil]
|
44
|
+
# Thin versions below 0.8.0 do not support additional options
|
45
|
+
args.pop if ::Thin::VERSION::MAJOR < 1 && ::Thin::VERSION::MINOR < 8
|
46
|
+
server = ::Miron::Handler::Thin.new(@mironfile, *args)
|
47
|
+
yield server if block_given?
|
48
|
+
server.start
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'unicorn'
|
2
|
+
|
3
|
+
module Miron
|
4
|
+
class Handler
|
5
|
+
class Unicorn < Unicorn::HttpServer
|
6
|
+
def self.run(mironfile, options = {})
|
7
|
+
Unicorn::Proxy.new(mironfile, options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(mironfile, options)
|
11
|
+
@mironfile = mironfile
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def process_client(socket)
|
16
|
+
# Get response
|
17
|
+
miron_request = @request.read(socket)
|
18
|
+
miron_response = Miron::Request.new(miron_request, @mironfile).fetch_response
|
19
|
+
# Process response
|
20
|
+
response_http_status = miron_response.http_status
|
21
|
+
# Add cookies to headers
|
22
|
+
miron_response.cookies.each do |k, v|
|
23
|
+
miron_response.headers['Set-Cookie'] = "#{k}=#{v}"
|
24
|
+
end
|
25
|
+
response_body = [miron_response.body]
|
26
|
+
# Write back to Unicorn
|
27
|
+
http_response_write(socket, response_http_status, miron_response.headers, response_body)
|
28
|
+
unless socket.closed?
|
29
|
+
socket.shutdown
|
30
|
+
socket.close
|
31
|
+
end
|
32
|
+
rescue => e
|
33
|
+
handle_error(socket, e)
|
34
|
+
end
|
35
|
+
|
36
|
+
class Proxy
|
37
|
+
def initialize(mironfile, options)
|
38
|
+
@mironfile = mironfile
|
39
|
+
@options = options
|
40
|
+
listen(@options['host'], @options['port'].to_i)
|
41
|
+
end
|
42
|
+
|
43
|
+
def listen(address, port)
|
44
|
+
puts 'Unicorn starting...'
|
45
|
+
puts "* Environment: #{@options['environment']}"
|
46
|
+
puts "* Listening on #{@options['host']}:#{@options['port']}"
|
47
|
+
begin
|
48
|
+
::Miron::Handler::Unicorn.new(@mironfile, {
|
49
|
+
listeners: ["#{address}:#{port}"],
|
50
|
+
logger: Logger.new(nil)
|
51
|
+
}).start.join
|
52
|
+
rescue Interrupt
|
53
|
+
puts '* Shutting down...'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -1,29 +1,33 @@
|
|
1
1
|
require 'webrick'
|
2
2
|
require 'logger'
|
3
|
+
require 'stringio'
|
3
4
|
|
4
5
|
module Miron
|
5
6
|
class Handler
|
6
7
|
class WEBrick < ::WEBrick::HTTPServlet::AbstractServlet
|
7
|
-
def self.run(
|
8
|
-
|
9
|
-
default_host = environment == 'development' ? 'localhost' : nil
|
10
|
-
|
11
|
-
options[:BindAddress] = options.delete(:Host) || default_host
|
8
|
+
def self.run(mironfile, options = {})
|
9
|
+
options[:BindAddress] = options['host']
|
12
10
|
options[:Port] = options['port']
|
13
11
|
@server = ::WEBrick::HTTPServer.new(options)
|
14
|
-
@server.mount('/', Miron::Handler::WEBrick,
|
12
|
+
@server.mount('/', Miron::Handler::WEBrick, mironfile)
|
15
13
|
yield @server if block_given?
|
16
|
-
|
14
|
+
|
15
|
+
begin
|
16
|
+
@server.start
|
17
|
+
rescue Interrupt
|
18
|
+
puts '* Shutting down...'
|
19
|
+
end
|
17
20
|
end
|
18
21
|
|
19
|
-
def initialize(server,
|
22
|
+
def initialize(server, mironfile)
|
20
23
|
super server
|
21
|
-
@
|
24
|
+
@mironfile = mironfile
|
22
25
|
end
|
23
26
|
|
24
27
|
def service(webrick_request, webrick_response)
|
25
28
|
miron_request = webrick_request.meta_vars
|
26
|
-
|
29
|
+
parse_input_body(webrick_request, miron_request)
|
30
|
+
miron_response = Miron::Request.new(miron_request, @mironfile).fetch_response
|
27
31
|
|
28
32
|
webrick_response.status = miron_response.http_status
|
29
33
|
webrick_response.body << miron_response.body
|
@@ -32,6 +36,14 @@ module Miron
|
|
32
36
|
miron_response.body.close if miron_response.body.respond_to?(:close)
|
33
37
|
end
|
34
38
|
|
39
|
+
def parse_input_body(webrick_request, miron_request)
|
40
|
+
if webrick_request.body.to_s.nil? || webrick_request.body.to_s.empty?
|
41
|
+
miron_request['HTTP_BODY'] = ''
|
42
|
+
else
|
43
|
+
miron_request['HTTP_BODY'] = ::MultiJson.load(webrick_request.body.to_s)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
35
47
|
def shutdown
|
36
48
|
@server.shutdown
|
37
49
|
end
|
data/lib/miron/mironfile.rb
CHANGED
@@ -8,17 +8,19 @@ module Miron
|
|
8
8
|
# @return [Miron::Mironfile] Returns newly create {Miron::Mironfile}
|
9
9
|
# @return [Nil] If no Mironfile was found in the given dir
|
10
10
|
#
|
11
|
-
attr_reader :app
|
11
|
+
attr_reader :app, :middleware
|
12
12
|
|
13
13
|
def self.from_dir(dir)
|
14
|
-
path = dir + 'Mironfile'
|
15
|
-
mironfile = Mironfile.new do
|
14
|
+
path = dir + 'Mironfile.rb'
|
15
|
+
mironfile = Mironfile.new(path) do
|
16
16
|
eval(path.read, nil, path.to_s)
|
17
17
|
end
|
18
18
|
mironfile
|
19
19
|
end
|
20
20
|
|
21
|
-
def initialize(&block)
|
21
|
+
def initialize(mironfile_path, &block)
|
22
|
+
require_relative File.expand_path(mironfile_path, __FILE__)
|
23
|
+
@middleware = []
|
22
24
|
instance_eval(&block)
|
23
25
|
end
|
24
26
|
|
@@ -32,7 +34,38 @@ module Miron
|
|
32
34
|
#
|
33
35
|
# run Heartbeat
|
34
36
|
def run(app)
|
35
|
-
@app = app
|
37
|
+
@app = app.to_s.gsub!('Miron::Mironfile::', '').constantize
|
38
|
+
end
|
39
|
+
|
40
|
+
# Takes an argument that is an object that responds to #call and returns a {Miron::Response}.
|
41
|
+
#
|
42
|
+
# class Middle
|
43
|
+
# def self.call(request)
|
44
|
+
# puts "hello from middle"
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# class Heartbeat
|
49
|
+
# def self.call(request)
|
50
|
+
# Miron::Response.new(200, { "Content-Type" => "text/plain" }, "OK")
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# use Middle
|
55
|
+
# run Heartbeat
|
56
|
+
def use(middleware)
|
57
|
+
middleware_string = middleware.to_s
|
58
|
+
if middleware_string.include?('Miron::Mironfile::')
|
59
|
+
@middleware << middleware_string.gsub!('Miron::Mironfile::', '').constantize
|
60
|
+
else
|
61
|
+
@middleware << middleware_string.constantize
|
62
|
+
end
|
36
63
|
end
|
37
64
|
end
|
38
65
|
end
|
66
|
+
|
67
|
+
def run(_)
|
68
|
+
end
|
69
|
+
|
70
|
+
def use(_)
|
71
|
+
end
|
data/lib/miron/request.rb
CHANGED
@@ -2,27 +2,50 @@ module Miron
|
|
2
2
|
# Miron::Request allows HTTP responses to be sent.
|
3
3
|
#
|
4
4
|
class Request
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :request, :mironfile
|
6
6
|
|
7
|
-
# @param [
|
8
|
-
# Request
|
7
|
+
# @param [Hash] request
|
8
|
+
# Request information
|
9
9
|
#
|
10
|
-
# @param [
|
11
|
-
#
|
10
|
+
# @param [Mironfile] mironfile
|
11
|
+
# Mironfile that has the app and middleware to perform a `.call` on
|
12
12
|
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@miron_response = miron_response
|
19
|
-
@app = app
|
13
|
+
def initialize(request, mironfile)
|
14
|
+
@request = request
|
15
|
+
@mironfile = mironfile
|
16
|
+
@response = Miron::Response.new
|
17
|
+
fix_hash_keys
|
20
18
|
end
|
21
19
|
|
22
20
|
# @return [Response] returns the newly created {Miron::Response}
|
23
21
|
#
|
24
22
|
def fetch_response
|
25
|
-
|
23
|
+
miron_response = nil
|
24
|
+
@mironfile.middleware.each do |middleware|
|
25
|
+
middleware_response = middleware.call(@request, @response)
|
26
|
+
miron_response = middleware_response if middleware_response.is_a?(Miron::Response)
|
27
|
+
end
|
28
|
+
|
29
|
+
return miron_response unless miron_response.nil?
|
30
|
+
|
31
|
+
app_response = @mironfile.app.call(@request, @response)
|
32
|
+
miron_response = app_response if app_response.is_a?(Miron::Response)
|
33
|
+
miron_response
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# Make request hash keys easier to understand.
|
39
|
+
def fix_hash_keys
|
40
|
+
# Convert PATH_INFO to PATH
|
41
|
+
return unless @request['PATH_INFO']
|
42
|
+
@request['PATH'] = @request['PATH_INFO']
|
43
|
+
@request.delete('PATH_INFO')
|
44
|
+
|
45
|
+
# Convert REQUEST_METHOD to HTTP_METHOD
|
46
|
+
return unless @request['REQUEST_METHOD']
|
47
|
+
@request['HTTP_METHOD'] = @request['REQUEST_METHOD']
|
48
|
+
@request.delete('REQUEST_METHOD')
|
26
49
|
end
|
27
50
|
end
|
28
51
|
end
|
data/lib/miron/response.rb
CHANGED
@@ -2,7 +2,7 @@ module Miron
|
|
2
2
|
# Miron::Reponse allows HTTP responses to be sent.
|
3
3
|
#
|
4
4
|
class Response
|
5
|
-
|
5
|
+
attr_accessor :http_status, :headers, :body, :cookies
|
6
6
|
|
7
7
|
# @param [Integer] http_status
|
8
8
|
# the HTTP status code to return
|
@@ -15,11 +15,11 @@ module Miron
|
|
15
15
|
#
|
16
16
|
# @return [Response] returns the newly created {Miron::Response}
|
17
17
|
#
|
18
|
-
def initialize
|
19
|
-
@http_status =
|
20
|
-
@headers =
|
21
|
-
@body =
|
22
|
-
@cookies =
|
18
|
+
def initialize
|
19
|
+
@http_status = 200
|
20
|
+
@headers = {}
|
21
|
+
@body = ''
|
22
|
+
@cookies = {}
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/miron/server.rb
CHANGED
@@ -2,31 +2,34 @@ module Miron
|
|
2
2
|
# Miron::Server allows HTTP responses to be sent.
|
3
3
|
#
|
4
4
|
class Server
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :mironfile, :options
|
6
6
|
attr_accessor :handler
|
7
7
|
|
8
|
-
# @param [
|
9
|
-
#
|
8
|
+
# @param [Mironfile] mironfile
|
9
|
+
# An instance of {Miron::Mironfile} that will be powering the {Miron::Server}
|
10
10
|
#
|
11
11
|
# @param [Hash] options
|
12
12
|
# A Hash of configuration options
|
13
13
|
#
|
14
|
-
# @return [Response] returns the newly created {Miron::
|
14
|
+
# @return [Response] returns the newly created {Miron::Server}
|
15
15
|
#
|
16
|
-
def initialize(
|
17
|
-
@
|
16
|
+
def initialize(mironfile, options)
|
17
|
+
@mironfile = mironfile
|
18
18
|
@options = options
|
19
19
|
resolve_handler
|
20
20
|
end
|
21
21
|
|
22
22
|
def start
|
23
|
-
|
23
|
+
# Set options defaults and run the handler
|
24
|
+
@options['environment'] = ENV['MIRON_ENV'] || 'development'
|
25
|
+
@options['host'] = '0.0.0.0'
|
26
|
+
@handler.run(@mironfile, @options)
|
24
27
|
end
|
25
28
|
|
26
29
|
private
|
27
30
|
|
28
31
|
def resolve_handler
|
29
|
-
@handler = Miron::Handler.get(options['
|
32
|
+
@handler = Miron::Handler.get(@options['handler'])
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
data/lib/miron/utils.rb
CHANGED
data/lib/miron/version.rb
CHANGED
data/lib/miron.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require 'active_support/core_ext/string/strip'
|
3
3
|
require 'active_support/core_ext/string/inflections'
|
4
|
+
require 'multi_json'
|
4
5
|
|
5
6
|
require 'miron/version'
|
6
7
|
|
@@ -15,7 +16,14 @@ module Miron
|
|
15
16
|
autoload :Server, 'miron/server'
|
16
17
|
autoload :Utils, 'miron/utils'
|
17
18
|
|
19
|
+
module Auth
|
20
|
+
autoload :Basic, 'miron/auth/basic'
|
21
|
+
end
|
22
|
+
|
18
23
|
class Handler
|
24
|
+
autoload :Puma, 'miron/handlers/puma'
|
25
|
+
autoload :Thin, 'miron/handlers/thin'
|
26
|
+
autoload :Unicorn, 'miron/handlers/unicorn'
|
19
27
|
autoload :WEBrick, 'miron/handlers/webrick'
|
20
28
|
end
|
21
29
|
end
|
data/miron.gemspec
CHANGED
@@ -21,11 +21,16 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'activesupport'
|
23
23
|
spec.add_runtime_dependency 'claide'
|
24
|
+
spec.add_runtime_dependency 'multi_json'
|
24
25
|
|
25
26
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
27
|
+
spec.add_development_dependency 'httparty'
|
26
28
|
spec.add_development_dependency 'pry'
|
29
|
+
spec.add_development_dependency 'puma'
|
27
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
28
31
|
spec.add_development_dependency 'rspec'
|
29
32
|
spec.add_development_dependency 'rubocop'
|
33
|
+
spec.add_development_dependency 'thin'
|
34
|
+
spec.add_development_dependency 'unicorn'
|
30
35
|
spec.add_development_dependency 'yard'
|
31
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: multi_json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,20 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '1.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: httparty
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: pry
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +94,20 @@ dependencies:
|
|
66
94
|
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: puma
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
112
|
name: rake
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +150,34 @@ dependencies:
|
|
108
150
|
- - ">="
|
109
151
|
- !ruby/object:Gem::Version
|
110
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: thin
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: unicorn
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
111
181
|
- !ruby/object:Gem::Dependency
|
112
182
|
name: yard
|
113
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,10 +217,14 @@ files:
|
|
147
217
|
- bin/travis
|
148
218
|
- exe/miron
|
149
219
|
- lib/miron.rb
|
220
|
+
- lib/miron/auth/basic.rb
|
150
221
|
- lib/miron/command.rb
|
151
222
|
- lib/miron/command/init.rb
|
152
223
|
- lib/miron/command/server.rb
|
153
224
|
- lib/miron/handler.rb
|
225
|
+
- lib/miron/handlers/puma.rb
|
226
|
+
- lib/miron/handlers/thin.rb
|
227
|
+
- lib/miron/handlers/unicorn.rb
|
154
228
|
- lib/miron/handlers/webrick.rb
|
155
229
|
- lib/miron/mironfile.rb
|
156
230
|
- lib/miron/request.rb
|
@@ -179,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
253
|
version: '0'
|
180
254
|
requirements: []
|
181
255
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.4.
|
256
|
+
rubygems_version: 2.4.8
|
183
257
|
signing_key:
|
184
258
|
specification_version: 4
|
185
259
|
summary: A redesigned Ruby web interface.
|