nesta 0.9.5 → 0.9.7
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/CHANGES +31 -3
- data/Gemfile.lock +4 -4
- data/config.ru +1 -0
- data/lib/nesta/app.rb +3 -3
- data/lib/nesta/config.rb +1 -1
- data/lib/nesta/env.rb +7 -0
- data/lib/nesta/models.rb +7 -7
- data/lib/nesta/navigation.rb +3 -2
- data/lib/nesta/overrides.rb +17 -10
- data/lib/nesta/path.rb +2 -2
- data/lib/nesta/version.rb +1 -1
- data/spec/commands_spec.rb +2 -2
- data/spec/models_spec.rb +8 -6
- data/spec/overrides_spec.rb +17 -3
- data/spec/spec_helper.rb +1 -0
- data/templates/config.ru +3 -2
- data/views/layout.haml +1 -1
- metadata +5 -4
data/CHANGES
CHANGED
@@ -1,3 +1,34 @@
|
|
1
|
+
= 0.9.7 / (19 August 2011)
|
2
|
+
|
3
|
+
* No code changes from 0.9.6; version number increased to allow new gem
|
4
|
+
to be deployed to rubygems.org.
|
5
|
+
|
6
|
+
= 0.9.6 / (18 August 2011) [never released due to packaging bug]
|
7
|
+
|
8
|
+
* Nesta no longer cares whether you write your Sass stylesheets in the
|
9
|
+
original indented Sass format or the default SCSS syntax (which is a
|
10
|
+
superset of CSS). To use this functionality within your own site or
|
11
|
+
theme change change any calls to the existing `sass` or `scss`
|
12
|
+
helpers to `stylesheet`. (Isaac Cambron, Graham Ashton)
|
13
|
+
|
14
|
+
* Add an HTML class ("current") to the menu items whose path matches
|
15
|
+
the current page.
|
16
|
+
|
17
|
+
* Bug fix: Strip trailing # characters from Markdown headings at the
|
18
|
+
top of a page.
|
19
|
+
|
20
|
+
* Bug fix: Don't render the return value of local_stylesheet_link_tag
|
21
|
+
directly into the page (haml_tag now writes direct to the output
|
22
|
+
buffer).
|
23
|
+
|
24
|
+
* Bug fix: Removed trailing whitespace inside <a> tags generated by
|
25
|
+
the display_breadcrumbs() helper.
|
26
|
+
|
27
|
+
* Bug fix: Nesta::App.root couldn't be set until after nesta/app was
|
28
|
+
required. Odd that, as the only reason to want to change
|
29
|
+
Nesta::App.root would be before requiring nesta/app. Fixed by
|
30
|
+
creating Nesta::Env and moving root to there instead.
|
31
|
+
|
1
32
|
= 0.9.5 / (1 May 2011)
|
2
33
|
|
3
34
|
* Added --version option to nesta command (Christopher Lindblom).
|
@@ -13,9 +44,6 @@
|
|
13
44
|
* Bug fix: Removed trailing whitespace inside <a> tags generated by
|
14
45
|
the display_menu() helper.
|
15
46
|
|
16
|
-
* Updated the URL from which Disqus JavaScript is loaded
|
17
|
-
(Sidharta Surya Kusnanto).
|
18
|
-
|
19
47
|
* Bug fix: Made article_summaries render summaries for the pages
|
20
48
|
passed into it (Robert Syme).
|
21
49
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nesta (0.9.
|
4
|
+
nesta (0.9.7)
|
5
5
|
RedCloth (~> 4.2)
|
6
6
|
haml (~> 3.1)
|
7
7
|
maruku (>= 0.6.0)
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
remote: http://rubygems.org/
|
14
14
|
specs:
|
15
15
|
RedCloth (4.2.7)
|
16
|
-
haml (3.1.
|
16
|
+
haml (3.1.2)
|
17
17
|
hoe (2.6.2)
|
18
18
|
rake (>= 0.8.7)
|
19
19
|
rubyforge (>= 2.0.4)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
rspec_hpricot_matchers (1.0)
|
30
30
|
rubyforge (2.0.4)
|
31
31
|
json_pure (>= 1.1.7)
|
32
|
-
sass (3.1.
|
32
|
+
sass (3.1.5)
|
33
33
|
shotgun (0.9)
|
34
34
|
rack (>= 1.0)
|
35
35
|
sinatra (1.1.2)
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
syntax (1.0.0)
|
39
39
|
test-unit (1.2.3)
|
40
40
|
hoe (>= 1.5.1)
|
41
|
-
tilt (1.3)
|
41
|
+
tilt (1.3.2)
|
42
42
|
|
43
43
|
PLATFORMS
|
44
44
|
ruby
|
data/config.ru
CHANGED
data/lib/nesta/app.rb
CHANGED
@@ -83,11 +83,11 @@ module Nesta
|
|
83
83
|
|
84
84
|
def local_stylesheet?
|
85
85
|
Nesta.deprecated('local_stylesheet?', 'use local_stylesheet_link_tag')
|
86
|
-
File.exist?(File.expand_path('views/local.sass', Nesta::
|
86
|
+
File.exist?(File.expand_path('views/local.sass', Nesta::Env.root))
|
87
87
|
end
|
88
88
|
|
89
89
|
def local_stylesheet_link_tag(name)
|
90
|
-
pattern = File.expand_path("views/#{name}.s{a,c}ss", Nesta::
|
90
|
+
pattern = File.expand_path("views/#{name}.s{a,c}ss", Nesta::Env.root)
|
91
91
|
if Dir.glob(pattern).size > 0
|
92
92
|
haml_tag :link, :href => "/css/#{name}.css", :rel => "stylesheet"
|
93
93
|
end
|
@@ -125,7 +125,7 @@ module Nesta
|
|
125
125
|
|
126
126
|
get '/css/:sheet.css' do
|
127
127
|
content_type 'text/css', :charset => 'utf-8'
|
128
|
-
cache
|
128
|
+
cache stylesheet(params[:sheet].to_sym)
|
129
129
|
end
|
130
130
|
|
131
131
|
get %r{/attachments/([\w/.-]+)} do
|
data/lib/nesta/config.rb
CHANGED
data/lib/nesta/env.rb
ADDED
data/lib/nesta/models.rb
CHANGED
@@ -170,7 +170,7 @@ module Nesta
|
|
170
170
|
def heading
|
171
171
|
regex = case @format
|
172
172
|
when :mdown
|
173
|
-
/^#\s*(
|
173
|
+
/^#\s*(.*?)(\s*#+|$)/
|
174
174
|
when :haml
|
175
175
|
/^\s*%h1\s+(.*)/
|
176
176
|
when :textile
|
@@ -194,12 +194,12 @@ module Nesta
|
|
194
194
|
|
195
195
|
def date(format = nil)
|
196
196
|
@date ||= if metadata("date")
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
197
|
+
if format == :xmlschema
|
198
|
+
Time.parse(metadata("date")).xmlschema
|
199
|
+
else
|
200
|
+
DateTime.parse(metadata("date"))
|
201
|
+
end
|
202
|
+
end
|
203
203
|
end
|
204
204
|
|
205
205
|
def atom_id
|
data/lib/nesta/navigation.rb
CHANGED
@@ -21,7 +21,8 @@ module Nesta
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
else
|
24
|
-
|
24
|
+
html_class = (request.path == item.abspath) ? "current" : nil
|
25
|
+
haml_tag :li, :class => html_class do
|
25
26
|
haml_tag :a, :<, :href => item.abspath do
|
26
27
|
haml_concat item.heading
|
27
28
|
end
|
@@ -43,7 +44,7 @@ module Nesta
|
|
43
44
|
haml_tag :ul, :class => options[:class] do
|
44
45
|
breadcrumb_ancestors[0...-1].each do |page|
|
45
46
|
haml_tag :li do
|
46
|
-
haml_tag :a, :href => page.abspath do
|
47
|
+
haml_tag :a, :<, :href => page.abspath do
|
47
48
|
haml_concat breadcrumb_label(page)
|
48
49
|
end
|
49
50
|
end
|
data/lib/nesta/overrides.rb
CHANGED
@@ -2,19 +2,25 @@ module Nesta
|
|
2
2
|
module Overrides
|
3
3
|
module Renderers
|
4
4
|
def haml(template, options = {}, locals = {})
|
5
|
-
defaults = Overrides.render_options(template, :haml)
|
5
|
+
defaults, engine = Overrides.render_options(template, :haml)
|
6
6
|
super(template, defaults.merge(options), locals)
|
7
7
|
end
|
8
8
|
|
9
9
|
def scss(template, options = {}, locals = {})
|
10
|
-
defaults = Overrides.render_options(template, :scss)
|
10
|
+
defaults, engine = Overrides.render_options(template, :scss)
|
11
11
|
super(template, defaults.merge(options), locals)
|
12
12
|
end
|
13
13
|
|
14
14
|
def sass(template, options = {}, locals = {})
|
15
|
-
defaults = Overrides.render_options(template, :sass)
|
15
|
+
defaults, engine = Overrides.render_options(template, :sass)
|
16
16
|
super(template, defaults.merge(options), locals)
|
17
17
|
end
|
18
|
+
|
19
|
+
def stylesheet(template, options = {}, locals = {})
|
20
|
+
defaults, engine = Overrides.render_options(template, :sass, :scss)
|
21
|
+
renderer = Sinatra::Templates.instance_method(engine)
|
22
|
+
renderer.bind(self).call(template, defaults.merge(options), locals)
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
def self.load_local_app
|
@@ -34,14 +40,15 @@ module Nesta
|
|
34
40
|
views && File.exist?(File.join(views, "#{template}.#{engine}"))
|
35
41
|
end
|
36
42
|
|
37
|
-
def self.render_options(template,
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
def self.render_options(template, *engines)
|
44
|
+
[local_view_path, theme_view_path].each do |path|
|
45
|
+
engines.each do |engine|
|
46
|
+
if template_exists?(engine, path, template)
|
47
|
+
return { :views => path }, engine
|
48
|
+
end
|
49
|
+
end
|
44
50
|
end
|
51
|
+
[{}, nil]
|
45
52
|
end
|
46
53
|
|
47
54
|
def self.local_view_path
|
data/lib/nesta/path.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Nesta
|
2
2
|
class Path
|
3
3
|
def self.local(*args)
|
4
|
-
File.expand_path(File.join(args), Nesta::
|
4
|
+
File.expand_path(File.join(args), Nesta::Env.root)
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.themes(*args)
|
8
|
-
File.expand_path(File.join('themes', *args), Nesta::
|
8
|
+
File.expand_path(File.join('themes', *args), Nesta::Env.root)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/nesta/version.rb
CHANGED
data/spec/commands_spec.rb
CHANGED
@@ -115,7 +115,7 @@ describe "nesta" do
|
|
115
115
|
FileUtils.mkdir_p(File.dirname(@config_path))
|
116
116
|
Nesta::Config.stub!(:yaml_path).and_return(@config_path)
|
117
117
|
create_config_yaml('content: path/to/content')
|
118
|
-
Nesta::
|
118
|
+
Nesta::Env.stub!(:root).and_return(@project_path)
|
119
119
|
@repo_url = 'git://github.com/gma/nesta-demo-content.git'
|
120
120
|
@demo_path = project_path('content-demo')
|
121
121
|
@command = Nesta::Commands::Demo::Content.new
|
@@ -265,7 +265,7 @@ describe "nesta" do
|
|
265
265
|
end
|
266
266
|
|
267
267
|
before(:each) do
|
268
|
-
Nesta::
|
268
|
+
Nesta::Env.stub!(:root).and_return(FixtureHelper::FIXTURE_DIR)
|
269
269
|
@name = 'my-new-theme'
|
270
270
|
Nesta::Commands::Theme::Create.new(@name).execute
|
271
271
|
end
|
data/spec/models_spec.rb
CHANGED
@@ -455,12 +455,14 @@ describe "Markdown page" do
|
|
455
455
|
it_should_behave_like "Page"
|
456
456
|
|
457
457
|
it "should set heading from first h1 tag" do
|
458
|
-
create_page(
|
459
|
-
:
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
458
|
+
page = create_page(
|
459
|
+
:heading => "First heading", :content => "# Second heading")
|
460
|
+
page.heading.should == "First heading"
|
461
|
+
end
|
462
|
+
|
463
|
+
it "should ignore trailing # characters in headings" do
|
464
|
+
article = create_article(:heading => 'With trailing #')
|
465
|
+
article.heading.should == 'With trailing'
|
464
466
|
end
|
465
467
|
end
|
466
468
|
|
data/spec/overrides_spec.rb
CHANGED
@@ -27,8 +27,8 @@ describe "Rendering" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
before(:each) do
|
30
|
-
@app_root = Nesta::
|
31
|
-
Nesta::
|
30
|
+
@app_root = Nesta::Env.root
|
31
|
+
Nesta::Env.root = File.expand_path('fixtures/tmp', File.dirname(__FILE__))
|
32
32
|
@theme = 'my-theme'
|
33
33
|
@fixtures = []
|
34
34
|
stub_configuration
|
@@ -36,9 +36,23 @@ describe "Rendering" do
|
|
36
36
|
|
37
37
|
after(:each) do
|
38
38
|
@fixtures.each { |path| FileUtils.rm(path) if File.exist?(path) }
|
39
|
-
Nesta::
|
39
|
+
Nesta::Env.root = @app_root
|
40
40
|
end
|
41
41
|
|
42
|
+
describe "when rendering stylesheets" do
|
43
|
+
it "should render the SASS stylesheets" do
|
44
|
+
create_template(:local, 'master.sass', "body\n width: 10px * 2")
|
45
|
+
get "/css/master.css"
|
46
|
+
body.should match(/width: 20px;/)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should render the SCSS stylesheets" do
|
50
|
+
create_template(:local, 'master.scss', "body {\n width: 10px * 2;\n}")
|
51
|
+
get "/css/master.css"
|
52
|
+
body.should match(/width: 20px;/)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
42
56
|
describe "when local files exist" do
|
43
57
|
before(:each) do
|
44
58
|
create_template(:local, 'page.haml', '%p Local template')
|
data/spec/spec_helper.rb
CHANGED
data/templates/config.ru
CHANGED
@@ -3,7 +3,8 @@ require 'bundler/setup'
|
|
3
3
|
|
4
4
|
Bundler.require(:default)
|
5
5
|
|
6
|
-
require 'nesta/
|
6
|
+
require 'nesta/env'
|
7
|
+
Nesta::Env.root = ::File.expand_path('.', ::File.dirname(__FILE__))
|
7
8
|
|
8
|
-
|
9
|
+
require 'nesta/app'
|
9
10
|
run Nesta::App
|
data/views/layout.haml
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
%link(rel="stylesheet" href="http://universal-ie6-css.googlecode.com/files/ie6.1.1.css" media="screen, projection")
|
15
15
|
/[if lt IE 9]
|
16
16
|
%script(src="//html5shim.googlecode.com/svn/trunk/html5.js")
|
17
|
-
|
17
|
+
- local_stylesheet_link_tag('local')
|
18
18
|
%link(href="/articles.xml" rel="alternate" type="application/atom+xml")
|
19
19
|
= haml :analytics, :layout => false
|
20
20
|
%body
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: nesta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Graham Ashton
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-19 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- lib/nesta/cache.rb
|
171
171
|
- lib/nesta/commands.rb
|
172
172
|
- lib/nesta/config.rb
|
173
|
+
- lib/nesta/env.rb
|
173
174
|
- lib/nesta/models.rb
|
174
175
|
- lib/nesta/navigation.rb
|
175
176
|
- lib/nesta/nesta.rb
|
@@ -230,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
231
|
requirements:
|
231
232
|
- - ">="
|
232
233
|
- !ruby/object:Gem::Version
|
233
|
-
hash: -
|
234
|
+
hash: -3003652627560154656
|
234
235
|
segments:
|
235
236
|
- 0
|
236
237
|
version: "0"
|
@@ -239,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
240
|
requirements:
|
240
241
|
- - ">="
|
241
242
|
- !ruby/object:Gem::Version
|
242
|
-
hash: -
|
243
|
+
hash: -3003652627560154656
|
243
244
|
segments:
|
244
245
|
- 0
|
245
246
|
version: "0"
|