Class: Lydown::CLI::Commands
- Inherits:
-
Thor
- Object
- Thor
- Lydown::CLI::Commands
show all
- Defined in:
- lib/lydown/cli/commands.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
119
120
121
122
|
# File 'lib/lydown/cli/commands.rb', line 119
def method_missing(method, *args)
args = ["compile", method.to_s] + args
self.class.start(args)
end
|
Instance Method Details
#compile(*args) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/lydown/cli/commands.rb', line 46
def compile(*args)
path = args.first || '.'
if (path =~ /^\-\-(\w+)/) && respond_to?($1)
return send($1)
end
require 'lydown'
opts = Lydown::CLI::Support.copy_options(options)
opts[:path] = path
opts[:format] = opts[:format].to_sym if opts[:format]
[:pdf, :png, :ly, :midi, :mp3].each {|f| opts[:format] = f if opts[f]}
opts[:parts] = opts[:parts].split(',') if opts[:parts]
opts[:movements] = opts[:movements].split(',') if opts[:movements]
Lydown::CLI::Support.detect_work_directory(opts)
Lydown::CLI::Support.detect_filename(opts)
if (opts[:format] == :midi) || (opts[:format] == :mp3)
opts[:score_only] = true
opts[:parts_only] = false
end
unless opts[:parts_only] || opts[:parts]
$stderr.puts "Processing score..."
Lydown::CLI::Compiler.process(opts.merge(mode: :score, parts: nil))
end
unless opts[:score_only]
$stderr.puts "Processing parts..."
Lydown::CLI::Compiler.process(opts.merge(mode: :part))
end
end
|
#translate(*args) ⇒ Object
#version ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/lydown/cli/commands.rb', line 10
def version
require 'lydown/version'
$stderr.puts "Lydown version #{Lydown::VERSION}"
lilypond_version = Lydown::Lilypond.detect_lilypond_version(false)
if lilypond_version
$stderr.puts "Lilypond version #{lilypond_version}"
end
end
|