httpit 0.4.9 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e19ebaa7ce0e21e0b32202483af61281e3f4d1e1
4
- data.tar.gz: 3910a728291a9c12fa4e50593597a86ca099c2b1
2
+ SHA256:
3
+ metadata.gz: 7a8232c3298cb4d225a367020e450aea8ebe1f56793b9970289fc47188e7b073
4
+ data.tar.gz: 0437b12ca4d642f709713816cf8147333bfd658f6d0a6c258153d19dee12cd07
5
5
  SHA512:
6
- metadata.gz: b5be5fd8a6994d9a3eeae756b48640d1cdbea106621c49acbb06a9bd1457b32fcce502d49ee856f37899741d0b468eb0aa3356ce316455224e5e014c35deb858
7
- data.tar.gz: 1a0394c8a94ddd895de86f13fc0b261d9494c4c09469ba94e22a05605112fe23464c6d9638f0b5a83e70853cf0c766fb05eacce2b9f1acfd7e9f10a439aa2a30
6
+ metadata.gz: f7f33910df8f3c7c3e116c28e081009d279f687547ccb405caf84682bb93fcf64637c41803406a0a94ff9ba40c0702d42920bb3ad8431b4aa85a767cb8a92af9
7
+ data.tar.gz: 1f6296dc8d278859b9138a685e0a990059466ee15c8aa7973bf9150f3143a8e2c3474e16e07800cbb34a494b44c7384209ae23dff96c56929126127b52671633
data/README.md CHANGED
@@ -28,4 +28,4 @@ See `example` folder
28
28
 
29
29
  * Develop websites with HAML & SASS but without backend
30
30
  * Share files to mobile devices (if we access over Wi-Fi)
31
- * Try some 3rd-party examples what requires absolute urls (src="/files/...")
31
+ * Try some 3rd-party examples what requires absolute urls (src="/files/...")
data/bin/httpit CHANGED
@@ -7,9 +7,10 @@ require "pathname"
7
7
  require 'shellwords'
8
8
 
9
9
  GEM_ROOT = Pathname.new(__FILE__).dirname.join("..").expand_path
10
- ENV['BUNDLE_GEMFILE'] ||= GEM_ROOT.join("Gemfile").to_s
11
10
 
12
- require "bundler/setup"
11
+ # ENV['BUNDLE_GEMFILE'] ||= GEM_ROOT.join("Gemfile").to_s
12
+ # require "bundler/setup"
13
+
13
14
  require 'sinatra/base'
14
15
  require 'haml'
15
16
  require 'sass'
@@ -39,12 +40,12 @@ class << ROOT
39
40
  end
40
41
  end
41
42
 
42
- # only one parametr - port number
43
- if ARGV.size > 0
44
- set :port, ARGV.first.to_i
45
- end
46
-
47
43
  class HttpIt < Sinatra::Base
44
+ # only one parametr - port number
45
+ if ARGV.size > 0
46
+ set :port, ARGV.first.to_i
47
+ end
48
+
48
49
  set :views, ROOT
49
50
  set :public_folder, ROOT
50
51
  set :app_file, $0
@@ -127,7 +128,13 @@ class HttpIt < Sinatra::Base
127
128
  get '/__img_preview' do
128
129
  params[:file] = params[:file].shellescape
129
130
  tmppath = "/tmp/httpit_preview_#{Time.now.to_i}.jpeg"
130
- `convert #{ROOT + params[:file]} -resize 1024 -quality 100% #{tmppath}`
131
+ begin
132
+ puts `convert #{ROOT + params[:file]} -resize 1024 -quality 100% #{tmppath}`
133
+ rescue => error
134
+ status 500
135
+ return "<b>CAN NOT RESIZE!</b><br>Command like utility 'convert' not found in your system (part of ImageMagick)"
136
+ end
137
+
131
138
  content_type "image/jpeg"
132
139
  content = File.open(tmppath, 'rb') { |f| f.read }
133
140
  File.delete(tmppath)
@@ -159,7 +166,9 @@ class HttpIt < Sinatra::Base
159
166
  if @path =~ /.+\.sass\.css/
160
167
  return halt(404) unless File.file?(abs_path.to_s.chomp('.css'))
161
168
  content_type :css
162
- sass @path.chomp('.sass.css').to_sym
169
+
170
+ template = Tilt.new(abs_path.to_s.chomp('.css'))
171
+ template.render
163
172
 
164
173
  elsif !abs_path.file? && !abs_path.directory?
165
174
  halt 404
@@ -196,4 +205,4 @@ class HttpIt < Sinatra::Base
196
205
  end
197
206
 
198
207
  HttpIt.run!
199
- at_exit { FileUtils.rm_rf(TMP_DIR) if File.exists?(TMP_DIR) }
208
+ at_exit { FileUtils.rm_rf(TMP_DIR) if File.directory?(TMP_DIR) }
@@ -1,3 +1,3 @@
1
1
  %header
2
2
  %h1 Math in design
3
- %h2 Fibonacci Sequence
3
+ %h2 Fibonacci Sequence
@@ -7,10 +7,10 @@
7
7
 
8
8
  %body
9
9
  #wrapper
10
- = haml :"#{@dirname}/_header"
10
+ != haml :"#{@dirname}/_header"
11
11
  .content
12
12
  .top-line
13
- This is example layout to show how gem "#{"<b>httpit</b>"}" in action
13
+ This is example layout to show how gem <b>httpit</b> in action
14
14
 
15
15
  %aside>
16
16
  %h4 For example:
@@ -28,8 +28,7 @@
28
28
  %h3 The Fibonacci Sequence
29
29
  %p
30
30
  The mathematics behind the golden ratio is heavily connected to the
31
- = succeed "." do
32
- %a{:href => "http://en.wikipedia.org/wiki/Fibonacci_sequence"} Fibonacci Sequence
31
+ %a{:href => "http://en.wikipedia.org/wiki/Fibonacci_sequence"} Fibonacci Sequence
33
32
  If you’re unfamiliar with the fibonacci sequence,
34
33
  it begins by definition with the numbers 0, 1 and then each successive number
35
34
  in the sequence is the sum of the previous two numbers.
@@ -39,8 +38,7 @@
39
38
  %p
40
39
  I’ll spare you the deep mathematics talk (we’ll just do a bit of division),
41
40
  since what we’re mainly interested in is how the sequence relates to the
42
- = succeed "." do
43
- %a{:href => "http://freemasonry.bcy.ca/symbolism/golden_ratio/index.html"} golden section
41
+ %a{:href => "http://freemasonry.bcy.ca/symbolism/golden_ratio/index.html"} golden section
44
42
 
45
43
  %p
46
44
  If you take any number in the sequence and divide it by the previous
data/httpit.gemspec CHANGED
@@ -1,21 +1,19 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "httpit"
3
- s.version = "0.4.9"
3
+ s.version = "0.5.0"
4
4
  s.summary = "Web server for static files"
5
5
  s.description = "HTTP sever for directory index with extra features"
6
6
  s.author = "Pavel Evstigneev"
7
7
  s.email = "pavel.evst@gmail.com"
8
8
  s.homepage = "http://github.com/Paxa/httpit"
9
- s.has_rdoc = false
10
9
  s.executables = ["httpit"]
11
- s.rubyforge_project = "httpit"
12
- s.files = File.read(__FILE__).match(/__#{'END'}__(.+)\z/m)[1].strip.split("\n")
13
- s.licenses = ['MIT', 'GPL-2']
14
-
15
- s.add_runtime_dependency 'sinatra', "~> 1.4.2"
16
- s.add_runtime_dependency 'haml', '~> 4.0.2'
17
- s.add_runtime_dependency 'kramdown', "~> 1.3.0"
18
- s.add_runtime_dependency 'sass', "~> 3.2.8"
10
+ s.files = File.read(__FILE__).match(/__#{'END'}__(.+)\z/m)[1].strip.split("\n") - ['Gemfile.lock']
11
+ s.licenses = ['MIT', 'GPL-2.0']
12
+
13
+ s.add_runtime_dependency 'sinatra', "~> 3.0.6"
14
+ s.add_runtime_dependency 'haml', '~> 6.1.1'
15
+ s.add_runtime_dependency 'kramdown', "~> 2.4.0"
16
+ s.add_runtime_dependency 'sass', "~> 3.7.4"
19
17
  end
20
18
 
21
19
  # git ls-files
data/views/listing.haml CHANGED
@@ -51,11 +51,11 @@
51
51
  - for file in @files
52
52
  %li
53
53
  - if file[1] == :file
54
- %span= "&ndash;"
54
+ %span &ndash;
55
55
  - elsif file[1] == :dir
56
- %span= "+"
56
+ %span +
57
57
  - elsif file[1] == :link
58
- %span= "&rarr;"
58
+ %span &rarr;
59
59
 
60
60
  %a{:href => file_url(@path, file[0], file[1])}= file[0]
61
61
 
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Evstigneev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-25 00:00:00.000000000 Z
11
+ date: 2023-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.2
19
+ version: 3.0.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.4.2
26
+ version: 3.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: haml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.2
33
+ version: 6.1.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.2
40
+ version: 6.1.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: kramdown
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.0
47
+ version: 2.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.0
54
+ version: 2.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sass
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 3.2.8
61
+ version: 3.7.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 3.2.8
68
+ version: 3.7.4
69
69
  description: HTTP sever for directory index with extra features
70
70
  email: pavel.evst@gmail.com
71
71
  executables:
@@ -73,9 +73,8 @@ executables:
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
76
+ - ".gitignore"
77
77
  - Gemfile
78
- - Gemfile.lock
79
78
  - LICENSE
80
79
  - README.md
81
80
  - bin/httpit
@@ -94,27 +93,25 @@ files:
94
93
  homepage: http://github.com/Paxa/httpit
95
94
  licenses:
96
95
  - MIT
97
- - GPL-2
96
+ - GPL-2.0
98
97
  metadata: {}
99
- post_install_message:
98
+ post_install_message:
100
99
  rdoc_options: []
101
100
  require_paths:
102
101
  - lib
103
102
  required_ruby_version: !ruby/object:Gem::Requirement
104
103
  requirements:
105
- - - '>='
104
+ - - ">="
106
105
  - !ruby/object:Gem::Version
107
106
  version: '0'
108
107
  required_rubygems_version: !ruby/object:Gem::Requirement
109
108
  requirements:
110
- - - '>='
109
+ - - ">="
111
110
  - !ruby/object:Gem::Version
112
111
  version: '0'
113
112
  requirements: []
114
- rubyforge_project: httpit
115
- rubygems_version: 2.0.6
116
- signing_key:
113
+ rubygems_version: 3.4.10
114
+ signing_key:
117
115
  specification_version: 4
118
116
  summary: Web server for static files
119
117
  test_files: []
120
- has_rdoc: false
data/Gemfile.lock DELETED
@@ -1,30 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- httpit (0.4.8)
5
- haml (~> 4.0.2)
6
- kramdown (~> 1.3.0)
7
- sass (~> 3.2.8)
8
- sinatra (~> 1.4.2)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- haml (4.0.4)
14
- tilt
15
- kramdown (1.3.0)
16
- rack (1.5.2)
17
- rack-protection (1.5.1)
18
- rack
19
- sass (3.2.13)
20
- sinatra (1.4.4)
21
- rack (~> 1.4)
22
- rack-protection (~> 1.4)
23
- tilt (~> 1.3, >= 1.3.4)
24
- tilt (1.4.1)
25
-
26
- PLATFORMS
27
- ruby
28
-
29
- DEPENDENCIES
30
- httpit!