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 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
@@ -2,6 +2,7 @@
2
2
  lib = File.expand_path('../../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
+ require "mosaic/version"
5
6
  require "mosaic/bin"
6
7
 
7
8
  Mosaic::Bin.new(ARGV)
@@ -5,6 +5,7 @@ gem 'mosaic'
5
5
 
6
6
  # Mosaic Required Gems
7
7
  gem 'sinatra-static-assets', require: 'sinatra/static_assets'
8
+ gem 'sprockets', '~> 2.9'
8
9
 
9
10
  # Sprocket Gems
10
11
  #gem 'sass'
@@ -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
@@ -18,6 +18,7 @@ module Mosaic
18
18
  puts "Route load order:"
19
19
 
20
20
  Mosaic.responders.keys.sort.reverse.each do |key|
21
+ puts key
21
22
  self.send(Mosaic.responders[key][1], key) do
22
23
  @responder = Mosaic.responders[key][0].new(request, key)
23
24
  @responder.handle
@@ -12,6 +12,8 @@ module Mosaic
12
12
  def handle_arguments
13
13
  if @args.include?("new")
14
14
  new_application
15
+ elsif @args.include?("-v")
16
+ puts Mosaic::VERSION
15
17
  else
16
18
  help_page
17
19
  end
@@ -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
@@ -1,4 +1,4 @@
1
1
  module Mosaic
2
2
  # Mosaics Version Number
3
- VERSION = "0.0.1pre2"
3
+ VERSION = "0.0.1"
4
4
  end
@@ -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
@@ -3,9 +3,15 @@ require "bundler"
3
3
 
4
4
  Bundler.require
5
5
 
6
+ require 'mosaic/modules/static'
7
+
6
8
  class TestModule < Mosaic::Module
7
9
  respond_to :get, "/"
8
10
  respond_to :get, "/foo/:bar"
11
+
12
+ def handle
13
+ handle_statically
14
+ end
9
15
  end
10
16
 
11
17
  class DummyRequest
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.1pre2
5
- prerelease: 5
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-05 00:00:00.000000000 Z
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: 1.3.1
132
+ version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
135
  rubygems_version: 1.8.23