-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathThorfile
48 lines (36 loc) · 1.24 KB
/
Thorfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'thor/group'
module Middleman
class Generator < ::Thor::Group
include ::Thor::Actions
source_root File.expand_path(File.dirname(__FILE__))
def copy_default_files
directory 'template', '.', exclude_pattern: /\.DS_Store$/
end
def ask_about_sprockets
@use_sprockets = yes?('Do you want to use the Asset Pipeline?')
end
def ask_about_compass
@use_compass = yes?('Do you want to use Compass?')
end
def ask_about_livereload
@use_livereload = yes?('Do you want to use LiveReload?')
end
def build_gemfile
if @use_livereload
insert_into_file 'Gemfile', "gem 'middleman-livereload'\n", after: "# Middleman Gems\n"
end
insert_into_file 'Gemfile', "gem 'middleman', '>= 4.0.0'\n", after: "# Middleman Gems\n"
if @use_compass
insert_into_file 'Gemfile', "gem 'middleman-compass', '>= 4.0.0'\n", after: "# Middleman Gems\n"
end
if @use_sprockets
insert_into_file 'Gemfile', "gem 'middleman-sprockets', '>= 4.0.0'\n", after: "# Middleman Gems\n"
end
end
def ask_about_rackup
if yes?('Do you want a Rack-compatible config.ru file?')
template 'optional/config.ru', 'config.ru'
end
end
end
end