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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/brief/briefcase/initializer.rb', line 7
def run
options = @options
root = options.root
FileUtils.mkdir_p(root.join("docs","posts"))
config = "use(#{options.app})\n" if options.app
config = " root = Pathname(Dir.pwd)\n\n config do\n # You can put any special brief configuration here\n # set(models_path: root.join('models')) if root.join('models').exist?\n # set(templates_path: root.join('templates')) if root.join('templates').exist?\n # set(docs_path: root.join('documents')) if root.join('documents').exist?\n end\n \\n\n define \"Post\" do\n meta do\n title\n status :in => %w(draft published)\n tags Array\n end\n \\n\n content do\n title \"h1:first-of-type\"\n subheading \"h2:first-of-type\"\n end\n end\n EOF\n\n example = <<-EOF\n ---\n type: post\n title: This is my first post\n status: published\n tags:\n - default\n - intro\n ---\n\n # This is my first post\n\n I should write something clever.\n EOF\n\n config.gsub!(/^\\ {1,6}/m, '')\n example.gsub!(/^\\ {1,6}/m, '')\n\n root.join(\"docs\",\"posts\",\"this-is-my-first-post.md\").open(\"w+\") {|fh| fh.write(example) }\n\n root.join(\"brief.rb\").open(\"w+\") do |fh|\n fh.write(config)\n end\nend\n"
|