module Lyp
Constants
- DEFAULT_LILYPONDS_DIRECTORY
- DEFAULT_PACKAGE_DIRECTORY
- DETECT_SYSTEM_LILYPOND_FILENAME
File for detecting version and data dir of system-installed lilypond
- ETC_DIRECTORY
- FONT_COPY_REQ
Fonts are installed on lilypond >= 2.18.2
- FONT_PATCH_FILENAME
Font patch filename (required for 2.18.2 <= lilypond < 2.19.12)
- FONT_PATCH_REQ
- LILYPOND_NOT_FOUND_MSG
- LILYPOND_RE
- LYP_BIN_DIRECTORY
- LYP_DIRECTORY
- LYP_EXT_DIRECTORY
- LYP_LIB_DIRECTORY
- LYP_LY_LIB_PATH
etc/lyp.ly contains lyp:* procedure definitions for loading packages and other support code.
- PACKAGE_RE
A package specifier is of the form <package>@<version specifier>, where the version specifier can be simply a version number, or include an operator before the version number.
Accepted operators: >=, ~>
- SETTINGS_FILENAME
- TMP_DIR
- TMP_ROOT
- VERSION
- WINDOWS
- WRAPPERS_DIR
- WRAPPER_TEMPLATE
Public Class Methods
confirm_action(prompt)
click to toggle source
# File lib/lyp/base.rb, line 77 def self.confirm_action(prompt) require 'readline' response = Readline.readline(prompt) ["y", "yes"].include?(response) end
ensure_dir(dir)
click to toggle source
# File lib/lyp/base.rb, line 61 def self.ensure_dir(dir) FileUtils.mkdir_p(dir) unless File.directory?(dir) dir end
ext_dir()
click to toggle source
# File lib/lyp/base.rb, line 52 def self.ext_dir ensure_dir(LYP_EXT_DIRECTORY) end
install_extension(path)
click to toggle source
# File lib/lyp/package.rb, line 533 def self.install_extension(path) # install extension only when installing the package return unless $installed_package FileUtils.cp(path, "#{Lyp.ext_dir}/#{$installed_package}.rb") end
lilyponds_dir()
click to toggle source
# File lib/lyp/base.rb, line 48 def self.lilyponds_dir ensure_dir(DEFAULT_LILYPONDS_DIRECTORY) end
packages_dir()
click to toggle source
# File lib/lyp/base.rb, line 44 def self.packages_dir ensure_dir(DEFAULT_PACKAGE_DIRECTORY) end
settings_file()
click to toggle source
# File lib/lyp/base.rb, line 56 def self.settings_file ensure_dir(LYP_DIRECTORY) File.join(LYP_DIRECTORY, SETTINGS_FILENAME) end
sudo_cp(src, dest)
click to toggle source
# File lib/lyp/base.rb, line 71 def self.sudo_cp(src, dest) cmd = "sudo cp #{src} #{dest}" msg = `#{cmd}` raise msg unless $?.success? end
tmp_filename(suffix = nil)
click to toggle source
# File lib/lyp/base.rb, line 66 def self.tmp_filename(suffix = nil) fn = (Thread.current.hash * (Time.now.to_f * 1000).to_i % 2**32).to_s(36) "#{TMP_ROOT}/#{fn}#{suffix}" end
version(v)
click to toggle source
# File lib/lyp/base.rb, line 84 def self.version(v) Gem::Version.new(v) end
version_req(r)
click to toggle source
# File lib/lyp/base.rb, line 88 def self.version_req(r) Gem::Requirement.new(r) end
wrap(fn, opts = {})
click to toggle source
# File lib/lyp/wrapper.rb, line 8 def self.wrap(fn, opts = {}) r = Lyp::DependencyResolver.new(fn, opts).resolve_package_dependencies # copy current_package_dir option r[:current_package_dir] = opts[:current_package_dir] r[:opts] = opts FileUtils.mkdir_p(WRAPPERS_DIR) fn = "#{WRAPPERS_DIR}/#{File.basename(fn)}" File.open(fn, 'w+') {|f| f << WRAPPER_TEMPLATE.render(r)} fn end