sinatra-export 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/lib/sinatra/export.rb +10 -3
- data/sinatra-export.gemspec +1 -1
- metadata +1 -1
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/lib/sinatra/export.rb
CHANGED
@@ -36,11 +36,18 @@ module Sinatra
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def build_path(path, dir)
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
response = get_path(path)
|
40
|
+
body = response.body
|
41
|
+
mtime = response.headers.key?("Last-Modified") ?
|
42
|
+
Time.httpdate(response.headers["Last-Modified"]) : Time.now
|
43
|
+
file_path = file_for_path(path, dir)
|
44
|
+
dir_path = dir_for_path(path, dir)
|
45
|
+
|
46
|
+
::FileUtils.mkdir_p(dir_path)
|
47
|
+
::File.open(file_path, 'w+') do |f|
|
42
48
|
f.write(body)
|
43
49
|
end
|
50
|
+
::FileUtils.touch(file_path, :mtime => mtime)
|
44
51
|
end
|
45
52
|
|
46
53
|
def get_path(path)
|
data/sinatra-export.gemspec
CHANGED