lyp-win 0.3.2 → 0.3.3
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/bin/lyp +4 -1
- data/lib/lyp/base.rb +5 -0
- data/lib/lyp/cli.rb +9 -8
- data/lib/lyp/etc/lyp.ly +64 -46
- data/lib/lyp/package.rb +50 -3
- data/lib/lyp/version.rb +1 -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: f7c493ee28fc66a7d21ed89d3cae1e75d77b7620
|
4
|
+
data.tar.gz: 5aa416050909fc3b7c628e799390f94a977609d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fead81c0513f4a8a5fdbaca6e3e240c5e56ea9d4e3a0ffcae556b91d52305fecdf2159133df4e7359dd08ee6422f6281bacdd318dc7250b3ee184843e487cb8
|
7
|
+
data.tar.gz: 5c7632c1626e763ac4463b0c3ad66cc78386eba95933511a213b8f3e7267924201514a3fcca2467656e47b53857f7e3e8652eacb0e294402d894bd0b9f364a7c
|
data/bin/install_release.sh
CHANGED
data/bin/lyp
CHANGED
data/lib/lyp/base.rb
CHANGED
@@ -17,6 +17,7 @@ module Lyp
|
|
17
17
|
LYP_DIRECTORY = File.expand_path('~/.lyp')
|
18
18
|
LYP_BIN_DIRECTORY = File.join(LYP_DIRECTORY, 'bin')
|
19
19
|
LYP_LIB_DIRECTORY = File.join(LYP_DIRECTORY, 'lib')
|
20
|
+
LYP_EXT_DIRECTORY = File.join(LYP_DIRECTORY, 'ext')
|
20
21
|
DEFAULT_PACKAGE_DIRECTORY = File.join(LYP_DIRECTORY, 'packages')
|
21
22
|
DEFAULT_LILYPONDS_DIRECTORY = File.join(LYP_DIRECTORY, 'lilyponds')
|
22
23
|
|
@@ -42,6 +43,10 @@ module Lyp
|
|
42
43
|
def self.lilyponds_dir
|
43
44
|
ensure_dir(DEFAULT_LILYPONDS_DIRECTORY)
|
44
45
|
end
|
46
|
+
|
47
|
+
def self.ext_dir
|
48
|
+
ensure_dir(LYP_EXT_DIRECTORY)
|
49
|
+
end
|
45
50
|
|
46
51
|
def self.settings_file
|
47
52
|
ensure_dir(LYP_DIRECTORY)
|
data/lib/lyp/cli.rb
CHANGED
@@ -64,7 +64,7 @@ class Lyp::CLI < Thor
|
|
64
64
|
else
|
65
65
|
search_package(pattern)
|
66
66
|
end
|
67
|
-
end
|
67
|
+
end
|
68
68
|
|
69
69
|
no_commands do
|
70
70
|
def search_lilypond(version)
|
@@ -303,12 +303,13 @@ class Lyp::CLI < Thor
|
|
303
303
|
end
|
304
304
|
end
|
305
305
|
end
|
306
|
+
|
307
|
+
def self.run
|
308
|
+
start(ARGV)
|
309
|
+
rescue => e
|
310
|
+
puts e.message
|
311
|
+
puts e.backtrace.join("\n") if $cmd_options[:verbose]
|
312
|
+
exit(1)
|
313
|
+
end
|
306
314
|
end
|
307
315
|
|
308
|
-
begin
|
309
|
-
Lyp::CLI.start(ARGV)
|
310
|
-
rescue => e
|
311
|
-
puts e.message
|
312
|
-
puts e.backtrace.join("\n") if $cmd_options[:verbose]
|
313
|
-
exit(1)
|
314
|
-
end
|
data/lib/lyp/etc/lyp.ly
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
#(begin
|
2
|
-
(display "\nlyp.ly\n")
|
3
|
-
|
4
2
|
; file/path procedures based on code from oll-core:
|
5
3
|
; https://github.com/openlilylib/oll-core/
|
6
4
|
|
@@ -103,51 +101,71 @@
|
|
103
101
|
(set! lyp:last-this-file current-file)
|
104
102
|
))
|
105
103
|
|
106
|
-
(define (lyp:include
|
107
|
-
|
108
|
-
(
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
(included? (and once-only? (hash-ref lyp:file-included? abs-path)))
|
113
|
-
)
|
114
|
-
(ly:debug (format "lyp:include ~a\n" abs-path))
|
115
|
-
(if (not (file-exists? abs-path))
|
116
|
-
(throw 'lyp:failure "lyp:include-ly-file"
|
117
|
-
(format "File not found ~a" abs-path) #f)
|
118
|
-
)
|
119
|
-
(if (not included?) (begin
|
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
|
-
|
129
|
-
(define (lyp:require ref) (let* (
|
130
|
-
(name (lyp:ref->name ref))
|
131
|
-
(package-dir (lyp:name->dir name))
|
132
|
-
(entry-point-path (lyp:join-path package-dir "package.ly"))
|
133
|
-
(loaded? (hash-ref lyp:package-loaded? name))
|
134
|
-
(prev-package-dir lyp:current-package-dir)
|
135
|
-
)
|
136
|
-
(if (not loaded?) (begin
|
137
|
-
(ly:debug "Loading package ~a at ~a" name package-dir)
|
138
|
-
(set! lyp:current-package-dir package-dir)
|
139
|
-
(hash-set! lyp:package-loaded? name #t)
|
140
|
-
(lyp:include entry-point-path)
|
141
|
-
(set! lyp:current-package-dir prev-package-dir)
|
142
|
-
))))
|
104
|
+
(define (lyp:do-include parser path)
|
105
|
+
(if (defined? '*parser*)
|
106
|
+
(ly:parser-parse-string (ly:parser-clone)
|
107
|
+
(format "\\include \"~a\"" path))
|
108
|
+
(ly:parser-parse-string (ly:parser-clone parser)
|
109
|
+
(format "\\include \"~a\"" path))))
|
143
110
|
)
|
144
111
|
|
145
112
|
% command form
|
146
|
-
require = #(define-void-function (parser location ref)(string?)
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
113
|
+
require = #(define-void-function (parser location ref)(string?) (let* (
|
114
|
+
(current-file (lyp:this-file))
|
115
|
+
(name (lyp:ref->name ref))
|
116
|
+
(package-dir (lyp:name->dir name))
|
117
|
+
(entry-point-path (lyp:join-path package-dir "package.ly"))
|
118
|
+
(loaded? (hash-ref lyp:package-loaded? name))
|
119
|
+
(prev-package-dir lyp:current-package-dir)
|
120
|
+
)
|
121
|
+
(if (not loaded?) (begin
|
122
|
+
(ly:debug "Loading package ~a at ~a" name package-dir)
|
123
|
+
(set! lyp:current-package-dir package-dir)
|
124
|
+
(hash-set! lyp:package-loaded? name #t)
|
125
|
+
|
126
|
+
(set! lyp:last-this-file entry-point-path)
|
127
|
+
(lyp:do-include parser entry-point-path)
|
128
|
+
(set! lyp:last-this-file current-file)
|
129
|
+
|
130
|
+
(set! lyp:current-package-dir prev-package-dir)
|
131
|
+
))
|
132
|
+
))
|
133
|
+
|
134
|
+
pinclude = #(define-void-function (parser location path)(string?) (let* (
|
135
|
+
(current-file (lyp:this-file))
|
136
|
+
(current-dir (dirname current-file))
|
137
|
+
(abs-path (if (lyp:absolute-path? path)
|
138
|
+
path
|
139
|
+
(lyp:expand-path (lyp:join-path current-dir path))))
|
140
|
+
)
|
141
|
+
(ly:debug (format "\\pinclude ~a\n" abs-path))
|
142
|
+
(if (not (file-exists? abs-path))
|
143
|
+
(throw 'lyp:failure "\\pinclude"
|
144
|
+
(format "File not found ~a" abs-path) #f))
|
145
|
+
|
146
|
+
(hash-set! lyp:file-included? abs-path #t)
|
147
|
+
(set! lyp:last-this-file abs-path)
|
148
|
+
(lyp:do-include parser abs-path)
|
149
|
+
(set! lyp:last-this-file current-file)
|
150
|
+
))
|
151
|
+
|
152
|
+
pincludeOnce = #(define-void-function (parser location path)(string?) (let* (
|
153
|
+
(current-file (lyp:this-file))
|
154
|
+
(current-dir (dirname current-file))
|
155
|
+
(abs-path (if (lyp:absolute-path? path)
|
156
|
+
path
|
157
|
+
(lyp:expand-path (lyp:join-path current-dir path))))
|
158
|
+
(included? (hash-ref lyp:file-included? abs-path))
|
159
|
+
)
|
160
|
+
(if (not included?) (begin
|
161
|
+
(ly:debug (format "\\pincludeOnce ~a\n" abs-path))
|
162
|
+
(if (not (file-exists? abs-path))
|
163
|
+
(throw 'lyp:failure "\\pincludeOnce"
|
164
|
+
(format "File not found ~a" abs-path) #f))
|
151
165
|
|
152
|
-
|
153
|
-
|
166
|
+
(hash-set! lyp:file-included? abs-path #t)
|
167
|
+
(set! lyp:last-this-file abs-path)
|
168
|
+
(lyp:do-include parser abs-path)
|
169
|
+
(set! lyp:last-this-file current-file)
|
170
|
+
)
|
171
|
+
)))
|
data/lib/lyp/package.rb
CHANGED
@@ -72,7 +72,13 @@ module Lyp::Package
|
|
72
72
|
install_package_fonts(info[:path], opts)
|
73
73
|
end
|
74
74
|
|
75
|
-
|
75
|
+
unless opts[:silent]
|
76
|
+
if info[:local_path]
|
77
|
+
puts "\nInstalled #{package}@#{info[:version]} => #{info[:local_path]}\n\n"
|
78
|
+
else
|
79
|
+
puts "\nInstalled #{package}@#{info[:version]}\n\n"
|
80
|
+
end
|
81
|
+
end
|
76
82
|
|
77
83
|
if opts[:test]
|
78
84
|
FileUtils.cd(info[:path]) do
|
@@ -85,7 +91,7 @@ module Lyp::Package
|
|
85
91
|
end
|
86
92
|
|
87
93
|
LOCAL_PACKAGE_WRAPPER =
|
88
|
-
"#(set! lyp:current-package-dir \"%s\")\n\\
|
94
|
+
"#(set! lyp:current-package-dir \"%s\")\n\\pinclude \"%s\"\n"
|
89
95
|
|
90
96
|
def install_from_local_files(package, version, opts)
|
91
97
|
version =~ /^([^\:]+)\:(.+)$/
|
@@ -118,7 +124,9 @@ module Lyp::Package
|
|
118
124
|
|
119
125
|
prepare_local_package_fonts(local_path, package_path)
|
120
126
|
|
121
|
-
{version
|
127
|
+
load_package_ext_file("#{package}@#{version}", local_path)
|
128
|
+
|
129
|
+
{version: version, path: package_path, local_path: local_path}
|
122
130
|
end
|
123
131
|
|
124
132
|
def prepare_local_package_fonts(local_path, package_path)
|
@@ -145,9 +153,20 @@ module Lyp::Package
|
|
145
153
|
FileUtils.rm_rf(package_path)
|
146
154
|
FileUtils.cp_r(tmp_path, package_path)
|
147
155
|
|
156
|
+
load_package_ext_file("#{package}@#{version}", package_path)
|
157
|
+
|
148
158
|
{version: version, path: package_path}
|
149
159
|
end
|
150
160
|
|
161
|
+
def load_package_ext_file(package, path)
|
162
|
+
ext_path = File.join(path, 'ext.rb')
|
163
|
+
if File.file?(ext_path)
|
164
|
+
$installed_package = package
|
165
|
+
$installed_package_path = path
|
166
|
+
load_extension(ext_path)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
151
170
|
def uninstall(package, opts = {})
|
152
171
|
unless package =~ Lyp::PACKAGE_RE
|
153
172
|
raise "Invalid package specifier #{package}"
|
@@ -163,6 +182,10 @@ module Lyp::Package
|
|
163
182
|
puts "Uninstalling #{name}" unless opts[:silent]
|
164
183
|
FileUtils.rm_rf(path)
|
165
184
|
end
|
185
|
+
|
186
|
+
Dir["#{Lyp.ext_dir}/#{File.basename(package_path)}*.rb"].each do |path|
|
187
|
+
FileUtils.rm_f(path)
|
188
|
+
end
|
166
189
|
else
|
167
190
|
if version
|
168
191
|
package_path += "@#{version}"
|
@@ -187,6 +210,10 @@ module Lyp::Package
|
|
187
210
|
name = package_path.gsub("#{Lyp.packages_dir}/", '')
|
188
211
|
puts "Uninstalling #{name}" unless opts[:silent]
|
189
212
|
FileUtils.rm_rf(package_path)
|
213
|
+
|
214
|
+
Dir["#{Lyp.ext_dir}/#{File.basename(package_path)}.rb"].each do |path|
|
215
|
+
FileUtils.rm_f(path)
|
216
|
+
end
|
190
217
|
else
|
191
218
|
raise "Could not find package #{package}"
|
192
219
|
end
|
@@ -453,5 +480,25 @@ module Lyp::Package
|
|
453
480
|
end
|
454
481
|
end
|
455
482
|
end
|
483
|
+
|
484
|
+
def load_all_extensions
|
485
|
+
Dir["#{Lyp.ext_dir}/*.rb"].each {|f| load_extension(f)}
|
486
|
+
end
|
487
|
+
|
488
|
+
def load_extension(path)
|
489
|
+
load(path)
|
490
|
+
rescue => e
|
491
|
+
STDERR.puts "Error while loading extension #{path}"
|
492
|
+
STDERR.puts " #{e.message}"
|
493
|
+
end
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
module Lyp
|
498
|
+
def self.install_extension(path)
|
499
|
+
# install extension only when installing the package
|
500
|
+
return unless $installed_package
|
501
|
+
|
502
|
+
FileUtils.cp(path, "#{Lyp.ext_dir}/#{$installed_package}.rb")
|
456
503
|
end
|
457
504
|
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.3.
|
4
|
+
version: 0.3.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-02-
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|