otto 1.1.0.pre.alpha4 → 1.2.0
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 +4 -4
- data/.gitignore +2 -0
- data/.rspec +4 -0
- data/.rubocop.yml +11 -9
- data/.rubocop_todo.yml +152 -0
- data/Gemfile +16 -5
- data/Gemfile.lock +49 -3
- data/LICENSE.txt +1 -1
- data/README.md +61 -112
- data/VERSION.yml +3 -2
- data/examples/basic/app.rb +78 -0
- data/examples/basic/config.ru +30 -0
- data/examples/basic/routes +20 -0
- data/examples/dynamic_pages/app.rb +115 -0
- data/examples/dynamic_pages/config.ru +30 -0
- data/{example → examples/dynamic_pages}/routes +5 -3
- data/examples/security_features/app.rb +273 -0
- data/examples/security_features/config.ru +81 -0
- data/examples/security_features/routes +11 -0
- data/lib/otto/design_system.rb +463 -0
- data/lib/otto/helpers/request.rb +126 -15
- data/lib/otto/helpers/response.rb +99 -13
- data/lib/otto/route.rb +105 -13
- data/lib/otto/security/config.rb +316 -0
- data/lib/otto/security/csrf.rb +181 -0
- data/lib/otto/security/validator.rb +296 -0
- data/lib/otto/static.rb +18 -5
- data/lib/otto/version.rb +6 -4
- data/lib/otto.rb +330 -116
- data/otto.gemspec +13 -12
- metadata +41 -18
- data/CHANGES.txt +0 -35
- data/example/app.rb +0 -58
- data/example/config.ru +0 -35
- /data/{example/public → public}/favicon.ico +0 -0
- /data/{example/public → public}/img/otto.jpg +0 -0
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: otto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rexml
|
@@ -50,20 +49,34 @@ dependencies:
|
|
50
49
|
requirements:
|
51
50
|
- - "~>"
|
52
51
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
52
|
+
version: '3.1'
|
54
53
|
- - "<"
|
55
54
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
55
|
+
version: '4.0'
|
57
56
|
type: :runtime
|
58
57
|
prerelease: false
|
59
58
|
version_requirements: !ruby/object:Gem::Requirement
|
60
59
|
requirements:
|
61
60
|
- - "~>"
|
62
61
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
62
|
+
version: '3.1'
|
64
63
|
- - "<"
|
65
64
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
65
|
+
version: '4.0'
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: rack-parser
|
68
|
+
requirement: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0.7'
|
73
|
+
type: :runtime
|
74
|
+
prerelease: false
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.7'
|
67
80
|
description: 'Otto: Auto-define your rack-apps in plaintext.'
|
68
81
|
email: gems@solutious.com
|
69
82
|
executables: []
|
@@ -71,30 +84,41 @@ extensions: []
|
|
71
84
|
extra_rdoc_files: []
|
72
85
|
files:
|
73
86
|
- ".gitignore"
|
87
|
+
- ".rspec"
|
74
88
|
- ".rubocop.yml"
|
75
|
-
-
|
89
|
+
- ".rubocop_todo.yml"
|
76
90
|
- Gemfile
|
77
91
|
- Gemfile.lock
|
78
92
|
- LICENSE.txt
|
79
93
|
- README.md
|
80
94
|
- VERSION.yml
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
84
|
-
-
|
85
|
-
-
|
95
|
+
- examples/basic/app.rb
|
96
|
+
- examples/basic/config.ru
|
97
|
+
- examples/basic/routes
|
98
|
+
- examples/dynamic_pages/app.rb
|
99
|
+
- examples/dynamic_pages/config.ru
|
100
|
+
- examples/dynamic_pages/routes
|
101
|
+
- examples/security_features/app.rb
|
102
|
+
- examples/security_features/config.ru
|
103
|
+
- examples/security_features/routes
|
86
104
|
- lib/otto.rb
|
105
|
+
- lib/otto/design_system.rb
|
87
106
|
- lib/otto/helpers/request.rb
|
88
107
|
- lib/otto/helpers/response.rb
|
89
108
|
- lib/otto/route.rb
|
109
|
+
- lib/otto/security/config.rb
|
110
|
+
- lib/otto/security/csrf.rb
|
111
|
+
- lib/otto/security/validator.rb
|
90
112
|
- lib/otto/static.rb
|
91
113
|
- lib/otto/version.rb
|
92
114
|
- otto.gemspec
|
115
|
+
- public/favicon.ico
|
116
|
+
- public/img/otto.jpg
|
93
117
|
homepage: https://github.com/delano/otto
|
94
118
|
licenses:
|
95
119
|
- MIT
|
96
|
-
metadata:
|
97
|
-
|
120
|
+
metadata:
|
121
|
+
rubygems_mfa_required: 'true'
|
98
122
|
rdoc_options: []
|
99
123
|
require_paths:
|
100
124
|
- lib
|
@@ -102,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
126
|
requirements:
|
103
127
|
- - ">="
|
104
128
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
129
|
+
version: '3.4'
|
106
130
|
- - "<"
|
107
131
|
- !ruby/object:Gem::Version
|
108
132
|
version: '4.0'
|
@@ -112,8 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
136
|
- !ruby/object:Gem::Version
|
113
137
|
version: '0'
|
114
138
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
116
|
-
signing_key:
|
139
|
+
rubygems_version: 3.6.9
|
117
140
|
specification_version: 4
|
118
141
|
summary: Auto-define your rack-apps in plaintext.
|
119
142
|
test_files: []
|
data/CHANGES.txt
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
OTTO, CHANGES
|
2
|
-
|
3
|
-
#### 0.4.1 (2015-04-07) ###############################
|
4
|
-
|
5
|
-
* FIXED: Resolved error when ACCEPT-LANGUAGES header doesn't exist
|
6
|
-
|
7
|
-
#### 0.4.0 (2015-04-06) ###############################
|
8
|
-
|
9
|
-
* ADDED: Locale support via env['rack.locale']
|
10
|
-
|
11
|
-
#### 0.3.2 (2013-01-27) ###############################
|
12
|
-
|
13
|
-
* CHANGE: send_cookie doesn't set domain
|
14
|
-
|
15
|
-
#### 0.3.1 (2012-12-17) ###############################
|
16
|
-
|
17
|
-
* ADDED: Otto.debug (set w/ Otto.debug= or env variable OTTO_DEBUG)
|
18
|
-
* ADDED: RequestHelpers#ajax?
|
19
|
-
* CHANGE: Added internal subnets to RequestHelpers#local?
|
20
|
-
|
21
|
-
|
22
|
-
#### 0.3.0 (2011-12-17) ###############################
|
23
|
-
|
24
|
-
* ADDED: Example app, better docs in readme
|
25
|
-
* CHANGE: No default value for user agent
|
26
|
-
|
27
|
-
#### 0.2.1 (2011-07-07) ###############################
|
28
|
-
|
29
|
-
* ADDED: Otto#add_static_path
|
30
|
-
|
31
|
-
#### 0.2.0 (2011-07-06) ###############################
|
32
|
-
|
33
|
-
Initial public release
|
34
|
-
|
35
|
-
|
data/example/app.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class App
|
4
|
-
|
5
|
-
# An instance of Rack::Request
|
6
|
-
attr_reader :req
|
7
|
-
# An instance of Rack::Response
|
8
|
-
attr_reader :res
|
9
|
-
|
10
|
-
# Otto creates an instance of this class for every request
|
11
|
-
# and passess the Rack::Request and Rack::Response objects.
|
12
|
-
def initialize req, res
|
13
|
-
@req, @res = req, res
|
14
|
-
res.header['Content-Type'] = "text/html; charset=utf-8"
|
15
|
-
end
|
16
|
-
|
17
|
-
def index
|
18
|
-
lines = [
|
19
|
-
'<img src="/img/otto.jpg" /><br/><br/>',
|
20
|
-
'Send feedback:<br/>',
|
21
|
-
'<form method="post"><input name="msg" /><input type="submit" /></form>',
|
22
|
-
'<a href="/product/100">A product example</a>'
|
23
|
-
]
|
24
|
-
res.send_cookie :sess, 1234567, 3600
|
25
|
-
res.body = lines.join($/)
|
26
|
-
end
|
27
|
-
|
28
|
-
def receive_feedback
|
29
|
-
res.body = req.params.inspect
|
30
|
-
end
|
31
|
-
|
32
|
-
def redirect
|
33
|
-
res.redirect '/robots.txt'
|
34
|
-
end
|
35
|
-
|
36
|
-
def robots_text
|
37
|
-
res.header['Content-Type'] = "text/plain"
|
38
|
-
rules = 'User-agent: *', 'Disallow: /private'
|
39
|
-
res.body = rules.join($/)
|
40
|
-
end
|
41
|
-
|
42
|
-
def display_product
|
43
|
-
res.header['Content-Type'] = "application/json; charset=utf-8"
|
44
|
-
prodid = req.params[:prodid]
|
45
|
-
res.body = '{"product":%s,"msg":"Hint: try another value"}' % [prodid]
|
46
|
-
end
|
47
|
-
|
48
|
-
def not_found
|
49
|
-
res.status = 404
|
50
|
-
res.body = "Item not found!"
|
51
|
-
end
|
52
|
-
|
53
|
-
def server_error
|
54
|
-
res.status = 500
|
55
|
-
res.body = "There was a server error!"
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
data/example/config.ru
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# OTTO EXAMPLE APP CONFIG - 2011-12-17
|
2
|
-
#
|
3
|
-
# Usage:
|
4
|
-
#
|
5
|
-
# $ thin -e dev -R config.ru -p 10770 start
|
6
|
-
# $ tail -f /var/log/system.log
|
7
|
-
|
8
|
-
ENV['RACK_ENV'] ||= 'prod'
|
9
|
-
ENV['APP_ROOT'] = ::File.expand_path(::File.join(::File.dirname(__FILE__)))
|
10
|
-
$:.unshift(::File.join(ENV['APP_ROOT']))
|
11
|
-
$:.unshift(::File.join(ENV['APP_ROOT'], '..', 'lib'))
|
12
|
-
|
13
|
-
require 'otto'
|
14
|
-
require 'app'
|
15
|
-
|
16
|
-
PUBLIC_DIR = "#{ENV['APP_ROOT']}/public"
|
17
|
-
APP_DIR = "#{ENV['APP_ROOT']}"
|
18
|
-
|
19
|
-
app = Otto.new("#{APP_DIR}/routes")
|
20
|
-
|
21
|
-
if Otto.env?(:dev) # DEV: Run web apps with extra logging and reloading
|
22
|
-
map('/') {
|
23
|
-
use Rack::CommonLogger
|
24
|
-
use Rack::Reloader, 0
|
25
|
-
app.option[:public] = PUBLIC_DIR
|
26
|
-
app.add_static_path '/favicon.ico'
|
27
|
-
run app
|
28
|
-
}
|
29
|
-
# Specify static paths to serve in dev-mode only
|
30
|
-
map('/etc/') { run Rack::File.new("#{PUBLIC_DIR}/etc") }
|
31
|
-
map('/img/') { run Rack::File.new("#{PUBLIC_DIR}/img") }
|
32
|
-
|
33
|
-
else # PROD: run barebones webapp
|
34
|
-
map('/') { run app }
|
35
|
-
end
|
File without changes
|
File without changes
|