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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ff21ca7ba2c6d2c94dcb6c07dd2574323653376
4
- data.tar.gz: 9b411863056ece14eeead97aa5966e17e24d432e
3
+ metadata.gz: 4d9fed1dd1f3c460de5891f6cfc0bdb7a6603db3
4
+ data.tar.gz: c253c781c07613a9a6523920077700d7e5c24584
5
5
  SHA512:
6
- metadata.gz: 1fc1bd8f3de79b99d4f46669fc6f82542eacd463a08962876af8b6fb804562b3b653217a2288630f7657be661cd8abb5d819be2fed123683b89888503376a8d2
7
- data.tar.gz: eb02d6b9696ea5ba3bf6d1309dd20bb43e1543e14f32337886bc1e57af2e7b7c8b033d1b2d7476c26d3176f755b6484f880eb2ff64893d4b6f528d0bc6f97cfa
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, Mac OS X and Windows 7+.
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/Mac OS X:
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 / Mac OS X users.)
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
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- LYP_VERSION="1.1.0"
3
+ LYP_VERSION="1.2.0"
4
4
  WORKDIR="/tmp/lyp-release-installer"
5
5
  URL_BASE="https://github.com/noteflakes/lyp/releases/download/v$LYP_VERSION"
6
6
 
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, --force_version use lilypond version specified in user file
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>", "Invokes lilypond with given 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 "test [<option>...] [.|PATTERN]", "Runs package tests on installed packages or local directory"
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", "Lists dependencies found in user's files"
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", "Resolves and installs missing dependencies found in user's files"
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
- ; \included.
140
- (module-define! (current-module) 'lyp:finalProcs '())
141
- (define (lyp:getFinalProcs)
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:setFinalProcs (append (lyp:getFinalProcs) (list proc))))
147
- (define (lyp:callFinalizers)
148
- (for-each (lambda (p) (p)) (lyp:getFinalProcs)))
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
- exec "tar -xjf #{fn} -C #{target}"
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
- exec "sh #{fn} --tarball >/dev/null"
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
- exec "tar -xjf #{tmp_fn} -C #{target}"
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 exec(cmd, raise_on_failure = true)
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 cmd #{cmd}:\n#{parse_error_msg($_err)}"
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)
@@ -83,5 +83,5 @@ end
83
83
  `
84
84
  \include {{quote_path[user_filename]}}
85
85
 
86
- #(lyp:callFinalizers)
86
+ #(lyp:call-finalizers)
87
87
  `
data/lib/lyp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lyp
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
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.1.0
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-04 00:00:00.000000000 Z
11
+ date: 2016-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient