middleman 1.1.0.beta.4 → 1.1.0.beta.5
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/.gitignore +1 -0
- data/.gitmodules +0 -0
- data/Rakefile +44 -0
- data/bin/mm-init +17 -9
- data/bin/mm-server +13 -6
- data/lib/middleman.rb +59 -0
- data/lib/middleman/features.rb +89 -8
- data/lib/middleman/{template → templates/default}/config.tt +0 -0
- data/lib/middleman/{template → templates/default}/views/index.html.haml +0 -0
- data/lib/middleman/{template → templates/default}/views/layout.haml +0 -0
- data/lib/middleman/{template → templates/default}/views/stylesheets/site.css.sass +0 -0
- data/lib/middleman/templates/html5boilerplate/config.tt +51 -0
- data/lib/middleman/templates/html5boilerplate/public/404.html +22 -0
- data/lib/middleman/templates/html5boilerplate/public/apple-touch-icon.png +0 -0
- data/lib/middleman/templates/html5boilerplate/public/crossdomain.xml +25 -0
- data/lib/middleman/templates/html5boilerplate/public/css/handheld.css +8 -0
- data/lib/middleman/templates/html5boilerplate/public/css/style.css +257 -0
- data/lib/middleman/templates/html5boilerplate/public/favicon.ico +0 -0
- data/lib/middleman/templates/html5boilerplate/public/humans.txt +43 -0
- data/lib/middleman/templates/html5boilerplate/public/images/.gitignore +2 -0
- data/lib/middleman/templates/html5boilerplate/public/index.html +81 -0
- data/lib/middleman/templates/html5boilerplate/public/js/libs/dd_belatedpng.js +13 -0
- data/lib/middleman/templates/html5boilerplate/public/js/libs/jquery-1.5.0.js +8176 -0
- data/lib/middleman/templates/html5boilerplate/public/js/libs/jquery-1.5.0.min.js +16 -0
- data/lib/middleman/templates/html5boilerplate/public/js/libs/modernizr-1.6.min.js +30 -0
- data/lib/middleman/templates/html5boilerplate/public/js/mylibs/.gitignore +2 -0
- data/lib/middleman/templates/html5boilerplate/public/js/plugins.js +13 -0
- data/lib/middleman/templates/html5boilerplate/public/js/script.js +26 -0
- data/lib/middleman/templates/html5boilerplate/public/robots.txt +5 -0
- data/lib/middleman/version.rb +1 -1
- data/middleman.gemspec +12 -9
- metadata +84 -35
data/.gitignore
CHANGED
data/.gitmodules
ADDED
File without changes
|
data/Rakefile
CHANGED
@@ -7,4 +7,48 @@ Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
|
7
7
|
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
8
8
|
end
|
9
9
|
|
10
|
+
#$LOAD_PATH.unshift 'lib'
|
11
|
+
|
12
|
+
require 'rake/testtask'
|
13
|
+
require 'rake/clean'
|
14
|
+
|
10
15
|
task :test => :cucumber
|
16
|
+
|
17
|
+
# rocco depends on rdiscount, which makes me sad.
|
18
|
+
unless defined?(JRUBY_VERSION)
|
19
|
+
# Bring in Rocco tasks
|
20
|
+
require 'rocco/tasks'
|
21
|
+
Rocco::make 'docs/'
|
22
|
+
|
23
|
+
desc 'Build rocco docs'
|
24
|
+
task :docs => :rocco
|
25
|
+
directory 'docs/'
|
26
|
+
|
27
|
+
# Make index.html a copy of rocco.html
|
28
|
+
file 'docs/index.html' => 'docs/middleman.html' do |f|
|
29
|
+
cp 'docs/middleman.html', 'docs/index.html', :preserve => true
|
30
|
+
end
|
31
|
+
task :docs => 'docs/index.html'
|
32
|
+
CLEAN.include 'docs/index.html'
|
33
|
+
|
34
|
+
desc 'Update gh-pages branch'
|
35
|
+
task :pages => ['docs/.git', :docs] do
|
36
|
+
rev = `git rev-parse --short HEAD`.strip
|
37
|
+
Dir.chdir 'docs' do
|
38
|
+
sh "git add *.html"
|
39
|
+
sh "git commit -m 'rebuild pages from #{rev}'" do |ok,res|
|
40
|
+
if ok
|
41
|
+
verbose { puts "gh-pages updated" }
|
42
|
+
sh "git push -q o HEAD:gh-pages"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Update the pages/ directory clone
|
49
|
+
file 'docs/.git' => ['docs/', '.git/refs/heads/gh-pages'] do |f|
|
50
|
+
sh "cd docs && git init -q && git remote add o ../.git" if !File.exist?(f.name)
|
51
|
+
sh "cd docs && git fetch -q o && git reset -q --hard o/gh-pages && touch ."
|
52
|
+
end
|
53
|
+
CLOBBER.include 'docs/.git'
|
54
|
+
end
|
data/bin/mm-init
CHANGED
@@ -7,24 +7,32 @@ module Middleman
|
|
7
7
|
class Generator < ::Thor::Group
|
8
8
|
include Thor::Actions
|
9
9
|
|
10
|
+
argument :location, :type => :string, :desc => "New project location"
|
11
|
+
|
12
|
+
class_option :template, :aliases => "-T", :default => "default", :desc => 'Optionally use a pre-defined project template: html5, default'
|
13
|
+
|
10
14
|
def self.source_root
|
11
|
-
File.join(File.dirname(__FILE__), '..', 'lib', 'middleman', '
|
15
|
+
File.join(File.dirname(__FILE__), '..', 'lib', 'middleman', 'templates')
|
12
16
|
end
|
13
17
|
|
14
|
-
argument :location, :type => :string, :desc => "New project location"
|
15
|
-
|
16
18
|
class_option :css_dir, :default => "stylesheets", :desc => 'The path to the css files'
|
17
19
|
class_option :js_dir, :default => "javascripts", :desc => 'The path to the javascript files'
|
18
20
|
class_option :images_dir, :default => "images", :desc => 'The path to the image files'
|
19
21
|
|
20
22
|
def create_project
|
21
|
-
template
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
if options[:template] == "html5"
|
24
|
+
template "html5boilerplate/config.tt", File.join(location, "config.rb")
|
25
|
+
directory "html5boilerplate/public", File.join(location, "public")
|
26
|
+
empty_directory File.join(location, "views")
|
27
|
+
else
|
28
|
+
template "default/config.tt", File.join(location, "config.rb")
|
29
|
+
directory "default/views", File.join(location, "views")
|
30
|
+
empty_directory File.join(location, "public", options[:css_dir])
|
31
|
+
empty_directory File.join(location, "public", options[:js_dir])
|
32
|
+
empty_directory File.join(location, "public", options[:images_dir])
|
33
|
+
end
|
26
34
|
end
|
27
35
|
end
|
28
36
|
end
|
29
37
|
|
30
|
-
Middleman::Generator.start
|
38
|
+
Middleman::Generator.start
|
data/bin/mm-server
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# Non-blocking site rebuilding
|
4
|
-
trap("TSTP") do
|
4
|
+
trap("TSTP") do
|
5
5
|
fork do
|
6
6
|
require "open3"
|
7
7
|
first_run = true
|
@@ -38,7 +38,7 @@ OptionParser.new { |opts|
|
|
38
38
|
opts.on("--debug", "Debug mode") {
|
39
39
|
::Middleman::Server.set :logging, true
|
40
40
|
}
|
41
|
-
|
41
|
+
|
42
42
|
opts.parse! ARGV
|
43
43
|
}
|
44
44
|
|
@@ -54,9 +54,16 @@ end
|
|
54
54
|
app = Middleman::Server.new
|
55
55
|
|
56
56
|
require 'rubygems'
|
57
|
-
require 'thin'
|
58
|
-
Thin::Logging.silent = true
|
59
57
|
|
60
|
-
|
58
|
+
unless defined?(JRUBY_VERSION)
|
59
|
+
require 'thin'
|
60
|
+
handler = Rack::Handler::Thin
|
61
|
+
else
|
62
|
+
require 'kirk'
|
63
|
+
require 'rack/handler/kirk'
|
64
|
+
handler = Rack::Handler::Kirk
|
65
|
+
end
|
66
|
+
|
67
|
+
handler.run app, options do |inst|
|
61
68
|
puts "== The Middleman is standing watch on port #{options[:Port]}"
|
62
|
-
end
|
69
|
+
end
|
data/lib/middleman.rb
CHANGED
@@ -1,15 +1,74 @@
|
|
1
|
+
# Middleman is a static site renderer that provides all the conveniences of
|
2
|
+
# a modern web stack, like Ruby on Rails, while remaining focused on building
|
3
|
+
# the fastest, most-professional sites possible
|
4
|
+
#
|
5
|
+
# Install Middleman:
|
6
|
+
#
|
7
|
+
# gem install middleman
|
8
|
+
#
|
9
|
+
# To accomplish its goals, Middleman supports provides access to:
|
10
|
+
#
|
11
|
+
#### Command-line tools:
|
12
|
+
# * **mm-init**: A tool for creating to new static sites.
|
13
|
+
# * **mm-server**: A tool for rapidly developing your static site.
|
14
|
+
# * **mm-build**: A tool for exporting your site into optimized HTML, CSS & JS.
|
15
|
+
#
|
16
|
+
#### Tons of templating languages including:
|
17
|
+
# * ERB (.erb)
|
18
|
+
# * Interpolated String (.str)
|
19
|
+
# * Sass (.sass)
|
20
|
+
# * Scss (.scss)
|
21
|
+
# * Haml (.haml)
|
22
|
+
# * Sass (.sass)
|
23
|
+
# * Less CSS (.less)
|
24
|
+
# * Builder (.builder)
|
25
|
+
# * Liquid (.liquid)
|
26
|
+
# * RDiscount (.markdown)
|
27
|
+
# * RedCloth (.textile)
|
28
|
+
# * RDoc (.rdoc)
|
29
|
+
# * Radius (.radius)
|
30
|
+
# * Markaby (.mab)
|
31
|
+
# * Nokogiri (.nokogiri)
|
32
|
+
# * Mustache (.mustache)
|
33
|
+
# * CoffeeScript (.coffee)
|
34
|
+
#
|
35
|
+
#### Compile-time Optimiztions
|
36
|
+
# * Javascript Minifiers: YUI, Google Closure & UglifyJS
|
37
|
+
# * Smush.it Image Compression
|
38
|
+
# * CSS Minification
|
39
|
+
#
|
40
|
+
#### Robust Extensions:
|
41
|
+
# Add your own runtime and build-time features!
|
42
|
+
#
|
43
|
+
#### Next Steps:
|
44
|
+
# * [Visit the website]
|
45
|
+
# * [Read the wiki]
|
46
|
+
# * [Email the users group]
|
47
|
+
# * [Submit bug reports]
|
48
|
+
#
|
49
|
+
# [Visit the website]: http://middlemanapp.com
|
50
|
+
# [Read the wiki]: https://github.com/tdreyno/middleman/wiki
|
51
|
+
# [Email the users group]: http://groups.google.com/group/middleman-users
|
52
|
+
# [Submit bug reports]: https://github.com/tdreyno/middleman/issues
|
53
|
+
|
54
|
+
# Setup out load paths
|
1
55
|
libdir = File.dirname(__FILE__)
|
2
56
|
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
3
57
|
|
58
|
+
# Require Rubygems (probably not necessary)
|
4
59
|
require 'rubygems'
|
5
60
|
|
61
|
+
# Top-level Middleman object
|
6
62
|
module Middleman
|
63
|
+
# Auto-load modules on-demand
|
7
64
|
autoload :Server, "middleman/server"
|
8
65
|
|
66
|
+
# Custom Renderers
|
9
67
|
module Renderers
|
10
68
|
autoload :Haml, "middleman/renderers/haml"
|
11
69
|
autoload :Sass, "middleman/renderers/sass"
|
12
70
|
end
|
13
71
|
|
72
|
+
# Features API
|
14
73
|
autoload :Features, "middleman/features"
|
15
74
|
end
|
data/lib/middleman/features.rb
CHANGED
@@ -1,33 +1,114 @@
|
|
1
|
+
# Middleman provides an extension API which allows you to hook into the
|
2
|
+
# lifecycle of a page request, or static build, and manipulate the output.
|
3
|
+
# Internal to Middleman, these extensions are called "features," but we use
|
4
|
+
# the exact same API as is made available to the public.
|
5
|
+
#
|
6
|
+
# A Middleman extension looks like this:
|
7
|
+
#
|
8
|
+
# module MyExtension
|
9
|
+
# class << self
|
10
|
+
# def registered(app)
|
11
|
+
# # My Code
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# In your `config.rb`, you must load your extension (if it is not defined in
|
17
|
+
# that file) and call `activate`.
|
18
|
+
#
|
19
|
+
# require "my_extension"
|
20
|
+
# activate MyExtension
|
21
|
+
#
|
22
|
+
# This will call the `registered` method in your extension and provide you
|
23
|
+
# with the `app` parameter which is a Middleman::Server context. From here
|
24
|
+
# you can choose to respond to requests for certain paths or simply attach
|
25
|
+
# Rack middleware to the stack.
|
26
|
+
#
|
27
|
+
# The built-in features cover a wide range of functions. Some provide helper
|
28
|
+
# methods to use in your views. Some modify the output on-the-fly. And some
|
29
|
+
# apply computationally-intensive changes to your final build files.
|
30
|
+
|
1
31
|
module Middleman::Features
|
32
|
+
|
33
|
+
# RelativeAssets allow any asset path in dynamic templates to be either
|
34
|
+
# relative to the root of the project or use an absolute URL.
|
2
35
|
autoload :RelativeAssets, "middleman/features/relative_assets"
|
36
|
+
|
37
|
+
# AssetHost allows you to setup multiple domains to host your static assets.
|
38
|
+
# Calls to asset paths in dynamic templates will then rotate through each of
|
39
|
+
# the asset servers to better spread the load.
|
3
40
|
autoload :AssetHost, "middleman/features/asset_host"
|
41
|
+
|
42
|
+
# CacheBuster adds a query string to assets in dynamic templates to avoid
|
43
|
+
# browser caches failing to update to your new content.
|
4
44
|
autoload :CacheBuster, "middleman/features/cache_buster"
|
45
|
+
|
46
|
+
# DefaultHelpers are the built-in dynamic template helpers.
|
5
47
|
autoload :DefaultHelpers, "middleman/features/default_helpers"
|
48
|
+
|
49
|
+
# AutomaticImageSizes inspects the images used in your dynamic templates and
|
50
|
+
# automatically adds width and height attributes to their HTML elements.
|
6
51
|
autoload :AutomaticImageSizes, "middleman/features/automatic_image_sizes"
|
52
|
+
|
53
|
+
# UglyHaml enables the non-indented output format from Haml templates. Useful
|
54
|
+
# for somewhat obfuscating the output and hiding the fact that you're using Haml.
|
7
55
|
autoload :UglyHaml, "middleman/features/ugly_haml"
|
56
|
+
|
57
|
+
# MinifyCss uses the YUI compressor to shrink CSS files
|
8
58
|
autoload :MinifyCss, "middleman/features/minify_css"
|
59
|
+
|
60
|
+
# MinifyJavascript uses the YUI compressor to shrink JS files
|
9
61
|
autoload :MinifyJavascript, "middleman/features/minify_javascript"
|
62
|
+
|
63
|
+
# Slickmap (http://astuteo.com/slickmap/) is a beautiful sitemap tool which
|
64
|
+
# will attempt to generate a `sitemap.html` file from your project.
|
10
65
|
autoload :Slickmap, "middleman/features/slickmap"
|
66
|
+
|
67
|
+
# SmushPngs uses Yahoo's Smush.it API to compresses PNGs and JPGs. Often times
|
68
|
+
# the service can decrease the size of Photoshop-exported images by 30-50%
|
11
69
|
autoload :SmushPngs, "middleman/features/smush_pngs"
|
70
|
+
|
71
|
+
# CodeRay is a syntax highlighter.
|
12
72
|
autoload :CodeRay, "middleman/features/code_ray"
|
73
|
+
|
74
|
+
# Lorem provides a handful of helpful prototyping methods to generate words,
|
75
|
+
# paragraphs, fake images, names and email addresses.
|
13
76
|
autoload :Lorem, "middleman/features/lorem"
|
14
|
-
|
15
|
-
|
77
|
+
|
78
|
+
# LiveReload will auto-reload browsers with the live reload extension installed after changes
|
79
|
+
# Currently disabled and untested.
|
80
|
+
#autoload :LiveReload, "middleman/features/live_reload"
|
81
|
+
|
82
|
+
# The Feature API is itself a Feature. Mind blowing!
|
16
83
|
class << self
|
17
84
|
def registered(app)
|
18
85
|
app.extend ClassMethods
|
19
86
|
end
|
20
87
|
alias :included :registered
|
21
88
|
end
|
22
|
-
|
89
|
+
|
23
90
|
module ClassMethods
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
91
|
+
# This method is available in the project's `config.rb`.
|
92
|
+
# It takes a underscore-separated symbol, finds the appropriate
|
93
|
+
# feature module and includes it.
|
94
|
+
#
|
95
|
+
# activate :lorem
|
96
|
+
#
|
97
|
+
# Alternatively, you can pass in a Middleman feature module directly.
|
98
|
+
#
|
99
|
+
# activate MyFeatureModule
|
100
|
+
def activate(feature)
|
101
|
+
feature = feature.to_s if feature.is_a? Symbol
|
102
|
+
|
103
|
+
if feature.is_a? String
|
104
|
+
feature = feature.camelize
|
105
|
+
feature = Middleman::Features.const_get(feature)
|
28
106
|
end
|
107
|
+
|
108
|
+
register feature
|
29
109
|
end
|
30
|
-
|
110
|
+
|
111
|
+
# Deprecated API. Please use `activate` instead.
|
31
112
|
def enable(feature_name)
|
32
113
|
$stderr.puts "Warning: Feature activation has been renamed from enable to activate"
|
33
114
|
activate(feature_name)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# html5boilerplate uses "css"
|
2
|
+
set :css_dir, "css"
|
3
|
+
|
4
|
+
# html5boilerplate uses "js"
|
5
|
+
set :js_dir, "js"
|
6
|
+
|
7
|
+
# html5boilerplate uses "images"
|
8
|
+
set :images_dir, "images"
|
9
|
+
|
10
|
+
# Per-page layout changes
|
11
|
+
# With no layout
|
12
|
+
# page "/path/to/file.html", :layout => false
|
13
|
+
# With alternative layout
|
14
|
+
# page "/path/to/file.html", :layout => :otherlayout
|
15
|
+
|
16
|
+
# Helpers
|
17
|
+
helpers do
|
18
|
+
def some_helper(*args)
|
19
|
+
"Helping"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Automatic sitemaps
|
24
|
+
# activate :slickmap
|
25
|
+
|
26
|
+
# CodeRay syntax highlighting in Haml
|
27
|
+
# activate :code_ray
|
28
|
+
|
29
|
+
# Automatic image dimension calculations in Haml
|
30
|
+
# activate :automatic_image_sizes
|
31
|
+
|
32
|
+
# Build-specific configuration
|
33
|
+
configure :build do
|
34
|
+
# For example, change the Compass output style for deployment
|
35
|
+
# activate :minify_css
|
36
|
+
|
37
|
+
# Minify Javascript on build
|
38
|
+
# activate :minify_javascript
|
39
|
+
|
40
|
+
# Shrink/smush PNG/JPEGs on build
|
41
|
+
# activate :smush_pngs
|
42
|
+
|
43
|
+
# Enable cache buster
|
44
|
+
# activate :cache_buster
|
45
|
+
|
46
|
+
# Generate ugly/obfuscated HTML from Haml
|
47
|
+
# activate :ugly_haml
|
48
|
+
|
49
|
+
# Or use a different image path
|
50
|
+
# set :http_path, "/Content/images/"
|
51
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<title>not found</title>
|
3
|
+
|
4
|
+
<style>
|
5
|
+
body { text-align: center;}
|
6
|
+
h1 { font-size: 50px; }
|
7
|
+
body { font: 20px Constantia, 'Hoefler Text', "Adobe Caslon Pro", Baskerville, Georgia, Times, serif; color: #999; text-shadow: 2px 2px 2px rgba(200, 200, 200, 0.5); }
|
8
|
+
::-moz-selection{ background:#FF5E99; color:#fff; }
|
9
|
+
::selection { background:#FF5E99; color:#fff; }
|
10
|
+
details { display:block; }
|
11
|
+
a { color: rgb(36, 109, 56); text-decoration:none; }
|
12
|
+
a:hover { color: rgb(96, 73, 141) ; text-shadow: 2px 2px 2px rgba(36, 109, 56, 0.5); }
|
13
|
+
span[frown] { transform: rotate(90deg); display:inline-block; color: #bbb; }
|
14
|
+
</style>
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
<details>
|
20
|
+
<summary><h1>Not found</h1></summary>
|
21
|
+
<p><span frown>:(</span></p>
|
22
|
+
</details>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
|
3
|
+
<cross-domain-policy>
|
4
|
+
|
5
|
+
|
6
|
+
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
|
7
|
+
|
8
|
+
<!-- Most restrictive policy: -->
|
9
|
+
<site-control permitted-cross-domain-policies="none"/>
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<!-- Least restrictive policy: -->
|
14
|
+
<!--
|
15
|
+
<site-control permitted-cross-domain-policies="all"/>
|
16
|
+
<allow-access-from domain="*" to-ports="*" secure="false"/>
|
17
|
+
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
|
18
|
+
-->
|
19
|
+
<!--
|
20
|
+
If you host a crossdomain.xml file with allow-access-from domain=“*”
|
21
|
+
and don’t understand all of the points described here, you probably
|
22
|
+
have a nasty security vulnerability. ~ simon willison
|
23
|
+
-->
|
24
|
+
|
25
|
+
</cross-domain-policy>
|