smort 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/LICENSE +13 -0
- data/Readme.md +3 -0
- data/VERSION +1 -0
- data/bin/smort +3 -0
- data/lib/smort.rb +1 -0
- data/lib/smort/main.rb +53 -0
- data/lib/smort/metadata.rb +43 -0
- data/lib/smort/mjolnir.rb +56 -0
- data/lib/smort/web.rb +36 -0
- data/web/app/smort.js +5 -0
- data/web/app/style/smort.css +3 -0
- data/web/public/favicon.ico +0 -0
- data/web/views/app.erb +2 -0
- data/web/views/layout.erb +21 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d5c031f80c300eccb14f8e5ec1761f11ca52eb63
|
4
|
+
data.tar.gz: fdbeb3e340bf6a3e015f37e0c3bb3ac207fd393d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1e05da8bdbf46b33c2ed7ce7e036dccb1a8a9194367d14031cd5822ea8e494516203c797c29cdbf41bb688a40998ef950c8aa38359ff8a5da0242177b9bef2df
|
7
|
+
data.tar.gz: c04dbc65d90289350ad84f315d0016560fc9a5f25cb00ed4b22204b18aaf1804506cb329aba3f7dfbc38ee2f94b4567a5e1de4434e512002639dde2d72640f38
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2015 Sean Clemmer
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
data/Readme.md
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/smort
ADDED
data/lib/smort.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'smort/main'
|
data/lib/smort/main.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
require_relative 'metadata'
|
4
|
+
require_relative 'mjolnir'
|
5
|
+
require_relative 'web'
|
6
|
+
|
7
|
+
|
8
|
+
module Smort
|
9
|
+
class Main < Mjolnir
|
10
|
+
|
11
|
+
desc 'version', 'Echo the application version'
|
12
|
+
def version
|
13
|
+
puts VERSION
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
desc 'art', 'View the application art'
|
18
|
+
def art
|
19
|
+
puts "\n%s\n" % ART
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'web', 'Serve the Web interface'
|
23
|
+
option :bind, \
|
24
|
+
type: :string,
|
25
|
+
aliases: %w[ -b ],
|
26
|
+
desc: 'Set Sinatra interface',
|
27
|
+
default: '0.0.0.0'
|
28
|
+
option :port, \
|
29
|
+
type: :numeric,
|
30
|
+
aliases: %w[ -p ],
|
31
|
+
desc: 'Set Sinatra port',
|
32
|
+
default: 4567
|
33
|
+
option :environment, \
|
34
|
+
type: :string,
|
35
|
+
aliases: %w[ -e ],
|
36
|
+
desc: 'Set Sinatra environment',
|
37
|
+
default: 'development'
|
38
|
+
include_common_options
|
39
|
+
def web
|
40
|
+
Web.set :environment, options.environment
|
41
|
+
Web.set :port, options.port
|
42
|
+
Web.set :bind, options.bind
|
43
|
+
if log.level >= ::Logger::DEBUG
|
44
|
+
Web.set :raise_errors, true
|
45
|
+
Web.set :dump_errors, true
|
46
|
+
Web.set :show_exceptions, true
|
47
|
+
Web.set :logging, ::Logger::DEBUG
|
48
|
+
end
|
49
|
+
Web.run!
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Smort
|
2
|
+
# Project root
|
3
|
+
ROOT = File.dirname(__FILE__), '..', '..'
|
4
|
+
|
5
|
+
# Pull the project version out of the VERSION file
|
6
|
+
VERSION = File.read(File.join(ROOT, 'VERSION')).strip
|
7
|
+
|
8
|
+
# We don't really do all that much, be humble
|
9
|
+
SUMMARY = 'An erudite JSON schema and document manager'
|
10
|
+
|
11
|
+
# Your benevolent dictator for life
|
12
|
+
AUTHOR = 'Sean Clemmer'
|
13
|
+
|
14
|
+
# Turn here to strangle your dictator
|
15
|
+
EMAIL = 'sclemmer@bluejeans.com'
|
16
|
+
|
17
|
+
# Like the MIT license, but even simpler
|
18
|
+
LICENSE = 'ISC'
|
19
|
+
|
20
|
+
# If you really just can't get enough
|
21
|
+
HOMEPAGE = 'https://github.com/sczizzo/smort'
|
22
|
+
|
23
|
+
# Bundled extensions
|
24
|
+
TRAVELING_RUBY_VERSION = '20150210-2.2.0'
|
25
|
+
THIN_VERSION = '1.6.3'
|
26
|
+
EM_VERSION = '1.0.4'
|
27
|
+
|
28
|
+
# Every project deserves its own ASCII art
|
29
|
+
ART = <<-'EOART' % VERSION
|
30
|
+
___ ___ ___ ___
|
31
|
+
/ /\ /__/\ / /\ / /\ ___
|
32
|
+
/ /:/_ | |::\ / /::\ / /::\ / /\
|
33
|
+
/ /:/ /\ | |:|:\ / /:/\:\ / /:/\:\ / /:/
|
34
|
+
/ /:/ /::\ __|__|:|\:\ / /:/ \:\ / /:/~/:/ / /:/
|
35
|
+
/__/:/ /:/\:\ /__/::::| \:\ /__/:/ \__\:\ /__/:/ /:/___ / /::\
|
36
|
+
\ \:\/:/~/:/ \ \:\~~\__\/ \ \:\ / /:/ \ \:\/:::::/ /__/:/\:\
|
37
|
+
\ \::/ /:/ \ \:\ \ \:\ /:/ \ \::/~~~~ \__\/ \:\
|
38
|
+
\__\/ /:/ \ \:\ \ \:\/:/ \ \:\ \ \:\
|
39
|
+
/__/:/ \ \:\ \ \::/ \ \:\ \__\/
|
40
|
+
\__\/ \__\/ \__\/ \__\/
|
41
|
+
v%s
|
42
|
+
EOART
|
43
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'slog'
|
2
|
+
require 'thor'
|
3
|
+
|
4
|
+
|
5
|
+
# Thor's hammer! Like Thor with better logging
|
6
|
+
class Mjolnir < Thor
|
7
|
+
|
8
|
+
# Common options for Thor commands
|
9
|
+
COMMON_OPTIONS = {
|
10
|
+
log: {
|
11
|
+
type: :string,
|
12
|
+
aliases: %w[ -L ],
|
13
|
+
desc: 'Log to file instead of STDOUT',
|
14
|
+
default: ENV['SMORT_LOG'] || nil
|
15
|
+
},
|
16
|
+
debug: {
|
17
|
+
type: :boolean,
|
18
|
+
aliases: %w[ -V ],
|
19
|
+
desc: 'Enable DEBUG-level logging',
|
20
|
+
default: ENV['SMORT_DEBUG'] || false
|
21
|
+
},
|
22
|
+
trace: {
|
23
|
+
type: :boolean,
|
24
|
+
aliases: %w[ -VV ],
|
25
|
+
desc: 'Enable TRACE-level logging',
|
26
|
+
default: ENV['SMORT_TRACE'] || false
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
# Decorate Thor commands with the options above
|
31
|
+
def self.include_common_options
|
32
|
+
COMMON_OPTIONS.each do |name, spec|
|
33
|
+
option name, spec
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
no_commands do
|
39
|
+
|
40
|
+
# Construct a Logger given the command-line options
|
41
|
+
def log
|
42
|
+
return @logger if defined? @logger
|
43
|
+
level = :info
|
44
|
+
level = :debug if options.debug?
|
45
|
+
level = :trace if options.trace?
|
46
|
+
device = options.log || $stderr
|
47
|
+
pretty = device.tty? rescue false
|
48
|
+
@logger = Slog.new \
|
49
|
+
out: device,
|
50
|
+
level: level,
|
51
|
+
colorize: pretty,
|
52
|
+
prettify: pretty
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/lib/smort/web.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'thread'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
require 'sinatra/base'
|
6
|
+
|
7
|
+
require_relative 'metadata'
|
8
|
+
|
9
|
+
Thread.abort_on_exception = true
|
10
|
+
|
11
|
+
|
12
|
+
module Smort
|
13
|
+
class Web < Sinatra::Application
|
14
|
+
set :root, File.join(Smort::ROOT, 'web')
|
15
|
+
|
16
|
+
get '/v' do
|
17
|
+
content_type :text
|
18
|
+
ART
|
19
|
+
end
|
20
|
+
|
21
|
+
get '/' do
|
22
|
+
erb :app
|
23
|
+
end
|
24
|
+
|
25
|
+
get '/favicon.ico' do
|
26
|
+
send_file File.join(settings.root, 'favicon.ico'), \
|
27
|
+
disposition: 'inline'
|
28
|
+
end
|
29
|
+
|
30
|
+
get %r|/app/(.*)| do |fn|
|
31
|
+
send_file File.join(settings.root, 'app', fn), \
|
32
|
+
disposition: 'inline'
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
data/web/app/smort.js
ADDED
Binary file
|
data/web/views/app.erb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<title>Smort</title>
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
8
|
+
<meta name="description" content="Weave." />
|
9
|
+
<meta name="author" content="Sean Clemmer" />
|
10
|
+
<link rel="icon" href="/favicon.ico" />
|
11
|
+
<link href="//maxcdn.bootstrapcdn.com/bootswatch/3.3.4/superhero/bootstrap.min.css" rel="stylesheet" />
|
12
|
+
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" />
|
13
|
+
<link href="/app/style/smort.css" rel="stylesheet" />
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<%= yield %>
|
17
|
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
18
|
+
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
19
|
+
<script src="/app/smort.js"></script>
|
20
|
+
</body>
|
21
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smort
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sean Clemmer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
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: slog
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sinatra
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: eventmachine
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.4
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thin
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.6.3
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.6.3
|
83
|
+
description: An erudite JSON schema and document manager.
|
84
|
+
email: sclemmer@bluejeans.com
|
85
|
+
executables:
|
86
|
+
- smort
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- LICENSE
|
91
|
+
- Readme.md
|
92
|
+
- VERSION
|
93
|
+
- bin/smort
|
94
|
+
- lib/smort.rb
|
95
|
+
- lib/smort/main.rb
|
96
|
+
- lib/smort/metadata.rb
|
97
|
+
- lib/smort/mjolnir.rb
|
98
|
+
- lib/smort/web.rb
|
99
|
+
- web/app/smort.js
|
100
|
+
- web/app/style/smort.css
|
101
|
+
- web/public/favicon.ico
|
102
|
+
- web/views/app.erb
|
103
|
+
- web/views/layout.erb
|
104
|
+
homepage: https://github.com/sczizzo/smort
|
105
|
+
licenses:
|
106
|
+
- ISC
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.4.5
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: An erudite JSON schema and document manager
|
128
|
+
test_files: []
|