lyp 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/lilypond +2 -10
- data/lib/lyp/base.rb +8 -1
- data/lib/lyp/cli.rb +18 -2
- data/lib/lyp/etc/font.scm +296 -0
- data/lib/lyp/lilypond.rb +56 -0
- data/lib/lyp/package.rb +37 -0
- data/lib/lyp/system.rb +3 -1
- data/lib/lyp/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44457899f8d309c43525243e8b0fcfaf0c856abf
|
4
|
+
data.tar.gz: 263b5f9891b99ee932bce722ef4a67a372ca77fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64e91346e7be7c10112d9e0552744a542fec4e2c69b8425a9eb4cb65977e65d3615b49417862bf26256d458f40baf6ad5a043df012b51c82ab3e2350cbce2486
|
7
|
+
data.tar.gz: d4e32d5e5f08762646da59bc519e5a1d716170013d428989a75fa12e0da2c9da8dae4198eca73d3a06d651559f4e253e5b47eedfce8bed3c6a3150eb7a6f05a5
|
data/bin/lilypond
CHANGED
@@ -12,19 +12,11 @@ unless lilypond_path && File.file?(lilypond_path)
|
|
12
12
|
exit 1
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
case ARGV
|
16
|
+
when [], ['-v'], ['--warranty'], ['scheme-sandbox']
|
17
17
|
exec("#{lilypond_path} #{ARGV.join(' ')}")
|
18
|
-
end
|
19
|
-
|
20
|
-
if ARGV.size == 0
|
21
|
-
exec(lilypond_path)
|
22
18
|
else
|
23
|
-
|
24
19
|
begin
|
25
20
|
Lyp::Lilypond.compile(ARGV)
|
26
|
-
# rescue => e
|
27
|
-
# STDERR.puts e.message
|
28
|
-
# exit 1
|
29
21
|
end
|
30
22
|
end
|
data/lib/lyp/base.rb
CHANGED
@@ -6,7 +6,7 @@ module Lyp
|
|
6
6
|
# before the version number.
|
7
7
|
#
|
8
8
|
# Accepted operators: >=, ~>
|
9
|
-
PACKAGE_RE = /^([^@\>~]+)(?:@?((?:\>=|~\>)?.+))?/
|
9
|
+
PACKAGE_RE = /^([^@\>~]+)(?:@?((?:\>=|~\>)?.+))?/
|
10
10
|
LILYPOND_RE = /^lilypond(?:@?((?:\>=|~\>)?.+))?/
|
11
11
|
|
12
12
|
LYP_DIRECTORY = File.expand_path('~/.lyp')
|
@@ -15,6 +15,13 @@ module Lyp
|
|
15
15
|
DEFAULT_PACKAGE_DIRECTORY = File.join(LYP_DIRECTORY, 'packages')
|
16
16
|
DEFAULT_LILYPONDS_DIRECTORY = File.join(LYP_DIRECTORY, 'lilyponds')
|
17
17
|
|
18
|
+
# Fonts are installed on lilypond >= 2.18.2
|
19
|
+
FONT_COPY_REQ = Gem::Requirement.new('>=2.18.2')
|
20
|
+
FONT_PATCH_REQ = Gem::Requirement.new('>=2.18.2', '<2.19.12')
|
21
|
+
|
22
|
+
# Font patch filename (required for 2.18.2 <= lilypond < 2.19.12)
|
23
|
+
FONT_PATCH_FILENAME = File.expand_path('etc/font.scm', File.dirname(__FILE__))
|
24
|
+
|
18
25
|
SETTINGS_FILENAME = 'settings.yml'
|
19
26
|
|
20
27
|
def self.packages_dir
|
data/lib/lyp/cli.rb
CHANGED
@@ -95,11 +95,27 @@ class Lyp::CLI < Thor
|
|
95
95
|
end
|
96
96
|
|
97
97
|
desc "compile [<option>...] <FILE>", "Invokes lilypond with given file"
|
98
|
+
method_option :install, aliases: '-i', type: :boolean, desc: 'Install the requested version of lilypond if not present'
|
99
|
+
method_option :env, aliases: '-e', type: :boolean, desc: 'Use version set by LILYPOND_VERSION environment variable'
|
98
100
|
def compile(*args)
|
99
101
|
Lyp::System.test_installed_status!
|
100
|
-
Lyp::Lilypond.check_lilypond!
|
101
102
|
|
102
|
-
|
103
|
+
if options[:env]
|
104
|
+
Lyp::Lilypond.force_env_version!
|
105
|
+
if options[:install] && !Lyp::Lilypond.forced_lilypond
|
106
|
+
Lyp::Lilypond.install(Lyp::Lilypond.forced_version)
|
107
|
+
end
|
108
|
+
else
|
109
|
+
# check lilypond default / current settings
|
110
|
+
Lyp::Lilypond.check_lilypond!
|
111
|
+
end
|
112
|
+
|
113
|
+
begin
|
114
|
+
Lyp::Lilypond.compile(args)
|
115
|
+
rescue => e
|
116
|
+
puts e.message
|
117
|
+
puts e.backtrace.join("\n")
|
118
|
+
end
|
103
119
|
end
|
104
120
|
|
105
121
|
desc "install <PACKAGE|lilypond|self>...", "Install a package or a version of lilypond. When 'install self' is invoked, lyp installs itself in ~/.lyp."
|
@@ -0,0 +1,296 @@
|
|
1
|
+
;;;; This file is part of LilyPond, the GNU music typesetter.
|
2
|
+
;;;;
|
3
|
+
;;;; Copyright (C) 2004--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
|
4
|
+
;;;;
|
5
|
+
;;;; LilyPond is free software: you can redistribute it and/or modify
|
6
|
+
;;;; it under the terms of the GNU General Public License as published by
|
7
|
+
;;;; the Free Software Foundation, either version 3 of the License, or
|
8
|
+
;;;; (at your option) any later version.
|
9
|
+
;;;;
|
10
|
+
;;;; LilyPond is distributed in the hope that it will be useful,
|
11
|
+
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
;;;; GNU General Public License for more details.
|
14
|
+
;;;;
|
15
|
+
;;;; You should have received a copy of the GNU General Public License
|
16
|
+
;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
;; This file supplied by Abraham Leigh and used by lyp to patch lilypond
|
19
|
+
;; versions from 2.18.2 to 2.19.11 in order to support custom music fonts.
|
20
|
+
|
21
|
+
;; TODO:
|
22
|
+
;;
|
23
|
+
;; lookup-font should be written in C.
|
24
|
+
;;
|
25
|
+
|
26
|
+
;; We have a tree, where each level of the tree is a qualifier
|
27
|
+
;; (eg. encoding, family, shape, series etc.) this defines the levels
|
28
|
+
;; in the tree. The first one is encoding, so we can directly select
|
29
|
+
;; between text or music in the first step of the selection.
|
30
|
+
(define default-qualifier-order
|
31
|
+
'(font-encoding font-family font-shape font-series))
|
32
|
+
|
33
|
+
(define-class <Font-tree-element>
|
34
|
+
())
|
35
|
+
|
36
|
+
(define-class <Font-tree-leaf> (<Font-tree-element>)
|
37
|
+
(default-size #:init-keyword #:default-size)
|
38
|
+
(size-vector #:init-keyword #:size-vector))
|
39
|
+
|
40
|
+
(define-class <Font-tree-node> (<Font-tree-element>)
|
41
|
+
(qualifier #:init-keyword #:qualifier #:accessor font-qualifier)
|
42
|
+
(default #:init-keyword #:default #:accessor font-default)
|
43
|
+
(children #:init-keyword #:children #:accessor font-children))
|
44
|
+
|
45
|
+
(define (make-font-tree-leaf size size-font-vector)
|
46
|
+
(make <Font-tree-leaf> #:default-size size #:size-vector size-font-vector))
|
47
|
+
|
48
|
+
(define (make-font-tree-node
|
49
|
+
qualifier default)
|
50
|
+
(make <Font-tree-node>
|
51
|
+
#:qualifier qualifier
|
52
|
+
#:default default
|
53
|
+
#:children (make-hash-table 11)))
|
54
|
+
|
55
|
+
(define-method (display (leaf <Font-tree-leaf>) port)
|
56
|
+
(for-each (lambda (x) (display x port))
|
57
|
+
(list
|
58
|
+
"#<Font-size-family:\n"
|
59
|
+
(slot-ref leaf 'default-size)
|
60
|
+
(slot-ref leaf 'size-vector)
|
61
|
+
"#>"
|
62
|
+
)))
|
63
|
+
|
64
|
+
(define-method (display (node <Font-tree-node>) port)
|
65
|
+
(for-each
|
66
|
+
(lambda (x)
|
67
|
+
(display x port))
|
68
|
+
(list
|
69
|
+
"Font_node {\nqual: "
|
70
|
+
(font-qualifier node)
|
71
|
+
"(def: "
|
72
|
+
(font-default node)
|
73
|
+
") {\n"))
|
74
|
+
(for-each
|
75
|
+
(lambda (x)
|
76
|
+
(display "\n")
|
77
|
+
(display (car x) port)
|
78
|
+
(display "=" port)
|
79
|
+
(display (cdr x) port))
|
80
|
+
(hash-table->alist (font-children node)))
|
81
|
+
(display "} }\n"))
|
82
|
+
|
83
|
+
|
84
|
+
(define-method (add-font (node <Font-tree-node>) fprops size-family)
|
85
|
+
(define (assoc-delete key alist)
|
86
|
+
(assoc-remove! (list-copy alist) key))
|
87
|
+
|
88
|
+
(define (make-node fprops size-family)
|
89
|
+
(if (null? fprops)
|
90
|
+
(make-font-tree-leaf (car size-family) (cdr size-family))
|
91
|
+
(let* ((qual (next-qualifier default-qualifier-order fprops)))
|
92
|
+
(make-font-tree-node qual
|
93
|
+
(assoc-get qual fprops)))))
|
94
|
+
|
95
|
+
(define (next-qualifier order props)
|
96
|
+
(cond
|
97
|
+
((and (null? props) (null? order))
|
98
|
+
#f)
|
99
|
+
((null? props) (car order))
|
100
|
+
((null? order) (caar props))
|
101
|
+
(else
|
102
|
+
(if (assoc-get (car order) props)
|
103
|
+
(car order)
|
104
|
+
(next-qualifier (cdr order) props)))))
|
105
|
+
|
106
|
+
(let* ((q (font-qualifier node))
|
107
|
+
(d (font-default node))
|
108
|
+
(v (assoc-get q fprops d))
|
109
|
+
(new-fprops (assoc-delete q fprops))
|
110
|
+
(child (hashq-ref (slot-ref node 'children)
|
111
|
+
v #f)))
|
112
|
+
(if (not child)
|
113
|
+
(begin
|
114
|
+
(set! child (make-node new-fprops size-family))
|
115
|
+
(hashq-set! (slot-ref node 'children) v child)))
|
116
|
+
(if (pair? new-fprops)
|
117
|
+
(add-font child new-fprops size-family))))
|
118
|
+
|
119
|
+
(define-method (add-font (node <Font-tree-leaf>) fprops size-family)
|
120
|
+
(throw "must add to node, not leaf"))
|
121
|
+
|
122
|
+
(define-method (g-lookup-font (node <Font-tree-node>) alist-chain)
|
123
|
+
(let* ((qual (font-qualifier node))
|
124
|
+
(def (font-default node))
|
125
|
+
(val (chain-assoc-get qual alist-chain def))
|
126
|
+
(desired-child (hashq-ref (font-children node) val)))
|
127
|
+
|
128
|
+
(if desired-child
|
129
|
+
(g-lookup-font desired-child alist-chain)
|
130
|
+
(g-lookup-font (hashq-ref (font-children node) def) alist-chain))))
|
131
|
+
|
132
|
+
(define-method (g-lookup-font (node <Font-tree-leaf>) alist-chain)
|
133
|
+
node)
|
134
|
+
|
135
|
+
;; two step call is handy for debugging.
|
136
|
+
(define (lookup-font node alist-chain)
|
137
|
+
(g-lookup-font node alist-chain))
|
138
|
+
|
139
|
+
;; TODO - we could actually construct this by loading all OTFs and
|
140
|
+
;; inspecting their design size fields.
|
141
|
+
(define-public feta-design-size-mapping
|
142
|
+
'((11 . 11.22)
|
143
|
+
(13 . 12.60)
|
144
|
+
(14 . 14.14)
|
145
|
+
(16 . 15.87)
|
146
|
+
(18 . 17.82)
|
147
|
+
(20 . 20)
|
148
|
+
(23 . 22.45)
|
149
|
+
(26 . 25.20)))
|
150
|
+
|
151
|
+
;; Each size family is a vector of fonts, loaded with a delay. The
|
152
|
+
;; vector should be sorted according to ascending design size.
|
153
|
+
(define-public (add-music-fonts node family name brace design-size-alist factor)
|
154
|
+
"Set up music fonts.
|
155
|
+
|
156
|
+
Arguments:
|
157
|
+
@itemize
|
158
|
+
@item
|
159
|
+
@var{node} is the font tree to modify.
|
160
|
+
|
161
|
+
@item
|
162
|
+
@var{family} is the family name of the music font.
|
163
|
+
|
164
|
+
@item
|
165
|
+
@var{name} is the basename for the music font.
|
166
|
+
@file{@var{name}-<designsize>.otf} should be the music font,
|
167
|
+
|
168
|
+
@item
|
169
|
+
@var{brace} is the basename for the brace font.
|
170
|
+
@file{@var{brace}-brace.otf} should have piano braces.
|
171
|
+
|
172
|
+
@item
|
173
|
+
@var{design-size-alist} is a list of @code{(rounded . designsize)}.
|
174
|
+
@code{rounded} is a suffix for font filenames, while @code{designsize}
|
175
|
+
should be the actual design size. The latter is used for text fonts
|
176
|
+
loaded through pango/@/fontconfig.
|
177
|
+
|
178
|
+
@item
|
179
|
+
@var{factor} is a size factor relative to the default size that is being
|
180
|
+
used. This is used to select the proper design size for the text fonts.
|
181
|
+
@end itemize"
|
182
|
+
(for-each
|
183
|
+
(lambda (x)
|
184
|
+
(add-font node
|
185
|
+
(list (cons 'font-encoding (car x))
|
186
|
+
(cons 'font-family family))
|
187
|
+
(cons (* factor (cadr x))
|
188
|
+
(caddr x))))
|
189
|
+
|
190
|
+
`((fetaText ,(ly:pt 20.0)
|
191
|
+
,(list->vector
|
192
|
+
(map (lambda (tup)
|
193
|
+
(cons (ly:pt (cdr tup))
|
194
|
+
(format #f "~a-~a ~a"
|
195
|
+
name
|
196
|
+
(car tup)
|
197
|
+
(ly:pt (cdr tup)))))
|
198
|
+
design-size-alist)))
|
199
|
+
(fetaMusic ,(ly:pt 20.0)
|
200
|
+
,(list->vector
|
201
|
+
(map (lambda (size-tup)
|
202
|
+
(delay (ly:system-font-load
|
203
|
+
(format #f "~a-~a" name (car size-tup)))))
|
204
|
+
design-size-alist
|
205
|
+
)))
|
206
|
+
(fetaBraces ,(ly:pt 20.0)
|
207
|
+
#(,(delay (ly:system-font-load
|
208
|
+
(format #f "~a-brace" brace)))))
|
209
|
+
)))
|
210
|
+
|
211
|
+
(define-public (add-pango-fonts node lily-family family factor)
|
212
|
+
;; Synchronized with the `text-font-size' variable in
|
213
|
+
;; layout-set-absolute-staff-size-in-module (see paper.scm).
|
214
|
+
(define text-font-size (ly:pt (* factor 11.0)))
|
215
|
+
|
216
|
+
(define (add-node shape series)
|
217
|
+
(add-font node
|
218
|
+
`((font-family . ,lily-family)
|
219
|
+
(font-shape . ,shape)
|
220
|
+
(font-series . ,series)
|
221
|
+
(font-encoding . latin1) ;; ugh.
|
222
|
+
)
|
223
|
+
`(,text-font-size
|
224
|
+
. #(,(cons
|
225
|
+
(ly:pt 12)
|
226
|
+
(ly:make-pango-description-string
|
227
|
+
`(((font-family . ,family)
|
228
|
+
(font-series . ,series)
|
229
|
+
(font-shape . ,shape)))
|
230
|
+
(ly:pt 12)))))))
|
231
|
+
|
232
|
+
(add-node 'upright 'normal)
|
233
|
+
(add-node 'caps 'normal)
|
234
|
+
(add-node 'upright 'bold)
|
235
|
+
(add-node 'italic 'normal)
|
236
|
+
(add-node 'italic 'bold))
|
237
|
+
|
238
|
+
; This function allows the user to change the specific fonts, leaving others
|
239
|
+
; to the default values. This way, "make-pango-font-tree"'s syntax doesn't
|
240
|
+
; have to change from the user's perspective.
|
241
|
+
;
|
242
|
+
; Usage:
|
243
|
+
; \paper {
|
244
|
+
; #(define fonts
|
245
|
+
; (set-global-fonts
|
246
|
+
; #:music "gonville" ; (the main notation font)
|
247
|
+
; #:roman "FreeSerif" ; (the main/serif text font)
|
248
|
+
; ))
|
249
|
+
; }
|
250
|
+
;
|
251
|
+
; Leaving out "#:brace", "#:sans", and "#:typewriter" leave them at
|
252
|
+
; "emmentaler", "sans-serif", and "monospace", respectively. All fonts are
|
253
|
+
; still accesible through the usual scheme symbols: 'feta, 'roman, 'sans, and
|
254
|
+
; 'typewriter.
|
255
|
+
(define*-public (set-global-fonts #:key
|
256
|
+
(music "emmentaler")
|
257
|
+
(brace "emmentaler")
|
258
|
+
(roman "Century Schoolbook L")
|
259
|
+
(sans "sans-serif")
|
260
|
+
(typewriter "monospace")
|
261
|
+
(factor 1))
|
262
|
+
(let ((n (make-font-tree-node 'font-encoding 'fetaMusic)))
|
263
|
+
(add-music-fonts n 'feta music brace feta-design-size-mapping factor)
|
264
|
+
(add-pango-fonts n 'roman roman factor)
|
265
|
+
(add-pango-fonts n 'sans sans factor)
|
266
|
+
(add-pango-fonts n 'typewriter typewriter factor)
|
267
|
+
n))
|
268
|
+
|
269
|
+
(define-public (make-pango-font-tree roman-str sans-str typewrite-str factor)
|
270
|
+
(let ((n (make-font-tree-node 'font-encoding 'fetaMusic)))
|
271
|
+
(add-music-fonts n 'feta "emmentaler" "emmentaler" feta-design-size-mapping factor)
|
272
|
+
(add-pango-fonts n 'roman roman-str factor)
|
273
|
+
(add-pango-fonts n 'sans sans-str factor)
|
274
|
+
(add-pango-fonts n 'typewriter typewrite-str factor)
|
275
|
+
n))
|
276
|
+
|
277
|
+
(define-public (make-century-schoolbook-tree factor)
|
278
|
+
(make-pango-font-tree
|
279
|
+
"Century Schoolbook L"
|
280
|
+
"sans-serif"
|
281
|
+
"monospace"
|
282
|
+
factor))
|
283
|
+
|
284
|
+
(define-public all-text-font-encodings
|
285
|
+
'(latin1))
|
286
|
+
|
287
|
+
(define-public all-music-font-encodings
|
288
|
+
'(fetaBraces
|
289
|
+
fetaMusic
|
290
|
+
fetaText))
|
291
|
+
|
292
|
+
(define-public (magstep s)
|
293
|
+
(exp (* (/ s 6) (log 2))))
|
294
|
+
|
295
|
+
(define-public (magnification->font-size m)
|
296
|
+
(* 6 (/ (log m) (log 2))))
|
data/lib/lyp/lilypond.rb
CHANGED
@@ -32,6 +32,8 @@ module Lyp::Lilypond
|
|
32
32
|
# The current lilypond path is stored in a temporary file named by the
|
33
33
|
# session id. Thus we can persist the version selected by the user
|
34
34
|
def current_lilypond
|
35
|
+
return forced_lilypond if @forced_version
|
36
|
+
|
35
37
|
settings = get_session_settings
|
36
38
|
|
37
39
|
if !settings[:current]
|
@@ -48,6 +50,23 @@ module Lyp::Lilypond
|
|
48
50
|
set_session_settings(settings)
|
49
51
|
end
|
50
52
|
|
53
|
+
def forced_lilypond
|
54
|
+
lilypond = lyp_lilyponds.find do |l|
|
55
|
+
l[:version] == @forced_version
|
56
|
+
end
|
57
|
+
|
58
|
+
lilypond && lilypond[:path]
|
59
|
+
end
|
60
|
+
|
61
|
+
def force_env_version!
|
62
|
+
@forced_version = ENV['LILYPOND_VERSION']
|
63
|
+
unless @forced_version
|
64
|
+
raise "LILYPOND_VERSION not set"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
attr_reader :forced_version
|
69
|
+
|
51
70
|
def check_lilypond!
|
52
71
|
# check default
|
53
72
|
select_default_lilypond! unless valid_lilypond?(default_lilypond)
|
@@ -116,9 +135,11 @@ module Lyp::Lilypond
|
|
116
135
|
Dir["#{Lyp.lilyponds_dir}/*"].each do |path|
|
117
136
|
next unless File.directory?(path) && File.basename(path) =~ /^[\d\.]+$/
|
118
137
|
|
138
|
+
root_path = path
|
119
139
|
version = File.basename(path)
|
120
140
|
path = File.join(path, "bin/lilypond")
|
121
141
|
list << {
|
142
|
+
root_path: root_path,
|
122
143
|
path: path,
|
123
144
|
version: version
|
124
145
|
}
|
@@ -136,6 +157,7 @@ module Lyp::Lilypond
|
|
136
157
|
resp = `#{path} -v`
|
137
158
|
if resp.lines.first =~ /LilyPond ([0-9\.]+)/i
|
138
159
|
m << {
|
160
|
+
root_path: File.expand_path(File.join(File.dirname(path), '..')),
|
139
161
|
path: path,
|
140
162
|
version: $1,
|
141
163
|
system: true
|
@@ -265,6 +287,9 @@ module Lyp::Lilypond
|
|
265
287
|
|
266
288
|
download_lilypond(url, fn, opts) unless File.file?(fn)
|
267
289
|
install_lilypond_files(fn, platform, version, opts)
|
290
|
+
|
291
|
+
patch_font_scm(version)
|
292
|
+
copy_fonts_from_all_packages(version, opts)
|
268
293
|
end
|
269
294
|
|
270
295
|
def lilypond_install_url(platform, version, opts)
|
@@ -368,6 +393,37 @@ module Lyp::Lilypond
|
|
368
393
|
puts e.message
|
369
394
|
end
|
370
395
|
|
396
|
+
def patch_font_scm(version)
|
397
|
+
return unless Lyp::FONT_PATCH_REQ =~ Gem::Version.new(version)
|
398
|
+
|
399
|
+
target_fn = File.join(Lyp.lilyponds_dir, version, 'share/lilypond/current/scm/font.scm')
|
400
|
+
FileUtils.cp(Lyp::FONT_PATCH_FILENAME, target_fn)
|
401
|
+
end
|
402
|
+
|
403
|
+
def copy_fonts_from_all_packages(version, opts)
|
404
|
+
return unless Lyp::FONT_COPY_REQ =~ Gem::Version.new(version)
|
405
|
+
|
406
|
+
ly_fonts_dir = File.join(Lyp.lilyponds_dir, version, 'share/lilypond/current/fonts')
|
407
|
+
|
408
|
+
Dir["#{Lyp.packages_dir}/**/fonts"].each do |package_fonts_dir|
|
409
|
+
|
410
|
+
Dir["#{package_fonts_dir}/*.otf"].each do |fn|
|
411
|
+
target_fn = File.join(ly_fonts_dir, 'otf', File.basename(fn))
|
412
|
+
FileUtils.cp(fn, target_fn)
|
413
|
+
end
|
414
|
+
|
415
|
+
Dir["#{package_fonts_dir}/*.svg"].each do |fn|
|
416
|
+
target_fn = File.join(ly_fonts_dir, 'svg', File.basename(fn))
|
417
|
+
FileUtils.cp(fn, target_fn)
|
418
|
+
end
|
419
|
+
|
420
|
+
Dir["#{package_fonts_dir}/*.woff"].each do |fn|
|
421
|
+
target_fn = File.join(ly_fonts_dir, 'svg', File.basename(fn))
|
422
|
+
FileUtils.cp(fn, target_fn)
|
423
|
+
end
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
371
427
|
def use(version, opts)
|
372
428
|
lilypond_list = list.reverse
|
373
429
|
|
data/lib/lyp/package.rb
CHANGED
@@ -67,6 +67,11 @@ module Lyp::Package
|
|
67
67
|
|
68
68
|
install_package_dependencies(info[:path], opts)
|
69
69
|
|
70
|
+
if File.directory?(File.join(info[:path], 'fonts'))
|
71
|
+
puts "Installing package fonts..." unless opts[:silent]
|
72
|
+
install_package_fonts(info[:path], opts)
|
73
|
+
end
|
74
|
+
|
70
75
|
puts "\nInstalled #{package}@#{info[:version]}\n\n" unless opts[:silent]
|
71
76
|
|
72
77
|
# important: return the installed version
|
@@ -105,6 +110,12 @@ module Lyp::Package
|
|
105
110
|
f << LOCAL_PACKAGE_WRAPPER % [entry_point_dirname, entry_point_path]
|
106
111
|
end
|
107
112
|
|
113
|
+
# create fonts directory symlink if needed
|
114
|
+
fonts_path = File.join(local_path, 'fonts')
|
115
|
+
if File.directory?(fonts_path)
|
116
|
+
FileUtils.ln_sf(fonts_path, File.join(package_path, 'fonts'))
|
117
|
+
end
|
118
|
+
|
108
119
|
{version: version, path: package_path}
|
109
120
|
end
|
110
121
|
|
@@ -202,6 +213,32 @@ module Lyp::Package
|
|
202
213
|
sub_deps.each {|d| install(d, opts)}
|
203
214
|
end
|
204
215
|
|
216
|
+
def install_package_fonts(package_path, opts = {})
|
217
|
+
req = Lyp::FONT_COPY_REQ
|
218
|
+
|
219
|
+
Lyp::Lilypond.list.each do |lilypond|
|
220
|
+
next unless req =~ Gem::Version.new(lilypond[:version])
|
221
|
+
|
222
|
+
ly_fonts_dir = File.join(lilypond[:root_path], 'share/lilypond/current/fonts')
|
223
|
+
package_fonts_dir = File.join(package_path, 'fonts')
|
224
|
+
|
225
|
+
Dir["#{package_fonts_dir}/*.otf"].each do |fn|
|
226
|
+
target_fn = File.join(ly_fonts_dir, 'otf', File.basename(fn))
|
227
|
+
FileUtils.cp(fn, target_fn)
|
228
|
+
end
|
229
|
+
|
230
|
+
Dir["#{package_fonts_dir}/*.svg"].each do |fn|
|
231
|
+
target_fn = File.join(ly_fonts_dir, 'svg', File.basename(fn))
|
232
|
+
FileUtils.cp(fn, target_fn)
|
233
|
+
end
|
234
|
+
|
235
|
+
Dir["#{package_fonts_dir}/*.woff"].each do |fn|
|
236
|
+
target_fn = File.join(ly_fonts_dir, 'svg', File.basename(fn))
|
237
|
+
FileUtils.cp(fn, target_fn)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
205
242
|
def package_git_url(package, search_index = true)
|
206
243
|
case package
|
207
244
|
when /^(?:(?:[^\:]+)|http|https)\:/
|
data/lib/lyp/system.rb
CHANGED
@@ -124,7 +124,9 @@ EOF
|
|
124
124
|
|
125
125
|
puts "Removing binary scripts..."
|
126
126
|
# Delete bin scripts
|
127
|
-
|
127
|
+
Dir["#{Lyp::LYP_BIN_DIRECTORY}/*"].each do |fn|
|
128
|
+
FileUtils.rm_f(fn) rescue nil
|
129
|
+
end
|
128
130
|
|
129
131
|
puts "\nTo completely remove installed packages and lilyponds run 'rm -rf ~/.lyp'.\n\n"
|
130
132
|
end
|
data/lib/lyp/version.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: 0.1.
|
4
|
+
version: 0.1.5
|
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-01-
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- lib/lyp.rb
|
137
137
|
- lib/lyp/base.rb
|
138
138
|
- lib/lyp/cli.rb
|
139
|
+
- lib/lyp/etc/font.scm
|
139
140
|
- lib/lyp/git_based_rugged.rb
|
140
141
|
- lib/lyp/lilypond.rb
|
141
142
|
- lib/lyp/package.rb
|