jabs 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,9 +56,12 @@ begin
56
56
  gemspec.homepage = "http://github.com/collin/jabs"
57
57
  gemspec.authors = ["Collin Miller"]
58
58
 
59
+ gemspec.executables << 'jabs'
60
+
59
61
  gemspec.add_dependency('fold', '0.5.0')
60
62
  gemspec.add_dependency('johnson', '1.1.2')
61
63
  gemspec.add_dependency('colored', '1.1')
64
+ gemspec.add_dependency('rack', '1.0.1')
62
65
  end
63
66
  Jeweler::GemcutterTasks.new
64
67
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby -KU
2
+
3
+ require 'jabs'
4
+ puts Jabs::Engine.new(STDIN.read).render
@@ -0,0 +1,10 @@
1
+ require 'lib/jabs'
2
+ require 'pathname'
3
+
4
+ puts Pathname.new(__FILE__).dirname.expand_path+'src'
5
+ puts "OF"
6
+
7
+ use Jabs::Rack::Static, :urls => '/src', :root => Pathname.new(__FILE__).dirname.expand_path
8
+ run lambda { |env|
9
+ [200, {'Content-Type'=>'text/html'}, "JABS"]
10
+ }
@@ -1,8 +1,8 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'rubygems'
4
1
  require 'fold'
2
+ require 'rack'
5
3
  require 'johnson'
4
+ require 'pathname'
5
+ puts require Pathname.new(__FILE__).dirname.expand_path+'jabs/middleware'
6
6
 
7
7
  module Johnson
8
8
  module Nodes
@@ -0,0 +1,27 @@
1
+ module Jabs
2
+
3
+ module Rack
4
+ class Static < ::Rack::Static
5
+ def initialize(app, options={})
6
+ super(app, options)
7
+ root = options[:root] || Dir.pwd
8
+ @file_server = Jabs::Rack::File.new(root)
9
+ end
10
+ end
11
+
12
+ class File < ::Rack::File
13
+ def serving
14
+ @path += ".jabs" unless @path[/\.jabs$/]
15
+ status, headers, body = * super
16
+ return [status, headers, body] unless status == 200
17
+
18
+ jabs = Jabs::Engine.new(open(body.path).read).render
19
+
20
+ headers['Content-Type'] = 'text/javascript'
21
+ headers['Content-Length'] = jabs.size.to_s
22
+
23
+ [status, headers, jabs]
24
+ end
25
+ end
26
+ end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jabs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Collin Miller
@@ -42,10 +42,21 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: "1.1"
44
44
  version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: rack
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.0.1
54
+ version:
45
55
  description: Inspiredby HAML, SASS and JABL by mr Hampton Catlin
46
56
  email: collintmiller@gmail.com
47
- executables: []
48
-
57
+ executables:
58
+ - jabs
59
+ - jabs
49
60
  extensions: []
50
61
 
51
62
  extra_rdoc_files:
@@ -56,7 +67,9 @@ files:
56
67
  - README
57
68
  - Rakefile.rb
58
69
  - VERSION
70
+ - bin/jabs
59
71
  - build
72
+ - examples/config.ru
60
73
  - examples/editor.html
61
74
  - examples/editor.js
62
75
  - examples/input_with_default.html
@@ -66,6 +79,7 @@ files:
66
79
  - examples/src/input_with_default.html.haml
67
80
  - examples/src/input_with_default.js.jabs
68
81
  - lib/jabs.rb
82
+ - lib/jabs/middleware.rb
69
83
  - lightning.jabs
70
84
  - rspec/fixtures/example.js
71
85
  - rspec/fixtures/example.js.jabs