middleman-core 3.3.2 → 3.3.3
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.
- checksums.yaml +4 -4
- data/features/helpers_select_tag.feature +6 -8
- data/lib/middleman-core.rb +1 -2
- data/lib/middleman-core/application.rb +10 -9
- data/lib/middleman-core/cli.rb +9 -13
- data/lib/middleman-core/cli/build.rb +26 -27
- data/lib/middleman-core/cli/bundler.rb +6 -7
- data/lib/middleman-core/cli/console.rb +10 -13
- data/lib/middleman-core/cli/extension.rb +2 -4
- data/lib/middleman-core/cli/init.rb +27 -28
- data/lib/middleman-core/cli/server.rb +43 -44
- data/lib/middleman-core/configuration.rb +13 -11
- data/lib/middleman-core/core_extensions/data.rb +21 -29
- data/lib/middleman-core/core_extensions/extensions.rb +8 -8
- data/lib/middleman-core/core_extensions/external_helpers.rb +3 -5
- data/lib/middleman-core/core_extensions/file_watcher.rb +7 -11
- data/lib/middleman-core/core_extensions/front_matter.rb +5 -6
- data/lib/middleman-core/core_extensions/rendering.rb +40 -30
- data/lib/middleman-core/core_extensions/request.rb +16 -19
- data/lib/middleman-core/core_extensions/routing.rb +37 -36
- data/lib/middleman-core/core_extensions/show_exceptions.rb +1 -5
- data/lib/middleman-core/extension.rb +14 -16
- data/lib/middleman-core/extensions.rb +4 -6
- data/lib/middleman-core/load_paths.rb +3 -6
- data/lib/middleman-core/logger.rb +1 -3
- data/lib/middleman-core/meta_pages.rb +11 -11
- data/lib/middleman-core/meta_pages/config_setting.rb +4 -4
- 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 +12 -11
- data/lib/middleman-core/profiling.rb +6 -8
- data/lib/middleman-core/renderers/asciidoc.rb +12 -13
- data/lib/middleman-core/renderers/coffee_script.rb +2 -4
- data/lib/middleman-core/renderers/erb.rb +3 -4
- data/lib/middleman-core/renderers/haml.rb +2 -4
- data/lib/middleman-core/renderers/kramdown.rb +3 -4
- data/lib/middleman-core/renderers/less.rb +3 -9
- data/lib/middleman-core/renderers/liquid.rb +4 -8
- data/lib/middleman-core/renderers/markdown.rb +7 -11
- data/lib/middleman-core/renderers/redcarpet.rb +14 -16
- data/lib/middleman-core/renderers/sass.rb +36 -15
- data/lib/middleman-core/renderers/slim.rb +7 -10
- data/lib/middleman-core/renderers/stylus.rb +2 -6
- data/lib/middleman-core/sitemap.rb +6 -13
- data/lib/middleman-core/sitemap/extensions/ignores.rb +4 -10
- data/lib/middleman-core/sitemap/extensions/on_disk.rb +3 -7
- data/lib/middleman-core/sitemap/extensions/proxies.rb +7 -12
- data/lib/middleman-core/sitemap/extensions/redirects.rb +7 -15
- data/lib/middleman-core/sitemap/extensions/request_endpoints.rb +7 -15
- data/lib/middleman-core/sitemap/extensions/traversal.rb +4 -7
- data/lib/middleman-core/sitemap/queryable.rb +22 -27
- data/lib/middleman-core/sitemap/resource.rb +13 -25
- data/lib/middleman-core/sitemap/store.rb +11 -15
- data/lib/middleman-core/templates.rb +9 -12
- data/lib/middleman-core/templates/default.rb +6 -7
- data/lib/middleman-core/templates/empty.rb +0 -1
- data/lib/middleman-core/templates/extension/Gemfile +1 -1
- data/lib/middleman-core/templates/extension/Rakefile +2 -2
- data/lib/middleman-core/templates/extension/lib/lib.rb +0 -1
- data/lib/middleman-core/templates/html5.rb +6 -7
- data/lib/middleman-core/templates/local.rb +1 -2
- data/lib/middleman-core/templates/mobile.rb +3 -4
- data/lib/middleman-core/templates/shared/config.ru +1 -1
- data/lib/middleman-core/util.rb +5 -6
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-more/core_extensions/compass.rb +0 -1
- data/lib/middleman-more/core_extensions/default_helpers.rb +25 -16
- data/lib/middleman-more/core_extensions/i18n.rb +24 -23
- data/lib/middleman-more/extensions/asset_hash.rb +4 -6
- data/lib/middleman-more/extensions/asset_host.rb +1 -1
- data/lib/middleman-more/extensions/automatic_alt_tags.rb +2 -3
- data/lib/middleman-more/extensions/automatic_image_sizes.rb +4 -5
- data/lib/middleman-more/extensions/cache_buster.rb +0 -1
- data/lib/middleman-more/extensions/gzip.rb +1 -1
- data/lib/middleman-more/extensions/lorem.rb +8 -8
- data/lib/middleman-more/extensions/minify_css.rb +9 -8
- data/lib/middleman-more/extensions/minify_javascript.rb +5 -6
- data/lib/middleman-more/extensions/relative_assets.rb +0 -1
- data/lib/middleman-more/templates/smacss.rb +6 -7
- data/middleman-core.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3be0033e0fe168ddaf3b6edbf98dc5a6fd883ac8
|
|
4
|
+
data.tar.gz: b2bb2e6bb90275633f18cf7024b2f28b6f7303b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3ebea0c549b8ece9887febef7c3afaf3c0fc6c95d013ae1f105f5d3d5456a0e50578d4ebe29f210062c14ad48caa62c4a444ab36245c12f6e7669b7ca5964b5b
|
|
7
|
+
data.tar.gz: 543d0c4944a14b1e9f1a146b7dab4077486568735dcd79fc0021f1da3909059e71fa184647be75dcb31469331b746b067b8be796d47379654e3c1bdd559e5f50
|
|
@@ -9,11 +9,9 @@ Feature: select_tag helper
|
|
|
9
9
|
"""
|
|
10
10
|
And the Server is running at "indexable-app"
|
|
11
11
|
When I go to "/select_tag.html"
|
|
12
|
-
Then I should see
|
|
13
|
-
""
|
|
14
|
-
|
|
15
|
-
<option value="
|
|
16
|
-
<option value="
|
|
17
|
-
|
|
18
|
-
</select>
|
|
19
|
-
"""
|
|
12
|
+
Then I should see '<select name="colors"'
|
|
13
|
+
Then I should see '<option value="">Choose a color</option>'
|
|
14
|
+
Then I should see '<option value="red">red</option>'
|
|
15
|
+
Then I should see '<option value="blue">blue</option>'
|
|
16
|
+
Then I should see '<option value="blorange">blorange</option>'
|
|
17
|
+
Then I should see '</select>'
|
data/lib/middleman-core.rb
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# Setup our load paths
|
|
2
|
+
# rubocop:disable FileName
|
|
2
3
|
libdir = File.expand_path(File.dirname(__FILE__))
|
|
3
4
|
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
4
5
|
|
|
5
6
|
# Top-level Middleman namespace
|
|
6
7
|
module Middleman
|
|
7
|
-
|
|
8
8
|
# Backwards compatibility namespace
|
|
9
9
|
module Features; end
|
|
10
|
-
|
|
11
10
|
end
|
|
12
11
|
|
|
13
12
|
require 'middleman-core/version'
|
|
@@ -52,20 +52,20 @@ module Middleman
|
|
|
52
52
|
class_eval(&block) if block_given?
|
|
53
53
|
include(*extensions) if extensions.any?
|
|
54
54
|
end
|
|
55
|
-
delegate :helpers, :
|
|
55
|
+
delegate :helpers, to: :"self.class"
|
|
56
56
|
|
|
57
57
|
# Root project directory (overwritten in middleman build/server)
|
|
58
58
|
# @return [String]
|
|
59
59
|
def self.root
|
|
60
60
|
ENV['MM_ROOT'] || Dir.pwd
|
|
61
61
|
end
|
|
62
|
-
delegate :root, :
|
|
62
|
+
delegate :root, to: :"self.class"
|
|
63
63
|
|
|
64
64
|
# Pathname-addressed root
|
|
65
65
|
def self.root_path
|
|
66
66
|
Pathname(root)
|
|
67
67
|
end
|
|
68
|
-
delegate :root_path, :
|
|
68
|
+
delegate :root_path, to: :"self.class"
|
|
69
69
|
|
|
70
70
|
# Name of the source directory
|
|
71
71
|
# @return [String]
|
|
@@ -162,12 +162,13 @@ module Middleman
|
|
|
162
162
|
# with_layout and page routing
|
|
163
163
|
include Middleman::CoreExtensions::Routing
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
# Reference to Logger singleton
|
|
166
|
+
def logger
|
|
167
|
+
::Middleman::Logger.singleton
|
|
168
|
+
end
|
|
166
169
|
|
|
167
170
|
# Initialize the Middleman project
|
|
168
171
|
def initialize(&block)
|
|
169
|
-
@logger = ::Middleman::Logger.singleton
|
|
170
|
-
|
|
171
172
|
# Clear the static class cache
|
|
172
173
|
cache.clear
|
|
173
174
|
|
|
@@ -194,7 +195,7 @@ module Middleman
|
|
|
194
195
|
def self.cache
|
|
195
196
|
@_cache ||= ::Tilt::Cache.new
|
|
196
197
|
end
|
|
197
|
-
delegate :cache, :
|
|
198
|
+
delegate :cache, to: :"self.class"
|
|
198
199
|
|
|
199
200
|
# Whether we're in development mode
|
|
200
201
|
# @return [Boolean] If we're in dev mode
|
|
@@ -215,7 +216,7 @@ module Middleman
|
|
|
215
216
|
File.join(root, config[:source])
|
|
216
217
|
end
|
|
217
218
|
|
|
218
|
-
delegate :instrument, :
|
|
219
|
+
delegate :instrument, to: ::Middleman::Util
|
|
219
220
|
|
|
220
221
|
# Work around this bug: http://bugs.ruby-lang.org/issues/4521
|
|
221
222
|
# where Ruby will call to_s/inspect while printing exception
|
|
@@ -224,7 +225,7 @@ module Middleman
|
|
|
224
225
|
def to_s
|
|
225
226
|
"#<Middleman::Application:0x#{object_id}>"
|
|
226
227
|
end
|
|
227
|
-
|
|
228
|
+
alias_method :inspect, :to_s # Ruby 2.0 calls inspect for NoMethodError instead of to_s
|
|
228
229
|
|
|
229
230
|
# Hooks clones _hooks from the class to the instance.
|
|
230
231
|
# https://github.com/apotonick/hooks/blob/master/lib/hooks/instance_hooks.rb#L10
|
data/lib/middleman-core/cli.rb
CHANGED
|
@@ -4,9 +4,7 @@ require 'thor/group'
|
|
|
4
4
|
|
|
5
5
|
# CLI Module
|
|
6
6
|
module Middleman
|
|
7
|
-
|
|
8
7
|
module Cli
|
|
9
|
-
|
|
10
8
|
# The base task from which everything else etends
|
|
11
9
|
class Base < Thor
|
|
12
10
|
class << self
|
|
@@ -32,19 +30,20 @@ module Middleman
|
|
|
32
30
|
# @param [Symbol, String, nil] meth
|
|
33
31
|
# @param [Boolean] subcommand
|
|
34
32
|
# @return [void]
|
|
35
|
-
|
|
33
|
+
# rubocop:disable UnusedMethodArgument
|
|
34
|
+
def help(meth=nil, subcommand=false)
|
|
36
35
|
if meth && !self.respond_to?(meth)
|
|
37
36
|
klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}")
|
|
38
|
-
klass.start(['-h', task].compact, :
|
|
37
|
+
klass.start(['-h', task].compact, shell: shell)
|
|
39
38
|
else
|
|
40
39
|
list = []
|
|
41
40
|
Thor::Util.thor_classes_in(Middleman::Cli).each do |thor_class|
|
|
42
41
|
list += thor_class.printable_tasks(false)
|
|
43
42
|
end
|
|
44
|
-
list.sort!{ |a,b| a[0] <=> b[0] }
|
|
43
|
+
list.sort! { |a, b| a[0] <=> b[0] }
|
|
45
44
|
|
|
46
45
|
shell.say 'Tasks:'
|
|
47
|
-
shell.print_table(list, :
|
|
46
|
+
shell.print_table(list, ident: 2, truncate: true)
|
|
48
47
|
shell.say
|
|
49
48
|
end
|
|
50
49
|
end
|
|
@@ -53,27 +52,24 @@ module Middleman
|
|
|
53
52
|
# @param [Symbol] meth
|
|
54
53
|
def method_missing(meth, *args)
|
|
55
54
|
meth = meth.to_s
|
|
56
|
-
|
|
57
|
-
if self.class.map.has_key?(meth)
|
|
58
|
-
meth = self.class.map[meth]
|
|
59
|
-
end
|
|
55
|
+
meth = self.class.map[meth] if self.class.map.key?(meth)
|
|
60
56
|
|
|
61
57
|
klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}")
|
|
62
58
|
|
|
63
59
|
if klass.nil?
|
|
64
60
|
tasks_dir = File.join(Dir.pwd, 'tasks')
|
|
65
61
|
|
|
66
|
-
if File.
|
|
62
|
+
if File.exist?(tasks_dir)
|
|
67
63
|
Dir[File.join(tasks_dir, '**/*_task.rb')].each { |f| require f }
|
|
68
64
|
klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}")
|
|
69
65
|
end
|
|
70
66
|
end
|
|
71
67
|
|
|
72
68
|
if klass.nil?
|
|
73
|
-
raise Thor::Error
|
|
69
|
+
raise Thor::Error, "There's no '#{meth}' command for Middleman. Try 'middleman help' for a list of commands."
|
|
74
70
|
else
|
|
75
71
|
args.unshift(task) if task
|
|
76
|
-
klass.start(args, :
|
|
72
|
+
klass.start(args, shell: shell)
|
|
77
73
|
end
|
|
78
74
|
end
|
|
79
75
|
end
|
|
@@ -4,7 +4,7 @@ require 'set'
|
|
|
4
4
|
# CLI Module
|
|
5
5
|
module Middleman::Cli
|
|
6
6
|
# Alias "b" to "build"
|
|
7
|
-
Base.map(
|
|
7
|
+
Base.map('b' => 'build')
|
|
8
8
|
|
|
9
9
|
# The CLI Build class
|
|
10
10
|
class Build < Thor
|
|
@@ -19,31 +19,31 @@ module Middleman::Cli
|
|
|
19
19
|
|
|
20
20
|
desc 'build [options]', 'Builds the static site for deployment'
|
|
21
21
|
method_option :clean,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
type: :boolean,
|
|
23
|
+
default: true,
|
|
24
|
+
desc: 'Remove orphaned files from build (--no-clean to disable)'
|
|
25
25
|
method_option :glob,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
type: :string,
|
|
27
|
+
aliases: '-g',
|
|
28
|
+
default: nil,
|
|
29
|
+
desc: 'Build a subset of the project'
|
|
30
30
|
method_option :verbose,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
type: :boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
desc: 'Print debug messages'
|
|
34
34
|
method_option :instrument,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
type: :string,
|
|
36
|
+
default: false,
|
|
37
|
+
desc: 'Print instrument messages'
|
|
38
38
|
method_option :profile,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
type: :boolean,
|
|
40
|
+
default: false,
|
|
41
|
+
desc: 'Generate profiling report for the build'
|
|
42
42
|
|
|
43
43
|
# Core build Thor command
|
|
44
44
|
# @return [void]
|
|
45
45
|
def build
|
|
46
|
-
|
|
46
|
+
unless ENV['MM_ROOT']
|
|
47
47
|
raise Thor::Error, 'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?'
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -62,7 +62,7 @@ module Middleman::Cli
|
|
|
62
62
|
self.class.shared_instance(options['verbose'], options['instrument'])
|
|
63
63
|
|
|
64
64
|
opts = {}
|
|
65
|
-
opts[:glob] = options['glob'] if options.
|
|
65
|
+
opts[:glob] = options['glob'] if options.key?('glob')
|
|
66
66
|
opts[:clean] = options['clean']
|
|
67
67
|
|
|
68
68
|
self.class.shared_instance.run_hook :before_build, self
|
|
@@ -71,15 +71,15 @@ module Middleman::Cli
|
|
|
71
71
|
|
|
72
72
|
self.class.shared_instance.run_hook :after_build, self
|
|
73
73
|
|
|
74
|
-
if
|
|
74
|
+
if had_errors && !debugging
|
|
75
75
|
msg = 'There were errors during this build'
|
|
76
76
|
unless options['verbose']
|
|
77
77
|
msg << ', re-run with `middleman build --verbose` to see the full exception.'
|
|
78
78
|
end
|
|
79
|
-
|
|
79
|
+
shell.say msg, :red
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
exit(1) if
|
|
82
|
+
exit(1) if had_errors
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
# Static methods
|
|
@@ -129,17 +129,17 @@ module Middleman::Cli
|
|
|
129
129
|
clean! if should_clean?
|
|
130
130
|
end
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
protected
|
|
133
133
|
|
|
134
134
|
# Remove files which were not built in this cycle
|
|
135
135
|
# @return [void]
|
|
136
136
|
def clean!
|
|
137
137
|
@to_clean.each do |f|
|
|
138
|
-
base.remove_file f, :
|
|
138
|
+
base.remove_file f, force: true
|
|
139
139
|
end
|
|
140
140
|
|
|
141
|
-
Dir[@build_dir.join('**', '*')].select {|d| File.directory?(d) }.each do |d|
|
|
142
|
-
base.remove_file d, :
|
|
141
|
+
Dir[@build_dir.join('**', '*')].select { |d| File.directory?(d) }.each do |d|
|
|
142
|
+
base.remove_file d, force: true if directory_empty? d
|
|
143
143
|
end
|
|
144
144
|
end
|
|
145
145
|
|
|
@@ -273,7 +273,6 @@ module Middleman::Cli
|
|
|
273
273
|
base.say_status :error, file_name, :red
|
|
274
274
|
if base.debugging
|
|
275
275
|
raise e
|
|
276
|
-
exit(1)
|
|
277
276
|
elsif base.options['verbose']
|
|
278
277
|
base.shell.say response, :red
|
|
279
278
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# CLI Module
|
|
2
2
|
module Middleman::Cli
|
|
3
|
-
|
|
4
3
|
# A initializing Bundler
|
|
5
4
|
class Bundle < Thor
|
|
6
5
|
include Thor::Actions
|
|
@@ -8,11 +7,11 @@ module Middleman::Cli
|
|
|
8
7
|
|
|
9
8
|
namespace :bundle
|
|
10
9
|
|
|
11
|
-
desc 'bundle', 'Setup initial bundle', :
|
|
10
|
+
desc 'bundle', 'Setup initial bundle', hide: true
|
|
12
11
|
|
|
13
12
|
# The setup task
|
|
14
13
|
def bundle
|
|
15
|
-
run('bundle install')
|
|
14
|
+
run('bundle install')# , :capture => true)
|
|
16
15
|
end
|
|
17
16
|
end
|
|
18
17
|
|
|
@@ -28,13 +27,13 @@ module Middleman::Cli
|
|
|
28
27
|
# The upgrade task
|
|
29
28
|
def upgrade
|
|
30
29
|
inside(ENV['MM_ROOT']) do
|
|
31
|
-
run('bundle update')
|
|
30
|
+
run('bundle update')# , :capture => true)
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
|
|
36
35
|
# Map "u" to "upgrade"
|
|
37
|
-
Base.map(
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
Base.map(
|
|
37
|
+
'u' => 'upgrade'
|
|
38
|
+
)
|
|
40
39
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# CLI Module
|
|
2
2
|
module Middleman::Cli
|
|
3
|
-
|
|
4
3
|
# A thor task for creating new projects
|
|
5
4
|
class Console < Thor
|
|
6
5
|
include Thor::Actions
|
|
@@ -11,26 +10,24 @@ module Middleman::Cli
|
|
|
11
10
|
|
|
12
11
|
desc 'console [options]', 'Start an interactive console in the context of your Middleman application'
|
|
13
12
|
method_option :environment,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
aliases: '-e',
|
|
14
|
+
default: ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development',
|
|
15
|
+
desc: 'The environment Middleman will run under'
|
|
17
16
|
method_option :verbose,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
type: :boolean,
|
|
18
|
+
default: false,
|
|
19
|
+
desc: 'Print debug messages'
|
|
21
20
|
def console
|
|
22
21
|
require 'middleman-core'
|
|
23
22
|
require 'irb'
|
|
24
23
|
|
|
25
24
|
opts = {
|
|
26
|
-
:
|
|
27
|
-
:
|
|
25
|
+
environment: options['environment'],
|
|
26
|
+
debug: options['verbose']
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
@app
|
|
31
|
-
if opts[:environment]
|
|
32
|
-
set :environment, opts[:environment].to_sym
|
|
33
|
-
end
|
|
29
|
+
@app = ::Middleman::Application.server.inst do
|
|
30
|
+
set :environment, opts[:environment].to_sym if opts[:environment]
|
|
34
31
|
|
|
35
32
|
::Middleman::Logger.singleton(opts[:debug] ? 0 : 1, opts[:instrumenting] || false)
|
|
36
33
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# CLI Module
|
|
2
2
|
module Middleman::Cli
|
|
3
|
-
|
|
4
3
|
# A thor task for creating new projects
|
|
5
4
|
class Extension < Thor
|
|
6
5
|
include Thor::Actions
|
|
@@ -10,7 +9,7 @@ module Middleman::Cli
|
|
|
10
9
|
namespace :extension
|
|
11
10
|
|
|
12
11
|
# Required path for the new project to be generated
|
|
13
|
-
argument :name, :
|
|
12
|
+
argument :name, type: :string
|
|
14
13
|
|
|
15
14
|
# Template files are relative to this file
|
|
16
15
|
# @return [String]
|
|
@@ -34,7 +33,7 @@ module Middleman::Cli
|
|
|
34
33
|
end
|
|
35
34
|
|
|
36
35
|
# Output a .gitignore file
|
|
37
|
-
class_option :git, :
|
|
36
|
+
class_option :git, type: :boolean, default: true
|
|
38
37
|
|
|
39
38
|
no_tasks {
|
|
40
39
|
# Write a .gitignore file for project
|
|
@@ -44,6 +43,5 @@ module Middleman::Cli
|
|
|
44
43
|
copy_file 'gitignore', File.join(name, '.gitignore')
|
|
45
44
|
end
|
|
46
45
|
}
|
|
47
|
-
|
|
48
46
|
end
|
|
49
47
|
end
|
|
@@ -2,7 +2,6 @@ require 'middleman-core/templates'
|
|
|
2
2
|
|
|
3
3
|
# CLI Module
|
|
4
4
|
module Middleman::Cli
|
|
5
|
-
|
|
6
5
|
# A thor task for creating new projects
|
|
7
6
|
class Init < Thor
|
|
8
7
|
check_unknown_options!
|
|
@@ -12,41 +11,41 @@ module Middleman::Cli
|
|
|
12
11
|
desc 'init NAME [options]', 'Create new project NAME'
|
|
13
12
|
available_templates = ::Middleman::Templates.registered.keys.join(', ')
|
|
14
13
|
method_option 'template',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
aliases: '-T',
|
|
15
|
+
default: 'default',
|
|
16
|
+
desc: "Use a project template: #{available_templates}"
|
|
18
17
|
method_option 'css_dir',
|
|
19
18
|
# :default => "stylesheets",
|
|
20
|
-
|
|
19
|
+
desc: 'The path to the css files'
|
|
21
20
|
method_option 'js_dir',
|
|
22
21
|
# :default => "javascripts",
|
|
23
|
-
|
|
22
|
+
desc: 'The path to the javascript files'
|
|
24
23
|
method_option 'images_dir',
|
|
25
24
|
# :default => "images",
|
|
26
|
-
|
|
25
|
+
desc: 'The path to the image files'
|
|
27
26
|
method_option 'rack',
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
type: :boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
desc: 'Include a config.ru file'
|
|
31
30
|
method_option 'skip-gemfile',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
type: :boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
desc: "Don't create a Gemfile"
|
|
35
34
|
method_option 'skip-bundle',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
type: :boolean,
|
|
36
|
+
aliases: '-B',
|
|
37
|
+
default: false,
|
|
38
|
+
desc: "Don't run bundle install"
|
|
40
39
|
method_option 'skip-git',
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
type: :boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
desc: 'Skip Git ignores and keeps'
|
|
44
43
|
# The init task
|
|
45
44
|
# @param [String] name
|
|
46
|
-
def init(name
|
|
45
|
+
def init(name='.')
|
|
47
46
|
key = options[:template].to_sym
|
|
48
|
-
unless ::Middleman::Templates.registered.
|
|
49
|
-
raise Thor::Error
|
|
47
|
+
unless ::Middleman::Templates.registered.key?(key)
|
|
48
|
+
raise Thor::Error, "Unknown project template '#{key}'"
|
|
50
49
|
end
|
|
51
50
|
|
|
52
51
|
thor_group = ::Middleman::Templates.registered[key]
|
|
@@ -59,9 +58,9 @@ module Middleman::Cli
|
|
|
59
58
|
end
|
|
60
59
|
|
|
61
60
|
# Map "i", "new" and "n" to "init"
|
|
62
|
-
Base.map(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
Base.map(
|
|
62
|
+
'i' => 'init',
|
|
63
|
+
'new' => 'init',
|
|
64
|
+
'n' => 'init'
|
|
65
|
+
)
|
|
67
66
|
end
|