sinatra-pages 1.5.0 → 1.5.1
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/Rakefile +0 -10
- data/lib/sinatra/pages.rb +6 -16
- data/spec/pages_spec.rb +9 -10
- metadata +15 -31
data/Rakefile
CHANGED
@@ -47,15 +47,5 @@ Spec::Rake::SpecTask.new :spec do |task|
|
|
47
47
|
task.rcov = false
|
48
48
|
end
|
49
49
|
|
50
|
-
desc 'Functional testing with RSpec and RCov.'
|
51
|
-
Spec::Rake::SpecTask.new :rcov do |task|
|
52
|
-
task.spec_opts = %w[--colour --format progress --loadby mtime --timeout 20 --diff --backtrace]
|
53
|
-
task.libs = %w[lib spec]
|
54
|
-
task.spec_files = FileList['spec/*_spec.rb']
|
55
|
-
task.rcov = true
|
56
|
-
task.rcov_dir = 'cov'
|
57
|
-
task.rcov_opts = %w[--text-summary --exclude spec/]
|
58
|
-
end
|
59
|
-
|
60
50
|
desc "Default is Functional testing with RSpec."
|
61
51
|
task :default => [:spec]
|
data/lib/sinatra/pages.rb
CHANGED
@@ -10,7 +10,7 @@ module Sinatra
|
|
10
10
|
app.enable :static
|
11
11
|
end
|
12
12
|
|
13
|
-
app.set :pages, Proc.new {
|
13
|
+
app.set :pages, Proc.new {app.views}
|
14
14
|
app.set :styles, Proc.new {find_styles_directory app.public}
|
15
15
|
app.set :html, :v5
|
16
16
|
app.set :stylesheet, :scss
|
@@ -23,23 +23,13 @@ module Sinatra
|
|
23
23
|
app.set :sass, Proc.new {generate_setup :sass, app}
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
app.condition {app.stylesheet != :css}
|
27
|
+
app.get '/*.css' do
|
28
|
+
content_type :css, :charset => 'utf-8'
|
29
29
|
|
30
|
-
|
31
|
-
end
|
30
|
+
sass File.basename(params[:splat].first).to_sym, :views => settings.styles
|
32
31
|
end
|
33
|
-
|
34
|
-
app.before do
|
35
|
-
unless settings.views == settings.pages
|
36
|
-
unless File.exist?(File.join settings.views, settings.pages.split('/').last)
|
37
|
-
FileUtils.ln_s settings.pages, settings.views \
|
38
|
-
if (File.exist?(settings.views) && File.exist?(settings.pages))
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
32
|
+
|
43
33
|
%w[/? /:page/? /*/:page/?].each do |route|
|
44
34
|
app.get route do
|
45
35
|
params[:page] = 'home' if params[:page].nil?
|
data/spec/pages_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe Sinatra::Pages do
|
|
14
14
|
its(:root) {should == Dir.pwd}
|
15
15
|
its(:public) {should == File.join(Dir.pwd, 'public')}
|
16
16
|
its(:views) {should == File.join(Dir.pwd, 'views')}
|
17
|
-
its(:pages) {should == File.join(Dir.pwd, '
|
17
|
+
its(:pages) {should == File.join(Dir.pwd, 'views')}
|
18
18
|
its(:static) {should == true}
|
19
19
|
end
|
20
20
|
|
@@ -26,7 +26,7 @@ describe Sinatra::Pages do
|
|
26
26
|
its(:root) {should == File.dirname(__FILE__)}
|
27
27
|
its(:public) {should == File.join(File.dirname(__FILE__), 'public')}
|
28
28
|
its(:views) {should == File.join(File.dirname(__FILE__), 'views')}
|
29
|
-
its(:pages) {should == File.join(File.dirname(__FILE__), '
|
29
|
+
its(:pages) {should == File.join(File.dirname(__FILE__), 'views')}
|
30
30
|
its(:static) {should == true}
|
31
31
|
end
|
32
32
|
|
@@ -35,26 +35,25 @@ describe Sinatra::Pages do
|
|
35
35
|
its(:root) {should == Dir.pwd}
|
36
36
|
its(:public) {should == File.join(File.dirname(__FILE__), 'public')}
|
37
37
|
its(:views) {should == File.join(Dir.pwd, 'views')}
|
38
|
-
its(:pages) {should == File.join(Dir.pwd, '
|
38
|
+
its(:pages) {should == File.join(Dir.pwd, 'views')}
|
39
39
|
its(:static) {should == true}
|
40
40
|
end
|
41
41
|
|
42
42
|
context '#views' do
|
43
43
|
subject {app.set :views, File.join(File.dirname(__FILE__), 'views')}
|
44
44
|
its(:root) {should == Dir.pwd}
|
45
|
-
its(:public) {should == File.join(
|
45
|
+
its(:public) {should == File.join(File.dirname(__FILE__), 'public')}
|
46
46
|
its(:views) {should == File.join(File.dirname(__FILE__), 'views')}
|
47
|
-
its(:pages) {should == File.join(
|
47
|
+
its(:pages) {should == File.join(File.dirname(__FILE__), 'views')}
|
48
48
|
its(:static) {should == true}
|
49
49
|
end
|
50
50
|
|
51
51
|
context '#pages' do
|
52
|
-
|
53
|
-
subject {app.set :pages, File.join(File.dirname(__FILE__), 'pages')}
|
52
|
+
subject {app.set :pages, File.join(app.views, 'pages')}
|
54
53
|
its(:root) {should == Dir.pwd}
|
55
|
-
its(:public) {should == File.join(
|
56
|
-
its(:views) {should == File.join(
|
57
|
-
its(:pages) {should == File.join(
|
54
|
+
its(:public) {should == File.join(File.dirname(__FILE__), 'public')}
|
55
|
+
its(:views) {should == File.join(File.dirname(__FILE__), 'views')}
|
56
|
+
its(:pages) {should == File.join(app.views, 'pages')}
|
58
57
|
its(:static) {should == true}
|
59
58
|
end
|
60
59
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 1
|
10
|
+
version: 1.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Julio Javier Cicchelli
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-05 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -42,12 +42,12 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 19
|
46
46
|
segments:
|
47
47
|
- 1
|
48
|
-
- 0
|
49
48
|
- 1
|
50
|
-
|
49
|
+
- 0
|
50
|
+
version: 1.1.0
|
51
51
|
type: :runtime
|
52
52
|
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
@@ -58,12 +58,12 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
hash:
|
61
|
+
hash: 45
|
62
62
|
segments:
|
63
63
|
- 3
|
64
64
|
- 0
|
65
|
-
-
|
66
|
-
version: 3.0.
|
65
|
+
- 21
|
66
|
+
version: 3.0.21
|
67
67
|
type: :runtime
|
68
68
|
version_requirements: *id003
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -82,38 +82,22 @@ dependencies:
|
|
82
82
|
version: 1.3.0
|
83
83
|
type: :development
|
84
84
|
version_requirements: *id004
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: rcov
|
87
|
-
prerelease: false
|
88
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ">="
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
hash: 43
|
94
|
-
segments:
|
95
|
-
- 0
|
96
|
-
- 9
|
97
|
-
- 8
|
98
|
-
version: 0.9.8
|
99
|
-
type: :development
|
100
|
-
version_requirements: *id005
|
101
85
|
- !ruby/object:Gem::Dependency
|
102
86
|
name: rack-test
|
103
87
|
prerelease: false
|
104
|
-
requirement: &
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
105
89
|
none: false
|
106
90
|
requirements:
|
107
91
|
- - ">="
|
108
92
|
- !ruby/object:Gem::Version
|
109
|
-
hash:
|
93
|
+
hash: 7
|
110
94
|
segments:
|
111
95
|
- 0
|
112
96
|
- 5
|
113
|
-
-
|
114
|
-
version: 0.5.
|
97
|
+
- 6
|
98
|
+
version: 0.5.6
|
115
99
|
type: :development
|
116
|
-
version_requirements: *
|
100
|
+
version_requirements: *id005
|
117
101
|
description: " A Sinatra extension for static pages rendering using the HAML rendering engine.\n"
|
118
102
|
email: javier@rock-n-code.com
|
119
103
|
executables: []
|