Module: Musical::Util
- Included in:
- Musical, DVD, DVD, DVD::Chapter
- Defined in:
- lib/musical/util.rb
Constant Summary collapse
- REQUIRED_APPS =
%w(dvdbackup ffmpeg).freeze
Instance Method Summary collapse
Instance Method Details
#check_env ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/musical/util.rb', line 6 def check_env REQUIRED_APPS.each do |app| unless installed?(app) = [] << "'#{app}' is not installed." << "Try this command to install '#{app}'." << "" << " brew install #{app}" << "" raise RuntimeError, .join("\n") end end true end |
#execute_command(cmd, silent = false) ⇒ Object
25 26 27 28 29 |
# File 'lib/musical/util.rb', line 25 def execute_command(cmd, silent = false) cmd << ' 2>/dev/null' if silent execute_out, _ = *Open3.capture2(cmd) execute_out end |
#installed?(app) ⇒ Boolean
21 22 23 |
# File 'lib/musical/util.rb', line 21 def installed?(app) !execute_command("which #{app}").empty? end |