awestruct 0.5.6 → 0.5.7.RC1
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/Gemfile +6 -1
- data/awestruct.gemspec +6 -6
- data/lib/awestruct/cli/auto.rb +0 -2
- data/lib/awestruct/cli/generate.rb +0 -1
- data/lib/awestruct/cli/init.rb +8 -8
- data/lib/awestruct/cli/manifest.rb +15 -5
- data/lib/awestruct/cli/options.rb +3 -11
- data/lib/awestruct/cli/server.rb +6 -4
- data/lib/awestruct/config/default-site.yml +1 -1
- data/lib/awestruct/context.rb +2 -0
- data/lib/awestruct/engine.rb +8 -3
- data/lib/awestruct/frameworks/base_Gemfile +3 -1
- data/lib/awestruct/handler_chains.rb +11 -0
- data/lib/awestruct/handlers/css_tilt_handler.rb +6 -5
- data/lib/awestruct/handlers/template/sassc.rb +21 -0
- data/lib/awestruct/rack/app.rb +11 -11
- data/lib/awestruct/rack/debug.rb +126 -0
- data/lib/awestruct/rack/generate.rb +4 -4
- data/lib/awestruct/rack/trace.html +881 -0
- data/lib/awestruct/version.rb +1 -1
- data/spec/awestruct/cli/init_spec.rb +1 -9
- data/spec/awestruct/cli/options_spec.rb +1 -1
- data/spec/awestruct/engine_spec.rb +4 -0
- data/spec/awestruct/handlers/sass_handler_spec.rb +1 -2
- data/spec/awestruct/handlers/scss_handler_spec.rb +1 -2
- data/spec/awestruct/handlers/slim_handler_spec.rb +1 -1
- data/spec/awestruct/rack/debug_spec.rb +106 -0
- metadata +20 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf4534d71bfab7a206ad91b375f4d5d7e235d132
|
4
|
+
data.tar.gz: 5e55791deda0c470d448ee22e5b57f73b2b3c63b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f9248debddd71714d08efe34bc27cee2bf07b4636913aa9758c3cabf829ab519b61f00131aed3c87f4ad0eae23c486ac021a3f5bd7bb3d3ac1f85da9a31981c
|
7
|
+
data.tar.gz: 42390bfcabae84162931e6d687024f5f70e728bbe89e7f30c4a586039813e6d1c8e5fc1a94389395f91bd5bf7cc53faae7fa21991db8681863341e2ad2f5d3e6
|
data/Gemfile
CHANGED
@@ -13,7 +13,9 @@ group :test do
|
|
13
13
|
gem 'tilt', '~> 2.0.1'
|
14
14
|
gem 'coffee-script', '~> 2.2.0'
|
15
15
|
gem 'asciidoctor', '1.5.2'
|
16
|
-
gem '
|
16
|
+
gem 'compass', '>= 1.0.1'
|
17
|
+
gem 'sassc', '~> 1.6'
|
18
|
+
gem 'slim', '~> 3.0'
|
17
19
|
gem 'kramdown', '~> 1.3.3'
|
18
20
|
gem 'therubyracer', '~> 0.12.1', :platforms => :ruby
|
19
21
|
gem 'therubyrhino', '~> 2.0.3', :platforms => :jruby
|
@@ -24,6 +26,9 @@ group :test do
|
|
24
26
|
gem 'uglifier', '~> 2.5.0'
|
25
27
|
gem 'htmlcompressor', '~> 0.0.7'
|
26
28
|
gem 'haml-contrib', '~> 1.0.0'
|
29
|
+
gem 'sass'
|
30
|
+
gem 'bootstrap-sass'
|
31
|
+
gem 'zurb-foundation'
|
27
32
|
gem "win32-open3-19", :platforms => :mingw # htmlcompressor depends on old yui compressor, that needs this on win32
|
28
33
|
end
|
29
34
|
|
data/awestruct.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'awestruct/version'
|
|
4
4
|
spec = Gem::Specification.new do |s|
|
5
5
|
s.name = 'awestruct'
|
6
6
|
s.version = Awestruct::VERSION
|
7
|
-
s.date = '2015-
|
7
|
+
s.date = '2015-10-13'
|
8
8
|
|
9
9
|
s.authors = ['Bob McWhirter', 'Jason Porter', 'Lance Ball', 'Dan Allen', 'Torsten Curdt', 'other contributors']
|
10
10
|
s.email = ['bob@mcwhirter.org', 'lightguard.jp@gmail.com', 'lball@redhat.com', 'dan.j.allen@gmail.com', 'tcurdt@vafer.org']
|
@@ -17,6 +17,7 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.license = 'MIT'
|
18
18
|
|
19
19
|
s.platform = Gem::Platform::RUBY
|
20
|
+
s.required_ruby_version = '>= 2.0'
|
20
21
|
|
21
22
|
s.has_rdoc = true
|
22
23
|
s.rdoc_options = ['--charset=UTF-8']
|
@@ -29,7 +30,8 @@ spec = Gem::Specification.new do |s|
|
|
29
30
|
|
30
31
|
s.requirements = <<-EOS
|
31
32
|
Any markup languages you are using and its dependencies.
|
32
|
-
Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if you're running on MRI. JRuby should be using haml 4.0.0+ with Kramdown.
|
33
|
+
Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if you're running on MRI. JRuby should be using haml 4.0.0+ with Kramdown.
|
34
|
+
Compass and sass are no longer hard dependencies. You'll need too add them on your own should you want them. We also should be able to work with sassc.
|
33
35
|
EOS
|
34
36
|
|
35
37
|
s.add_dependency 'haml', '~> 4.0', '>= 4.0.5'
|
@@ -37,14 +39,12 @@ Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if
|
|
37
39
|
s.add_dependency 'tilt', '~> 2.0', '>= 2.0.1'
|
38
40
|
s.add_dependency 'mime-types', '~> 2.1'
|
39
41
|
s.add_dependency 'rest-client', '~> 1.7', '>= 1.7.2'
|
40
|
-
s.add_dependency 'listen', '
|
42
|
+
s.add_dependency 'listen', '>= 2.7.1', '<= 4.0'
|
41
43
|
s.add_dependency 'rack', '~> 1.5', '>= 1.5.2'
|
42
44
|
s.add_dependency 'git', '~> 1.2', '>= 1.2.6'
|
43
45
|
s.add_dependency 'guard-livereload', '~> 2.1', '>= 2.1.2'
|
44
46
|
s.add_dependency 'colorize', '~> 0.7', '>= 0.7.1'
|
45
|
-
s.add_dependency 'oga', '~>
|
46
|
-
s.add_dependency 'sass', '~> 3.2'
|
47
|
-
s.add_dependency 'compass', '~> 1', '>= 1.0.1'
|
47
|
+
s.add_dependency 'oga', '~> 1.3'
|
48
48
|
s.add_dependency 'parallel', '~> 1.1', '> 1.1.1'
|
49
49
|
|
50
50
|
s.add_development_dependency 'nokogiri', '~> 1.5.0','>= 1.5.10'
|
data/lib/awestruct/cli/auto.rb
CHANGED
data/lib/awestruct/cli/init.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'awestruct/cli/manifest'
|
2
2
|
require 'awestruct/cli/options'
|
3
|
-
require 'sass'
|
4
|
-
require 'sass/plugin'
|
5
3
|
|
6
4
|
module Awestruct
|
7
5
|
module CLI
|
@@ -34,17 +32,13 @@ module Awestruct
|
|
34
32
|
|
35
33
|
lib = nil
|
36
34
|
case @framework
|
37
|
-
when 'compass'
|
38
|
-
scaffold_name = 'blueprint'
|
39
35
|
when 'bootstrap'
|
40
36
|
lib = 'bootstrap-sass'
|
41
37
|
when 'foundation'
|
42
38
|
lib = 'zurb-foundation'
|
43
|
-
when '960'
|
44
|
-
lib = 'ninesixty'
|
45
39
|
end
|
46
40
|
require lib unless lib.nil?
|
47
|
-
manifest.install_compass(@framework)
|
41
|
+
manifest.install_compass(@framework) unless lib.nil?
|
48
42
|
if (@scaffold)
|
49
43
|
manifest.copy_file('_config/site.yml', framework_path('base_site.yml'), :overwrite => true)
|
50
44
|
manifest.copy_file('_layouts/base.html.haml', framework_path('base_layout.html.haml', scaffold_name))
|
@@ -67,7 +61,13 @@ module Awestruct
|
|
67
61
|
manifest.remove_file('MIT-LICENSE.txt')
|
68
62
|
end
|
69
63
|
end
|
70
|
-
|
64
|
+
begin
|
65
|
+
manifest.perform(@dir)
|
66
|
+
rescue => e
|
67
|
+
puts e.backtrace
|
68
|
+
puts e.message
|
69
|
+
puts manifest.steps
|
70
|
+
end
|
71
71
|
end
|
72
72
|
|
73
73
|
def framework_path(path, framework = nil)
|
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'sass/callbacks'
|
2
|
-
require 'compass'
|
3
|
-
require 'compass/commands'
|
4
1
|
require 'erb'
|
5
2
|
require 'rubygems/specification'
|
6
3
|
require 'ostruct'
|
@@ -26,7 +23,8 @@ module Awestruct
|
|
26
23
|
end
|
27
24
|
|
28
25
|
def template_file(path, input_path, state = {})
|
29
|
-
|
26
|
+
new_state = state.merge(load_gem(true))
|
27
|
+
steps << TemplateFile.new(path, input_path, new_state)
|
30
28
|
end
|
31
29
|
|
32
30
|
def copy_file(path, input_path, opts = {})
|
@@ -77,11 +75,15 @@ module Awestruct
|
|
77
75
|
|
78
76
|
private
|
79
77
|
|
80
|
-
def load_gem
|
78
|
+
def load_gem(add_compass = false)
|
81
79
|
spec = {:dependencies => {}}
|
82
80
|
gem_spec = Gem::Specification::load(
|
83
81
|
File.join(File.dirname(__FILE__), "../../../", "awestruct.gemspec"))
|
84
82
|
|
83
|
+
if add_compass
|
84
|
+
gem_spec.add_dependency('compass', '>= 1.0.1')
|
85
|
+
end
|
86
|
+
|
85
87
|
gem_spec.dependencies.each { |d| spec[:dependencies][d.name] = d}
|
86
88
|
spec[:awestruct_version] = gem_spec.version
|
87
89
|
spec
|
@@ -230,8 +232,12 @@ module Awestruct
|
|
230
232
|
|
231
233
|
def perform(dir)
|
232
234
|
|
235
|
+
begin
|
233
236
|
rendered = ERB.new(File.read(@input_path), nil, '<>').result(
|
234
237
|
OpenStruct.new(@state).instance_eval { binding })
|
238
|
+
rescue => e
|
239
|
+
puts "::DEBUG:: #{e.message} state - #{@state}"
|
240
|
+
end
|
235
241
|
|
236
242
|
p = File.join(dir, @path)
|
237
243
|
$LOG.info "Create file: #{p}" if $LOG.info?
|
@@ -249,6 +255,10 @@ module Awestruct
|
|
249
255
|
end
|
250
256
|
|
251
257
|
def perform(dir)
|
258
|
+
require 'sass/callbacks'
|
259
|
+
require 'compass'
|
260
|
+
require 'compass/commands'
|
261
|
+
|
252
262
|
::Compass.configuration.sass_dir = 'stylesheets'
|
253
263
|
::Compass.configuration.css_dir = '_site/stylesheets'
|
254
264
|
::Compass.configuration.images_dir = 'images'
|
@@ -6,16 +6,9 @@ module Awestruct
|
|
6
6
|
module CLI
|
7
7
|
|
8
8
|
class Options
|
9
|
-
|
10
|
-
'localhost' => 'localhost',
|
11
|
-
'0.0.0.0' => 'localhost',
|
12
|
-
'127.0.0.1' => 'localhost',
|
13
|
-
'::1' => '[::1]',
|
14
|
-
'localhost6' => 'localhost6'
|
15
|
-
}
|
16
|
-
DEFAULT_BIND_ADDR = '0.0.0.0'
|
9
|
+
DEFAULT_BIND_ADDR = 'localhost'
|
17
10
|
DEFAULT_PORT = 4242
|
18
|
-
DEFAULT_BASE_URL = %(http://#{
|
11
|
+
DEFAULT_BASE_URL = %(http://#{DEFAULT_BIND_ADDR}:#{DEFAULT_PORT})
|
19
12
|
DEFAULT_GENERATE_ON_ACCESS = false
|
20
13
|
|
21
14
|
attr_accessor :generate
|
@@ -80,7 +73,7 @@ module Awestruct
|
|
80
73
|
self.init = init
|
81
74
|
self.generate = false
|
82
75
|
end
|
83
|
-
opts.on( '-f', '--framework FRAMEWORK', 'Specify a compass framework during initialization (bootstrap, foundation
|
76
|
+
opts.on( '-f', '--framework FRAMEWORK', 'Specify a compass framework during initialization (bootstrap, foundation)' ) do |framework|
|
84
77
|
self.framework = framework
|
85
78
|
end
|
86
79
|
opts.on( '--[no-]scaffold', 'Create scaffolding during initialization (default: true)' ) do |s|
|
@@ -163,7 +156,6 @@ module Awestruct
|
|
163
156
|
|
164
157
|
opts.parse!(args)
|
165
158
|
self.port ||= DEFAULT_PORT
|
166
|
-
self.bind_addr = LOCAL_HOSTS[DEFAULT_BIND_ADDR] if self.bind_addr === DEFAULT_BIND_ADDR
|
167
159
|
self.base_url = %(http://#{self.bind_addr}:#{self.port}) if self.base_url === DEFAULT_BASE_URL
|
168
160
|
|
169
161
|
self.generate = true if self.generate.nil?
|
data/lib/awestruct/cli/server.rb
CHANGED
@@ -2,6 +2,7 @@ require 'rack'
|
|
2
2
|
require 'rack/builder'
|
3
3
|
require 'rack/server'
|
4
4
|
require 'awestruct/rack/app'
|
5
|
+
require 'awestruct/rack/debug'
|
5
6
|
require 'awestruct/rack/generate'
|
6
7
|
require 'awestruct/cli/options'
|
7
8
|
|
@@ -18,11 +19,11 @@ module Awestruct
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def run
|
21
|
-
unless port_open?
|
22
|
-
$LOG.error "#{
|
22
|
+
unless port_open? @bind_addr, @port
|
23
|
+
$LOG.error "#{@bind_addr}:#{@port} not available for server" if $LOG.error?
|
23
24
|
abort
|
24
25
|
end
|
25
|
-
url = %(http://#{
|
26
|
+
url = %(http://#{@bind_addr}:#{@port})
|
26
27
|
msg = %(Starting preview server at #{url} (Press Ctrl-C to shutdown))
|
27
28
|
$LOG.info %(#{'*' * msg.length}\n#{msg}\n#{'*' * msg.length}\n) if $LOG.info?
|
28
29
|
|
@@ -30,12 +31,13 @@ module Awestruct
|
|
30
31
|
generate_on_access = @generate_on_access
|
31
32
|
app = ::Rack::Builder.new do
|
32
33
|
use Awestruct::Rack::GenerateOnAccess if generate_on_access
|
34
|
+
use Awestruct::Rack::Debug
|
33
35
|
map "/" do
|
34
36
|
run Awestruct::Rack::App.new( path )
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
38
|
-
::Rack::Server::start(
|
40
|
+
::Rack::Server::start(:app => app,
|
39
41
|
:Port => @port,
|
40
42
|
:Host => @bind_addr
|
41
43
|
)
|
data/lib/awestruct/context.rb
CHANGED
data/lib/awestruct/engine.rb
CHANGED
@@ -15,7 +15,6 @@ require 'set'
|
|
15
15
|
require 'date'
|
16
16
|
require 'erb'
|
17
17
|
|
18
|
-
require 'compass'
|
19
18
|
require 'parallel'
|
20
19
|
|
21
20
|
class OpenStruct
|
@@ -71,8 +70,14 @@ module Awestruct
|
|
71
70
|
$LOG.debug 'execute_pipeline' if $LOG.debug?
|
72
71
|
$LOG.info 'Excecuting pipeline...' if $LOG.info?
|
73
72
|
execute_pipeline(false)
|
74
|
-
|
75
|
-
|
73
|
+
begin
|
74
|
+
if require('compass') || defined?(::Compass)
|
75
|
+
$LOG.debug 'configure_compass' if $LOG.debug?
|
76
|
+
configure_compass
|
77
|
+
end
|
78
|
+
rescue LoadError
|
79
|
+
# doesn't matter if we can't load it
|
80
|
+
end
|
76
81
|
$LOG.debug 'set_urls' if $LOG.debug?
|
77
82
|
set_urls( site.pages )
|
78
83
|
$LOG.debug 'build_page_index' if $LOG.debug?
|
@@ -27,15 +27,17 @@ source 'https://rubygems.org' # This tells Bundler w
|
|
27
27
|
gem 'awestruct', '>= <%= awestruct_version %>' # Goes without saying
|
28
28
|
gem 'webrick', '~> 1.3.1' # The rack webserver to use in dev mode
|
29
29
|
|
30
|
-
gem 'compass', '<%= dependencies['compass'].requirement %>'
|
31
30
|
<% if framework.eql? 'bootstrap' %>
|
32
31
|
gem 'bootstrap-sass', '<%= dependencies['bootstrap-sass'].requirement %>'
|
32
|
+
gem 'compass', '<%= dependencies['compass'].requirement %>'
|
33
33
|
<% end %>
|
34
34
|
<% if framework.eql? 'foundation' %>
|
35
35
|
gem 'zurb-foundation', '<%= dependencies['zurb-foundation'].requirement %>'
|
36
|
+
gem 'compass', '<%= dependencies['compass'].requirement %>'
|
36
37
|
<% end %>
|
37
38
|
<% if framework.eql? '960' %>
|
38
39
|
gem 'compass-960-plugin', '<%= dependencies['compass-960-plugin'].requirement %>'
|
40
|
+
gem 'compass', '<%= dependencies['compass'].requirement %>'
|
39
41
|
<% end %>
|
40
42
|
|
41
43
|
# FIXME
|
@@ -23,6 +23,17 @@ module Awestruct
|
|
23
23
|
def initialize(include_defaults=true)
|
24
24
|
@chains = []
|
25
25
|
self << :defaults if include_defaults
|
26
|
+
|
27
|
+
# Register our sassc templates
|
28
|
+
begin
|
29
|
+
if require('sassc') || defined?(::Sassc)
|
30
|
+
require 'awestruct/handlers/template/sassc'
|
31
|
+
::Tilt.register ::Awestruct::Tilt::SassSasscTemplate,'sass'
|
32
|
+
::Tilt.register ::Awestruct::Tilt::ScssSasscTemplate,'scss'
|
33
|
+
end
|
34
|
+
rescue LoadError
|
35
|
+
# doesn't matter if we can't load it
|
36
|
+
end
|
26
37
|
end
|
27
38
|
|
28
39
|
def[](path)
|
@@ -3,8 +3,6 @@ require 'awestruct/handlers/file_handler'
|
|
3
3
|
require 'awestruct/handlers/front_matter_handler'
|
4
4
|
require 'awestruct/handlers/layout_handler'
|
5
5
|
|
6
|
-
require 'compass'
|
7
|
-
|
8
6
|
module Awestruct
|
9
7
|
module Handlers
|
10
8
|
class CssTiltHandler < BaseTiltHandler
|
@@ -26,10 +24,13 @@ module Awestruct
|
|
26
24
|
|
27
25
|
# Sass / Scss
|
28
26
|
opts[:load_paths] ||= []
|
29
|
-
|
30
|
-
|
27
|
+
|
28
|
+
if require('compass') || defined?(::Compass)
|
29
|
+
::Compass::Frameworks::ALL.each do |framework|
|
30
|
+
opts[:load_paths] << framework.stylesheets_directory
|
31
|
+
end
|
32
|
+
opts[:load_paths] << ::Compass::SpriteImporter.new
|
31
33
|
end
|
32
|
-
opts[:load_paths] << ::Compass::SpriteImporter.new
|
33
34
|
opts[:load_paths] << File.join(site.config.dir.to_s, File.dirname(relative_source_path) ) unless relative_source_path.nil?
|
34
35
|
|
35
36
|
# Less use Paths instead of load_paths
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
require 'sassc'
|
3
|
+
|
4
|
+
module Awestruct
|
5
|
+
module Tilt
|
6
|
+
class SassSasscTemplate < ::Tilt::SassTemplate
|
7
|
+
self.default_mime_type = 'text/css'
|
8
|
+
|
9
|
+
def prepare
|
10
|
+
@engine = ::SassC::Engine.new(data, sass_options)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
class ScssSasscTemplate < ::Tilt::ScssTemplate
|
14
|
+
self.default_mime_type = 'text/css'
|
15
|
+
|
16
|
+
def prepare
|
17
|
+
@engine = ::SassC::Engine.new(data, sass_options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/awestruct/rack/app.rb
CHANGED
@@ -11,12 +11,12 @@ module Awestruct
|
|
11
11
|
path = env['PATH_INFO']
|
12
12
|
fs_path = File.join( @doc_root, path )
|
13
13
|
|
14
|
-
if
|
15
|
-
if
|
14
|
+
if File.directory?(fs_path)
|
15
|
+
if !(path =~ %r(/$))
|
16
16
|
return [ 301,
|
17
|
-
{ 'location'=>File.join(path, '') },
|
17
|
+
{ 'location'.freeze => File.join(path, '') },
|
18
18
|
["Redirecting to: #{path}"] ]
|
19
|
-
elsif
|
19
|
+
elsif File.file?(File.join(fs_path, 'index.html'))
|
20
20
|
fs_path = File.join( fs_path, 'index.html' )
|
21
21
|
end
|
22
22
|
end
|
@@ -27,18 +27,18 @@ module Awestruct
|
|
27
27
|
# The Body must respond to each and must only yield String
|
28
28
|
# values. The Body itself should not be an instance of String,
|
29
29
|
# as this will break in Ruby 1.9.
|
30
|
-
if
|
30
|
+
if File.file?(fs_path)
|
31
31
|
body = read_content( fs_path )
|
32
32
|
content_type = ::Rack::Mime.mime_type( File.extname(fs_path) )
|
33
33
|
length = body.size.to_s
|
34
34
|
[ 200,
|
35
|
-
{
|
35
|
+
{'Content-Type'.freeze => content_type, 'Content-Length'.freeze => length},
|
36
36
|
[body] ]
|
37
37
|
else
|
38
38
|
body, content_type = read_error_document(path)
|
39
39
|
length = body.size.to_s
|
40
40
|
[ 404,
|
41
|
-
{
|
41
|
+
{'Content-Type'.freeze => content_type || 'text/plain', 'Content-Length'.freeze => length},
|
42
42
|
[body] ]
|
43
43
|
end
|
44
44
|
end
|
@@ -46,14 +46,14 @@ module Awestruct
|
|
46
46
|
def read_error_document( path )
|
47
47
|
doc_path = nil
|
48
48
|
htaccess = File.join( @doc_root, '.htaccess' )
|
49
|
-
if
|
49
|
+
if File.file?(htaccess)
|
50
50
|
File.open( htaccess ).each_line do |line|
|
51
|
-
if
|
51
|
+
if line =~ %r(^.*ErrorDocument[ \t]+404[ \t]+(.+)$)
|
52
52
|
doc_path = $1
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
-
if
|
56
|
+
if doc_path
|
57
57
|
fs_doc_path = File.join( @doc_root, doc_path )
|
58
58
|
return [read_content( fs_doc_path ), ::Rack::Mime.mime_type( File.extname(fs_doc_path) )] if File.file?( fs_doc_path )
|
59
59
|
end
|
@@ -62,7 +62,7 @@ module Awestruct
|
|
62
62
|
|
63
63
|
|
64
64
|
def read_content( path )
|
65
|
-
input_stream = IO.open(IO.sysopen(path,
|
65
|
+
input_stream = IO.open(IO.sysopen(path, 'rb'), 'rb')
|
66
66
|
result = input_stream.read
|
67
67
|
return result
|
68
68
|
ensure
|