fuse 0.1.1 → 0.1.2

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.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/lib/fuse.rb +1 -1
  3. data/lib/fuse/server.rb +5 -8
  4. metadata +15 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDNiOTM4NDIyZTA2ZjNkYWQ5MmViMGEwNzZhM2JkZmE1OWYxMGI4MA==
4
+ Yzc5OTM5ZjNmY2JjYzZhMjEzYzYwMmM4OTdlZGY2Mzg3OTA0MjkwOQ==
5
5
  data.tar.gz: !binary |-
6
- YWY3MmY3YzEyOTY1ZDNhMDIwZTAzMzExN2FlYTMyZDY0NGJjYmYyNA==
6
+ NTY2ZTkzODk5MTNhOGJmNGQ0MGI5ZjA4NzAxODRmYzEwNjNkYjZhYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZmMwNzExMGExNjVmZWEyYjY3ZmM2OTNiYzgwYTcxZGFjY2YzZDdkZTM5MGRj
10
- ODI4ZTdmMzBhNDM0OWZkNTQ1M2ZkMDFiZTIzZjkyYTQwNTQwOTdjZmIwYmEz
11
- NzlkNGZmMDUwYmM1NDQ3MGY3YmMzNTIyZjExYWQzNWY1Yzc5MDI=
9
+ MGE5YjliMTM1MDJkNzU3OTIxZWVjOTMwMDYwNTQxZDBhNGU4YzUxNjE5ZDJh
10
+ MjMyZGZlM2U3MmQ0NDNiN2RiYmM2YTBjOWZmNjRjZWQzZGVlOTQyODFmODUy
11
+ NjhiMjFkNmEyZTI5MjNmY2M3YzEwNzdkYTc5YTBiODNlZTZkYmM=
12
12
  data.tar.gz: !binary |-
13
- MzJmNDEwOGIzYTBiNGVkMDNjYTk2Y2RlNDIxNWVjNjBhYzZkZjcyNjVkN2M1
14
- ODg2YTM1Njc2YjNlNWI4NzkyMTcxNjMzM2E2Y2EzZWYyMmU1NGYxOTQyYjc5
15
- YjU4NDE3YjY1NjVkNGI4NTdkMDVkOGYxY2IyMTA0OTk2ZGFkMDQ=
13
+ NDEwMmU5ODE4ZGFlYjIxODU4YjU0MmIwMzA1NmRmMjE4YWM5MDk0YTIxNWI4
14
+ YzNiMmYxNjYyOTBhYTJhYmZiNWMzMDAzNmZhNjc0OTIyMTFkZjJkMDYzZThm
15
+ ODZjNTgxMGQ3NDBmMTFhZTFjOWFmNGU5YTA2YjE1YTc1YjIxODU=
@@ -3,7 +3,7 @@ require 'thin'
3
3
 
4
4
  module Fuse
5
5
 
6
- VERSION = '0.1.1'
6
+ VERSION = '0.1.2'
7
7
 
8
8
  def self.root
9
9
  @root ||= File.expand_path File.dirname(__FILE__)
@@ -8,18 +8,19 @@ class Fuse::Server
8
8
 
9
9
  def call(env)
10
10
 
11
- @env = env
11
+ request = Rack::Request.new(env)
12
12
 
13
13
  call_options = @options.merge Hash[request.GET.map{ |k, v| [k.to_sym, v] }]
14
14
 
15
- if (asset = Fuse::Document::Asset.for(request.path, File.directory?(@options[:source]) ? @options[:source] : File.dirname(@options[:source])))
15
+ if @root && (asset = Fuse::Document::Asset.for(request.path))
16
16
  return asset.call(env)
17
17
  end
18
18
 
19
19
  begin
20
20
  doc = Fuse::Document.new(call_options)
21
+ @root = doc.root
21
22
  rescue Fuse::Exception::SourceUnknown::TooManySources
22
- doc = render_list($!.options, $!.option_name)
23
+ doc = render_list($!.options, $!.option_name, request)
23
24
  rescue Fuse::Exception
24
25
  if $!.message
25
26
  doc = render_error($!.message)
@@ -34,17 +35,13 @@ class Fuse::Server
34
35
 
35
36
  private
36
37
 
37
- def request
38
- Rack::Request.new(@env)
39
- end
40
-
41
38
  def render_error(text)
42
39
  render_body do |h|
43
40
  h.p { h.text text }
44
41
  end
45
42
  end
46
43
 
47
- def render_list(assets, key)
44
+ def render_list(assets, key, request)
48
45
  render_body do |h|
49
46
  h.h3 { h.text "Choose #{key}:" }
50
47
  h.ul {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil E. Pearson
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.12.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: capybara
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 2.0.2
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 2.0.2
97
111
  description: ! 'Portable document authoring. Fuse HTML, JavaScript, CSS, images and
98
112
  fonts into standalone HTML files.
99
113