dandelion_s1 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4031ed23f316378896973babb48674efcd36cc01
4
+ data.tar.gz: d12cf0462b0575d5b8762a793a41413088ade3eb
5
+ SHA512:
6
+ metadata.gz: 3694e43d28323cb649d61e9f540ee7e296a7d9dc17080fbb0838442f38fee78139c7af8ef0c03c0c67338909447e5bb1ff1f9052e726559107789b071ca81576
7
+ data.tar.gz: 5f3690d88973de69dab025287c5396ceac7832121424b04fa050acf0fb189d97cc73aa0f9101951ac01d134b9244b6cb82038714b8c2d7820c7bdb702031e447
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,5 @@
1
+ b
2
+ j����P�~S'O��W�j�� >�{}��Tϸq�fY8��o�t�
3
+ ����;),AbH�jA̬���%|�'ؾ�")#Sw�$P���? _]v�+��&�>>. 0���s�ٙ�ۉf��2J�| �:�� ��eU�:�^w#`v�"7t���e6�^\'��~��K��ff
4
+ u�vD��\l�T���|G��H
5
+ ��&~�8!9c-�~Fq�+/��`4�0�g�'����`�Տ
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: dandelion_s1.rb
4
+
5
+ require 'rack-rscript'
6
+
7
+
8
+ class DandelionS1 < RackRscript
9
+
10
+ def initialize(h={})
11
+
12
+ raw_opts = {root: 'www', access: {}, static: []}.merge h
13
+ #@static = %w(index.html dynarex snippets)
14
+ @static = raw_opts[:static]
15
+ @root = raw_opts[:root]
16
+
17
+ #@access_list = {'/do/r/hello3' => 'user'}
18
+ @access_list = raw_opts[:access]
19
+ super(raw_opts)
20
+ end
21
+
22
+ def call(e)
23
+
24
+ private_user = @access_list[e['REQUEST_PATH']]
25
+
26
+ if private_user.nil? or private_user == e['REMOTE_USER'] then
27
+ super(e)
28
+ else
29
+ request = '/unauthorised/'
30
+ content, content_type, status_code = run_route(request)
31
+ content_type ||= 'text/html'
32
+ [status_code=401, {"Content-Type" => content_type}, [content]]
33
+ end
34
+
35
+ end
36
+
37
+ def default_routes(env, params)
38
+
39
+ super(env, params)
40
+
41
+ get /(\/(?:#{@static.join('|')}).*)/ do |path|
42
+
43
+ filepath = File.join(@root, path)
44
+
45
+ if path.length < 1 or path[-1] == '/' then
46
+ path += 'index.html'
47
+ File.read File.join(base, path)
48
+ elsif File.directory? filepath then
49
+ Redirect.new (path + '/')
50
+ elsif File.exists? filepath then
51
+ h = {xml: 'application/xml', html: 'text/html', png: 'image/png',
52
+ jpg: 'image/jpeg', txt: 'text/plain'}
53
+
54
+ [File.read(filepath), h[filepath[/\w+$/].to_sym]]
55
+ else
56
+ 'oops, file ' + filepath + ' not found'
57
+ end
58
+
59
+ end
60
+
61
+ get /^\/$/ do
62
+
63
+ file = File.join(@root, 'index.html')
64
+ File.read file
65
+ end
66
+
67
+ get '/unauthorised/' do
68
+ 'unauthorised user'
69
+ end
70
+
71
+ end
72
+
73
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dandelion_s1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE0MDIxMDEwMDQyMVoXDTE1MDIxMDEwMDQyMVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJ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-02-10 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: rack-rscript
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ description:
51
+ email: james@r0bertson.co.uk
52
+ executables: []
53
+ extensions: []
54
+ extra_rdoc_files: []
55
+ files:
56
+ - lib/dandelion_s1.rb
57
+ homepage: https://github.com/jrobertson/dandelion_s1
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.0.14
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: A kind of Rack-Rscript web server which facilitates static files, basic authentication,
81
+ and private pages.
82
+ test_files: []
metadata.gz.sig ADDED
Binary file