luneta 0.0.3
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.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +9 -0
- data/bin/luneta +2 -0
- data/lib/luneta.rb +11 -0
- data/lib/luneta/builder.rb +11 -0
- data/lib/luneta/layout.rb +13 -0
- data/lib/luneta/park.rb +73 -0
- data/lib/luneta/template.rb +13 -0
- data/lib/luneta/version.rb +3 -0
- data/luneta.gemspec +26 -0
- data/spec/.DS_Store +0 -0
- data/spec/layout_spec.rb +23 -0
- data/spec/luneta_spec.rb +40 -0
- data/spec/sample-site/.DS_Store +0 -0
- data/spec/sample-site/app.rb +33 -0
- data/spec/sample-site/config.ru +4 -0
- data/spec/sample-site/humans.txt +8 -0
- data/spec/sample-site/images/foundation/orbit/bullets.jpg +0 -0
- data/spec/sample-site/images/foundation/orbit/left-arrow-small.png +0 -0
- data/spec/sample-site/images/foundation/orbit/left-arrow.png +0 -0
- data/spec/sample-site/images/foundation/orbit/loading.gif +0 -0
- data/spec/sample-site/images/foundation/orbit/mask-black.png +0 -0
- data/spec/sample-site/images/foundation/orbit/pause-black.png +0 -0
- data/spec/sample-site/images/foundation/orbit/right-arrow-small.png +0 -0
- data/spec/sample-site/images/foundation/orbit/right-arrow.png +0 -0
- data/spec/sample-site/images/foundation/orbit/rotator-black.png +0 -0
- data/spec/sample-site/images/foundation/orbit/timer-black.png +0 -0
- data/spec/sample-site/index.html.erb +180 -0
- data/spec/sample-site/javascripts/app.js +38 -0
- data/spec/sample-site/javascripts/foundation.min.js +98 -0
- data/spec/sample-site/javascripts/jquery.foundation.accordion.js +34 -0
- data/spec/sample-site/javascripts/jquery.foundation.alerts.js +20 -0
- data/spec/sample-site/javascripts/jquery.foundation.buttons.js +74 -0
- data/spec/sample-site/javascripts/jquery.foundation.clearing.js +468 -0
- data/spec/sample-site/javascripts/jquery.foundation.forms.js +486 -0
- data/spec/sample-site/javascripts/jquery.foundation.joyride.js +639 -0
- data/spec/sample-site/javascripts/jquery.foundation.magellan.js +85 -0
- data/spec/sample-site/javascripts/jquery.foundation.mediaQueryToggle.js +27 -0
- data/spec/sample-site/javascripts/jquery.foundation.navigation.js +55 -0
- data/spec/sample-site/javascripts/jquery.foundation.orbit.js +897 -0
- data/spec/sample-site/javascripts/jquery.foundation.reveal.js +794 -0
- data/spec/sample-site/javascripts/jquery.foundation.tabs.js +43 -0
- data/spec/sample-site/javascripts/jquery.foundation.tooltips.js +193 -0
- data/spec/sample-site/javascripts/jquery.foundation.topbar.js +152 -0
- data/spec/sample-site/javascripts/jquery.js +9440 -0
- data/spec/sample-site/javascripts/jquery.placeholder.js +157 -0
- data/spec/sample-site/javascripts/modernizr.foundation.js +4 -0
- data/spec/sample-site/layout.erb +38 -0
- data/spec/sample-site/robots.txt +4 -0
- data/spec/sample-site/simple-layout.erb +10 -0
- data/spec/sample-site/simple-layout.rb +3 -0
- data/spec/sample-site/simple-test-with-params.haml +1 -0
- data/spec/sample-site/simple-test.erb +3 -0
- data/spec/sample-site/simple-test.haml +1 -0
- data/spec/sample-site/store.html +253 -0
- data/spec/sample-site/stylesheets/app.css +29 -0
- data/spec/sample-site/stylesheets/foundation.css +1213 -0
- data/spec/sample-site/stylesheets/foundation.min.css +1 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/template_spec.rb +36 -0
- metadata +200 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/luneta
ADDED
data/lib/luneta.rb
ADDED
data/lib/luneta/park.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Luneta::Park
|
2
|
+
# A rack handler to support development or running as a standalone server
|
3
|
+
|
4
|
+
require 'rack/request'
|
5
|
+
require 'rack/response'
|
6
|
+
|
7
|
+
module Luneta
|
8
|
+
class Park
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
@@routes = []
|
13
|
+
|
14
|
+
def start(routes = [], &block)
|
15
|
+
|
16
|
+
builder = Luneta::Builder.new do |builder|
|
17
|
+
builder.run Luneta::Park.new(routes)
|
18
|
+
end
|
19
|
+
|
20
|
+
yield block
|
21
|
+
|
22
|
+
return builder
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def path(&block)
|
27
|
+
yield block
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(routes)
|
33
|
+
@routes = routes
|
34
|
+
end
|
35
|
+
|
36
|
+
def call(env)
|
37
|
+
|
38
|
+
@output = ""
|
39
|
+
|
40
|
+
@routes.each do |route|
|
41
|
+
match = env['PATH_INFO'].match(route[:path])
|
42
|
+
if match
|
43
|
+
req = Rack::Request.new(env)
|
44
|
+
template = route[:template]
|
45
|
+
template = Dir.pwd + "/" + template
|
46
|
+
layout_template = route[:layout]
|
47
|
+
layout_template = Dir.pwd + "/" + layout_template
|
48
|
+
|
49
|
+
res = Rack::Response.new
|
50
|
+
|
51
|
+
if layout_template
|
52
|
+
|
53
|
+
layout = Luneta::Template.new(layout_template)
|
54
|
+
|
55
|
+
@output = layout.render(route[:title], route[:locals]) do
|
56
|
+
Luneta::Template.new(template).render(route[:title], route[:locals])
|
57
|
+
end
|
58
|
+
|
59
|
+
else
|
60
|
+
@output = Luneta::Template.new(template).render(route[:title], route[:locals])
|
61
|
+
end
|
62
|
+
|
63
|
+
res.write @output
|
64
|
+
res.finish
|
65
|
+
|
66
|
+
return res
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
data/luneta.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "luneta/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "luneta"
|
7
|
+
s.version = Luneta::VERSION
|
8
|
+
s.authors = ["Jason Torres"]
|
9
|
+
s.email = ["jason.e.torres@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{An über simple web microframework built on rack and tilt.}
|
12
|
+
s.description = %q{An über simple web microframework built on rack and tilt.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "luneta"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "minitest", "~> 4.2.0"
|
23
|
+
s.add_development_dependency "rack-test"
|
24
|
+
s.add_runtime_dependency "tilt"
|
25
|
+
s.add_runtime_dependency "rack"
|
26
|
+
end
|
data/spec/.DS_Store
ADDED
Binary file
|
data/spec/layout_spec.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Luneta' do
|
4
|
+
|
5
|
+
describe 'Layout' do
|
6
|
+
|
7
|
+
let(:layout) do
|
8
|
+
Luneta::Layout.new(sample_file("sample-site/simple-layout.erb"))
|
9
|
+
end
|
10
|
+
|
11
|
+
it "creates an instance" do
|
12
|
+
layout.must_be_instance_of(Luneta::Layout)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "renders the layout" do
|
16
|
+
layout.render do
|
17
|
+
"Content"
|
18
|
+
end.must_match("Content")
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/spec/luneta_spec.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
include Rack::Test::Methods
|
3
|
+
|
4
|
+
describe 'Luneta' do
|
5
|
+
|
6
|
+
def app
|
7
|
+
routes = [
|
8
|
+
{
|
9
|
+
title: 'Simple HAML',
|
10
|
+
path: '/simple-test.html',
|
11
|
+
template: 'spec/sample-site/simple-test.erb',
|
12
|
+
layout: 'spec/sample-site/layout.erb',
|
13
|
+
locals: {title: 'Simple Test', description: 'Simple Description'}
|
14
|
+
},
|
15
|
+
{
|
16
|
+
title: 'Simple ERB',
|
17
|
+
path: '/test.html',
|
18
|
+
template: 'spec/sample-site/index.html.erb',
|
19
|
+
layout: 'spec/sample-site/layout.erb',
|
20
|
+
locals: {title: 'Test', description: 'SEO description'}
|
21
|
+
}
|
22
|
+
]
|
23
|
+
|
24
|
+
Luneta::Park.start(routes) do
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns the instance" do
|
30
|
+
app.must_be_instance_of(Luneta::Builder)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "returns a valid page" do
|
34
|
+
request "/test.html"
|
35
|
+
#last_response.must_be :ok?
|
36
|
+
last_response.ok?.must_equal(true)
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
end
|
Binary file
|
@@ -0,0 +1,33 @@
|
|
1
|
+
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
2
|
+
|
3
|
+
require 'luneta'
|
4
|
+
|
5
|
+
routes = [
|
6
|
+
{
|
7
|
+
title: 'Simple HAML',
|
8
|
+
path: '/simple-test.html',
|
9
|
+
template: 'simple-test.erb',
|
10
|
+
layout: 'layout.erb',
|
11
|
+
locals: {title: 'Simple Test', description: 'Simple Description'}
|
12
|
+
},
|
13
|
+
{
|
14
|
+
title: 'Simple ERB',
|
15
|
+
path: '/test.html',
|
16
|
+
template: 'index.html.erb',
|
17
|
+
layout: 'layout.erb',
|
18
|
+
locals: {title: 'Test', description: 'SEO description'}
|
19
|
+
}
|
20
|
+
]
|
21
|
+
|
22
|
+
App = Luneta::Park.start(routes) do
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
#Luneta.new do
|
27
|
+
|
28
|
+
#path '/simple-test.haml' do
|
29
|
+
#title 'Simple Haml'
|
30
|
+
#template 'simple-test.erb'
|
31
|
+
#end
|
32
|
+
|
33
|
+
#end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,180 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="twelve columns">
|
3
|
+
<h2>Welcome to Foundation</h2>
|
4
|
+
<p>This is version <strong>3.2.0</strong> generated on November 05, 2012.</p>
|
5
|
+
<hr />
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="row">
|
10
|
+
<div class="eight columns">
|
11
|
+
<h3>The Grid</h3>
|
12
|
+
|
13
|
+
<!-- Grid Example -->
|
14
|
+
<div class="row">
|
15
|
+
<div class="twelve columns">
|
16
|
+
<div class="panel">
|
17
|
+
<p>This is a twelve column section in a row. Each of these includes a div.panel element so you can see where the columns are - it's not required at all for the grid.</p>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<div class="row">
|
22
|
+
<div class="six columns">
|
23
|
+
<div class="panel">
|
24
|
+
<p>Six columns</p>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<div class="six columns">
|
28
|
+
<div class="panel">
|
29
|
+
<p>Six columns</p>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
<div class="row">
|
34
|
+
<div class="four columns">
|
35
|
+
<div class="panel">
|
36
|
+
<p>Four columns</p>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
<div class="four columns">
|
40
|
+
<div class="panel">
|
41
|
+
<p>Four columns</p>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
<div class="four columns">
|
45
|
+
<div class="panel">
|
46
|
+
<p>Four columns</p>
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
|
52
|
+
<h3>Tabs</h3>
|
53
|
+
<dl class="tabs">
|
54
|
+
<dd class="active"><a href="#simple1">Simple Tab 1</a></dd>
|
55
|
+
<dd><a href="#simple2">Simple Tab 2</a></dd>
|
56
|
+
<dd><a href="#simple3">Simple Tab 3</a></dd>
|
57
|
+
</dl>
|
58
|
+
|
59
|
+
<ul class="tabs-content">
|
60
|
+
<li class="active" id="simple1Tab">This is simple tab 1's content. Pretty neat, huh?</li>
|
61
|
+
<li id="simple2Tab">This is simple tab 2's content. Now you see it!</li>
|
62
|
+
<li id="simple3Tab">This is simple tab 3's content. It's, you know...okay.</li>
|
63
|
+
</ul>
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
<h3>Buttons</h3>
|
68
|
+
|
69
|
+
<div class="row">
|
70
|
+
<div class="six columns">
|
71
|
+
<p><a href="#" class="small button">Small Button</a></p>
|
72
|
+
<p><a href="#" class="button">Medium Button</a></p>
|
73
|
+
<p><a href="#" class="large button">Large Button</a></p>
|
74
|
+
</div>
|
75
|
+
<div class="six columns">
|
76
|
+
<p><a href="#" class="small alert button">Small Alert Button</a></p>
|
77
|
+
<p><a href="#" class="success button">Medium Success Button</a></p>
|
78
|
+
<p><a href="#" class="large secondary button">Large Secondary Button</a></p>
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<div class="four columns">
|
85
|
+
<h4>Getting Started</h4>
|
86
|
+
<p>We're stoked you want to try Foundation! To get going, this file (index.html) includes some basic styles you can modify, play around with, or totally destroy to get going.</p>
|
87
|
+
|
88
|
+
<h4>Other Resources</h4>
|
89
|
+
<p>Once you've exhausted the fun in this document, you should check out:</p>
|
90
|
+
<ul class="disc">
|
91
|
+
<li><a href="http://foundation.zurb.com/docs">Foundation Documentation</a><br />Everything you need to know about using the framework.</li>
|
92
|
+
<li><a href="http://github.com/zurb/foundation">Foundation on Github</a><br />Latest code, issue reports, feature requests and more.</li>
|
93
|
+
<li><a href="http://twitter.com/foundationzurb">@foundationzurb</a><br />Ping us on Twitter if you have questions. If you build something with this we'd love to see it (and send you a totally boss sticker).</li>
|
94
|
+
</ul>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<div class="row">
|
100
|
+
<div class="twelve columns">
|
101
|
+
<h3>Orbit</h3>
|
102
|
+
<div id="featured">
|
103
|
+
<img src="holder.js/1200x250/text:Slide_1" alt="slide image">
|
104
|
+
<img src="holder.js/1200x250/text:Slide_2" alt="slide image">
|
105
|
+
<img src="holder.js/1200x250/text:Slide_3" alt="slide image">
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<div class="row">
|
113
|
+
<div class="twelve columns">
|
114
|
+
<h3>Reveal</h3>
|
115
|
+
<p><a href="#" data-reveal-id="exampleModal" class="button">Example modal</a></p>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div id="exampleModal" class="reveal-modal">
|
120
|
+
<h2>This is a modal.</h2>
|
121
|
+
<p>
|
122
|
+
Reveal makes these very easy to summon and dismiss. The close button is simple an anchor with a unicode
|
123
|
+
character icon and a class of <code>close-reveal-modal</code>. Clicking anywhere outside the modal will
|
124
|
+
also dismiss it.
|
125
|
+
</p>
|
126
|
+
<a class="close-reveal-modal">×</a>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
|
130
|
+
<!-- Included JS Files (Uncompressed) -->
|
131
|
+
<!--
|
132
|
+
|
133
|
+
<script src="javascripts/jquery.js"></script>
|
134
|
+
|
135
|
+
<script src="javascripts/jquery.foundation.mediaQueryToggle.js"></script>
|
136
|
+
|
137
|
+
<script src="javascripts/jquery.foundation.forms.js"></script>
|
138
|
+
|
139
|
+
<script src="javascripts/jquery.foundation.reveal.js"></script>
|
140
|
+
|
141
|
+
<script src="javascripts/jquery.foundation.orbit.js"></script>
|
142
|
+
|
143
|
+
<script src="javascripts/jquery.foundation.navigation.js"></script>
|
144
|
+
|
145
|
+
<script src="javascripts/jquery.foundation.buttons.js"></script>
|
146
|
+
|
147
|
+
<script src="javascripts/jquery.foundation.tabs.js"></script>
|
148
|
+
|
149
|
+
<script src="javascripts/jquery.foundation.tooltips.js"></script>
|
150
|
+
|
151
|
+
<script src="javascripts/jquery.foundation.accordion.js"></script>
|
152
|
+
|
153
|
+
<script src="javascripts/jquery.placeholder.js"></script>
|
154
|
+
|
155
|
+
<script src="javascripts/jquery.foundation.alerts.js"></script>
|
156
|
+
|
157
|
+
<script src="javascripts/jquery.foundation.topbar.js"></script>
|
158
|
+
|
159
|
+
<script src="javascripts/jquery.foundation.joyride.js"></script>
|
160
|
+
|
161
|
+
<script src="javascripts/jquery.foundation.clearing.js"></script>
|
162
|
+
|
163
|
+
<script src="javascripts/jquery.foundation.magellan.js"></script>
|
164
|
+
|
165
|
+
-->
|
166
|
+
|
167
|
+
<!-- Included JS Files (Compressed) -->
|
168
|
+
<script src="javascripts/jquery.js"></script>
|
169
|
+
<script src="javascripts/foundation.min.js"></script>
|
170
|
+
|
171
|
+
<!-- Initialize JS Plugins -->
|
172
|
+
<script src="javascripts/app.js"></script>
|
173
|
+
|
174
|
+
|
175
|
+
<script>
|
176
|
+
$(window).load(function(){
|
177
|
+
$("#featured").orbit();
|
178
|
+
});
|
179
|
+
</script>
|
180
|
+
|