-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexemplify.rake
More file actions
35 lines (29 loc) · 999 Bytes
/
exemplify.rake
File metadata and controls
35 lines (29 loc) · 999 Bytes
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
##
# Exemplify rake tasks
#
# Will help to create configuration files from their .example templates
# See https://github.com/Velid/exemplify for Readme and examples
#
namespace :exemplify do
FileList['config/**/*.example'].each do |template|
target = template.chomp('.example')
desc "Create configuration file #{target} from its .example template"
task target => template do
# Abort if target file already exists
if File.exists? target
puts "[WARNING] Specified file #{target} already exists, skipping"
else
# Proceed if example file has been found
puts "[INFO] Template file #{template} found, will exemplify now"
begin
cp template, target
puts "[OK] Created #{target} from template"
rescue Exception => error
puts "[ERROR] Failed to copy template file to #{target}: #{error}"
end
end
end
# Add generic task to load all targets
task :all => target
end
end