miron 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +1 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +10 -0
- data/.travis.yml +5 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +5 -0
- data/CONTRIBUTING.md +125 -0
- data/Gemfile +4 -0
- data/LICENSE.md +22 -0
- data/README.md +19 -0
- data/Rakefile +17 -0
- data/UPGRADING.md +4 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/bin/travis +7 -0
- data/exe/miron +6 -0
- data/lib/miron.rb +21 -0
- data/lib/miron/command.rb +28 -0
- data/lib/miron/command/init.rb +37 -0
- data/lib/miron/command/server.rb +33 -0
- data/lib/miron/handler.rb +21 -0
- data/lib/miron/handlers/webrick.rb +40 -0
- data/lib/miron/mironfile.rb +38 -0
- data/lib/miron/request.rb +28 -0
- data/lib/miron/response.rb +25 -0
- data/lib/miron/server.rb +32 -0
- data/lib/miron/utils.rb +20 -0
- data/lib/miron/version.rb +5 -0
- data/miron.gemspec +31 -0
- metadata +187 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0c04dafa4abf1207f7cd2fa1fc8ffd280d67040f
|
4
|
+
data.tar.gz: c2072ce7cac097d879d82aa31f20decb6e9210d2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6f804660f7d397e908d60d0ba7eb252c77b3acd7a85892a081404494d57990a3d83cf4fd324aa590aba8f651c1765ea097c4b2576a8ee46110beb25d4906599a
|
7
|
+
data.tar.gz: 72654931ca42ee95eb5fddd399e55ec26fa3de7d033f6669c012a1581a7f9cf19ff60588b4f022ac34b329ecdea33d8a9fee722711258fe78667cdf35f2f1a4f
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
# Contributing to Miron
|
2
|
+
|
3
|
+
This project is work of [many contributors](https://github.com/mironrb/miron/graphs/contributors).
|
4
|
+
|
5
|
+
You're encouraged to submit [pull requests](https://github.com/mironrb/miron/pulls), [propose features and discuss issues](https://github.com/mironrb/miron/issues).
|
6
|
+
|
7
|
+
In the examples below, substitute your Github username for `contributor` in URLs.
|
8
|
+
|
9
|
+
## Fork the Project
|
10
|
+
|
11
|
+
Fork the [project on Github](https://github.com/mironrb/miron) and check out your copy.
|
12
|
+
|
13
|
+
```
|
14
|
+
git clone https://github.com/contributor/miron.git
|
15
|
+
cd miron
|
16
|
+
git remote add upstream https://github.com/mironrb/miron.git
|
17
|
+
```
|
18
|
+
|
19
|
+
## Bundle Install and Test
|
20
|
+
|
21
|
+
Ensure that you can build the project and run tests.
|
22
|
+
|
23
|
+
```
|
24
|
+
bundle install
|
25
|
+
bundle exec rake
|
26
|
+
```
|
27
|
+
|
28
|
+
## Create a Topic Branch
|
29
|
+
|
30
|
+
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
|
31
|
+
|
32
|
+
```
|
33
|
+
git checkout master
|
34
|
+
git pull upstream master
|
35
|
+
git checkout -b my-feature-branch
|
36
|
+
```
|
37
|
+
|
38
|
+
## Write Tests
|
39
|
+
|
40
|
+
Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build.
|
41
|
+
Add to [spec](spec).
|
42
|
+
|
43
|
+
We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
|
44
|
+
|
45
|
+
## Write Code
|
46
|
+
|
47
|
+
Implement your feature or bug fix.
|
48
|
+
|
49
|
+
Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop).
|
50
|
+
Run `bundle exec rubocop` and fix any style issues highlighted.
|
51
|
+
|
52
|
+
Make sure that `bundle exec rake` completes without errors.
|
53
|
+
|
54
|
+
## Write Documentation
|
55
|
+
|
56
|
+
Document any external behavior in the [README](README.md).
|
57
|
+
|
58
|
+
## Update Changelog
|
59
|
+
|
60
|
+
Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*.
|
61
|
+
Make it look like every other line, including your name and link to your Github account.
|
62
|
+
|
63
|
+
## Commit Changes
|
64
|
+
|
65
|
+
Make sure git knows your name and email address:
|
66
|
+
|
67
|
+
```
|
68
|
+
git config --global user.name "Your Name"
|
69
|
+
git config --global user.email "contributor@example.com"
|
70
|
+
```
|
71
|
+
|
72
|
+
Writing good commit logs is important. A commit log should describe what changed and why.
|
73
|
+
|
74
|
+
```
|
75
|
+
git add ...
|
76
|
+
git commit
|
77
|
+
```
|
78
|
+
|
79
|
+
## Push
|
80
|
+
|
81
|
+
```
|
82
|
+
git push origin my-feature-branch
|
83
|
+
```
|
84
|
+
|
85
|
+
## Make a Pull Request
|
86
|
+
|
87
|
+
Go to https://github.com/contributor/miron and select your feature branch.
|
88
|
+
Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
89
|
+
|
90
|
+
## Rebase
|
91
|
+
|
92
|
+
If you've been working on a change for a while, rebase with upstream/master.
|
93
|
+
|
94
|
+
```
|
95
|
+
git fetch upstream
|
96
|
+
git rebase upstream/master
|
97
|
+
git push origin my-feature-branch -f
|
98
|
+
```
|
99
|
+
|
100
|
+
## Update CHANGELOG Again
|
101
|
+
|
102
|
+
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
|
103
|
+
|
104
|
+
```
|
105
|
+
* [#123](https://github.com/mironrb/miron/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
|
106
|
+
```
|
107
|
+
|
108
|
+
Amend your previous commit and force push the changes.
|
109
|
+
|
110
|
+
```
|
111
|
+
git commit --amend
|
112
|
+
git push origin my-feature-branch -f
|
113
|
+
```
|
114
|
+
|
115
|
+
## Check on Your Pull Request
|
116
|
+
|
117
|
+
Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
|
118
|
+
|
119
|
+
## Be Patient
|
120
|
+
|
121
|
+
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
|
122
|
+
|
123
|
+
## Thank You
|
124
|
+
|
125
|
+
Please do know that we really appreciate and value your time and work. We love you, really.
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2015 Jon Moss and Contributors
|
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/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Miron
|
2
|
+
|
3
|
+
[](https://travis-ci.org/mironrb/miron)
|
4
|
+
|
5
|
+
A redesigned Ruby web interface.
|
6
|
+
|
7
|
+
## Contributing
|
8
|
+
|
9
|
+
See [CONTRIBUTING](CONTRIBUTING.md).
|
10
|
+
|
11
|
+
## Upgrading
|
12
|
+
|
13
|
+
See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING.md) for how to upgrade to more recent versions.
|
14
|
+
|
15
|
+
## Copyright and License
|
16
|
+
|
17
|
+
Copyright (c) 2015, [Jon Moss](https://twitter.com/applerebel), and [Contributors](CHANGELOG.md).
|
18
|
+
|
19
|
+
This project is licensed under the [MIT License](LICENSE.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
|
5
|
+
Bundler.setup :default, :development
|
6
|
+
|
7
|
+
require 'rspec/core'
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
11
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'rubocop/rake_task'
|
15
|
+
RuboCop::RakeTask.new
|
16
|
+
|
17
|
+
task default: [:rubocop, :spec]
|
data/UPGRADING.md
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'miron'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/bin/travis
ADDED
data/exe/miron
ADDED
data/lib/miron.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'active_support/core_ext/string/strip'
|
3
|
+
require 'active_support/core_ext/string/inflections'
|
4
|
+
|
5
|
+
require 'miron/version'
|
6
|
+
|
7
|
+
# Miron: The Gem, The Myth, The Legend
|
8
|
+
#
|
9
|
+
module Miron
|
10
|
+
autoload :Command, 'miron/command'
|
11
|
+
autoload :Handler, 'miron/handler'
|
12
|
+
autoload :Mironfile, 'miron/mironfile'
|
13
|
+
autoload :Response, 'miron/response'
|
14
|
+
autoload :Request, 'miron/request'
|
15
|
+
autoload :Server, 'miron/server'
|
16
|
+
autoload :Utils, 'miron/utils'
|
17
|
+
|
18
|
+
class Handler
|
19
|
+
autoload :WEBrick, 'miron/handlers/webrick'
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'claide'
|
2
|
+
|
3
|
+
module Miron
|
4
|
+
class Command < CLAide::Command
|
5
|
+
require 'miron/command/init'
|
6
|
+
require 'miron/command/server'
|
7
|
+
|
8
|
+
self.abstract_command = true
|
9
|
+
self.command = 'miron'
|
10
|
+
self.version = VERSION
|
11
|
+
self.description = 'Miron, a redesigned Ruby web interface.'
|
12
|
+
self.plugin_prefixes = %w(claide miron)
|
13
|
+
|
14
|
+
def self.options
|
15
|
+
[
|
16
|
+
].concat(super)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.run(argv)
|
20
|
+
help! 'You cannot run Miron as root.' if Process.uid == 0
|
21
|
+
super(argv)
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(argv)
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Miron
|
2
|
+
class Command
|
3
|
+
class Init < Command
|
4
|
+
self.summary = 'Generate a Mironfile for the current directory.'
|
5
|
+
self.description = 'Creates a Mironfile for the current directory if none currently exists.'
|
6
|
+
self.arguments = [
|
7
|
+
]
|
8
|
+
|
9
|
+
def initialize(argv)
|
10
|
+
@mironfile_path = Pathname.pwd + 'Mironfile'
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def validate!
|
15
|
+
super
|
16
|
+
help! 'Existing Mironfile found in directory' if Miron::Utils.mironfile_in_dir(Pathname.pwd)
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
@mironfile_path.open('w') { |f| f << mironfile_template }
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
# @return [String] the text of the Podfile for the provided project
|
26
|
+
#
|
27
|
+
def mironfile_template
|
28
|
+
mironfile = ''
|
29
|
+
mironfile << <<-MIRON.strip_heredoc
|
30
|
+
# This file is used by Miron-based servers to start the application.
|
31
|
+
MIRON
|
32
|
+
|
33
|
+
mironfile << "\n"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Miron
|
2
|
+
class Command
|
3
|
+
class Server < Command
|
4
|
+
self.summary = 'Start a Miron-backed server.'
|
5
|
+
self.description = 'Start a Miron-backed server.'
|
6
|
+
|
7
|
+
def self.options
|
8
|
+
[
|
9
|
+
['--port=PORT', 'Port to run the Mironfile on'],
|
10
|
+
['--handler=HANDLER', 'Handler to use for your Miron-backed server']
|
11
|
+
].concat(super)
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(argv)
|
15
|
+
@app = Miron::Mironfile.from_dir(Pathname.pwd).app
|
16
|
+
@options = {}
|
17
|
+
@options['port'] = argv.option('port') || '9290'
|
18
|
+
@options['server'] = argv.option('server')
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def validate!
|
23
|
+
super
|
24
|
+
help! 'No Mironfile found in directory' if Miron::Utils.mironfile_in_dir(Pathname.pwd) == false
|
25
|
+
end
|
26
|
+
|
27
|
+
def run
|
28
|
+
server = Miron::Server.new(@app, @options)
|
29
|
+
server.start
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Miron
|
2
|
+
class Handler
|
3
|
+
# @param [String] handler_name
|
4
|
+
# inheritor of {Miron::Handler} to try and use to run a Miron-backed server
|
5
|
+
#
|
6
|
+
# @return [Miron::Handler]
|
7
|
+
# returns constant of handler_name, if it can be found
|
8
|
+
#
|
9
|
+
# @return [Miron::Handler]
|
10
|
+
# returns the newly created {Miron::Response}
|
11
|
+
# returns constant of {Miron::Handle::WEBrick}, if handler_name cannot be found
|
12
|
+
#
|
13
|
+
def self.get(handler_name)
|
14
|
+
if !handler_name.nil? && Miron::Handler.const_defined?(:"#{handler_name.capitalize}")
|
15
|
+
Miron::Handler.const_get(:"#{handler_name.capitalize}")
|
16
|
+
else
|
17
|
+
Miron::Handler::WEBrick
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'webrick'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
module Miron
|
5
|
+
class Handler
|
6
|
+
class WEBrick < ::WEBrick::HTTPServlet::AbstractServlet
|
7
|
+
def self.run(app, options = {})
|
8
|
+
environment = ENV['MIRON_ENV'] || 'development'
|
9
|
+
default_host = environment == 'development' ? 'localhost' : nil
|
10
|
+
|
11
|
+
options[:BindAddress] = options.delete(:Host) || default_host
|
12
|
+
options[:Port] = options['port']
|
13
|
+
@server = ::WEBrick::HTTPServer.new(options)
|
14
|
+
@server.mount('/', Miron::Handler::WEBrick, app)
|
15
|
+
yield @server if block_given?
|
16
|
+
@server.start
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(server, app)
|
20
|
+
super server
|
21
|
+
@app = app
|
22
|
+
end
|
23
|
+
|
24
|
+
def service(webrick_request, webrick_response)
|
25
|
+
miron_request = webrick_request.meta_vars
|
26
|
+
miron_response = Miron::Request.new(miron_request, webrick_response, @app).fetch_response
|
27
|
+
|
28
|
+
webrick_response.status = miron_response.http_status
|
29
|
+
webrick_response.body << miron_response.body
|
30
|
+
miron_response.headers.each { |k, v| webrick_response[k] = v }
|
31
|
+
miron_response.cookies.each { |k, v| webrick_response.cookies << "#{k}=#{v}" }
|
32
|
+
miron_response.body.close if miron_response.body.respond_to?(:close)
|
33
|
+
end
|
34
|
+
|
35
|
+
def shutdown
|
36
|
+
@server.shutdown
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Miron
|
2
|
+
class Mironfile
|
3
|
+
# Returns the contents of the Mironfile in the given dir, if any exists.
|
4
|
+
#
|
5
|
+
# @param [Pathname] dir
|
6
|
+
# The directory where to look for the Mironfile.
|
7
|
+
#
|
8
|
+
# @return [Miron::Mironfile] Returns newly create {Miron::Mironfile}
|
9
|
+
# @return [Nil] If no Mironfile was found in the given dir
|
10
|
+
#
|
11
|
+
attr_reader :app
|
12
|
+
|
13
|
+
def self.from_dir(dir)
|
14
|
+
path = dir + 'Mironfile'
|
15
|
+
mironfile = Mironfile.new do
|
16
|
+
eval(path.read, nil, path.to_s)
|
17
|
+
end
|
18
|
+
mironfile
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(&block)
|
22
|
+
instance_eval(&block)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Takes an argument that is an object that responds to #call and returns a {Miron::Response}.
|
26
|
+
#
|
27
|
+
# class Heartbeat
|
28
|
+
# def self.call(request)
|
29
|
+
# Miron::Response.new(200, { "Content-Type" => "text/plain" }, "OK")
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# run Heartbeat
|
34
|
+
def run(app)
|
35
|
+
@app = app
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Miron
|
2
|
+
# Miron::Request allows HTTP responses to be sent.
|
3
|
+
#
|
4
|
+
class Request
|
5
|
+
attr_reader :miron_request, :miron_response, :app
|
6
|
+
|
7
|
+
# @param [Class] miron_request
|
8
|
+
# Request object (can be an instance of `WEBrick::Request`)
|
9
|
+
#
|
10
|
+
# @param [Class] miron_response
|
11
|
+
# Response object (can be an instance of `WEBrick::Response`)
|
12
|
+
#
|
13
|
+
# @param [] app
|
14
|
+
# App to perform a `.call` on
|
15
|
+
#
|
16
|
+
def initialize(miron_request, miron_response, app)
|
17
|
+
@miron_request = miron_request
|
18
|
+
@miron_response = miron_response
|
19
|
+
@app = app
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Response] returns the newly created {Miron::Response}
|
23
|
+
#
|
24
|
+
def fetch_response
|
25
|
+
@app.call(@miron_request)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Miron
|
2
|
+
# Miron::Reponse allows HTTP responses to be sent.
|
3
|
+
#
|
4
|
+
class Response
|
5
|
+
attr_reader :http_status, :headers, :body, :cookies
|
6
|
+
|
7
|
+
# @param [Integer] http_status
|
8
|
+
# the HTTP status code to return
|
9
|
+
#
|
10
|
+
# @param [Hash] headers
|
11
|
+
# the HTTP headers to return
|
12
|
+
#
|
13
|
+
# @param [String] body
|
14
|
+
# the HTTP body to return
|
15
|
+
#
|
16
|
+
# @return [Response] returns the newly created {Miron::Response}
|
17
|
+
#
|
18
|
+
def initialize(http_status, headers, body, cookies = {})
|
19
|
+
@http_status = http_status
|
20
|
+
@headers = headers
|
21
|
+
@body = body
|
22
|
+
@cookies = cookies
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/miron/server.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Miron
|
2
|
+
# Miron::Server allows HTTP responses to be sent.
|
3
|
+
#
|
4
|
+
class Server
|
5
|
+
attr_reader :app, :options
|
6
|
+
attr_accessor :handler
|
7
|
+
|
8
|
+
# @param [String] app
|
9
|
+
# A String of the mironfile that will be powering the {Miron::Server}
|
10
|
+
#
|
11
|
+
# @param [Hash] options
|
12
|
+
# A Hash of configuration options
|
13
|
+
#
|
14
|
+
# @return [Response] returns the newly created {Miron::Response}
|
15
|
+
#
|
16
|
+
def initialize(app, options)
|
17
|
+
@app = app
|
18
|
+
@options = options
|
19
|
+
resolve_handler
|
20
|
+
end
|
21
|
+
|
22
|
+
def start
|
23
|
+
@handler.run(app, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def resolve_handler
|
29
|
+
@handler = Miron::Handler.get(options['server'])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/miron/utils.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Miron
|
2
|
+
class Utils
|
3
|
+
# Returns the path of the Mironfile in the given dir, if any exists.
|
4
|
+
#
|
5
|
+
# @param [Pathname] dir
|
6
|
+
# The directory where to look for the Mironfile.
|
7
|
+
#
|
8
|
+
# @return [Pathname] The path of the Mironfile.
|
9
|
+
# @return [Nil] If no Mironfile was found in the given dir
|
10
|
+
#
|
11
|
+
def self.mironfile_in_dir(dir)
|
12
|
+
mironfile = dir + 'Mironfile'
|
13
|
+
if mironfile.exist?
|
14
|
+
true
|
15
|
+
else
|
16
|
+
false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/miron.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'miron/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'miron'
|
8
|
+
spec.version = Miron::VERSION
|
9
|
+
spec.authors = 'Jon Moss'
|
10
|
+
spec.email = 'me@jonathanmoss.me'
|
11
|
+
|
12
|
+
spec.summary = 'A redesigned Ruby web interface.'
|
13
|
+
spec.description = 'A redesigned Ruby web interface.'
|
14
|
+
spec.homepage = 'https://github.com/mironrb/miron'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'activesupport'
|
23
|
+
spec.add_runtime_dependency 'claide'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
26
|
+
spec.add_development_dependency 'pry'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'rspec'
|
29
|
+
spec.add_development_dependency 'rubocop'
|
30
|
+
spec.add_development_dependency 'yard'
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: miron
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jon Moss
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: claide
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.10'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
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'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: A redesigned Ruby web interface.
|
126
|
+
email: me@jonathanmoss.me
|
127
|
+
executables:
|
128
|
+
- miron
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- ".rubocop.yml"
|
135
|
+
- ".rubocop_todo.yml"
|
136
|
+
- ".travis.yml"
|
137
|
+
- ".yardopts"
|
138
|
+
- CHANGELOG.md
|
139
|
+
- CONTRIBUTING.md
|
140
|
+
- Gemfile
|
141
|
+
- LICENSE.md
|
142
|
+
- README.md
|
143
|
+
- Rakefile
|
144
|
+
- UPGRADING.md
|
145
|
+
- bin/console
|
146
|
+
- bin/setup
|
147
|
+
- bin/travis
|
148
|
+
- exe/miron
|
149
|
+
- lib/miron.rb
|
150
|
+
- lib/miron/command.rb
|
151
|
+
- lib/miron/command/init.rb
|
152
|
+
- lib/miron/command/server.rb
|
153
|
+
- lib/miron/handler.rb
|
154
|
+
- lib/miron/handlers/webrick.rb
|
155
|
+
- lib/miron/mironfile.rb
|
156
|
+
- lib/miron/request.rb
|
157
|
+
- lib/miron/response.rb
|
158
|
+
- lib/miron/server.rb
|
159
|
+
- lib/miron/utils.rb
|
160
|
+
- lib/miron/version.rb
|
161
|
+
- miron.gemspec
|
162
|
+
homepage: https://github.com/mironrb/miron
|
163
|
+
licenses:
|
164
|
+
- MIT
|
165
|
+
metadata: {}
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options: []
|
168
|
+
require_paths:
|
169
|
+
- lib
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
requirements: []
|
181
|
+
rubyforge_project:
|
182
|
+
rubygems_version: 2.4.5.1
|
183
|
+
signing_key:
|
184
|
+
specification_version: 4
|
185
|
+
summary: A redesigned Ruby web interface.
|
186
|
+
test_files: []
|
187
|
+
has_rdoc:
|