mosaic 0.0.1pre2 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/bin/mosaic +1 -0
- data/lib/blank_app/Gemfile +1 -0
- data/lib/blank_app/app/modules/example.rb +4 -0
- data/lib/mosaic/application.rb +1 -0
- data/lib/mosaic/bin.rb +2 -0
- data/lib/mosaic/module.rb +9 -0
- data/lib/mosaic/version.rb +1 -1
- data/spec/module_spec.rb +6 -0
- data/spec/spec_helper.rb +6 -0
- metadata +5 -5
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
[![Status](https://secure.travis-ci.org/Arcath/mosaic.png?branch=master)](http://travis-ci.org/Arcath/mosaic)
|
4
4
|
|
5
|
+
[rDoc](http://rdoc.info/github/Arcath/mosaic/master/frames) - [wiki](https://github.com/Arcath/mosaic/wiki)
|
6
|
+
|
5
7
|
A simple MOdular Sinatra ApplICation framework.
|
6
8
|
|
7
9
|
## Installation
|
data/bin/mosaic
CHANGED
data/lib/blank_app/Gemfile
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
# Example Mosaic Module
|
2
|
+
#
|
3
|
+
# Would respond to /example with the contents of views/index.html
|
1
4
|
class ExampleModule < Mosaic::Module
|
2
5
|
respond_to :get, "/example"
|
3
6
|
|
7
|
+
# Is called by Mosaic when ever a request is made.
|
4
8
|
def handle
|
5
9
|
@response.content = :'index.html'
|
6
10
|
end
|
data/lib/mosaic/application.rb
CHANGED
data/lib/mosaic/bin.rb
CHANGED
data/lib/mosaic/module.rb
CHANGED
@@ -30,6 +30,7 @@ module Mosaic
|
|
30
30
|
# Creates a new responder, called by Mosaic::Application for every request that uses a given module
|
31
31
|
# Takes the request object and the current path as input
|
32
32
|
def initialize(request, path)
|
33
|
+
@path = path
|
33
34
|
@request = request
|
34
35
|
@response = Mosaic::Response.new(request)
|
35
36
|
@params = request.params
|
@@ -63,6 +64,14 @@ module Mosaic
|
|
63
64
|
def contained_view(file)
|
64
65
|
File.read(File.expand_path("../../../support/views/#{file}", __FILE__))
|
65
66
|
end
|
67
|
+
|
68
|
+
def handle_statically(manual_path = nil)
|
69
|
+
static_request = @request
|
70
|
+
static_request.path_info = manual_path if manual_path
|
71
|
+
static_module = Mosaic::Modules::Static.new(static_request, @path)
|
72
|
+
static_module.handle
|
73
|
+
@response = static_module.response
|
74
|
+
end
|
66
75
|
end
|
67
76
|
|
68
77
|
# Container for modules supplied with Mosaic
|
data/lib/mosaic/version.rb
CHANGED
data/spec/module_spec.rb
CHANGED
@@ -18,4 +18,10 @@ describe Mosaic::Module do
|
|
18
18
|
# This should have been set when TestModule was declared
|
19
19
|
Mosaic.responders["/"].should be_a Array
|
20
20
|
end
|
21
|
+
|
22
|
+
it "should allow you to use handle_statically" do
|
23
|
+
test_module = TestModule.new(DummyRequest.new("/foo/widget"), "/foo/:bar")
|
24
|
+
test_module.handle
|
25
|
+
test_module.response.response_code.should eq 404
|
26
|
+
end
|
21
27
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mosaic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Adam "Arcath" Laycock
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -127,9 +127,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
|
-
- - ! '
|
130
|
+
- - ! '>='
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
132
|
+
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
135
|
rubygems_version: 1.8.23
|