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
|
# File 'lib/baseapi/cli.rb', line 10
def setup(*controllers)
controllers.push 'application'
controllers.push 'base_api'
controllers.uniq!
controllers.each do |controller|
dir = [
"app/views/#{controller}"
]
dir.each do |path|
if !Dir.exists?(path)
Dir.mkdir(path)
end
end
files = [
'error.json.jbuilder',
'model.json.jbuilder',
'models.json.jbuilder',
]
files.each do |file|
src = File.expand_path("../app/views/base_api/#{file}", __FILE__)
FileUtils.cp(src, "app/views/#{controller}/#{file}")
end
end
end
|