lyp 1.0.0 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -8
- data/bin/install_release.sh +3 -3
- data/bin/lilypond +2 -2
- data/lib/lyp/base.rb +8 -1
- data/lib/lyp/cli.rb +1 -1
- data/lib/lyp/etc/lyp.ly +12 -0
- data/lib/lyp/lilypond.rb +90 -54
- data/lib/lyp/package.rb +14 -10
- data/lib/lyp/resolver.rb +5 -5
- data/lib/lyp/system.rb +1 -1
- data/lib/lyp/templates/deps_wrapper.rb +21 -3
- data/lib/lyp/version.rb +1 -1
- data/lib/lyp/wrapper.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ee97de7db10409599600eb1e33133ca5e81171d
|
4
|
+
data.tar.gz: 97da159cbed5589c1c5049581dabf8c829f8301c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 254a3af78bd69aa9783773060ca4c1554800a8433520ed60a75441a7c63bbfd9661c3c30cefe53f2d8bc520489a3db54edf59c9b32327eb7b098a06139fc8415
|
7
|
+
data.tar.gz: 62c0296ad688312460f8a097c3feff5abb827aafa00fef673501b7cb71b4c73ebae01aa55213e7f3a43129800716521b6c2ee27fdfc865386ae00c0022fc72f8
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<p align="center">
|
2
|
-
<a href="https://travis-ci.org/noteflakes/lyp"><img src="https://travis-ci.org/noteflakes/lyp.svg?branch=master"
|
2
|
+
<a href="https://travis-ci.org/noteflakes/lyp"><img src="https://travis-ci.org/noteflakes/lyp.svg?branch=master"></a>
|
3
3
|
</p>
|
4
4
|
<p align="center">
|
5
5
|
<a href="https://github.com/lyp-packages/index#readme">The lyp package index</a>
|
@@ -32,7 +32,9 @@ __No hassle Lilypond installation__: With lyp you can also install any version o
|
|
32
32
|
- [Developing packages](#developing-packages)
|
33
33
|
- [The package interface](#the-package-interface)
|
34
34
|
- [Including files](#including-files)
|
35
|
+
- [Scheme interface](#scheme-interface)
|
35
36
|
- [Including fonts](#including-fonts)
|
37
|
+
- [Extending lyp](#extending-lyp)
|
36
38
|
- [Testing packages](#testing-packages)
|
37
39
|
- [Publishing packages](#publishing-packages)
|
38
40
|
- [Installing and Using Lilypond](#installing-and-using-lilypond)
|
@@ -129,7 +131,7 @@ For more information on running lilypond see the section on [Running lilypond](#
|
|
129
131
|
|
130
132
|
A package is a library of lilypond code, containing one or more lilypond files, that provide commonly-used functionality for users. A package can be a library of scheme code to extend lilypond, as in openlilylib; or a stylesheet which contains music fonts and additional lilypond code to change the look of the music: font, spacing, line widths, sizes, etc.
|
131
133
|
|
132
|
-
The difference between merely copying and including a lilypond file in your music, and using a lilypond package is that you can easily share your music file with anyone and let them compile your music without having to download and copy additional code. lyp takes care of installing and resolving any dependencies in your lilypond files, so that you can compile your lilypond files anywhere without schlepping around a bunch of include files. Also, because packages are versioned, repeatable compilation using external code becomes trivial.
|
134
|
+
The difference between merely copying and including a lilypond file in your music, and using a lilypond package is that you can easily share your music file with anyone and let them compile your music without having to download and copy additional code. lyp takes care of installing and resolving any dependencies in your lilypond files, so that you can compile your lilypond files anywhere without schlepping around a bunch of include files. Also, because packages are versioned, repeatable compilation using external code becomes trivial.
|
133
135
|
|
134
136
|
### What constitutes a package?
|
135
137
|
|
@@ -329,7 +331,7 @@ Lyp also defines a `lyp:load` scheme function for loading scheme files using rel
|
|
329
331
|
#(if (not (defined? 'mypack:init))(lyp:load "scm/init.scm"))
|
330
332
|
```
|
331
333
|
|
332
|
-
Loading scheme files that way is a better technique than adding
|
334
|
+
Loading scheme files that way is a better technique than adding directories to `%load-path`, because this way one avoids possible name clashes, which may lead to unexpected behavior.
|
333
335
|
|
334
336
|
### Conditional includes
|
335
337
|
|
@@ -340,11 +342,39 @@ Files can also be included conditionally by evaluating a scheme expression using
|
|
340
342
|
\pcondInclude #(eq? edition 'urtext) "urtext_tweaks.ly"
|
341
343
|
```
|
342
344
|
|
345
|
+
### Scheme interface
|
346
|
+
|
347
|
+
Lyp provides to loaded packages a small API to facilitate handling relative paths and loading of lilypond include files and scheme files. The API is documented on the [lyp wiki](https://github.com/noteflakes/lyp/wiki/Package-Scheme-Interface).
|
348
|
+
|
343
349
|
### Including fonts
|
344
350
|
|
345
351
|
Lyp also supports automatic installation of fonts, based on work by [Abraham Lee](https://github.com/tisimst). When a package is installed, lyp will copy any font files residing in the `fonts` directory into the corresponding `otf` and `svg` directories of all installed versions of lilypond.
|
346
352
|
|
347
|
-
**Note**: fonts will be only installed in versions of lilypond starting from than 2.18.2. Lyp automatically patches any version
|
353
|
+
**Note**: fonts will be only installed in versions of lilypond starting from than 2.18.2. Lyp automatically patches any version newer than 2.19.12 in order to support custom fonts.
|
354
|
+
|
355
|
+
### Extending lyp
|
356
|
+
|
357
|
+
A package can also be used to extend or override lyp's stock functionality or add more features and commands. Extensions are written in Ruby in a file named `ext.rb` placed in the package's main directory. An extension can be used to either perform a certain action when the package is installed, or be loaded each time lyp is invoked.
|
358
|
+
|
359
|
+
When a package is installed, lyp executes the code in `ext.rb`. To make the extension run each time lyp is invoked, the extension should include the following line:
|
360
|
+
|
361
|
+
```ruby
|
362
|
+
Lyp.install_extension(__FILE__)
|
363
|
+
```
|
364
|
+
|
365
|
+
More commands can be added to lyp's command line interface by adding methods to the `Lyp::CLI` class using the [Thor](https://github.com/erikhuda/thor/wiki/Method-Options) API. For example:
|
366
|
+
|
367
|
+
```ruby
|
368
|
+
class Lyp::CLI
|
369
|
+
desc "count", "show package count"
|
370
|
+
def count
|
371
|
+
packages = Lyp::Package.list_lyp_index("")
|
372
|
+
puts "#{packages.size} packages installed"
|
373
|
+
end
|
374
|
+
end
|
375
|
+
```
|
376
|
+
|
377
|
+
The implementation of the stock lyp commands can be be found in [`lib/lyp/cli.rb`](./lib/lyp/cli.rb).
|
348
378
|
|
349
379
|
### Testing Packages
|
350
380
|
|
@@ -403,7 +433,7 @@ $ lyp uninstall lilypond@2.18.2
|
|
403
433
|
### Showing the list of installed lilypond versions
|
404
434
|
|
405
435
|
To display all installed versions of lilypond, use the `list` command:
|
406
|
-
|
436
|
+
|
407
437
|
```bash
|
408
438
|
$ lyp list lilypond
|
409
439
|
```
|
@@ -506,7 +536,7 @@ Once one or more versions of lilypond are installed, the lilypond command may be
|
|
506
536
|
$ lilypond --use=stable ...
|
507
537
|
$ lilypond --use=latest ...
|
508
538
|
```
|
509
|
-
|
539
|
+
|
510
540
|
- `--env`, `-E` - use a version set by the `$LILYPOND_VERSION` environment variable:
|
511
541
|
|
512
542
|
```bash
|
@@ -518,7 +548,7 @@ Once one or more versions of lilypond are installed, the lilypond command may be
|
|
518
548
|
```bash
|
519
549
|
$ lilypond -u2.19.35 -n ...
|
520
550
|
```
|
521
|
-
|
551
|
+
|
522
552
|
- `--raw`, `-r` - do not pre-process input file (no scanning for dependencies, no wrapping).
|
523
553
|
|
524
554
|
```bash
|
@@ -535,4 +565,4 @@ $ bundle install # needs to be run only once
|
|
535
565
|
$ rspec
|
536
566
|
```
|
537
567
|
|
538
|
-
Please feel free to submit issues and pull requests.
|
568
|
+
Please feel free to submit issues and pull requests.
|
data/bin/install_release.sh
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
LYP_VERSION="1.0.
|
3
|
+
LYP_VERSION="1.0.3"
|
4
4
|
WORKDIR="/tmp/lyp-release-installer"
|
5
5
|
URL_BASE="https://github.com/noteflakes/lyp/releases/download/v$LYP_VERSION"
|
6
6
|
|
@@ -8,8 +8,8 @@ shopt -s extglob
|
|
8
8
|
set -o errtrace
|
9
9
|
set -o errexit
|
10
10
|
|
11
|
-
fail() { log "\nERROR: $*\n"
|
12
|
-
has() { type "$1" > /dev/null 2>&1 }
|
11
|
+
fail() { log "\nERROR: $*\n"; exit 1; }
|
12
|
+
has() { type "$1" > /dev/null 2>&1; }
|
13
13
|
|
14
14
|
download() {
|
15
15
|
if has "curl"; then
|
data/bin/lilypond
CHANGED
@@ -6,8 +6,7 @@ require 'lyp/version'
|
|
6
6
|
require 'lyp'
|
7
7
|
|
8
8
|
$options, $argv = Lyp::Lilypond.preprocess_argv(ARGV)
|
9
|
-
|
10
|
-
$lilypond_path = Lyp::Lilypond.select_lilypond_version($options)
|
9
|
+
$lilypond_path = Lyp::Lilypond.select_lilypond_version($options, ARGV.last)
|
11
10
|
|
12
11
|
if $options[:raw]
|
13
12
|
exec("#{$lilypond_path} #{$argv.join(' ')}")
|
@@ -27,6 +26,7 @@ Lyp-provided options:
|
|
27
26
|
-A, --auto-install-deps install any missing dependencies
|
28
27
|
-c, --cropped crop output (requires setting 0 margins)
|
29
28
|
-E, --env use version specified in $LILYPOND_VERSION
|
29
|
+
-F, --force_version use lilypond version specified in user file
|
30
30
|
-n, --install install the specified version if not found
|
31
31
|
-O, --open open the target file after compilation
|
32
32
|
-R, --raw run raw lilypond (no pre-processing)
|
data/lib/lyp/base.rb
CHANGED
data/lib/lyp/cli.rb
CHANGED
@@ -103,7 +103,7 @@ class Lyp::CLI < Thor
|
|
103
103
|
def compile(*argv)
|
104
104
|
opts, argv = Lyp::Lilypond.preprocess_argv(argv)
|
105
105
|
|
106
|
-
lilypond_path = Lyp::Lilypond.select_lilypond_version(opts)
|
106
|
+
lilypond_path = Lyp::Lilypond.select_lilypond_version(opts, argv.last)
|
107
107
|
|
108
108
|
$stderr.puts "Lyp #{Lyp::VERSION}"
|
109
109
|
Lyp::System.test_installed_status!
|
data/lib/lyp/etc/lyp.ly
CHANGED
@@ -134,6 +134,18 @@
|
|
134
134
|
(lyp:include-string (lyp:fmt-include abs-path))
|
135
135
|
))
|
136
136
|
))
|
137
|
+
|
138
|
+
; define list of finalizer lambdas to be called after the user's file has been
|
139
|
+
; \included.
|
140
|
+
(module-define! (current-module) 'lyp:finalProcs '())
|
141
|
+
(define (lyp:getFinalProcs)
|
142
|
+
(module-ref (current-module) 'lyp:finalProcs))
|
143
|
+
(define (lyp:setFinalProcs l)
|
144
|
+
(module-define! (current-module) 'lyp:finalProcs l))
|
145
|
+
(define (lyp:finalize proc)
|
146
|
+
(lyp:setFinalProcs (append (lyp:getFinalProcs) (list proc))))
|
147
|
+
(define (lyp:callFinalizers)
|
148
|
+
(for-each (lambda (p) (p)) (lyp:getFinalProcs)))
|
137
149
|
)
|
138
150
|
|
139
151
|
% command form
|
data/lib/lyp/lilypond.rb
CHANGED
@@ -4,56 +4,78 @@ require 'ruby-progressbar'
|
|
4
4
|
|
5
5
|
module Lyp::Lilypond
|
6
6
|
class << self
|
7
|
+
NO_ARGUMENT_OPTIONS_REGEXP = /^\-([REnFOcSA]+)(.+)/
|
8
|
+
|
7
9
|
def preprocess_argv(argv)
|
8
10
|
options = {}
|
9
11
|
argv = argv.dup # copy for iterating
|
10
12
|
argv_clean = []
|
11
13
|
while arg = argv.shift
|
12
|
-
|
13
|
-
when '-R', '--raw'
|
14
|
-
options[:raw] = true
|
15
|
-
when '-r', '--require'
|
16
|
-
options[:ext_require] ||= []
|
17
|
-
options[:ext_require] << argv.shift
|
18
|
-
when /^(?:\-r|\-\-require\=)"?([^\s]+)"?/
|
19
|
-
options[:ext_require] ||= []
|
20
|
-
options[:ext_require] << $1
|
21
|
-
when '-E', '--env'
|
22
|
-
unless ENV['LILYPOND_VERSION']
|
23
|
-
STDERR.puts "$LILYPOND_VERSION not set"
|
24
|
-
exit 1
|
25
|
-
end
|
26
|
-
options[:use_version] = ENV['LILYPOND_VERSION']
|
27
|
-
when '-u', '--use'
|
28
|
-
options[:use_version] = argv.shift
|
29
|
-
when /^(?:\-u|\-\-use\=)"?([^\s]+)"?/
|
30
|
-
options[:use_version] = $1
|
31
|
-
when '-n', '--install'
|
32
|
-
options[:install] = true
|
33
|
-
when '-O', '--open'
|
34
|
-
options[:open] = true
|
35
|
-
when '-c', '--cropped'
|
36
|
-
argv_clean += ['-dbackend=eps', '-daux-files=#f']
|
37
|
-
when '-S', '--snippet'
|
38
|
-
argv_clean += ['-dbackend=eps', '-daux-files=#f', '--png', '-dresolution=600']
|
39
|
-
when '-A', '--auto-install-deps'
|
40
|
-
options[:resolve] = true
|
41
|
-
else
|
42
|
-
argv_clean << arg
|
43
|
-
end
|
14
|
+
parse_lilypond_arg(arg, argv, argv_clean, options)
|
44
15
|
end
|
45
16
|
|
46
17
|
[options, argv_clean]
|
47
18
|
end
|
48
19
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
52
|
-
|
20
|
+
def parse_lilypond_arg(arg, argv, argv_clean, options)
|
21
|
+
case arg
|
22
|
+
when NO_ARGUMENT_OPTIONS_REGEXP
|
23
|
+
# handle multiple options in shorthand form, e.g. -FnO
|
24
|
+
tmp_args = []
|
25
|
+
$1.each_char {|c| tmp_args << "-#{c}"}
|
26
|
+
tmp_args << "-#{$2}"
|
27
|
+
argv = tmp_args + argv
|
28
|
+
when '-A', '--auto-install-deps'
|
29
|
+
options[:resolve] = true
|
30
|
+
when '-c', '--cropped'
|
31
|
+
argv_clean += ['-dbackend=eps', '-daux-files=#f']
|
32
|
+
when '-E', '--env'
|
33
|
+
unless ENV['LILYPOND_VERSION']
|
34
|
+
STDERR.puts "$LILYPOND_VERSION not set"
|
35
|
+
exit 1
|
53
36
|
end
|
54
|
-
|
37
|
+
options[:use_version] = ENV['LILYPOND_VERSION']
|
38
|
+
when '-F', '--force-version'
|
39
|
+
options[:force_version] = true
|
40
|
+
when '-n', '--install'
|
41
|
+
options[:install] = true
|
42
|
+
when '-O', '--open'
|
43
|
+
options[:open] = true
|
44
|
+
when '-r', '--require'
|
45
|
+
options[:ext_require] ||= []
|
46
|
+
options[:ext_require] << argv.shift
|
47
|
+
when /^(?:\-r|\-\-require\=)"?([^\s]+)"?/
|
48
|
+
options[:ext_require] ||= []
|
49
|
+
options[:ext_require] << $1
|
50
|
+
when '-R', '--raw'
|
51
|
+
options[:raw] = true
|
52
|
+
when '-S', '--snippet'
|
53
|
+
argv_clean += ['-dbackend=eps', '-daux-files=#f', '--png', '-dresolution=600']
|
54
|
+
options[:snippet_paper_preamble] = true
|
55
|
+
when '-u', '--use'
|
56
|
+
options[:use_version] = argv.shift
|
57
|
+
when /^(?:\-u|\-\-use\=)"?([^\s]+)"?/
|
58
|
+
options[:use_version] = $1
|
59
|
+
else
|
60
|
+
argv_clean << arg
|
55
61
|
end
|
62
|
+
end
|
63
|
+
|
64
|
+
VERSION_STATEMENT_REGEX = /\\version "([^"]+)"/
|
65
|
+
|
66
|
+
def select_lilypond_version(opts, file_path)
|
67
|
+
forced_version = opts[:force_version] ?
|
68
|
+
get_file_expected_version(file_path) : opts[:use_version]
|
69
|
+
|
70
|
+
if forced_version
|
71
|
+
Lyp::Lilypond.install_if_missing(forced_version) if opts[:install]
|
72
|
+
Lyp::Lilypond.force_version!(forced_version)
|
73
|
+
end
|
74
|
+
|
56
75
|
Lyp::Lilypond.check_lilypond!
|
76
|
+
|
77
|
+
opts[:lilypond_version] = current_lilypond_version
|
78
|
+
|
57
79
|
Lyp::Lilypond.current_lilypond.tap do |path|
|
58
80
|
unless path && File.file?(path)
|
59
81
|
STDERR.puts "No version of lilypond found. To install lilypond run 'lyp install lilypond'."
|
@@ -65,6 +87,16 @@ module Lyp::Lilypond
|
|
65
87
|
exit 1
|
66
88
|
end
|
67
89
|
|
90
|
+
def get_file_expected_version(file_path)
|
91
|
+
if IO.read(file_path) =~ VERSION_STATEMENT_REGEX
|
92
|
+
$1
|
93
|
+
else
|
94
|
+
raise "Could not find version statement in #{file_path}"
|
95
|
+
end
|
96
|
+
rescue => e
|
97
|
+
raise "Failed to read #{file_path}"
|
98
|
+
end
|
99
|
+
|
68
100
|
def compile(argv, opts = {})
|
69
101
|
unless argv.last == '-'
|
70
102
|
fn = Lyp.wrap(argv.pop, opts)
|
@@ -80,6 +112,9 @@ module Lyp::Lilypond
|
|
80
112
|
case opts[:mode]
|
81
113
|
when :system
|
82
114
|
system("#{lilypond} #{argv.join(" ")}")
|
115
|
+
when :spawn
|
116
|
+
pid = spawn(lilypond, *argv, opts[:spawn_opts] || {})
|
117
|
+
Process.detach(pid)
|
83
118
|
else
|
84
119
|
Kernel.exec(lilypond, *argv)
|
85
120
|
end
|
@@ -112,7 +147,7 @@ module Lyp::Lilypond
|
|
112
147
|
path = current_lilypond
|
113
148
|
version = File.basename(File.expand_path("#{File.dirname(path)}/../.."))
|
114
149
|
|
115
|
-
unless (
|
150
|
+
unless (Lyp.version(version) rescue nil)
|
116
151
|
resp = `#{path} -v`
|
117
152
|
if resp.lines.first =~ /LilyPond ([0-9\.]+)/i
|
118
153
|
version = $1
|
@@ -149,6 +184,7 @@ module Lyp::Lilypond
|
|
149
184
|
|
150
185
|
attr_reader :forced_version
|
151
186
|
|
187
|
+
# Make sure there's a default and current lilypond set
|
152
188
|
def check_lilypond!
|
153
189
|
path = default_lilypond
|
154
190
|
select_default_lilypond! unless path && path =~ /lilypond$/
|
@@ -186,7 +222,7 @@ module Lyp::Lilypond
|
|
186
222
|
end
|
187
223
|
|
188
224
|
CMP_VERSION = proc do |x, y|
|
189
|
-
|
225
|
+
Lyp.version(x[:version]) <=> Lyp.version(y[:version])
|
190
226
|
end
|
191
227
|
|
192
228
|
def filter_installed_list(version_specifier)
|
@@ -304,24 +340,24 @@ module Lyp::Lilypond
|
|
304
340
|
when 'latest'
|
305
341
|
version == all_versions.last
|
306
342
|
when 'stable'
|
307
|
-
|
343
|
+
Lyp.version(version).segments[1].even?
|
308
344
|
when 'unstable'
|
309
|
-
|
345
|
+
Lyp.version(version).segments[1].odd?
|
310
346
|
else
|
311
|
-
|
347
|
+
Lyp.version_req(specifier) =~ Lyp.version(version)
|
312
348
|
end
|
313
349
|
end
|
314
350
|
|
315
351
|
def latest_stable_version
|
316
|
-
search.reverse.find {|l|
|
352
|
+
search.reverse.find {|l| Lyp.version(l[:version]).segments[1].even?}[:version]
|
317
353
|
end
|
318
354
|
|
319
355
|
def latest_unstable_version
|
320
|
-
search.reverse.find {|l|
|
356
|
+
search.reverse.find {|l| Lyp.version(l[:version]).segments[1].odd?}[:version]
|
321
357
|
end
|
322
358
|
|
323
359
|
def latest_installed_unstable_version
|
324
|
-
latest = list.reverse.find {|l|
|
360
|
+
latest = list.reverse.find {|l| Lyp.version(l[:version]).segments[1].odd?}
|
325
361
|
latest ? latest[:version] : nil
|
326
362
|
end
|
327
363
|
|
@@ -362,8 +398,8 @@ module Lyp::Lilypond
|
|
362
398
|
when 'latest'
|
363
399
|
latest_version
|
364
400
|
else
|
365
|
-
req =
|
366
|
-
lilypond = search.reverse.find {|l| req =~
|
401
|
+
req = Lyp.version_req(version_specifier)
|
402
|
+
lilypond = search.reverse.find {|l| req =~ Lyp.version(l[:version])}
|
367
403
|
if lilypond
|
368
404
|
lilypond[:version]
|
369
405
|
else
|
@@ -536,7 +572,7 @@ module Lyp::Lilypond
|
|
536
572
|
end
|
537
573
|
|
538
574
|
def patch_font_scm(version)
|
539
|
-
return unless Lyp::FONT_PATCH_REQ =~
|
575
|
+
return unless Lyp::FONT_PATCH_REQ =~ Lyp.version(version)
|
540
576
|
|
541
577
|
target_fn = File.join(lyp_lilypond_share_dir(version), 'lilypond/current/scm/font.scm')
|
542
578
|
FileUtils.cp(Lyp::FONT_PATCH_FILENAME, target_fn)
|
@@ -552,7 +588,7 @@ module Lyp::Lilypond
|
|
552
588
|
EOF
|
553
589
|
|
554
590
|
def patch_system_lilypond_font_scm(lilypond, opts)
|
555
|
-
return false unless Lyp::FONT_PATCH_REQ =~
|
591
|
+
return false unless Lyp::FONT_PATCH_REQ =~ Lyp.version(lilypond[:version])
|
556
592
|
|
557
593
|
target_fn = File.join(lilypond[:data_path], '/scm/font.scm')
|
558
594
|
# do nothing if alredy patched
|
@@ -574,7 +610,7 @@ module Lyp::Lilypond
|
|
574
610
|
end
|
575
611
|
|
576
612
|
def copy_fonts_from_all_packages(version, opts)
|
577
|
-
return unless Lyp::FONT_COPY_REQ =~
|
613
|
+
return unless Lyp::FONT_COPY_REQ =~ Lyp.version(version)
|
578
614
|
|
579
615
|
ly_fonts_dir = File.join(lyp_lilypond_share_dir(version), 'lilypond/current/fonts')
|
580
616
|
|
@@ -612,16 +648,16 @@ module Lyp::Lilypond
|
|
612
648
|
lilypond = lilypond_list.first
|
613
649
|
when 'stable'
|
614
650
|
lilypond = lilypond_list.find do |v|
|
615
|
-
|
651
|
+
Lyp.version(v[:version]).segments[1].even?
|
616
652
|
end
|
617
653
|
when 'unstable'
|
618
654
|
lilypond = lilypond_list.find do |v|
|
619
|
-
|
655
|
+
Lyp.version(v[:version]).segments[1].odd?
|
620
656
|
end
|
621
657
|
else
|
622
658
|
version = "~>#{version}.0" if version =~ /^\d+\.\d+$/
|
623
|
-
req =
|
624
|
-
lilypond = lilypond_list.find {|v| req =~
|
659
|
+
req = Lyp.version_req(version)
|
660
|
+
lilypond = lilypond_list.find {|v| req =~ Lyp.version(v[:version])}
|
625
661
|
end
|
626
662
|
|
627
663
|
unless lilypond
|
data/lib/lyp/package.rb
CHANGED
@@ -13,14 +13,14 @@ module Lyp::Package
|
|
13
13
|
if pattern
|
14
14
|
if (pattern =~ /[@\>\<\=\~]/) && (pattern =~ Lyp::PACKAGE_RE)
|
15
15
|
package, version = $1, $2
|
16
|
-
req =
|
16
|
+
req = Lyp.version_req(version) rescue nil
|
17
17
|
packages.select! do |p|
|
18
18
|
p =~ Lyp::PACKAGE_RE
|
19
19
|
p_pack, p_ver = $1, $2
|
20
20
|
|
21
21
|
next false unless p_pack == package
|
22
22
|
|
23
|
-
if req && (p_gemver =
|
23
|
+
if req && (p_gemver = Lyp.version(p_ver) rescue nil)
|
24
24
|
req =~ p_gemver
|
25
25
|
else
|
26
26
|
p_ver == version
|
@@ -38,8 +38,8 @@ module Lyp::Package
|
|
38
38
|
x =~ Lyp::PACKAGE_RE; x_package, x_version = $1, $2
|
39
39
|
y =~ Lyp::PACKAGE_RE; y_package, y_version = $1, $2
|
40
40
|
|
41
|
-
x_version = (x_version &&
|
42
|
-
y_version = (y_version &&
|
41
|
+
x_version = (x_version && Lyp.version(x_version) rescue x)
|
42
|
+
y_version = (y_version && Lyp.version(y_version) rescue y)
|
43
43
|
|
44
44
|
if (x_package == y_package) && (x_version.class == y_version.class)
|
45
45
|
x_version <=> y_version
|
@@ -238,7 +238,11 @@ module Lyp::Package
|
|
238
238
|
puts "Cloning #{url}..." unless opts[:silent]
|
239
239
|
Rugged::Repository.clone_at(url, tmp_path)
|
240
240
|
rescue => e
|
241
|
-
|
241
|
+
if opts[:verbose]
|
242
|
+
raise e
|
243
|
+
else
|
244
|
+
raise "Could not clone repository (please check that the package URL is correct.)"
|
245
|
+
end
|
242
246
|
end
|
243
247
|
|
244
248
|
def checkout_package_version(repo, version, opts = {})
|
@@ -281,7 +285,7 @@ module Lyp::Package
|
|
281
285
|
req = Lyp::FONT_COPY_REQ
|
282
286
|
|
283
287
|
Lyp::Lilypond.list.each do |lilypond|
|
284
|
-
next unless req =~
|
288
|
+
next unless req =~ Lyp.version(lilypond[:version])
|
285
289
|
|
286
290
|
if lilypond[:system]
|
287
291
|
next unless Lyp.confirm_action(SYSTEM_LILYPOND_PROMPT % lilypond[:version])
|
@@ -409,9 +413,9 @@ module Lyp::Package
|
|
409
413
|
when nil, '', 'latest'
|
410
414
|
highest_versioned_tag(repo) || 'master'
|
411
415
|
when /^(\>=|~\>|\d)/
|
412
|
-
req =
|
416
|
+
req = Lyp.version_req(version_specifier)
|
413
417
|
tag = repo_tags(repo).reverse.find do |t|
|
414
|
-
(v = tag_version(t.name)) && (req =~
|
418
|
+
(v = tag_version(t.name)) && (req =~ Lyp.version(v))
|
415
419
|
end
|
416
420
|
unless tag
|
417
421
|
raise "Could not find a version matching #{version_specifier}"
|
@@ -424,7 +428,7 @@ module Lyp::Package
|
|
424
428
|
end
|
425
429
|
|
426
430
|
def highest_versioned_tag(repo)
|
427
|
-
tag = repo_tags(repo).select {|t|
|
431
|
+
tag = repo_tags(repo).select {|t| Lyp.version(tag_version(t.name)) rescue nil}.last
|
428
432
|
tag && tag.name
|
429
433
|
end
|
430
434
|
|
@@ -436,7 +440,7 @@ module Lyp::Package
|
|
436
440
|
tags.sort do |x, y|
|
437
441
|
x_version, y_version = tag_version(x.name), tag_version(y.name)
|
438
442
|
if x_version && y_version
|
439
|
-
|
443
|
+
Lyp.version(x_version) <=> Lyp.version(y_version)
|
440
444
|
else
|
441
445
|
x.name <=> y.name
|
442
446
|
end
|
data/lib/lyp/resolver.rb
CHANGED
@@ -361,7 +361,7 @@ module Lyp
|
|
361
361
|
|
362
362
|
map = lambda do |m, p|
|
363
363
|
if p =~ Lyp::PACKAGE_RE
|
364
|
-
m[$1] = versions[p] ||= (
|
364
|
+
m[$1] = versions[p] ||= (Lyp.version($2 || '0.0') rescue nil)
|
365
365
|
end
|
366
366
|
m
|
367
367
|
end
|
@@ -426,10 +426,10 @@ module Lyp
|
|
426
426
|
req_version = 'forced'
|
427
427
|
end
|
428
428
|
|
429
|
-
req =
|
429
|
+
req = Lyp.version_req(req_version || '>=0') rescue nil
|
430
430
|
available_packages.select do |package, leaf|
|
431
431
|
if (package =~ Lyp::PACKAGE_RE) && (req_package == $1)
|
432
|
-
version =
|
432
|
+
version = Lyp.version($2 || '0') rescue nil
|
433
433
|
if version.nil? || req.nil?
|
434
434
|
req_version.nil? || (req_version == $2)
|
435
435
|
else
|
@@ -473,8 +473,8 @@ module Lyp
|
|
473
473
|
specifiers = map_specifiers_to_versions
|
474
474
|
|
475
475
|
compare_versions = lambda do |x, y|
|
476
|
-
v_x = x =~ Lyp::PACKAGE_RE &&
|
477
|
-
v_y = y =~ Lyp::PACKAGE_RE &&
|
476
|
+
v_x = x =~ Lyp::PACKAGE_RE && Lyp.version($2)
|
477
|
+
v_y = y =~ Lyp::PACKAGE_RE && Lyp.version($2)
|
478
478
|
x <=> y
|
479
479
|
end
|
480
480
|
|
data/lib/lyp/system.rb
CHANGED
@@ -7,6 +7,12 @@
|
|
7
7
|
# }
|
8
8
|
# }
|
9
9
|
|
10
|
+
if _[:opts][:lilypond_version]
|
11
|
+
`
|
12
|
+
\version "{{_[:opts][:lilypond_version]}}"
|
13
|
+
`
|
14
|
+
end
|
15
|
+
|
10
16
|
require 'fileutils'
|
11
17
|
|
12
18
|
user_filename = File.expand_path(_[:user_file])
|
@@ -20,15 +26,27 @@ end
|
|
20
26
|
current_package_dir = _[:current_package_dir] || FileUtils.pwd
|
21
27
|
|
22
28
|
# The wrapper defines a few global variables:
|
23
|
-
#
|
29
|
+
#
|
24
30
|
# lyp:input-filename - the absolute path to the input file name
|
25
31
|
# lyp:input-dirname - the absolute path to the input file directory name
|
26
32
|
# lyp:current-package-dir - the directory for the package currently being loaded
|
27
|
-
# lyp:package-refs - a hash table mapping package refs to package entry
|
33
|
+
# lyp:package-refs - a hash table mapping package refs to package entry
|
28
34
|
# point absolute paths
|
29
35
|
# lyp:package-loaded - a hash table for keeping track of loaded packages
|
30
36
|
# lyp:file-included - a hash table for keeping track of include files
|
31
37
|
|
38
|
+
if _[:opts][:snippet_paper_preamble]
|
39
|
+
`
|
40
|
+
\paper {
|
41
|
+
indent = 0\mm
|
42
|
+
oddHeaderMarkup = ""
|
43
|
+
evenHeaderMarkup = ""
|
44
|
+
oddFooterMarkup = ""
|
45
|
+
evenFooterMarkup = ""
|
46
|
+
}
|
47
|
+
`
|
48
|
+
end
|
49
|
+
|
32
50
|
`
|
33
51
|
#(ly:set-option 'relative-includes #t)
|
34
52
|
\include "{{Lyp::LYP_LY_LIB_PATH}}"
|
@@ -67,5 +85,5 @@ end
|
|
67
85
|
`
|
68
86
|
\include {{quote_path[user_filename]}}
|
69
87
|
|
70
|
-
#(
|
88
|
+
#(lyp:callFinalizers)
|
71
89
|
`
|
data/lib/lyp/version.rb
CHANGED
data/lib/lyp/wrapper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lyp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|