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
|
# File 'lib/generators/workarea/override/override_generator.rb', line 11
def override
directory = if type == 'layouts'
'views/layouts'
elsif type.in?(%w(javascripts stylesheets images fonts))
"assets/#{type}"
else
type
end
[
Workarea::Plugin.installed,
Workarea::Core,
Workarea::Testing
].flatten.each do |plugin|
puts "Generating #{type} for #{plugin.to_s.demodulize.titleize.downcase}..."
root = plugin.const_get(:Engine).root
self.class.class_eval("def self.source_root; '#{root}'; end;")
relative_path = "app/#{directory}/#{path}"
full_path = "#{root}/#{relative_path}"
if File.directory?(full_path)
directory(
full_path,
relative_path
)
elsif File.file?(full_path)
copy_file(
full_path,
relative_path
)
copy_files_with_matching_names(
full_path,
relative_path
)
end
end
end
|