lyp-win 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/install_release.sh +4 -4
- data/bin/lilypond +3 -3
- data/lib/lyp/etc/lyp.ly +96 -43
- data/lib/lyp/lilypond.rb +19 -1
- data/lib/lyp/package.rb +1 -1
- data/lib/lyp/version.rb +1 -1
- data/lib/lyp/wrapper.rb +3 -5
- 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: 92d7c8b45c2774b839d4e20d3726c5532879a05b
|
4
|
+
data.tar.gz: 6cb8087783571a956f952e0f81a922d25397af83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e6d13810fba7603cfc1640d1c752ad926f3e8ef4c679e252c6e4d8a1cb1a27d5a533f475e06df83f1d0825dead5e765ca941bb804f4ef4f444236551f5c881a
|
7
|
+
data.tar.gz: 8a53bebf7bcbfbc40b8106a42614a8b756c7bd1504301eef54bc3ac202ac84adfb045f68c136a100987fcc75346307177f529b9baae273811870f1a38869fa45
|
data/bin/install_release.sh
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
+
LYP_VERSION="0.3.2"
|
4
|
+
WORKDIR="/tmp/lyp-release-installer"
|
5
|
+
URL_BASE="https://github.com/noteflakes/lyp/releases/download/v$LYP_VERSION"
|
6
|
+
|
3
7
|
shopt -s extglob
|
4
8
|
set -o errtrace
|
5
9
|
set -o errexit
|
@@ -17,10 +21,6 @@ download() {
|
|
17
21
|
fi
|
18
22
|
}
|
19
23
|
|
20
|
-
WORKDIR="/tmp/lyp-release-installer"
|
21
|
-
LYP_VERSION="0.3.1"
|
22
|
-
URL_BASE="https://github.com/noteflakes/lyp/releases/download/v$LYP_VERSION"
|
23
|
-
|
24
24
|
PLATFORM=`uname -sp`
|
25
25
|
case $PLATFORM in
|
26
26
|
"Linux x86_64")
|
data/bin/lilypond
CHANGED
@@ -29,7 +29,7 @@ def process_argv
|
|
29
29
|
argv_clean << arg
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
[options, argv_clean]
|
34
34
|
end
|
35
35
|
$options, $argv = process_argv
|
@@ -55,7 +55,7 @@ end
|
|
55
55
|
$lilypond_path = get_lilypond_path
|
56
56
|
|
57
57
|
if $options[:raw]
|
58
|
-
exec("#{$lilypond_path} #{$argv
|
58
|
+
exec("#{$lilypond_path} #{$argv.join(' ')}")
|
59
59
|
end
|
60
60
|
|
61
61
|
OVERRIDING_LILYPOND_SWITCHES = %w{
|
@@ -78,7 +78,7 @@ case $argv.first
|
|
78
78
|
when nil, *OVERRIDING_LILYPOND_SWITCHES
|
79
79
|
STDERR.puts "Lyp version #{Lyp::VERSION}"
|
80
80
|
exec("#{$lilypond_path} #{$argv.join(' ')}")
|
81
|
-
|
81
|
+
|
82
82
|
when *LILYPOND_HELP_SWITCHES
|
83
83
|
STDERR.puts "Lyp version #{Lyp::VERSION}"
|
84
84
|
puts `#{$lilypond_path} #{$argv.join(' ')}`
|
data/lib/lyp/etc/lyp.ly
CHANGED
@@ -1,16 +1,64 @@
|
|
1
1
|
#(begin
|
2
|
+
(display "\nlyp.ly\n")
|
3
|
+
|
4
|
+
; file/path procedures based on code from oll-core:
|
5
|
+
; https://github.com/openlilylib/oll-core/
|
6
|
+
|
7
|
+
(use-modules
|
8
|
+
(lily)
|
9
|
+
(ice-9 regex))
|
10
|
+
|
2
11
|
(define lyp:path-separator "/")
|
3
|
-
(define (lyp:
|
12
|
+
(define (lyp:join-path . ls) (string-join ls lyp:path-separator))
|
13
|
+
|
14
|
+
; convert back-slashes to forward slashes (for use in lyp:split-path)
|
15
|
+
(define (lyp:normalize-path path)
|
16
|
+
(regexp-substitute/global #f "[\\]+" path 'pre "/" 'post)
|
17
|
+
)
|
18
|
+
|
19
|
+
(define (lyp:split-path path)
|
20
|
+
(string-split (lyp:normalize-path path) #\/))
|
21
|
+
|
22
|
+
(define lyp:absolute-path-pattern
|
23
|
+
(if (eq? PLATFORM 'windows) "^[a-zA-Z]:" "^/"))
|
24
|
+
|
25
|
+
(define (lyp:absolute-path? path)
|
26
|
+
(string-match lyp:absolute-path-pattern path))
|
27
|
+
|
28
|
+
; return an absolute path, resolving any . or .. parts
|
29
|
+
(define (lyp:expand-path path) (let* (
|
30
|
+
; create a path list by joining the current directory
|
31
|
+
(tmp-path (if (lyp:absolute-path? path)
|
32
|
+
path (lyp:join-path (ly-getcwd) path)))
|
33
|
+
(src-list (lyp:split-path tmp-path))
|
34
|
+
(dst-list '())
|
35
|
+
)
|
36
|
+
(for-each
|
37
|
+
(lambda (p)
|
38
|
+
(cond
|
39
|
+
((eq? (length dst-list) 0) ; start of path
|
40
|
+
(set! dst-list (list p)))
|
41
|
+
((or (string=? p "") (string=? p ".")) ; ignore empty part
|
42
|
+
#f)
|
43
|
+
((string=? p "..") ; go up a level (remove last part from list)
|
44
|
+
(set! dst-list (reverse (cdr (reverse dst-list)))))
|
45
|
+
(else
|
46
|
+
(set! dst-list (append dst-list (list p))))))
|
47
|
+
src-list)
|
48
|
+
(apply lyp:join-path dst-list)
|
49
|
+
))
|
50
|
+
|
51
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
4
52
|
|
5
53
|
; hash table mapping package refs to package names
|
6
54
|
(define lyp:package-refs (make-hash-table))
|
7
|
-
|
55
|
+
|
8
56
|
; hash table mapping package names to package directories
|
9
57
|
(define lyp:package-dirs (make-hash-table))
|
10
|
-
|
58
|
+
|
11
59
|
; hash table mapping package names to loaded state
|
12
60
|
(define lyp:package-loaded? (make-hash-table))
|
13
|
-
|
61
|
+
|
14
62
|
; hash table mapping file paths to included state
|
15
63
|
(define lyp:file-included? (make-hash-table))
|
16
64
|
|
@@ -22,7 +70,7 @@
|
|
22
70
|
(or name (throw 'lyp:failure "lyp:ref->name"
|
23
71
|
(format "Invalid package ref ~a" ref) #f))
|
24
72
|
))
|
25
|
-
|
73
|
+
|
26
74
|
; convert package reef to directory
|
27
75
|
(define (lyp:name->dir name) (let (
|
28
76
|
(dir (hash-ref lyp:package-dirs name))
|
@@ -30,50 +78,58 @@
|
|
30
78
|
(or dir (throw 'lyp-failure "lyp:name->dir"
|
31
79
|
(format "Invalid package name ~a" ref) #f))
|
32
80
|
))
|
33
|
-
|
34
|
-
;
|
35
|
-
;
|
36
|
-
|
37
|
-
|
38
|
-
|
81
|
+
|
82
|
+
; Because the *location* in lilypond is kinda broken (it becomes unusable
|
83
|
+
; when using nested includes, even in > 2.19.22, we provide an alternative
|
84
|
+
; for keeping track of the current file, and thus be able to include files
|
85
|
+
; using relative path names (relative to the current file).
|
86
|
+
(define lyp:last-this-file #f)
|
87
|
+
(define (lyp:this-file) (or lyp:last-this-file lyp:input-filename))
|
88
|
+
(define (lyp:this-dir) (dirname (lyp:this-file)))
|
89
|
+
|
90
|
+
(define (lyp:load path) (let* (
|
91
|
+
(current-file (lyp:this-file))
|
92
|
+
(current-dir (dirname current-file))
|
93
|
+
(abs-path (if (lyp:absolute-path? path)
|
94
|
+
path
|
95
|
+
(lyp:expand-path (lyp:join-path current-dir path))))
|
39
96
|
)
|
40
|
-
(
|
41
|
-
|
42
|
-
|
43
|
-
; converts a package file reference to absolute path
|
44
|
-
(define (lyp:fileref->path ref) (let* (
|
45
|
-
(split (string-split ref #\:))
|
46
|
-
(qualified? (eq? (length split) 2))
|
47
|
-
(package (if qualified? (list-ref split 0) %nil))
|
48
|
-
(path (if qualified? (list-ref split 1) (list-ref split 0)))
|
97
|
+
(if (not (file-exists? abs-path))
|
98
|
+
(throw 'lyp:failure "lyp:load"
|
99
|
+
(format "File not found ~a" abs-path) #f)
|
49
100
|
)
|
50
|
-
(lyp:
|
101
|
+
(set! lyp:last-this-file abs-path)
|
102
|
+
(load abs-path)
|
103
|
+
(set! lyp:last-this-file current-file)
|
51
104
|
))
|
52
|
-
|
53
|
-
(define (lyp:load ref) (load (lyp:fileref->path ref)))
|
54
|
-
|
105
|
+
|
55
106
|
(define (lyp:include-ly-file path once-only?) (let* (
|
56
|
-
(
|
107
|
+
(current-file (lyp:this-file))
|
108
|
+
(current-dir (dirname current-file))
|
109
|
+
(abs-path (if (lyp:absolute-path? path)
|
110
|
+
path
|
111
|
+
(lyp:expand-path (lyp:join-path current-dir path))))
|
112
|
+
(included? (and once-only? (hash-ref lyp:file-included? abs-path)))
|
57
113
|
)
|
58
|
-
(
|
114
|
+
(ly:debug (format "lyp:include ~a\n" abs-path))
|
115
|
+
(if (not (file-exists? abs-path))
|
59
116
|
(throw 'lyp:failure "lyp:include-ly-file"
|
60
|
-
(format "File not found ~a" path) #f)
|
117
|
+
(format "File not found ~a" abs-path) #f)
|
61
118
|
)
|
62
119
|
(if (not included?) (begin
|
63
|
-
(hash-set! lyp:file-included? path #t)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
(define (lyp:include-once
|
71
|
-
|
72
|
-
|
120
|
+
(hash-set! lyp:file-included? abs-path #t)
|
121
|
+
(set! lyp:last-this-file abs-path)
|
122
|
+
#{ \include #abs-path #}
|
123
|
+
(set! lyp:last-this-file current-file)
|
124
|
+
))))
|
125
|
+
|
126
|
+
(define (lyp:include path) (lyp:include-ly-file path #f))
|
127
|
+
(define (lyp:include-once path) (lyp:include-ly-file path #t))
|
128
|
+
|
73
129
|
(define (lyp:require ref) (let* (
|
74
130
|
(name (lyp:ref->name ref))
|
75
131
|
(package-dir (lyp:name->dir name))
|
76
|
-
(entry-point-path (lyp:
|
132
|
+
(entry-point-path (lyp:join-path package-dir "package.ly"))
|
77
133
|
(loaded? (hash-ref lyp:package-loaded? name))
|
78
134
|
(prev-package-dir lyp:current-package-dir)
|
79
135
|
)
|
@@ -81,20 +137,17 @@
|
|
81
137
|
(ly:debug "Loading package ~a at ~a" name package-dir)
|
82
138
|
(set! lyp:current-package-dir package-dir)
|
83
139
|
(hash-set! lyp:package-loaded? name #t)
|
84
|
-
|
140
|
+
(lyp:include entry-point-path)
|
85
141
|
(set! lyp:current-package-dir prev-package-dir)
|
86
|
-
))
|
87
|
-
))
|
142
|
+
))))
|
88
143
|
)
|
89
144
|
|
90
145
|
% command form
|
91
146
|
require = #(define-void-function (parser location ref)(string?)
|
92
147
|
(lyp:require ref))
|
93
148
|
|
94
|
-
|
95
149
|
pinclude = #(define-void-function (parser location ref)(string?)
|
96
150
|
(lyp:include ref))
|
97
151
|
|
98
152
|
pincludeOnce = #(define-void-function (parser location ref)(string?)
|
99
153
|
(lyp:include-once ref))
|
100
|
-
|
data/lib/lyp/lilypond.rb
CHANGED
@@ -48,6 +48,19 @@ module Lyp::Lilypond
|
|
48
48
|
settings[:current]
|
49
49
|
end
|
50
50
|
|
51
|
+
def current_lilypond_version
|
52
|
+
path = current_lilypond
|
53
|
+
version = File.basename(File.expand_path("#{File.dirname(path)}/../.."))
|
54
|
+
|
55
|
+
unless (Gem::Version.new(version) rescue nil)
|
56
|
+
resp = `#{path} -v`
|
57
|
+
if resp.lines.first =~ /LilyPond ([0-9\.]+)/i
|
58
|
+
version = $1
|
59
|
+
end
|
60
|
+
end
|
61
|
+
version
|
62
|
+
end
|
63
|
+
|
51
64
|
def set_current_lilypond(path)
|
52
65
|
settings = get_session_settings
|
53
66
|
settings[:current] = path
|
@@ -560,9 +573,14 @@ module Lyp::Lilypond
|
|
560
573
|
success = exit_value == 0
|
561
574
|
end
|
562
575
|
if !success && raise_on_failure
|
563
|
-
raise "Error executing cmd #{cmd}
|
576
|
+
raise "Error executing cmd #{cmd}:\n#{parse_error_msg($_err)}"
|
564
577
|
end
|
565
578
|
success
|
566
579
|
end
|
580
|
+
|
581
|
+
def parse_error_msg(msg)
|
582
|
+
(msg =~ /[^\n]+: error.+failed files: ".+"/m) ?
|
583
|
+
$& : msg
|
584
|
+
end
|
567
585
|
end
|
568
586
|
end
|
data/lib/lyp/package.rb
CHANGED
@@ -431,7 +431,7 @@ module Lyp::Package
|
|
431
431
|
|
432
432
|
def perform_test(fn, stats)
|
433
433
|
stats[:test_count] += 1
|
434
|
-
unless Lyp::Lilypond.compile([fn], mode: :system
|
434
|
+
unless Lyp::Lilypond.compile([fn], mode: :system)
|
435
435
|
stats[:fail_count] += 1
|
436
436
|
end
|
437
437
|
end
|
data/lib/lyp/version.rb
CHANGED
data/lib/lyp/wrapper.rb
CHANGED
@@ -11,12 +11,10 @@ module Lyp
|
|
11
11
|
# copy current_package_dir option
|
12
12
|
r[:current_package_dir] = opts[:current_package_dir]
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
fn = "#{Lyp::TMP_ROOT}/wrappers/#{File.basename(fn)}"
|
14
|
+
FileUtils.mkdir_p("#{Lyp::TMP_ROOT}/wrappers")
|
15
|
+
fn = "#{Lyp::TMP_ROOT}/wrappers/#{File.basename(fn)}"
|
17
16
|
|
18
|
-
|
19
|
-
end
|
17
|
+
File.open(fn, 'w+') {|f| f << WRAPPER_TEMPLATE.render(r)}
|
20
18
|
fn
|
21
19
|
end
|
22
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lyp-win
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
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-02-
|
11
|
+
date: 2016-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|