middleman-core 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/features/helpers_select_tag.feature +19 -0
- data/lib/middleman-core.rb +4 -4
- data/lib/middleman-core/application.rb +40 -46
- data/lib/middleman-core/cli.rb +15 -15
- data/lib/middleman-core/cli/build.rb +26 -24
- data/lib/middleman-core/cli/bundler.rb +4 -4
- data/lib/middleman-core/cli/console.rb +6 -6
- data/lib/middleman-core/cli/extension.rb +12 -12
- data/lib/middleman-core/cli/init.rb +17 -17
- data/lib/middleman-core/cli/server.rb +28 -28
- data/lib/middleman-core/configuration.rb +2 -2
- data/lib/middleman-core/core_extensions.rb +23 -23
- data/lib/middleman-core/core_extensions/data.rb +5 -5
- data/lib/middleman-core/core_extensions/extensions.rb +6 -6
- data/lib/middleman-core/core_extensions/external_helpers.rb +2 -2
- data/lib/middleman-core/core_extensions/file_watcher.rb +3 -3
- data/lib/middleman-core/core_extensions/front_matter.rb +11 -11
- data/lib/middleman-core/core_extensions/rendering.rb +21 -21
- data/lib/middleman-core/core_extensions/request.rb +10 -8
- data/lib/middleman-core/core_extensions/routing.rb +1 -1
- data/lib/middleman-core/extensions.rb +5 -5
- data/lib/middleman-core/load_paths.rb +7 -7
- data/lib/middleman-core/logger.rb +13 -1
- data/lib/middleman-core/meta_pages.rb +2 -2
- data/lib/middleman-core/meta_pages/config_setting.rb +3 -3
- data/lib/middleman-core/meta_pages/sitemap_resource.rb +2 -2
- data/lib/middleman-core/meta_pages/sitemap_tree.rb +4 -4
- data/lib/middleman-core/preview_server.rb +16 -12
- data/lib/middleman-core/profiling.rb +1 -1
- data/lib/middleman-core/renderers/coffee_script.rb +1 -1
- data/lib/middleman-core/renderers/erb.rb +1 -1
- data/lib/middleman-core/renderers/haml.rb +1 -1
- data/lib/middleman-core/renderers/kramdown.rb +2 -2
- data/lib/middleman-core/renderers/less.rb +2 -2
- data/lib/middleman-core/renderers/liquid.rb +1 -1
- data/lib/middleman-core/renderers/markdown.rb +3 -3
- data/lib/middleman-core/renderers/redcarpet.rb +1 -1
- data/lib/middleman-core/renderers/sass.rb +7 -7
- data/lib/middleman-core/renderers/slim.rb +2 -2
- data/lib/middleman-core/renderers/stylus.rb +2 -2
- data/lib/middleman-core/sitemap.rb +8 -8
- data/lib/middleman-core/sitemap/extensions/ignores.rb +2 -2
- data/lib/middleman-core/sitemap/extensions/redirects.rb +4 -1
- data/lib/middleman-core/sitemap/extensions/traversal.rb +6 -6
- data/lib/middleman-core/sitemap/queryable.rb +3 -3
- data/lib/middleman-core/sitemap/resource.rb +6 -6
- data/lib/middleman-core/sitemap/store.rb +12 -12
- data/lib/middleman-core/step_definitions.rb +5 -5
- data/lib/middleman-core/step_definitions/builder_steps.rb +5 -5
- data/lib/middleman-core/step_definitions/server_steps.rb +6 -6
- data/lib/middleman-core/templates.rb +14 -14
- data/lib/middleman-core/templates/default.rb +17 -17
- data/lib/middleman-core/templates/empty.rb +3 -3
- data/lib/middleman-core/templates/extension/Gemfile +7 -7
- data/lib/middleman-core/templates/extension/Rakefile +1 -1
- data/lib/middleman-core/templates/extension/features/support/env.rb +2 -2
- data/lib/middleman-core/templates/extension/lib/lib.rb +2 -2
- data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +1 -1
- data/lib/middleman-core/templates/html5.rb +9 -9
- data/lib/middleman-core/templates/local.rb +3 -3
- data/lib/middleman-core/templates/mobile.rb +6 -6
- data/lib/middleman-core/templates/shared/config.tt +1 -1
- data/lib/middleman-core/util.rb +234 -182
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-more/core_extensions/compass.rb +3 -3
- data/lib/middleman-more/core_extensions/default_helpers.rb +21 -10
- data/lib/middleman-more/core_extensions/i18n.rb +18 -18
- data/lib/middleman-more/extensions/asset_hash.rb +7 -5
- data/lib/middleman-more/extensions/asset_host.rb +2 -2
- data/lib/middleman-more/extensions/automatic_alt_tags.rb +4 -4
- data/lib/middleman-more/extensions/automatic_image_sizes.rb +3 -3
- data/lib/middleman-more/extensions/cache_buster.rb +7 -7
- data/lib/middleman-more/extensions/lorem.rb +5 -5
- data/lib/middleman-more/extensions/minify_css.rb +4 -4
- data/lib/middleman-more/extensions/minify_javascript.rb +3 -3
- data/lib/middleman-more/extensions/relative_assets.rb +1 -1
- data/lib/middleman-more/templates/smacss.rb +10 -10
- data/lib/middleman/rack.rb +2 -2
- data/middleman-core.gemspec +1 -1
- metadata +6 -4
@@ -1,7 +1,7 @@
|
|
1
1
|
# Used for merging results of metadata callbacks
|
2
|
-
require
|
2
|
+
require 'active_support/core_ext/hash/deep_merge'
|
3
3
|
require 'monitor'
|
4
|
-
require
|
4
|
+
require 'middleman-core/sitemap/queryable'
|
5
5
|
|
6
6
|
module Middleman
|
7
7
|
|
@@ -24,7 +24,7 @@ module Middleman
|
|
24
24
|
# Initialize with parent app
|
25
25
|
# @param [Middleman::Application] app
|
26
26
|
def initialize(app)
|
27
|
-
@app
|
27
|
+
@app = app
|
28
28
|
@resources = []
|
29
29
|
@_cached_metadata = {}
|
30
30
|
@resource_list_manipulators = []
|
@@ -161,7 +161,7 @@ module Middleman
|
|
161
161
|
when Regexp
|
162
162
|
next result unless request_path =~ matcher
|
163
163
|
when String
|
164
|
-
next result unless File.fnmatch(
|
164
|
+
next result unless File.fnmatch('/' + Util.strip_leading_slash(matcher), "/#{request_path}")
|
165
165
|
end
|
166
166
|
|
167
167
|
metadata = callback.call(request_path).dup
|
@@ -178,14 +178,14 @@ module Middleman
|
|
178
178
|
def file_to_path(file)
|
179
179
|
file = File.join(@app.root, file)
|
180
180
|
|
181
|
-
prefix = @app.source_dir.sub(/\/$/,
|
181
|
+
prefix = @app.source_dir.sub(/\/$/, '') + '/'
|
182
182
|
return false unless file.start_with?(prefix)
|
183
183
|
|
184
|
-
path = file.sub(prefix,
|
184
|
+
path = file.sub(prefix, '')
|
185
185
|
|
186
186
|
# Replace a file name containing automatic_directory_matcher with a folder
|
187
187
|
unless @app.config[:automatic_directory_matcher].nil?
|
188
|
-
path = path.gsub(@app.config[:automatic_directory_matcher],
|
188
|
+
path = path.gsub(@app.config[:automatic_directory_matcher], '/')
|
189
189
|
end
|
190
190
|
|
191
191
|
extensionless_path(path)
|
@@ -211,7 +211,7 @@ module Middleman
|
|
211
211
|
return unless @needs_sitemap_rebuild
|
212
212
|
@needs_sitemap_rebuild = false
|
213
213
|
|
214
|
-
@app.logger.debug
|
214
|
+
@app.logger.debug '== Rebuilding resource list'
|
215
215
|
|
216
216
|
@resources = @resource_list_manipulators.inject([]) do |result, (_, inst)|
|
217
217
|
newres = inst.manipulate_resource_list(result)
|
@@ -244,7 +244,7 @@ module Middleman
|
|
244
244
|
# @return [String]
|
245
245
|
def remove_templating_extensions(path)
|
246
246
|
# Strip templating extensions as long as Tilt knows them
|
247
|
-
path = path.sub(File.extname(path),
|
247
|
+
path = path.sub(File.extname(path), '') while ::Tilt[path]
|
248
248
|
path
|
249
249
|
end
|
250
250
|
|
@@ -252,10 +252,10 @@ module Middleman
|
|
252
252
|
# @param [String] path
|
253
253
|
# @return [String]
|
254
254
|
def strip_away_locale(path)
|
255
|
-
if app.respond_to? :langs
|
255
|
+
if @app.respond_to? :langs
|
256
256
|
path_bits = path.split('.')
|
257
257
|
lang = path_bits.last
|
258
|
-
if app.langs.include?(lang.to_sym)
|
258
|
+
if @app.langs.include?(lang.to_sym)
|
259
259
|
return path_bits[0..-2].join('.')
|
260
260
|
end
|
261
261
|
end
|
@@ -270,7 +270,7 @@ module Middleman
|
|
270
270
|
input_ext = File.extname(file)
|
271
271
|
|
272
272
|
if !input_ext.empty?
|
273
|
-
input_ext = input_ext.split(
|
273
|
+
input_ext = input_ext.split('.').last.to_sym
|
274
274
|
if @app.template_extensions.has_key?(input_ext)
|
275
275
|
path << ".#{@app.template_extensions[input_ext]}"
|
276
276
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
MIDDLEMAN_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
2
|
-
MIDDLEMAN_BIN_PATH = File.join(MIDDLEMAN_ROOT_PATH,
|
2
|
+
MIDDLEMAN_BIN_PATH = File.join(MIDDLEMAN_ROOT_PATH, 'bin')
|
3
3
|
ENV['PATH'] = "#{MIDDLEMAN_BIN_PATH}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
5
|
+
require 'aruba/cucumber'
|
6
|
+
require 'middleman-core/step_definitions/middleman_steps'
|
7
|
+
require 'middleman-core/step_definitions/builder_steps'
|
8
|
+
require 'middleman-core/step_definitions/server_steps'
|
9
9
|
|
10
10
|
Before do
|
11
11
|
@aruba_timeout_seconds = 30
|
@@ -5,20 +5,20 @@ Before do
|
|
5
5
|
end
|
6
6
|
|
7
7
|
Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |path, config_name|
|
8
|
-
target = File.join(PROJECT_ROOT_PATH,
|
8
|
+
target = File.join(PROJECT_ROOT_PATH, 'fixtures', path)
|
9
9
|
config_path = File.join(current_dir, "config-#{config_name}.rb")
|
10
|
-
config_dest = File.join(current_dir,
|
10
|
+
config_dest = File.join(current_dir, 'config.rb')
|
11
11
|
FileUtils.cp(config_path, config_dest)
|
12
12
|
end
|
13
13
|
|
14
14
|
Given /^an empty app$/ do
|
15
15
|
step %Q{a directory named "empty_app"}
|
16
16
|
step %Q{I cd to "empty_app"}
|
17
|
-
ENV[
|
17
|
+
ENV['MM_ROOT'] = nil
|
18
18
|
end
|
19
19
|
|
20
20
|
Given /^a fixture app "([^\"]*)"$/ do |path|
|
21
|
-
ENV[
|
21
|
+
ENV['MM_ROOT'] = nil
|
22
22
|
|
23
23
|
# This step can be reentered from several places but we don't want
|
24
24
|
# to keep re-copying and re-cd-ing into ever-deeper directories
|
@@ -26,7 +26,7 @@ Given /^a fixture app "([^\"]*)"$/ do |path|
|
|
26
26
|
|
27
27
|
step %Q{a directory named "#{path}"}
|
28
28
|
|
29
|
-
target_path = File.join(PROJECT_ROOT_PATH,
|
29
|
+
target_path = File.join(PROJECT_ROOT_PATH, 'fixtures', path)
|
30
30
|
FileUtils.cp_r(target_path, current_dir)
|
31
31
|
|
32
32
|
step %Q{I cd to "#{path}"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'rack/test'
|
4
4
|
|
5
5
|
Given /^a clean server$/ do
|
6
6
|
@initialize_commands = []
|
@@ -9,7 +9,7 @@ end
|
|
9
9
|
Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state|
|
10
10
|
@initialize_commands ||= []
|
11
11
|
|
12
|
-
if state ==
|
12
|
+
if state == 'enabled'
|
13
13
|
@initialize_commands << lambda { activate(feature.to_sym) }
|
14
14
|
end
|
15
15
|
end
|
@@ -34,13 +34,13 @@ end
|
|
34
34
|
Given /^the Server is running$/ do
|
35
35
|
root_dir = File.expand_path(current_dir)
|
36
36
|
|
37
|
-
if File.exists?(File.join(root_dir,
|
38
|
-
ENV[
|
37
|
+
if File.exists?(File.join(root_dir, 'source'))
|
38
|
+
ENV['MM_SOURCE'] = 'source'
|
39
39
|
else
|
40
|
-
ENV[
|
40
|
+
ENV['MM_SOURCE'] = ''
|
41
41
|
end
|
42
42
|
|
43
|
-
ENV[
|
43
|
+
ENV['MM_ROOT'] = root_dir
|
44
44
|
|
45
45
|
initialize_commands = @initialize_commands || []
|
46
46
|
initialize_commands.unshift lambda {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Use thor for template generation
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require 'thor'
|
3
|
+
require 'thor/group'
|
4
4
|
|
5
5
|
# Templates namespace
|
6
6
|
module Middleman::Templates
|
@@ -37,14 +37,14 @@ module Middleman::Templates
|
|
37
37
|
# The gemfile template to use. Individual templates can define this class
|
38
38
|
# method to override the template path.
|
39
39
|
def self.gemfile_template
|
40
|
-
|
40
|
+
'shared/Gemfile.tt'
|
41
41
|
end
|
42
42
|
|
43
43
|
# Required path for the new project to be generated
|
44
44
|
argument :location, :type => :string
|
45
45
|
|
46
46
|
# Name of the template being used to generate the project.
|
47
|
-
class_option :template, :default =>
|
47
|
+
class_option :template, :default => 'default'
|
48
48
|
|
49
49
|
# Output a config.ru file for Rack if --rack is passed
|
50
50
|
class_option :rack, :type => :boolean, :default => false
|
@@ -53,7 +53,7 @@ module Middleman::Templates
|
|
53
53
|
# @return [void]
|
54
54
|
def generate_rack!
|
55
55
|
return unless options[:rack]
|
56
|
-
template
|
56
|
+
template 'shared/config.ru', File.join(location, 'config.ru')
|
57
57
|
end
|
58
58
|
|
59
59
|
class_option :'skip-bundle', :type => :boolean, :default => false
|
@@ -63,12 +63,12 @@ module Middleman::Templates
|
|
63
63
|
# @return [void]
|
64
64
|
def generate_bundler!
|
65
65
|
return if options[:'skip-gemfile']
|
66
|
-
template self.class.gemfile_template, File.join(location,
|
66
|
+
template self.class.gemfile_template, File.join(location, 'Gemfile')
|
67
67
|
|
68
68
|
return if options[:'skip-bundle']
|
69
69
|
inside(location) do
|
70
70
|
::Middleman::Cli::Bundle.new.invoke(:bundle)
|
71
|
-
end unless ENV[
|
71
|
+
end unless ENV['TEST']
|
72
72
|
end
|
73
73
|
|
74
74
|
# Output a .gitignore file
|
@@ -78,25 +78,25 @@ module Middleman::Templates
|
|
78
78
|
# @return [void]
|
79
79
|
def generate_gitignore!
|
80
80
|
return if options[:'skip-git']
|
81
|
-
copy_file
|
81
|
+
copy_file 'shared/gitignore', File.join(location, '.gitignore')
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
# Default template
|
87
|
-
require
|
87
|
+
require 'middleman-core/templates/default'
|
88
88
|
|
89
89
|
# HTML5 template
|
90
|
-
require
|
90
|
+
require 'middleman-core/templates/html5'
|
91
91
|
|
92
92
|
# HTML5 Mobile template
|
93
|
-
require
|
93
|
+
require 'middleman-core/templates/mobile'
|
94
94
|
|
95
95
|
# SMACSS templates
|
96
|
-
require
|
96
|
+
require 'middleman-more/templates/smacss'
|
97
97
|
|
98
98
|
# Local templates
|
99
|
-
require
|
99
|
+
require 'middleman-core/templates/local'
|
100
100
|
|
101
101
|
# Barebones template
|
102
|
-
require
|
102
|
+
require 'middleman-core/templates/empty'
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# Default Middleman template
|
2
2
|
class Middleman::Templates::Default < Middleman::Templates::Base
|
3
3
|
|
4
|
-
class_option
|
5
|
-
:default =>
|
4
|
+
class_option 'css_dir',
|
5
|
+
:default => 'stylesheets',
|
6
6
|
:desc => 'The path to the css files'
|
7
|
-
class_option
|
8
|
-
:default =>
|
7
|
+
class_option 'js_dir',
|
8
|
+
:default => 'javascripts',
|
9
9
|
:desc => 'The path to the javascript files'
|
10
|
-
class_option
|
11
|
-
:default =>
|
10
|
+
class_option 'images_dir',
|
11
|
+
:default => 'images',
|
12
12
|
:desc => 'The path to the image files'
|
13
13
|
|
14
14
|
# Template files are relative to this file
|
@@ -20,17 +20,17 @@ class Middleman::Templates::Default < Middleman::Templates::Base
|
|
20
20
|
# Actually output the files
|
21
21
|
# @return [void]
|
22
22
|
def build_scaffold!
|
23
|
-
template
|
24
|
-
copy_file
|
25
|
-
copy_file
|
26
|
-
empty_directory File.join(location,
|
27
|
-
copy_file
|
28
|
-
copy_file
|
29
|
-
empty_directory File.join(location,
|
30
|
-
copy_file
|
31
|
-
empty_directory File.join(location,
|
32
|
-
copy_file
|
33
|
-
copy_file
|
23
|
+
template 'shared/config.tt', File.join(location, 'config.rb')
|
24
|
+
copy_file 'default/source/index.html.erb', File.join(location, 'source/index.html.erb')
|
25
|
+
copy_file 'default/source/layouts/layout.erb', File.join(location, 'source/layouts/layout.erb')
|
26
|
+
empty_directory File.join(location, 'source', options[:css_dir])
|
27
|
+
copy_file 'default/source/stylesheets/all.css', File.join(location, 'source', options[:css_dir], 'all.css')
|
28
|
+
copy_file 'default/source/stylesheets/normalize.css', File.join(location, 'source', options[:css_dir], 'normalize.css')
|
29
|
+
empty_directory File.join(location, 'source', options[:js_dir])
|
30
|
+
copy_file 'default/source/javascripts/all.js', File.join(location, 'source', options[:js_dir], 'all.js')
|
31
|
+
empty_directory File.join(location, 'source', options[:images_dir])
|
32
|
+
copy_file 'default/source/images/background.png', File.join(location, 'source', options[:images_dir], 'background.png')
|
33
|
+
copy_file 'default/source/images/middleman.png', File.join(location, 'source', options[:images_dir], 'middleman.png')
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -8,14 +8,14 @@ class Middleman::Templates::Empty < Middleman::Templates::Base
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.gemfile_template
|
11
|
-
|
11
|
+
'empty/Gemfile.tt'
|
12
12
|
end
|
13
13
|
|
14
14
|
# Actually output the files
|
15
15
|
# @return [void]
|
16
16
|
def build_scaffold!
|
17
|
-
create_file File.join(location,
|
18
|
-
empty_directory File.join(location,
|
17
|
+
create_file File.join(location, 'config.rb'), "\n"
|
18
|
+
empty_directory File.join(location, 'source')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -6,14 +6,14 @@ source 'http://rubygems.org'
|
|
6
6
|
gemspec
|
7
7
|
|
8
8
|
group :development do
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rdoc'
|
11
|
+
gem 'yard'
|
12
12
|
end
|
13
13
|
|
14
14
|
group :test do
|
15
|
-
gem
|
16
|
-
gem
|
17
|
-
gem
|
18
|
-
gem
|
15
|
+
gem 'cucumber'
|
16
|
+
gem 'fivemat'
|
17
|
+
gem 'aruba'
|
18
|
+
gem 'rspec'
|
19
19
|
end
|
@@ -1,4 +1,4 @@
|
|
1
1
|
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require 'middleman-core'
|
3
|
+
require 'middleman-core/step_definitions'
|
4
4
|
require File.join(PROJECT_ROOT_PATH, 'lib', '<%= name %>')
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Require core library
|
2
|
-
require
|
2
|
+
require 'middleman-core'
|
3
3
|
|
4
4
|
# Extension namespace
|
5
5
|
class MyExtension < ::Middleman::Extension
|
6
|
-
option :my_option,
|
6
|
+
option :my_option, 'default', 'An example option'
|
7
7
|
|
8
8
|
def initialize(app, options_hash={}, &block)
|
9
9
|
# Call super to build options from the options_hash
|
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require '<%= name %>'
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# HTML5 Boilerplate template
|
2
2
|
class Middleman::Templates::Html5 < Middleman::Templates::Base
|
3
3
|
|
4
|
-
class_option
|
5
|
-
:default =>
|
4
|
+
class_option 'css_dir',
|
5
|
+
:default => 'css',
|
6
6
|
:desc => 'The path to the css files'
|
7
|
-
class_option
|
8
|
-
:default =>
|
7
|
+
class_option 'js_dir',
|
8
|
+
:default => 'js',
|
9
9
|
:desc => 'The path to the javascript files'
|
10
|
-
class_option
|
11
|
-
:default =>
|
10
|
+
class_option 'images_dir',
|
11
|
+
:default => 'img',
|
12
12
|
:desc => 'The path to the image files'
|
13
13
|
|
14
14
|
# Templates are relative to this file
|
@@ -20,9 +20,9 @@ class Middleman::Templates::Html5 < Middleman::Templates::Base
|
|
20
20
|
# Output the files
|
21
21
|
# @return [void]
|
22
22
|
def build_scaffold!
|
23
|
-
template
|
24
|
-
directory
|
25
|
-
empty_directory File.join(location,
|
23
|
+
template 'shared/config.tt', File.join(location, 'config.rb')
|
24
|
+
directory 'html5/source', File.join(location, 'source')
|
25
|
+
empty_directory File.join(location, 'source')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -4,7 +4,7 @@ class Middleman::Templates::Local < Middleman::Templates::Base
|
|
4
4
|
# Look for templates in ~/.middleman
|
5
5
|
# @return [String]
|
6
6
|
def self.source_root
|
7
|
-
File.join(File.expand_path(
|
7
|
+
File.join(File.expand_path('~/'), '.middleman')
|
8
8
|
end
|
9
9
|
|
10
10
|
# Just copy from the template path
|
@@ -15,10 +15,10 @@ class Middleman::Templates::Local < Middleman::Templates::Base
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# Iterate over the directories in the templates path and register each one.
|
18
|
-
Dir[File.join(Middleman::Templates::Local.source_root,
|
18
|
+
Dir[File.join(Middleman::Templates::Local.source_root, '*')].each do |dir|
|
19
19
|
next unless File.directory?(dir)
|
20
20
|
|
21
|
-
template_file = File.join(dir,
|
21
|
+
template_file = File.join(dir, 'template.rb')
|
22
22
|
|
23
23
|
if File.exists?(template_file)
|
24
24
|
require template_file
|
@@ -2,9 +2,9 @@
|
|
2
2
|
class Middleman::Templates::Mobile < Middleman::Templates::Base
|
3
3
|
|
4
4
|
# Slightly different paths
|
5
|
-
class_option :css_dir, :default =>
|
6
|
-
class_option :js_dir, :default =>
|
7
|
-
class_option :images_dir, :default =>
|
5
|
+
class_option :css_dir, :default => 'css'
|
6
|
+
class_option :js_dir, :default => 'js'
|
7
|
+
class_option :images_dir, :default => 'img'
|
8
8
|
|
9
9
|
# Template files are relative to this file
|
10
10
|
# @return [String]
|
@@ -15,9 +15,9 @@ class Middleman::Templates::Mobile < Middleman::Templates::Base
|
|
15
15
|
# Output the files
|
16
16
|
# @return [void]
|
17
17
|
def build_scaffold!
|
18
|
-
template
|
19
|
-
directory
|
20
|
-
empty_directory File.join(location,
|
18
|
+
template 'shared/config.tt', File.join(location, 'config.rb')
|
19
|
+
directory 'mobile/source', File.join(location, 'source')
|
20
|
+
empty_directory File.join(location, 'source')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|