httpit 0.4.3 → 0.4.5

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- httpit (0.4.2)
4
+ httpit (0.4.5)
5
5
  RedCloth (~> 4.2.9)
6
6
  haml (~> 4.0.2)
7
7
  sass (~> 3.2.8)
@@ -11,17 +11,17 @@ GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  RedCloth (4.2.9)
14
- haml (4.0.2)
14
+ haml (4.0.3)
15
15
  tilt
16
16
  rack (1.5.2)
17
17
  rack-protection (1.5.0)
18
18
  rack
19
- sass (3.2.8)
20
- sinatra (1.4.2)
21
- rack (~> 1.5, >= 1.5.2)
19
+ sass (3.2.12)
20
+ sinatra (1.4.3)
21
+ rack (~> 1.4)
22
22
  rack-protection (~> 1.4)
23
23
  tilt (~> 1.3, >= 1.3.4)
24
- tilt (1.3.7)
24
+ tilt (1.4.1)
25
25
 
26
26
  PLATFORMS
27
27
  ruby
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Pavel Evstigneev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -20,4 +20,10 @@ httpit 9081
20
20
 
21
21
  To complile `sass` file make request for `style.sass.css`
22
22
 
23
- See `example` folder
23
+ See `example` folder
24
+
25
+ ## Use cases
26
+
27
+ * Develop websites with HAML & SASS but without backend
28
+ * Share files to mobile devices (if we access over Wi-Fi)
29
+ * Try some 3rd-party examples what requires absolute urls (src="/files/...")
data/bin/httpit CHANGED
@@ -51,6 +51,10 @@ class HttpIt < Sinatra::Base
51
51
  content
52
52
  end
53
53
  end
54
+
55
+ def file_url(path, file)
56
+ "#{path}/#{CGI::escape(file)}"
57
+ end
54
58
  end
55
59
 
56
60
  # build array of contents and theris type for specified folder
@@ -117,7 +121,7 @@ class HttpIt < Sinatra::Base
117
121
  # shows folder contents
118
122
  get %r{.+} do
119
123
  return nil if request.path == '/favicon.ico'
120
- @path = URI.unescape(request.path)
124
+ @path = CGI::unescape(request.path)
121
125
 
122
126
  abs_path = ROOT + @path
123
127
  @dirname = abs_path.file? ? File.dirname(@path) : @path.chomp('/')
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "httpit"
3
- s.version = "0.4.3"
3
+ s.version = "0.4.5"
4
4
  s.summary = "Web server for static files"
5
5
  s.description = "Just go to folder and run `httpit` to make it avaliable as web-server"
6
6
  s.author = "Pavel Evstigneev"
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.executables = ["httpit"]
11
11
  s.rubyforge_project = "httpit"
12
12
  s.files = `git ls-files`.split("\n")
13
+ s.licenses = ['MIT', 'GPL-2']
13
14
 
14
15
  s.add_runtime_dependency 'sinatra', "~> 1.4.2"
15
16
  s.add_runtime_dependency 'haml', '~> 4.0.2'
@@ -52,7 +52,7 @@
52
52
  - elsif file[1] == :link
53
53
  %span= "&rarr;"
54
54
 
55
- %a{:href => "#{@path}/#{file[0]}"}= file[0]
55
+ %a{:href => file_url(@path, file[0])}= file[0]
56
56
 
57
57
  - if %w{.jpg .jpeg .png .gif}.include?(File.extname(file[0]).downcase)
58
58
  %a{:href => "/__img_preview?file=#{@path}/#{file[0]}", :class => "preview_link"} #1024
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-18 00:00:00.000000000 Z
12
+ date: 2013-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -85,6 +85,7 @@ files:
85
85
  - .gitignore
86
86
  - Gemfile
87
87
  - Gemfile.lock
88
+ - LICENSE
88
89
  - README.md
89
90
  - bin/httpit
90
91
  - example/images/bird.jpg
@@ -100,7 +101,9 @@ files:
100
101
  - views/utils.js
101
102
  - views/view.haml
102
103
  homepage: http://github.com/Paxa/httpit
103
- licenses: []
104
+ licenses:
105
+ - MIT
106
+ - GPL-2
104
107
  post_install_message:
105
108
  rdoc_options: []
106
109
  require_paths:
@@ -119,9 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
122
  version: '0'
120
123
  requirements: []
121
124
  rubyforge_project: httpit
122
- rubygems_version: 1.8.24
125
+ rubygems_version: 1.8.25
123
126
  signing_key:
124
127
  specification_version: 3
125
128
  summary: Web server for static files
126
129
  test_files: []
127
- has_rdoc: false