lyp-win 0.3.9 → 1.0.0
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 +1 -1
- data/lib/lyp.rb +1 -0
- data/lib/lyp/cli.rb +13 -0
- data/lib/lyp/etc/lyp.ly +11 -12
- data/lib/lyp/transform.rb +30 -0
- 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: 6287c0b51e3557916d828be45beb7202755eece1
|
4
|
+
data.tar.gz: c18f29783c78a749c03c60f508439a0fe789de5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a82be4ccfe9549f26495c8501cade265c16e67746d31c842b02d6e3b27a337c7789e3798cdbf65aec36ce10ed178f0f6e81dd33f244c1f2327671f2c3073b07
|
7
|
+
data.tar.gz: 527692ac8d475dbede87df0faa88628a7b6bf5eb2628c0881870cd769ce0ca5c3746690266f45dc6586be6d6014023cbd6cea87a01a7f0e99a83e00398a986be
|
data/bin/install_release.sh
CHANGED
data/lib/lyp.rb
CHANGED
data/lib/lyp/cli.rb
CHANGED
@@ -306,6 +306,19 @@ class Lyp::CLI < Thor
|
|
306
306
|
end
|
307
307
|
end
|
308
308
|
|
309
|
+
desc "flatten FILE", "Flatten a file and included files into a single output file"
|
310
|
+
def flatten(input_path, output_path = nil)
|
311
|
+
input_path = File.expand_path(input_path)
|
312
|
+
output_path = File.expand_path(output_path) if output_path
|
313
|
+
flat = Lyp::Transform.flatten(input_path)
|
314
|
+
if output_path
|
315
|
+
File.open(output_path, 'w+') {|f| f << flat}
|
316
|
+
else
|
317
|
+
puts flat
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
|
309
322
|
def self.run
|
310
323
|
start(ARGV)
|
311
324
|
rescue => e
|
data/lib/lyp/etc/lyp.ly
CHANGED
@@ -77,8 +77,8 @@
|
|
77
77
|
(format "Invalid package name ~a" ref) #f))
|
78
78
|
))
|
79
79
|
|
80
|
-
; Because the *location* in lilypond is kinda broken (it becomes unusable
|
81
|
-
; when using nested includes, even in > 2.19.22, we provide an alternative
|
80
|
+
; Because the *location* in lilypond is kinda broken (it becomes unusable
|
81
|
+
; when using nested includes, even in > 2.19.22, we provide an alternative
|
82
82
|
; for keeping track of the current file, and thus be able to include files
|
83
83
|
; using relative path names (relative to the current file).
|
84
84
|
(define lyp:last-this-file #f)
|
@@ -105,17 +105,17 @@
|
|
105
105
|
(define (lyp:fmt-include path)
|
106
106
|
(format "#(set! lyp:last-this-file \"~A\")\n\\include \"~A\"\n#(set! lyp:last-this-file \"~A\")\n"
|
107
107
|
path path (lyp:this-file)))
|
108
|
-
|
108
|
+
|
109
109
|
(define (lyp:fmt-require entry-point-path package-dir)
|
110
110
|
(format "#(set! lyp:current-package-dir \"~A\")\n~A#(set! lyp:current-package-dir \"~A\")\n"
|
111
111
|
package-dir (lyp:fmt-include entry-point-path) lyp:current-package-dir))
|
112
|
-
|
112
|
+
|
113
113
|
; helper function to cover API changes from 2.18 to 2.19
|
114
114
|
(define (lyp:include-string str)
|
115
115
|
(if (defined? '*parser*)
|
116
116
|
(ly:parser-include-string str)
|
117
117
|
(ly:parser-include-string parser str)))
|
118
|
-
|
118
|
+
|
119
119
|
(define (lyp:include parser location path once) (let* (
|
120
120
|
(current-dir (lyp:this-dir))
|
121
121
|
(abs-path (if (lyp:absolute-path? path)
|
@@ -123,7 +123,7 @@
|
|
123
123
|
(lyp:expand-path (lyp:join-path current-dir path))))
|
124
124
|
(included? (and once (hash-ref lyp:file-included? abs-path)))
|
125
125
|
)
|
126
|
-
|
126
|
+
|
127
127
|
(if (not included?) (begin
|
128
128
|
(ly:debug "include ~a\n" abs-path)
|
129
129
|
(if (not (file-exists? abs-path))
|
@@ -146,20 +146,19 @@ require = #(define-void-function (parser location ref)(string?) (let* (
|
|
146
146
|
(if (not loaded?) (begin
|
147
147
|
(ly:debug "Loading package ~a at ~a" name package-dir)
|
148
148
|
(hash-set! lyp:package-loaded? name #t)
|
149
|
-
|
149
|
+
|
150
150
|
(lyp:include-string (lyp:fmt-require entry-point-path package-dir))
|
151
151
|
))
|
152
152
|
))
|
153
|
-
|
154
|
-
pinclude = #(define-void-function (parser location path)(string?)
|
153
|
+
|
154
|
+
pinclude = #(define-void-function (parser location path)(string?)
|
155
155
|
(lyp:include parser location path #f))
|
156
156
|
|
157
157
|
pcondInclude = #(define-void-function (parser location expr path)(scheme? string?)
|
158
158
|
(if expr (lyp:include parser location path #f)))
|
159
159
|
|
160
|
-
pincludeOnce = #(define-void-function (parser location path)(string?)
|
160
|
+
pincludeOnce = #(define-void-function (parser location path)(string?)
|
161
161
|
(lyp:include parser location path #t))
|
162
162
|
|
163
|
-
pcondIncludeOnce = #(define-void-function (parser location path)(string?)
|
163
|
+
pcondIncludeOnce = #(define-void-function (parser location expr path)(scheme? string?)
|
164
164
|
(if expr (lyp:include parser location path #t)))
|
165
|
-
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Lyp::Transform
|
4
|
+
class << self
|
5
|
+
R = Lyp::DependencyResolver
|
6
|
+
|
7
|
+
def flatten(path, ctx = {})
|
8
|
+
ctx[path] = true
|
9
|
+
|
10
|
+
dir = File.dirname(path)
|
11
|
+
src = IO.read(path)
|
12
|
+
|
13
|
+
src.gsub(R::DEP_RE) do
|
14
|
+
inc_path = File.expand_path($2, dir)
|
15
|
+
case $1
|
16
|
+
when R::INCLUDE, R::PINCLUDE
|
17
|
+
"\n%%% #{inc_path}\n#{flatten(inc_path, ctx)}\n"
|
18
|
+
when R::PINCLUDE_ONCE
|
19
|
+
if ctx[inc_path]
|
20
|
+
""
|
21
|
+
else
|
22
|
+
"\n%%% #{inc_path}\n#{flatten(inc_path, ctx)}\n"
|
23
|
+
end
|
24
|
+
else
|
25
|
+
$~
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/lyp/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.0
|
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-06-
|
11
|
+
date: 2016-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/lyp/system.rb
|
98
98
|
- lib/lyp/template.rb
|
99
99
|
- lib/lyp/templates/deps_wrapper.rb
|
100
|
+
- lib/lyp/transform.rb
|
100
101
|
- lib/lyp/version.rb
|
101
102
|
- lib/lyp/windows.rb
|
102
103
|
- lib/lyp/wrapper.rb
|