GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
First public API specs:
* Template
* Stripped down spec_helper
* Added a bunch of sample templates for the template specs
* Updated merb.rb to push itself into the load path if it's not already
  true
* Require "erubis" before building the Erubis compiler
wycats (author)
Sun Jan 13 02:51:38 -0800 2008
commit  1fa4c67b89b11ee0c58b9b4305dbc0c5e17b9f08
tree    a6e3ac54d7b1099d4f9093ea55bcc3d8cd99d8fa
parent  91fd22403178475fe75fa564bdbbe0bdcb7ddaae
...
4
5
6
 
 
 
 
 
7
8
9
 
10
11
12
...
15
16
17
18
 
19
20
21
...
59
60
61
62
 
63
64
65
...
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
21
22
23
 
24
25
26
27
...
65
66
67
 
68
69
70
71
0
@@ -4,9 +4,15 @@
0
 require 'rubygems'
0
 require 'set'
0
 require 'fileutils'
0
+
0
+$LOAD_PATH.push File.dirname(__FILE__) unless
0
+ $LOAD_PATH.include?(File.dirname(__FILE__)) ||
0
+ $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
0
+
0
 require 'merb_core/gem_ext/erubis'
0
 require 'merb_core/logger'
0
 require 'merb_core/version'
0
+require 'merb_core/core_ext'
0
 
0
 gem "assistance"
0
 require "assistance"
0
@@ -15,7 +21,7 @@ module Merb
0
   class << self
0
     
0
     attr_accessor :environment, :load_paths
0
- self.load_paths = Hash.new
0
+ Merb.load_paths = Hash.new
0
     
0
     require 'merb_core/autoload'
0
     
0
@@ -59,7 +65,7 @@ module Merb
0
     
0
     # Set up default generator scope
0
     attr_accessor :generator_scope
0
- self.generator_scope = [:merb_default, :merb, :rspec]
0
+ Merb.generator_scope = [:merb_default, :merb, :rspec]
0
   end
0
 
0
 end
...
62
63
64
 
 
65
66
67
68
69
70
71
72
73
74
75
76
77
 
 
78
79
80
81
82
83
 
 
84
85
86
87
 
 
88
89
90
91
...
62
63
64
65
66
67
68
69
70
 
 
 
 
 
 
 
 
 
71
72
73
74
75
76
 
 
77
78
79
80
81
 
82
83
84
85
86
87
0
@@ -62,29 +62,25 @@ module Merb::Template
0
     # Merb::Template.register_extensions(Merb::Template::Erubis, ["erb"])
0
     # ]}}
0
     def register_extensions(engine, extensions) enforce!(engine => Class, extensions => Array)
0
+ raise ArgumentError, "The class you are registering does not have a compile_template method" unless
0
+ engine.respond_to?(:compile_template)
0
       extensions.each{|ext| EXTENSIONS[ext] = engine }
0
     end
0
   end
0
   
0
- class Erubis
0
- Merb::Template.register_extensions(self, %[erb])
0
-
0
- # ==== Parameters
0
- # path<String>:: A full path to the template
0
- def initialize(path)
0
- @path = path
0
- end
0
-
0
+ require 'erubis'
0
+ class Erubis
0
     # ==== Parameters
0
     # path<String>:: A full path to the template
0
     # name<String>:: The name of the method that will be created
0
     # mod<Module>:: The module that the compiled method will be placed into
0
- def compile_template(path, name, mod)
0
- template = Erubis::Eruby.new(File.read(path))
0
+ def self.compile_template(path, name, mod)
0
+ template = ::Erubis::Eruby.new(File.read(path))
0
       template.def_method(mod, name, path)
0
       name
0
     end
0
-
0
+
0
+ Merb::Template.register_extensions(self, %w[erb])
0
   end
0
   
0
 end
0
\ No newline at end of file
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 
57
58
59
...
67
68
69
70
 
 
 
 
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
88
89
90
91
92
93
94
95
96
 
 
 
 
 
 
 
 
97
98
...
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
3
4
5
6
...
14
15
16
 
17
18
19
20
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 
 
 
 
 
52
53
 
 
54
55
56
57
58
59
60
61
62
63
0
@@ -1,59 +1,6 @@
0
 $TESTING=true
0
-require 'timeout'
0
-require 'open-uri'
0
-require 'net/http'
0
-require 'rubygems'
0
-require 'spec'
0
-require 'mocha'
0
-require 'hpricot'
0
-$:.push File.join(File.dirname(__FILE__), '..', 'lib')
0
-$:.push File.join(File.dirname(__FILE__), '..', 'lib', 'merb', 'server')
0
-require File.join(File.dirname(__FILE__), '..', 'lib', 'merb', 'config')
0
-Merb::Config.setup
0
-require 'merb'
0
-require 'merb/test/helper'
0
-
0
-FIXTURES = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures')) unless defined?(FIXTURES)
0
-
0
-require File.join(File.dirname(__FILE__), "spec_helpers", "url_shared_behaviour")
0
-
0
-Spec::Runner.configure do |config|
0
- config.include(Merb::Test::Helper)
0
- config.include(Merb::Test::RspecMatchers)
0
- # config.include(Merb::Test::MerbRspecControllerRedirect)
0
-end
0
-
0
-# Creates a new controller, e.g.
0
-# c = new_controller('index', Examples) do |request|
0
-# request.post_body = "blah"
0
-# end
0
-def new_controller(action = 'index', controller = nil, additional_params = {})
0
- request = OpenStruct.new
0
- request.params = {:action => action, :controller => (controller.to_s || "Test")}
0
- request.params.update(additional_params)
0
- request.cookies = {}
0
- request.accept ||= '*/*'
0
-
0
- yield request if block_given?
0
-
0
- response = OpenStruct.new
0
- response.read = ""
0
- (controller || Merb::Controller).build(request, response)
0
-end
0
-
0
-class Merb::Controller
0
- require "lib/merb/session/memory_session"
0
- Merb::MemorySessionContainer.setup
0
- include ::Merb::SessionMixin
0
- self.session_secret_key = "footo the bar to the baz"
0
-end
0
-
0
-class String
0
- def clean
0
- Hpricot(chomp).to_s
0
- end
0
-end
0
 
0
+require File.join(File.dirname(__FILE__), "..", "lib", "merb")
0
 
0
 # -- Global custom matchers --
0
 
0
@@ -67,31 +14,49 @@ end
0
 #
0
 # "expected File but got Tempfile"
0
 
0
-class BeKindOf
0
+module Merb
0
+ module Test
0
+ module RspecMatchers
0
+ class BeKindOf
0
   
0
- def initialize(expected) # + args
0
- @expected = expected
0
- end
0
-
0
- def matches?(target)
0
- @target = target
0
- @target.kind_of?(@expected)
0
- end
0
-
0
- def failure_message
0
- "expected #{@expected} but got #{@target.class}"
0
- end
0
-
0
- def negative_failure_message
0
- "expected #{@expected} to not be #{@target.class}"
0
+ def initialize(expected) # + args
0
+ @expected = expected
0
+ end
0
+
0
+ def matches?(target)
0
+ @target = target
0
+ @target.kind_of?(@expected)
0
+ end
0
+
0
+ def failure_message
0
+ "expected #{@expected} but got #{@target.class}"
0
+ end
0
+
0
+ def negative_failure_message
0
+ "expected #{@expected} to not be #{@target.class}"
0
+ end
0
+
0
+ def description
0
+ "be_kind_of #{@target}"
0
+ end
0
+
0
+ end
0
+
0
+ def be_kind_of(expected) # + args
0
+ BeKindOf.new(expected)
0
+ end
0
+ end
0
+
0
+ module Helper; end
0
   end
0
-
0
- def description
0
- "be_kind_of #{@target}"
0
- end
0
-
0
 end
0
 
0
-def be_kind_of(expected) # + args
0
- BeKindOf.new(expected)
0
+Spec::Runner.configure do |config|
0
+ config.include(Merb::Test::Helper)
0
+ config.include(Merb::Test::RspecMatchers)
0
+ Spec::Example::ExampleGroup.class_eval do
0
+ def running(&blk) blk; end
0
+ def executing(&blk) blk; end
0
+ def doing(&blk) blk; end
0
+ end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.