middleman 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
+ - jruby
4
5
  script: "bundle exec rake test"
data/CHANGELOG CHANGED
@@ -1,6 +1,14 @@
1
- 2.0.0
1
+ 2.0.3
2
+ =====
3
+ - Pulled out undocumented Blog feature into its own extension
4
+
5
+ 2.0.2
2
6
  =====
7
+ - Fixed Sprockets circular error
8
+ - Added auto-requiring extensions
3
9
 
10
+ 2.0.0
11
+ =====
4
12
  - Guard-powered auto-reloading of config.rb
5
13
  - Guard LiveReload
6
14
  - Sprockets JS
@@ -140,9 +140,6 @@ module Middleman
140
140
  # Lorem provides a handful of helpful prototyping methods to generate
141
141
  # words, paragraphs, fake images, names and email addresses.
142
142
  autoload :Lorem, "middleman/features/lorem"
143
-
144
- # Treat project as a blog
145
- autoload :Blog, "middleman/features/blog"
146
143
 
147
144
  # guard-livereload
148
145
  autoload :LiveReload, "middleman/features/live_reload"
@@ -46,9 +46,6 @@ end
46
46
  # Default template
47
47
  require "middleman/templates/default"
48
48
 
49
- # Blog template
50
- require "middleman/templates/blog"
51
-
52
49
  # HTML5 template
53
50
  require "middleman/templates/html5"
54
51
 
@@ -1,3 +1,3 @@
1
1
  module Middleman
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 2
10
- version: 2.0.2
9
+ - 3
10
+ version: 2.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thomas Reynolds
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-19 00:00:00 Z
18
+ date: 2011-08-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rack
@@ -569,7 +569,6 @@ files:
569
569
  - lib/middleman/features/asset_host.rb
570
570
  - lib/middleman/features/automatic_image_sizes.rb
571
571
  - lib/middleman/features/automatic_image_sizes/fastimage.rb
572
- - lib/middleman/features/blog.rb
573
572
  - lib/middleman/features/cache_buster.rb
574
573
  - lib/middleman/features/directory_indexes.rb
575
574
  - lib/middleman/features/lorem.rb
@@ -584,14 +583,6 @@ files:
584
583
  - lib/middleman/renderers/sass.rb
585
584
  - lib/middleman/renderers/slim.rb
586
585
  - lib/middleman/templates.rb
587
- - lib/middleman/templates/blog.rb
588
- - lib/middleman/templates/blog/config.ru
589
- - lib/middleman/templates/blog/config.tt
590
- - lib/middleman/templates/blog/source/2011/01/01/new-article.html.markdown
591
- - lib/middleman/templates/blog/source/archives/index.html.erb
592
- - lib/middleman/templates/blog/source/feed.xml.builder
593
- - lib/middleman/templates/blog/source/index.html.erb
594
- - lib/middleman/templates/blog/source/layout.erb
595
586
  - lib/middleman/templates/default.rb
596
587
  - lib/middleman/templates/default/source/index.html.erb
597
588
  - lib/middleman/templates/default/source/layout.erb
@@ -1,156 +0,0 @@
1
- module Middleman
2
- module Features
3
- module Blog
4
- class << self
5
- def registered(app)
6
- # Include helpers
7
- app.helpers Middleman::Features::Blog::Helpers
8
-
9
- app.after_configuration do
10
- if !app.settings.respond_to? :blog_permalink
11
- app.set :blog_permalink, ":year/:month/:day/:title.html"
12
- end
13
-
14
- if !app.settings.respond_to? :blog_taglink
15
- app.set :blog_taglink, "tags/:tag.html"
16
- end
17
-
18
- if !app.settings.respond_to? :blog_layout
19
- app.set :blog_layout, "layout"
20
- end
21
-
22
- if !app.settings.respond_to? :blog_summary_separator
23
- app.set :blog_summary_separator, /READMORE/
24
- end
25
-
26
- if !app.settings.respond_to? :blog_summary_length
27
- app.set :blog_summary_length, 250
28
- end
29
-
30
- if !app.settings.respond_to? :blog_layout_engine
31
- app.set :blog_layout_engine, "erb"
32
- end
33
-
34
- if !app.settings.respond_to? :blog_index_template
35
- app.set :blog_index_template, "index_template"
36
- end
37
-
38
- if !app.settings.respond_to? :blog_article_template
39
- app.set :blog_article_template, "article_template"
40
- end
41
-
42
- if !app.build?
43
- $stderr.puts "== Blog: #{app.settings.blog_permalink}"
44
- end
45
-
46
- app.get("/#{app.blog_permalink}") do
47
- process_request({
48
- :layout => app.blog_layout,
49
- :layout_engine => app.blog_layout_engine
50
- })
51
-
52
- # No need for separator on permalink page
53
- body body.gsub!(app.blog_summary_separator, "")
54
- end
55
- end
56
-
57
- app.before_processing do
58
- articles_glob = File.join(app.views, app.settings.blog_permalink.gsub(/(:\w+)/, "*") + ".*")
59
-
60
- articles = Dir[articles_glob].map do |article|
61
- template_content = File.read(article)
62
- data, content = app.parse_front_matter(template_content)
63
- data["date"] = Date.parse(data["date"])
64
-
65
- data["raw"] = content
66
- data["url"] = article.gsub(app.views, "").split(".html").first + ".html"
67
-
68
- all_content = Tilt.new(article).render
69
- data["body"] = all_content.gsub!(app.settings.blog_summary_separator, "")
70
-
71
- sum = if data["raw"] =~ app.settings.blog_summary_separator
72
- data["raw"].split(app.settings.blog_summary_separator).first
73
- else
74
- data["raw"].match(/(.{1,#{app.settings.blog_summary_length}}.*?)(\n|\Z)/m).to_s
75
- end
76
-
77
- engine = app.settings.markdown_engine.new { sum }
78
- data["summary"] = engine.render
79
- data
80
- end.sort { |a, b| b["date"] <=> a["date"] }
81
-
82
- tags = {}
83
- articles.each do |article|
84
- article["tags"] ||= ""
85
- if !article["tags"].empty?
86
- tags_array = article["tags"].split(',').map{|t| t.strip}
87
- tags_array.each do |tag_title|
88
- tag_key = tag_title.parameterize
89
- tag_path = blog_taglink.gsub(/(:\w+)/, tag_key)
90
- (tags[tag_path] ||= {})["title"] = tag_title
91
- tags[tag_path]["ident"] = tag_key
92
- (tags[tag_path]["pages"] ||= {})[article["title"]] = article["url"]
93
- end
94
- end
95
- end
96
-
97
- app.data_content("blog", { :articles => articles, :tags => tags })
98
- true
99
- end
100
- end
101
- alias :included :registered
102
- end
103
-
104
- module Helpers
105
- def is_blog_article?
106
- !current_article_title.blank?
107
- end
108
-
109
- def blog_title
110
- end
111
-
112
- def current_article_date
113
- DateTime.parse(current_article_metadata.date)
114
- end
115
-
116
- def current_article_title
117
- current_article_metadata.title
118
- end
119
-
120
- def current_article_metadata
121
- data.page
122
- end
123
-
124
- def current_article_tags
125
- article_tags_hash = {}
126
- if is_blog_article? && current_article_metadata.tags
127
- article_tags = current_article_metadata.tags.split(',').map{|t| t.strip}
128
- article_tags.each do |tag_title|
129
- article_tags_hash[tag_title] = self.class.blog_taglink.gsub(/(:\w+)/, tag_title.parameterize)
130
- end
131
- end
132
- article_tags_hash
133
- end
134
-
135
- def blog_tags
136
- data.blog.tags
137
- end
138
-
139
- def current_tag_data
140
- data.blog.tags[request.path]
141
- end
142
-
143
- def current_tag_articles
144
- data.blog.articles.map do |article|
145
- article if current_tag_data.pages.has_value?(article.url)
146
- end.compact
147
- end
148
-
149
- def current_tag_title
150
- current_tag_data[:title]
151
- end
152
-
153
- end
154
- end
155
- end
156
- end
@@ -1,20 +0,0 @@
1
- class Middleman::Templates::Blog < Middleman::Templates::Base
2
- def self.source_root
3
- File.dirname(__FILE__)
4
- end
5
-
6
- def build_scaffold
7
- template "blog/config.tt", File.join(location, "config.rb")
8
- directory "blog/source", File.join(location, "source")
9
-
10
- empty_directory File.join(location, "source", options[:css_dir])
11
- empty_directory File.join(location, "source", options[:js_dir])
12
- empty_directory File.join(location, "source", options[:images_dir])
13
- end
14
-
15
- def generate_rack
16
- template "blog/config.ru", File.join(location, "config.ru")
17
- end
18
- end
19
-
20
- Middleman::Templates.register(:blog, Middleman::Templates::Blog)
@@ -1,9 +0,0 @@
1
- # Rack config
2
-
3
- # Look for index files in folders like Apache
4
- require "rack/contrib/try_static"
5
- use Rack::TryStatic, :root => "build", :urls => %w[/], :try => ['.html', 'index.html', '/index.html']
6
-
7
- # Cache static assets
8
- require "rack/contrib/static_cache"
9
- use Rack::StaticCache, :urls => ['/'], :root => 'build'
@@ -1,18 +0,0 @@
1
- activate :blog
2
- # set :blog_permalink, ":year/:month/:day/:title.html"
3
- # set :blog_summary_separator, /READMORE/
4
- # set :blog_summary_length, 500
5
-
6
- page "/feed.xml", :layout => false
7
-
8
- # Build-specific configuration
9
- configure :build do
10
- # For example, change the Compass output style for deployment
11
- # activate :minify_css
12
-
13
- # Minify Javascript on build
14
- # activate :minify_javascript
15
-
16
- # Enable cache buster
17
- # activate :cache_buster
18
- end
@@ -1,6 +0,0 @@
1
- ---
2
- title: "New Article title"
3
- date: 01/01/2011
4
- ---
5
-
6
- Content of my article
@@ -1,10 +0,0 @@
1
- <h1>Archive: <%# @path %></h1>
2
- <ul class="archives">
3
- <% for entry in data.blog.articles %>
4
- <li>
5
- <a href="<%= entry.url %>"><%= entry.title %></a>
6
- <span><%= entry.date.strftime('%b %e') %></span>
7
- </li>
8
- <% end %>
9
- </ul>
10
-
@@ -1,23 +0,0 @@
1
- xml.instruct!
2
- xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
3
- xml.title "Blog Name"
4
- xml.subtitle "Blog subtitle"
5
- xml.id "http://blog.url.com/"
6
- xml.link "href" => "http://blog.url.com/"
7
- xml.link "href" => "http://blog.url.com/feed.xml", "rel" => "self"
8
- xml.updated data.blog.articles.first.date.to_time.iso8601
9
- xml.author { xml.name "Blog Author" }
10
-
11
- data.blog.articles.each do |article|
12
- xml.entry do
13
- xml.title article.title
14
- xml.link "rel" => "alternate", "href" => article.url
15
- xml.id article.url
16
- xml.published article.date.to_time.iso8601
17
- xml.updated article.date.to_time.iso8601
18
- xml.author { xml.name "Article Author" }
19
- xml.summary article.summary, "type" => "html"
20
- xml.content article.body, "type" => "html"
21
- end
22
- end
23
- end
@@ -1,9 +0,0 @@
1
- <% data.blog.articles[0...5].each_with_index do |article, i| %>
2
- <article class="<%= (i == 0) ? 'first' : '' %>">
3
- <h1><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e %Y') %></span></h1>
4
-
5
- <%= article.summary %>
6
-
7
- <div class="more"><a href="<%= article.url %>">read on &raquo;</a></div>
8
- </article>
9
- <% end %>
@@ -1,30 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv='X-UA-Compatible' content='IE=edge;chrome=1' />
6
- </head>
7
- <body>
8
-
9
- <div id="main" role="main">
10
- <% if is_blog_article? %>
11
- <% content_for :blog_article, yield %>
12
- <%= partial settings.blog_article_template %>
13
- <% else %>
14
- <%= yield %>
15
- <% end %>
16
- </div>
17
-
18
- <aside>
19
- <h2>
20
- Recent Articles
21
- <a href="/archives">Archive</a>
22
- </h2>
23
- <ol>
24
- <% data.blog.articles[0...10].each do |article| %>
25
- <li><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e') %></span></li>
26
- <% end %>
27
- </li>
28
- </aside>
29
- </body>
30
- </html>