httpit 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/httpit +18 -4
  2. data/httpit.gemspec +1 -1
  3. metadata +3 -2
data/bin/httpit CHANGED
@@ -1,15 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "rubygems"
3
- require "bundler/setup"
4
3
 
4
+ require "fileutils"
5
+ require "pathname"
6
+
7
+ GEM_ROOT = Pathname.new(__FILE__).dirname.join("..").expand_path
8
+ ENV['BUNDLE_GEMFILE'] ||= GEM_ROOT.join("Gemfile").to_s
9
+
10
+ require "bundler/setup"
5
11
  require 'sinatra/base'
6
12
  require 'haml'
7
13
  require 'sass'
8
14
  require 'redcloth'
9
- require "pathname"
10
- require "fileutils"
11
15
 
12
- GEM_ROOT = Pathname.new(__FILE__).dirname.join("..").expand_path
13
16
  ROOT = Pathname.pwd
14
17
 
15
18
  TMP_DIR = File.expand_path("#{Dir.tmpdir}/#{Time.now.to_i}#{rand(1000)}/")
@@ -39,6 +42,17 @@ class HttpIt < Sinatra::Base
39
42
  set :static, false
40
43
  set :sass, :cache => true, :cache_location => File.join(TMP_DIR, 'sass-cache')
41
44
 
45
+ helpers do
46
+ def with_layout(template, &block)
47
+ content = capture_haml do
48
+ yield
49
+ end
50
+ haml(template.to_sym, :layout => false) do
51
+ content
52
+ end
53
+ end
54
+ end
55
+
42
56
  # build array of contents and theris type for specified folder
43
57
  def get_content(folder = nil, sort = nil)
44
58
  abs_path = folder ? ROOT + folder : ROOT
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "httpit"
3
- s.version = "0.4.2"
3
+ s.version = "0.4.3"
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"
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.2
4
+ version: 0.4.3
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-04-27 00:00:00.000000000 Z
12
+ date: 2013-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -124,3 +124,4 @@ signing_key:
124
124
  specification_version: 3
125
125
  summary: Web server for static files
126
126
  test_files: []
127
+ has_rdoc: false