-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
27 lines (23 loc) · 989 Bytes
/
init.rb
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
require 'optparse'
require 'fileutils'
options = {parts: 4, verses: 0, transpose: false}
OptionParser.new do |parser|
parser.on("-p", "--parts NUMBER", "Require NUMBER of parts; Default: 4") do |parts|
options[:parts] = parts.to_i
end
parser.on("-v", "--verses NUMBER", "Require NUMBER of verses; Default: 1") do |verses|
options[:verses] = verses.to_i
end
parser.on("-t", "--transpose", "Sets up template for transposition") do
options[:transpose] = true
end
parser.on("-h", "--help", "Prints this Help") do
puts parser
end
end.parse!
#FileUtils.cp('../metadata/metadata_template.yaml', './metadata.yaml') unless File.exist?('./metadata.yaml')
lily = File.basename(FileUtils.pwd) + '.ly'
params = "-f #{lily} -p #{options[:parts]} -v #{options[:verses]}"
params = params + " -t" if options[:transpose]
system("ruby ../my_include/instrumental_template.ly.erb #{params}")
system("ruby ../my_include/score.ly.erb #{lily}")