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
|
# File 'lib/dayvan/cli.rb', line 11
def init
destination_root = Pathname.pwd
source_path = Pathname(__FILE__).dirname.expand_path
name = destination_root.basename.to_s
empty_directory 'config'
create_file "config/#{name}.yaml" do
{'database' => {
'url' => "http://localhost:5984/#{name}"
}}.to_yaml.split("\n")[1..-1].join("\n") + "\n"
end
copy_file 'validation.coffee.erb', 'config/validation.coffee'
empty_directory 'views'
copy_file 'all.coffee.erb', 'views/all.coffee'
copy_file 'size.coffee.erb', 'views/size.coffee'
empty_directory 'public'
@name = name
@version = Dayvan.version
template 'welcome.html.erb', 'public/index.html'
puts "Initialized CouchApp in #{destination_root}"
end
|