lyp 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/bin/install_release.sh +1 -1
- data/bin/lilypond +1 -1
- data/lib/lyp/cli.rb +20 -4
- data/lib/lyp/etc/lyp.ly +6 -9
- data/lib/lyp/lilypond.rb +24 -5
- data/lib/lyp/system.rb +9 -0
- data/lib/lyp/templates/deps_wrapper.rb +1 -1
- 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: 4d9fed1dd1f3c460de5891f6cfc0bdb7a6603db3
|
4
|
+
data.tar.gz: c253c781c07613a9a6523920077700d7e5c24584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffc6ec1b50ffd05b9032ac30a00ab05ec608ba8210e26b911cac1132721fd6674f0bacf9245efec42bd624aa08272e9b054f436080e9f0a840f44871acdff64f
|
7
|
+
data.tar.gz: 37948d1ec09e6e3558719acf6c4f47254c41bbb39b50e44c204f6046b40820b252c37c0c2eac3b3106bc09c3bc7e3d77460a9f8c56d02a6e810509fc1a0abb59
|
data/README.md
CHANGED
@@ -49,14 +49,16 @@ __No hassle Lilypond installation__: With lyp you can also install any version o
|
|
49
49
|
|
50
50
|
### System requirements
|
51
51
|
|
52
|
-
Lyp is tested to work on Linux,
|
52
|
+
Lyp is tested to work on Linux, MacOS and Windows 7+.
|
53
53
|
|
54
54
|
### Installing lyp as a Ruby gem
|
55
55
|
|
56
|
+
_Note_: A recent version of Ruby (2.0.0 or later) is included in MacOS 10.9.0 or later.
|
57
|
+
|
56
58
|
If you have a recent (>=1.9.3) version of Ruby on your machine, you can install lyp as a gem.
|
57
59
|
|
58
60
|
```bash
|
59
|
-
# Linux/
|
61
|
+
# Linux/MacOS:
|
60
62
|
$ gem install lyp
|
61
63
|
|
62
64
|
# Windows:
|
@@ -86,7 +88,7 @@ Windows users can simply download the latest Windows [release](https://github.co
|
|
86
88
|
|
87
89
|
### Manually installing releases
|
88
90
|
|
89
|
-
(This section is for Linux /
|
91
|
+
(This section is for Linux / MacOS users.)
|
90
92
|
|
91
93
|
If you feel uneasy about piping curl output to bash, you can install lyp yourself by downloading a [release](https://github.com/noteflakes/lyp/releases), untarring it, and running `lyp install self`:
|
92
94
|
|
data/bin/install_release.sh
CHANGED
data/bin/lilypond
CHANGED
@@ -26,7 +26,7 @@ Lyp-provided options:
|
|
26
26
|
-A, --auto-install-deps install any missing dependencies
|
27
27
|
-c, --cropped crop output (requires setting 0 margins)
|
28
28
|
-E, --env use version specified in $LILYPOND_VERSION
|
29
|
-
-F, --
|
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/cli.rb
CHANGED
@@ -99,7 +99,7 @@ class Lyp::CLI < Thor
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
desc "compile [<option>...] <FILE>", "
|
102
|
+
desc "compile [<option>...] <FILE>", "Invoke lilypond with given file"
|
103
103
|
def compile(*argv)
|
104
104
|
opts, argv = Lyp::Lilypond.preprocess_argv(argv)
|
105
105
|
|
@@ -110,7 +110,14 @@ class Lyp::CLI < Thor
|
|
110
110
|
Lyp::Lilypond.compile(argv, opts)
|
111
111
|
end
|
112
112
|
|
113
|
-
desc "
|
113
|
+
desc "exec <CMD> [<options>...]", "Execute a lilypond script"
|
114
|
+
def exec(*argv)
|
115
|
+
$stderr.puts "Lyp #{Lyp::VERSION}"
|
116
|
+
Lyp::System.test_installed_status!
|
117
|
+
Lyp::Lilypond.invoke_script(argv, {})
|
118
|
+
end
|
119
|
+
|
120
|
+
desc "test [<option>...] [.|PATTERN]", "Run package tests on installed packages or local directory"
|
114
121
|
method_option :install, aliases: '-n', type: :boolean, desc: 'Install the requested version of Lilypond if not present'
|
115
122
|
method_option :env, aliases: '-E', type: :boolean, desc: 'Use version set by LILYPOND_VERSION environment variable'
|
116
123
|
method_option :use, aliases: '-u', type: :string, desc: 'Use specified version'
|
@@ -275,7 +282,7 @@ class Lyp::CLI < Thor
|
|
275
282
|
end
|
276
283
|
end
|
277
284
|
|
278
|
-
desc "deps FILE", "
|
285
|
+
desc "deps FILE", "List dependencies found in user's files"
|
279
286
|
def deps(fn)
|
280
287
|
$cmd_options = options
|
281
288
|
|
@@ -291,7 +298,7 @@ class Lyp::CLI < Thor
|
|
291
298
|
end
|
292
299
|
end
|
293
300
|
|
294
|
-
desc "resolve FILE", "
|
301
|
+
desc "resolve FILE", "Resolve and install missing dependencies found in user's files"
|
295
302
|
method_option :all, aliases: '-a', type: :boolean, desc: 'Install all found dependencies'
|
296
303
|
def resolve(fn)
|
297
304
|
$cmd_options = options
|
@@ -326,6 +333,15 @@ class Lyp::CLI < Thor
|
|
326
333
|
end
|
327
334
|
end
|
328
335
|
|
336
|
+
desc "accelerate", "Rewrite gem binaries to make lyp faster"
|
337
|
+
def accelerate
|
338
|
+
unless Lyp::System.is_gem?
|
339
|
+
puts "Lyp is not installed as a gem."
|
340
|
+
exit 1
|
341
|
+
end
|
342
|
+
|
343
|
+
Lyp::System.rewrite_gem_scripts
|
344
|
+
end
|
329
345
|
|
330
346
|
def self.run
|
331
347
|
start(ARGV)
|
data/lib/lyp/etc/lyp.ly
CHANGED
@@ -136,16 +136,13 @@
|
|
136
136
|
))
|
137
137
|
|
138
138
|
; define list of finalizer lambdas to be called after the user's file has been
|
139
|
-
;
|
140
|
-
|
141
|
-
(define
|
142
|
-
(module-ref (current-module) 'lyp:finalProcs))
|
143
|
-
(define (lyp:setFinalProcs l)
|
144
|
-
(module-define! (current-module) 'lyp:finalProcs l))
|
139
|
+
; processed. packages invoke (lyp:finalize proc) to add their own code.
|
140
|
+
; Finalizers are called in the order they were added.
|
141
|
+
(define lyp:final-procs '())
|
145
142
|
(define (lyp:finalize proc)
|
146
|
-
(lyp:
|
147
|
-
(define (lyp:
|
148
|
-
(for-each (lambda (p) (p))
|
143
|
+
(set! lyp:final-procs (append lyp:final-procs (list proc))))
|
144
|
+
(define (lyp:call-finalizers)
|
145
|
+
(for-each (lambda (p) (p)) lyp:final-procs))
|
149
146
|
)
|
150
147
|
|
151
148
|
% command form
|
data/lib/lyp/lilypond.rb
CHANGED
@@ -116,6 +116,20 @@ module Lyp::Lilypond
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
+
def invoke_script(argv, opts = {})
|
120
|
+
cmd = File.join(current_lilypond_bin_path, argv.shift)
|
121
|
+
|
122
|
+
case opts[:mode]
|
123
|
+
when :system
|
124
|
+
system("#{cmd} #{argv.join(" ")}")
|
125
|
+
when :spawn
|
126
|
+
pid = spawn(cmd, *argv, opts[:spawn_opts] || {})
|
127
|
+
Process.detach(pid)
|
128
|
+
else
|
129
|
+
Kernel.exec(cmd, *argv)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
119
133
|
def default_lilypond
|
120
134
|
Lyp::Settings['lilypond/default']
|
121
135
|
end
|
@@ -139,6 +153,11 @@ module Lyp::Lilypond
|
|
139
153
|
settings[:current]
|
140
154
|
end
|
141
155
|
|
156
|
+
def current_lilypond_bin_path
|
157
|
+
lilypond = current_lilypond
|
158
|
+
lilypond && File.dirname(lilypond)
|
159
|
+
end
|
160
|
+
|
142
161
|
def current_lilypond_version
|
143
162
|
path = current_lilypond
|
144
163
|
version = File.basename(File.expand_path("#{File.dirname(path)}/../.."))
|
@@ -504,7 +523,7 @@ module Lyp::Lilypond
|
|
504
523
|
|
505
524
|
def install_lilypond_files_osx(fn, target, platform, version, opts)
|
506
525
|
STDERR.puts "Extracting..." unless opts[:silent]
|
507
|
-
|
526
|
+
run_cmd "tar -xjf #{fn} -C #{target}"
|
508
527
|
|
509
528
|
copy_lilypond_files("#{target}/LilyPond.app/Contents/Resources", version, opts)
|
510
529
|
end
|
@@ -519,12 +538,12 @@ module Lyp::Lilypond
|
|
519
538
|
FileUtils.mkdir_p(tmp_dir)
|
520
539
|
|
521
540
|
FileUtils.cd(tmp_dir) do
|
522
|
-
|
541
|
+
run_cmd "sh #{fn} --tarball >/dev/null"
|
523
542
|
end
|
524
543
|
|
525
544
|
tmp_fn = "#{tmp_dir}/lilypond-#{version}-1.#{platform}.tar.bz2"
|
526
545
|
|
527
|
-
|
546
|
+
run_cmd "tar -xjf #{tmp_fn} -C #{target}"
|
528
547
|
|
529
548
|
copy_lilypond_files("#{target}/usr", version, opts)
|
530
549
|
ensure
|
@@ -701,7 +720,7 @@ module Lyp::Lilypond
|
|
701
720
|
FileUtils.rm_rf(path)
|
702
721
|
end
|
703
722
|
|
704
|
-
def
|
723
|
+
def run_cmd(cmd, raise_on_failure = true)
|
705
724
|
req_ext('open3')
|
706
725
|
$_out = ""
|
707
726
|
$_err = ""
|
@@ -713,7 +732,7 @@ module Lyp::Lilypond
|
|
713
732
|
success = exit_value == 0
|
714
733
|
end
|
715
734
|
if !success && raise_on_failure
|
716
|
-
raise "Error executing
|
735
|
+
raise "Error executing #{cmd}:\n#{parse_error_msg($_err)}"
|
717
736
|
end
|
718
737
|
success
|
719
738
|
end
|
data/lib/lyp/system.rb
CHANGED
@@ -110,6 +110,15 @@ EOF
|
|
110
110
|
def is_gem?
|
111
111
|
SELF_DIR !~ /#{RELEASE_BIN_PATH}$/
|
112
112
|
end
|
113
|
+
|
114
|
+
def rewrite_gem_scripts
|
115
|
+
%w{lyp lilypond}.each do |script_name|
|
116
|
+
src_path = Gem.bin_path('lyp', script_name)
|
117
|
+
dest_path = File.join(Gem.bindir, script_name)
|
118
|
+
puts "cp #{src_path} #{dest_path}"
|
119
|
+
FileUtils.cp(src_path, dest_path)
|
120
|
+
end
|
121
|
+
end
|
113
122
|
|
114
123
|
def setup_gem_files
|
115
124
|
FileUtils.rm_rf(Lyp::LYP_BIN_DIRECTORY)
|
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: 1.
|
4
|
+
version: 1.2.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-12-
|
11
|
+
date: 2016-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|