glog 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/glog.rb +20 -0
- data/lib/glog/page.rb +41 -0
- data/lib/glog/server.rb +40 -0
- metadata +47 -24
- data/LICENSE +0 -20
- data/README.markdown +0 -42
- data/spec/fixtures/example/plugins/canonical_host.rb +0 -25
- data/spec/fixtures/example/plugins/chrome_frame.rb +0 -50
- data/spec/fixtures/example/plugins/google_analytics.rb +0 -45
- data/spec/fixtures/example/plugins/no_ie.rb +0 -38
- data/spec/glog_spec.rb +0 -82
- data/spec/spec_helper.rb +0 -18
data/lib/glog.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rack'
|
3
|
+
require 'jadof'
|
4
|
+
require 'haml'
|
5
|
+
require 'glog/page'
|
6
|
+
require 'glog/server'
|
7
|
+
|
8
|
+
module Glog
|
9
|
+
|
10
|
+
@@config = nil
|
11
|
+
|
12
|
+
def self.config
|
13
|
+
@@config ||= YAML.load_file('glog.yaml')
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.config=(config)
|
17
|
+
@@config = config
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/lib/glog/page.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
module Glog
|
2
|
+
class Page < JADOF::Page
|
3
|
+
def self.root
|
4
|
+
get(Glog.config['root'])
|
5
|
+
end
|
6
|
+
|
7
|
+
def render
|
8
|
+
self.template == false ? super : wrap_with_template(super)
|
9
|
+
end
|
10
|
+
|
11
|
+
def template_path
|
12
|
+
if self.template
|
13
|
+
"templates/#{self.template}.haml"
|
14
|
+
else self.parent.size > 0
|
15
|
+
detect_template_from_parent
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def detect_template_from_parent
|
20
|
+
first_match = false
|
21
|
+
segments = self.parent.split(File::SEPARATOR)
|
22
|
+
segments.size.times do |i|
|
23
|
+
template_path = (['templates'] + segments[0..-(i-1)] + ['default.haml']).join(File::SEPARATOR)
|
24
|
+
if File.exists?(template_path)
|
25
|
+
first_match = template_path
|
26
|
+
break
|
27
|
+
end
|
28
|
+
segments.pop
|
29
|
+
end
|
30
|
+
first_match || 'templates/default.haml'
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def wrap_with_template(content)
|
36
|
+
locals = { :page => self, :config => Glog.config, :pages => self.class }
|
37
|
+
Haml::Engine.new(File.read(template_path)).to_html(nil, locals)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
data/lib/glog/server.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module Glog
|
2
|
+
class Server
|
3
|
+
|
4
|
+
def call(env)
|
5
|
+
env['PATH_INFO'] == '/' ? send_root_page : send_path(env['PATH_INFO'])
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def send_path(path)
|
11
|
+
path = path[1..-1] # /my/page => my/page
|
12
|
+
# First trying to load page
|
13
|
+
if page = Page.get(path)
|
14
|
+
send_page(page)
|
15
|
+
# Then trying to load directory index if any
|
16
|
+
elsif page = try_dir_index(path)
|
17
|
+
send_page(page)
|
18
|
+
else
|
19
|
+
send_not_found
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def try_dir_index(path)
|
24
|
+
File.directory?(File.join('pages', path))
|
25
|
+
Page.get(File.join(path, 'index'))
|
26
|
+
end
|
27
|
+
|
28
|
+
def send_page(page)
|
29
|
+
[200, { 'Content-Type' => 'text/html' }, page.render]
|
30
|
+
end
|
31
|
+
|
32
|
+
def send_not_found
|
33
|
+
[404, { 'Content-Type' => 'text/html'}, '404 Not Found']
|
34
|
+
end
|
35
|
+
|
36
|
+
def send_root_page
|
37
|
+
Page.root ? send_page(Page.root) : send_not_found
|
38
|
+
end
|
39
|
+
end # Server
|
40
|
+
end # Glog
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Antono Vasiljev
|
@@ -18,9 +18,23 @@ date: 2010-03-28 00:00:00 +02:00
|
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
21
|
+
name: rack
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 1
|
30
|
+
- 0
|
31
|
+
version: 1.1.0
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: jadof
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
24
38
|
requirements:
|
25
39
|
- - ">="
|
26
40
|
- !ruby/object:Gem::Version
|
@@ -30,11 +44,11 @@ dependencies:
|
|
30
44
|
- 6
|
31
45
|
version: 0.1.6
|
32
46
|
type: :runtime
|
33
|
-
version_requirements: *
|
47
|
+
version_requirements: *id002
|
34
48
|
- !ruby/object:Gem::Dependency
|
35
49
|
name: haml
|
36
50
|
prerelease: false
|
37
|
-
requirement: &
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
38
52
|
requirements:
|
39
53
|
- - ">="
|
40
54
|
- !ruby/object:Gem::Version
|
@@ -44,11 +58,25 @@ dependencies:
|
|
44
58
|
- 0
|
45
59
|
version: 2.2.0
|
46
60
|
type: :runtime
|
47
|
-
version_requirements: *
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: maruku
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
- 6
|
72
|
+
- 0
|
73
|
+
version: 0.6.0
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
48
76
|
- !ruby/object:Gem::Dependency
|
49
77
|
name: rspec
|
50
78
|
prerelease: false
|
51
|
-
requirement: &
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
52
80
|
requirements:
|
53
81
|
- - ">="
|
54
82
|
- !ruby/object:Gem::Version
|
@@ -58,11 +86,11 @@ dependencies:
|
|
58
86
|
- 0
|
59
87
|
version: 1.3.0
|
60
88
|
type: :development
|
61
|
-
version_requirements: *
|
89
|
+
version_requirements: *id005
|
62
90
|
- !ruby/object:Gem::Dependency
|
63
91
|
name: rack-test
|
64
92
|
prerelease: false
|
65
|
-
requirement: &
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
66
94
|
requirements:
|
67
95
|
- - ">="
|
68
96
|
- !ruby/object:Gem::Version
|
@@ -72,19 +100,19 @@ dependencies:
|
|
72
100
|
- 3
|
73
101
|
version: 0.5.3
|
74
102
|
type: :development
|
75
|
-
version_requirements: *
|
76
|
-
description:
|
103
|
+
version_requirements: *id006
|
104
|
+
description:
|
77
105
|
email: antono.vasiljev@gmail.com
|
78
106
|
executables: []
|
79
107
|
|
80
108
|
extensions: []
|
81
109
|
|
82
|
-
extra_rdoc_files:
|
83
|
-
|
84
|
-
- README.markdown
|
110
|
+
extra_rdoc_files: []
|
111
|
+
|
85
112
|
files:
|
86
|
-
-
|
87
|
-
-
|
113
|
+
- lib/glog.rb
|
114
|
+
- lib/glog/page.rb
|
115
|
+
- lib/glog/server.rb
|
88
116
|
has_rdoc: true
|
89
117
|
homepage: http://github.com/antono/glog
|
90
118
|
licenses: []
|
@@ -114,11 +142,6 @@ rubyforge_project:
|
|
114
142
|
rubygems_version: 1.3.6
|
115
143
|
signing_key:
|
116
144
|
specification_version: 3
|
117
|
-
summary: Git powered bogging engine
|
118
|
-
test_files:
|
119
|
-
|
120
|
-
- spec/fixtures/example/plugins/chrome_frame.rb
|
121
|
-
- spec/fixtures/example/plugins/canonical_host.rb
|
122
|
-
- spec/fixtures/example/plugins/no_ie.rb
|
123
|
-
- spec/glog_spec.rb
|
124
|
-
- spec/spec_helper.rb
|
145
|
+
summary: Git powered bogging/cms engine
|
146
|
+
test_files: []
|
147
|
+
|
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2009 Antono Vasiljev
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
Glog - simplier than toto
|
2
|
-
=========================
|
3
|
-
|
4
|
-
Glog is Rack Middleware to serve directory of files as blog or site.
|
5
|
-
|
6
|
-
Glog inspired by [toto](http://github.com/cloudhead/toto) and based on
|
7
|
-
[JADOF](http://github.com/remi/jadof).
|
8
|
-
|
9
|
-
Glog makes less assumptions about your urls.
|
10
|
-
**J**ust **a** **D**irectory **o**f **F**iles.
|
11
|
-
|
12
|
-
|
13
|
-
TODO
|
14
|
-
|
15
|
-
|
16
|
-
Plugins
|
17
|
-
-------
|
18
|
-
|
19
|
-
Use rack middleware as plugins:
|
20
|
-
|
21
|
-
require 'rack/noie'
|
22
|
-
use Rack::NoIE, :redirect => '/noie.html'
|
23
|
-
|
24
|
-
require 'rack/google\_analytics'
|
25
|
-
use Rack::GoogleAnalytics, 'UA-1234567-0'
|
26
|
-
|
27
|
-
|
28
|
-
Note on Patches/Pull Requests
|
29
|
-
-----------------------------
|
30
|
-
|
31
|
-
- Fork the project.
|
32
|
-
- Make your feature addition or bug fix.
|
33
|
-
- Add tests for it. This is important so I don't break it in a
|
34
|
-
future version unintentionally.
|
35
|
-
- Commit, do not mess with rakefile, version, or history.
|
36
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
37
|
-
- Send me a pull request. Bonus points for topic branches.
|
38
|
-
|
39
|
-
Copyright
|
40
|
-
---------
|
41
|
-
|
42
|
-
Copyright (c) 2010 Antono Vasiljev. See LICENSE for details.
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# http://gist.github.com/206213
|
2
|
-
module Rack
|
3
|
-
class CanonicalHost
|
4
|
-
def initialize(app, host=nil, &block)
|
5
|
-
@app = app
|
6
|
-
@host = (block_given? && block.call) || host
|
7
|
-
end
|
8
|
-
|
9
|
-
def call(env)
|
10
|
-
if url = url(env)
|
11
|
-
[301, { 'Location' => url }, ['Redirecting...']]
|
12
|
-
else
|
13
|
-
@app.call(env)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def url(env)
|
18
|
-
if @host && env['SERVER_NAME'] != @host
|
19
|
-
url = Rack::Request.new(env).url
|
20
|
-
url.sub(%r{\A(https?://)(.*?)(:\d+)?(/|$)}, "\\1#{@host}\\3/")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
private :url
|
24
|
-
end
|
25
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# http://gist.github.com/206201
|
2
|
-
# http://coderack.org/users/luigi/entries/4-rackchromeframe
|
3
|
-
module Rack
|
4
|
-
class ChromeFrame
|
5
|
-
|
6
|
-
def initialize(app, options={})
|
7
|
-
@app = app
|
8
|
-
end
|
9
|
-
|
10
|
-
def call(env)
|
11
|
-
status, headers, response = @app.call(env)
|
12
|
-
if env['HTTP_USER_AGENT'] =~ /MSIE/ && response.content_type == 'text/html'
|
13
|
-
new_body = insert_goods(build_response_body(response))
|
14
|
-
new_headers = recalculate_body_length(headers, new_body)
|
15
|
-
[status, new_headers, new_body]
|
16
|
-
else
|
17
|
-
[status, headers, response]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def build_response_body(response)
|
22
|
-
response_body = ""
|
23
|
-
response.each { |part| response_body += part }
|
24
|
-
response_body
|
25
|
-
end
|
26
|
-
|
27
|
-
def recalculate_body_length(headers, body)
|
28
|
-
new_headers = headers
|
29
|
-
new_headers["Content-Length"] = body.length.to_s
|
30
|
-
new_headers
|
31
|
-
end
|
32
|
-
|
33
|
-
def insert_goods(body)
|
34
|
-
head = <<-HEAD
|
35
|
-
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
36
|
-
HEAD
|
37
|
-
|
38
|
-
bod = <<-BOD
|
39
|
-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
|
40
|
-
<div id="cf-placeholder"></div>
|
41
|
-
<script>CFInstall.check({node: "cf-placeholder"});</script>
|
42
|
-
BOD
|
43
|
-
|
44
|
-
body.gsub!(/<\/head>/, head + "\n</head>")
|
45
|
-
body.gsub!(/<\/body>/, bod + "\n</body>")
|
46
|
-
body
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# http://gist.github.com/207948
|
2
|
-
# http://coderack.org/users/sam/entries/21-rackgoogleanalytics
|
3
|
-
module Rack
|
4
|
-
class GoogleAnalytics
|
5
|
-
TRACKING_CODE = <<-EOCODE
|
6
|
-
<script type="text/javascript">
|
7
|
-
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
8
|
-
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
9
|
-
</script>
|
10
|
-
<script type="text/javascript">
|
11
|
-
try {
|
12
|
-
var pageTracker = _gat._getTracker("{{ID}}");
|
13
|
-
pageTracker._trackPageview();
|
14
|
-
} catch(err) {}</script>
|
15
|
-
EOCODE
|
16
|
-
|
17
|
-
def initialize(app, id)
|
18
|
-
@app = app
|
19
|
-
@id = id
|
20
|
-
end
|
21
|
-
|
22
|
-
def call(env)
|
23
|
-
status, headers, body = @app.call(env)
|
24
|
-
|
25
|
-
body.each do |part|
|
26
|
-
if part =~ /<\/body>/
|
27
|
-
part.sub!(/<\/body>/, "#{tracking_code}</body>")
|
28
|
-
|
29
|
-
if headers['Content-Length']
|
30
|
-
headers['Content-Length'] = (headers['Content-Length'].to_i + tracking_code.length).to_s
|
31
|
-
end
|
32
|
-
|
33
|
-
break
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
[status, headers, body]
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
def tracking_code
|
42
|
-
TRACKING_CODE.sub(/\{\{ID\}\}/, @id)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# http://gist.github.com/207947
|
2
|
-
# http://coderack.org/users/julioody/entries/20-racknoie
|
3
|
-
module Rack
|
4
|
-
class NoIE
|
5
|
-
def initialize(app, options = {})
|
6
|
-
@app = app
|
7
|
-
@options = options
|
8
|
-
@options[:redirect] ||= 'http://www.microsoft.com/windows/internet-explorer/default.aspx'
|
9
|
-
@options[:minimum] ||= 7.0
|
10
|
-
end
|
11
|
-
|
12
|
-
def call(env)
|
13
|
-
ie_found_in?(env) ? kick_it : @app.call(env)
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
def ie_found_in?(env)
|
18
|
-
if env['HTTP_USER_AGENT']
|
19
|
-
is_ie?(env['HTTP_USER_AGENT']) and ie_version(env['HTTP_USER_AGENT']) < @options[:minimum] and @options[:redirect] != env['PATH_INFO']
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def is_ie?(ua_string)
|
24
|
-
# We need at least one digit to be able to get the version, hence the \d
|
25
|
-
ua_string.match(/MSIE \d/) ? true : false
|
26
|
-
end
|
27
|
-
|
28
|
-
def ie_version(ua_string)
|
29
|
-
ua_string.match(/MSIE (\S+)/)[1].to_f
|
30
|
-
end
|
31
|
-
|
32
|
-
def kick_it
|
33
|
-
[301, {'Location' => @options[:redirect]}, 'Fail browser is fail']
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
use Rack::NoIE, :redirect => Glog.config['plugins']['no_ie']
|
data/spec/glog_spec.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Glog" do
|
4
|
-
|
5
|
-
let(:app) { create_from_fixture('example') }
|
6
|
-
|
7
|
-
it "should have config accessor" do
|
8
|
-
Glog.config = 'config'
|
9
|
-
Glog.config.should == 'config'
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "Glog::Page" do
|
13
|
-
describe "Page.root" do
|
14
|
-
it "should return root page defined in Glog.config" do
|
15
|
-
Glog::Page.root.title.should == 'Hello All'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#template_path" do
|
20
|
-
describe "when template defined in file" do
|
21
|
-
it "should return templates/{Page#template}.haml" do
|
22
|
-
page = Glog::Page.get('template_test/template1_test')
|
23
|
-
page.should_not be_nil
|
24
|
-
page.template_path.should == 'templates/template1.haml'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "when Page#template is undefined" do
|
29
|
-
it "should should use default.html from tepmlates/{Page#parent}" do
|
30
|
-
page = Glog::Page.get("template_test/undefined_template")
|
31
|
-
page.parent.should == 'template_test'
|
32
|
-
page.template_path.should == "templates/#{page.parent}/default.haml"
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "if there is no defaut.html in templats/{Page#parent}" do
|
36
|
-
it "should inherit default.html template from parent dirs" do
|
37
|
-
page = Glog::Page.get("template_test/deep/template")
|
38
|
-
page.parent.should == 'template_test/deep'
|
39
|
-
page.template_path.should == "templates/template_test/default.haml"
|
40
|
-
# And very deep page...
|
41
|
-
page = Glog::Page.get("deep/deep/deep/page/with/undefined/template/here")
|
42
|
-
page.parent.should == 'deep/deep/deep/page/with/undefined/template'
|
43
|
-
page.template_path.should == "templates/default.haml"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "Glog::Server" do
|
51
|
-
include Rack::Test::Methods
|
52
|
-
|
53
|
-
describe "GET /" do
|
54
|
-
it "should be ok" do
|
55
|
-
get '/'
|
56
|
-
last_response.should be_ok
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should render text from page defined as root in Glog.config" do
|
60
|
-
get '/'
|
61
|
-
last_response.body.should =~ /Hello All/
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "GET /some/dir" do
|
66
|
-
it "should try to render /some/dir/index if index exists" do
|
67
|
-
dir = 'spec/fixtures/example/pages/epo/2010'
|
68
|
-
File.exists?(dir).should be_true
|
69
|
-
File.directory?(dir).should be_true
|
70
|
-
get '/epo/2010'
|
71
|
-
last_response.should be_ok
|
72
|
-
last_response.body.should match(/this is index/)
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should return 404 if no index found" do
|
76
|
-
get '/epo/2010'
|
77
|
-
last_response.should be_ok
|
78
|
-
last_response.body.should match(/this is index/)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end # describe Server
|
82
|
-
end # describe Glog
|
data/spec/spec_helper.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'glog'
|
6
|
-
require 'spec'
|
7
|
-
require 'spec/autorun'
|
8
|
-
require 'spec/interop/test'
|
9
|
-
require 'rack/test'
|
10
|
-
|
11
|
-
def create_from_fixture(name)
|
12
|
-
Dir.chdir(File.join(File.dirname(__FILE__), "fixtures", name))
|
13
|
-
Glog.config = YAML.load_file('glog.yaml')
|
14
|
-
@app = Glog::Server.new
|
15
|
-
end
|
16
|
-
|
17
|
-
Spec::Runner.configure do |config|
|
18
|
-
end
|