forked from middleman/middleman-templates-default
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Thorfile
47 lines (36 loc) · 1.18 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
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_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_compass
insert_into_file 'Gemfile', "gem 'middleman-compass', '>= 4.0.0'\n", after: "# Middleman Gems\n"
end
if @use_livereload
insert_into_file 'Gemfile', "gem 'middleman-livereload'\n", after: "# Middleman Gems\n"
insert_into_file 'config.rb', <<-eos, after: "# General configuration\n"
# Reload the browser automatically whenever files change
configure :development do
activate :livereload
end
eos
end
insert_into_file 'Gemfile', "gem 'middleman', '>= 4.0.0'\n", after: "# Middleman Gems\n"
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