lyp-win 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: eeeb07e71da27f2b64f82ed5857c27595ecce50c
4
+ data.tar.gz: 8cdf9309856d240e99a172171c33f25d8938f86c
5
+ SHA512:
6
+ metadata.gz: f58acdac29428959fd4e4585ceeabc2bf884f73691d965e104058de218a5fcd94f676f66cc33f7e0396b5a21889a7d006d63889a7d5d5fbe1889fc53a2b83ba8
7
+ data.tar.gz: 813b94150f002c21118331f3d70bff586471c3d4c78a67323cb0a07a404427b52a7fda4fd2a06df1eab2184424c03743c8c32c6c42a9087b95dc11ccc81c58f2
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2016 Sharon Rosner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,508 @@
1
+ [![Build Status](https://travis-ci.org/noteflakes/lyp.svg?branch=master)](https://travis-ci.org/noteflakes/lyp)
2
+
3
+ # lyp - a package manager for lilypond
4
+
5
+ Use lyp to install and manage packages for lilypond, and install and manage multiple versions of lilypond on your machine.
6
+
7
+ __Code reuse__: lyp lets you install packages that act as lilypond code libraries and can be used to enhance your lilypond files with additional functionality. Packages can depend on other packages. Lyp resolves both direct and transitive package dependencies, and automatically selects the correct version to use for each package.
8
+
9
+ __No hassle Lilypond installation__: With lyp you can also install any version of lilypond on your machine with a single command, without having to visit the lilypond website, clicking a link and then copying files around. In addition, lyp lets you switch between multiple versions of lilypond and always keep your machine up to date with the latest version.
10
+
11
+ ## Table of contents
12
+
13
+ - [Installation](#installation)
14
+ - [How lyp works](#how-lyp-works)
15
+ - [Uninstalling](#uninstalling)
16
+ - [Working with packages](#working-with-packages)
17
+ - [What constitutes a package?](#what-constitutes-a-package)
18
+ - [Installing packages](#installing-packages)
19
+ - [Automatic package installation](#automatic-package-installation)
20
+ - [Package references](#package-references)
21
+ - [Version specifiers](#version-specifiers)
22
+ - [Using packages](#using-packages)
23
+ - [Developing packages](#developing-packages)
24
+ - [The package interface](#the-package-interface)
25
+ - [Including files](#including-files)
26
+ - [Including fonts](#including-fonts)
27
+ - [Testing packages](#testing-packages)
28
+ - [Publishing packages](#publishing-packages)
29
+ - [Installing and Using Lilypond](#installing-and-using-lilypond)
30
+ - [Installing/uninstalling a version of lilypond](#installing-uninstalling a version of lilypond)
31
+ - [Showing the list of installed lilypond versions](#showing-the-list-of-installed-lilypond-versions)
32
+ - [Showing available lilypond versions](#Showing-available-lilypond-versions)
33
+ - [Switching between lilypond versions](#switching-between-lilypond-versions)
34
+ - [Running lilypond](#running-lilypond)
35
+ - [Contributing](#contributing)
36
+
37
+ ## Installation
38
+
39
+ **Note**: lyp is tested to work on Linux and Mac OSX. Installing and using it on Windows would probably be problematic.
40
+
41
+ #### Installing lyp as a Ruby gem
42
+
43
+ If you have a recent (>=1.9.3) version of Ruby on your machine, you can install lyp as a gem:
44
+
45
+ ```bash
46
+ $ gem install lyp
47
+ $ lyp install self
48
+ ```
49
+
50
+ The `lyp install self` command is needed in order to setup the `~/.lyp` working directory and add the lyp binaries directory to your `PATH` (see below), by adding a line of code to your shell profile file.
51
+
52
+ #### Installing lyp without Ruby
53
+
54
+ If you don't have Ruby on your machine you can install lyp as a stand alone package using the install script ([view source](https://git.io/getlyp)):
55
+
56
+ ```bash
57
+ $ curl -sSL https://git.io/getlyp | bash
58
+ ```
59
+
60
+ or with Wget:
61
+
62
+ ```bash
63
+ $ wget -qO- https://git.io/getlyp | bash
64
+ ```
65
+
66
+ 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`:
67
+
68
+ ```bash
69
+ $ cd /Downloads
70
+ # assuming linux-64 platform
71
+ $ tar -xzf lyp-0.2.1-linux-x86_64.tar.gz
72
+ $ lyp-0.2.1-linux-x86_64/lyp install self
73
+ ```
74
+
75
+ https://github.com/noteflakes/lyp/releases/download/v0.2.1/lyp-0.2.1-linux-x86_64.tar.gz
76
+
77
+ **Note**: using the standalone release of lyp requires having git on your machine.
78
+
79
+ ### How lyp works
80
+
81
+ Lyp sets up a working directory in `~/.lyp` where it keeps its binaries, installed packages, and installed versions of lilypond. Lyp provides a wrapper script for lilypond, which does the following:
82
+
83
+ - Select the correct version of lilypond to use (see below).
84
+ - Scan the given lilypond file for any dependencies (specified using `\require`), and also recursively scan any include files for dependencies
85
+ - Resolve the dependency tree and calculate the correct versions to use for each required package.
86
+ - Create a wrapper lilypond file that loads the packages.
87
+ - Invoke the selected version of lilypond.
88
+
89
+ For more information on running lilypond see the section on [Running lilypond](#running-lilypond).
90
+
91
+ ### Uninstalling
92
+
93
+ In order to remove lyp from your system use the `uninstall self` command:
94
+
95
+ ```bash
96
+ $ lyp uninstall self
97
+ ```
98
+
99
+ This command will undo the changes made to your shell profile file, and remove any binaries from `~/.lyp/bin`.
100
+
101
+ In order to completely remove all files in `~/.lyp` you can simply delete the directory:
102
+
103
+ ```bash
104
+ $ rm -rf ~/.lyp
105
+ ```
106
+
107
+ ## Working with Packages
108
+
109
+ A package is a library of lilypond code, containing one or more lilypond files, that provide commonly-used functionality for users. A package can be a library of scheme code to extend lilypond, as in openlilylib; or a stylesheet which contains music fonts and additional lilypond code to change the look of the music: font, spacing, line widths, sizes, etc.
110
+
111
+ The difference between merely copying and including a lilypond file in your music, and using a lilypond package is that you can easily share your music file with anyone and let them compile your music without having to download and copy additional code. lyp takes care of installing and resolving any dependencies in your lilypond files, so that you can compile your lilypond files anywhere without schlepping around a bunch of include files. Also, because packages are versioned, repeatable compilation using external code becomes trivial.
112
+
113
+ ### What constitutes a package?
114
+
115
+ In lyp, a package should contain at least a single lilypond file named `package.ly` in its root directory. A package could contain additional lilypond files referenced in the main package file (using relative includes). A package could also depend on other packages by using the `\require` command (see below).
116
+
117
+ Lilypond packages are expected to be published as git repositories. The packages is then versioned using git tags. A package can be referenced either using its git URL, a short name (if it's registered in the [lyp package index](https://github.com/noteflakes/lyp-index)), or alternatively as a local path (which is meant for package development more than anything else).
118
+
119
+ ### Installing packages
120
+
121
+ In order to install a package, use the `lyp install` command:
122
+
123
+ ```bash
124
+ # install latest version of package dummy
125
+ $ lyp install dummy
126
+
127
+ # install version 0.2.0
128
+ $ lyp install github.com/ciconia/mypack@0.2.0
129
+
130
+ # install version 0.1.0 or higher
131
+ $ lyp install "mypack>=0.1.0"
132
+
133
+ # install from local path (see section below on developing packages)
134
+ $ lyp install mypack@dev:~/repo/mypack
135
+ ```
136
+
137
+ To uninstall the package, use the `lyp uninstall` command:
138
+
139
+ ```bash
140
+ # uninstall version 0.1.0
141
+ $ lyp uninstall dummy@0.1.0
142
+
143
+ # uninstall all versions of dummy
144
+ $ lyp uninstall -a dummy
145
+ ```
146
+
147
+ To list currently installed packages use `lyp list` command:
148
+
149
+ ```bash
150
+ # list all installed packages
151
+ $ lyp list
152
+
153
+ # list all installed packages matching the pattern 'font'
154
+ $ lyp list font
155
+ ```
156
+
157
+ To list packages available on the lyp package index use the `lyp search` command:
158
+
159
+ ```bash
160
+ # list all packages in index
161
+ lyp search
162
+
163
+ # list available packages matching pattern 'stylesheet'
164
+ lyp search stylesheet
165
+ ```
166
+
167
+ ### Automatic package installation
168
+
169
+ An easier way to install packages is by using the `lyp resolve` command, which installs all packages required for a given input file. Suppose a lilypond called `test.ly` with the following content:
170
+
171
+ ```lilypond
172
+ \version "2.19.35"
173
+ \require "assert"
174
+
175
+ #(assert-eq? 1 1)
176
+ #(assert:summary)
177
+ ```
178
+
179
+ To install the `assert` package required in the file we run:
180
+
181
+ ```bash
182
+ $ lyp resolve test.ly
183
+ #=>
184
+ Cloning https://github.com/noteflakes/lyp-assert.git...
185
+
186
+ Installed assert@0.2.0
187
+ ```
188
+
189
+ Package dependencies for a given input file can be shown using the `lyp deps` command:
190
+
191
+ ```bash
192
+ $ lyp deps test.ly
193
+ #=>
194
+ assert => 0.2.0
195
+ ```
196
+
197
+ ### Package references
198
+
199
+ A package is normally referenced by its git URL. Lyp lets you provide either fully- or partially qualified URLs. A package hosted on github can be also referenced by the user/repository pair. The following are all equivalent:
200
+
201
+ ```bash
202
+ # Fully-qualified URLs
203
+ $ lyp install https://github.com/noteflakes/lyp-package-template.git
204
+ $ lyp install https://github.com/noteflakes/lyp-package-template
205
+
206
+ # Partially-qualified URL
207
+ $ lyp install github.com/noteflakes/lyp-package-template
208
+
209
+ # Github repository id
210
+ $ lyp install noteflakes/lyp-package-template
211
+ ```
212
+
213
+ In addition, lyp also provides an [index of publically available package](https://github.com/noteflakes/lyp-index), which maps a package name to its URL (see also below). Using the index, packages are referenced by their published name instead of by their git URL:
214
+
215
+ ```bash
216
+ $ lyp install dummy
217
+ ```
218
+
219
+ To get a list of all available packages on the index, use the `lyp search` command.
220
+
221
+ ### Version specifiers
222
+
223
+ When installing packages defining package dependencies, it is advisable to specify the desired version to use. Using definitive versions lets you ensure that your third-party dependencies do not change unexpectedly and do not break your code.
224
+
225
+ Versions can either be specified as specific version numbers, as version constraints or as descriptive names.
226
+
227
+ Versions are specified using the ampersand character:
228
+
229
+ ```
230
+ package@0.1.0
231
+ package@stable
232
+ ```
233
+
234
+ Version constraints specify a range of versions to use. Lyp currently supports two types of constraints:
235
+
236
+ - Optimistic constraint: `package>=0.1.0`, which means any version equal to or higher than 0.1.0.
237
+ - Pessimistic constraint: `package~>0.1.0`, which means any version equal or higher than 0.1.0, and lower than 0.2.0. This type of constraint is useful for packages which follow the semantic versioning standard.
238
+
239
+ Version specifiers could be used when installing, listing and requiring packages, and also for specifying versions of lilypond (see below). For example:
240
+
241
+ ```bash
242
+ $ lyp install "dummy~>0.2.0"
243
+ ```
244
+
245
+ **Note**: when using version constraints you should put the package specifier in quotes for bash properly parse the command.
246
+
247
+ ### Requiring packages
248
+
249
+ To include a package in your lilypond code, use the `\require` command:
250
+
251
+ ```lilypond
252
+ \require "dummy"
253
+ \require "github.com/lulu/mypack>=0.4.0"
254
+ ```
255
+
256
+ **Note**: once you use `\require` in your code, you will have to compile it using the lilypond wrapper provided by lyp. It will not pass compilation using plain lilypond.
257
+
258
+ Once the package requirements are defined, you can either install packages manually using [`lyp install`](#installing-packages), or automatically using [`lyp resolve`](#automatic-package-installation) as described above.
259
+
260
+ ## Developing packages
261
+
262
+ To create a lilypond package:
263
+
264
+ - Create a git repository.
265
+ - Add a `package.ly` file, which is the main entry point for your package.
266
+ - Optionally add additional lilypond files or package dependencies.
267
+ - Test & debug your code (see below).
268
+ - Publish your package (see below).
269
+
270
+ To test your package with an actual input file, you can install it from a local path (for more on testing see [below](#testing-packages)). Suppose your package is at ~/repo/mypack:
271
+
272
+ ```bash
273
+ $ lyp install mypack@dev:~/repo/mypack
274
+ ```
275
+
276
+ This will create a `mypack@dev` package referencing your local files, which you can then reference normally from an input file using the `\require` command:
277
+
278
+ ```lilypond
279
+ \require "mypack@dev"
280
+ ```
281
+
282
+ If the input file is residing inside your package (for example, [test files](#testing-packages)), you can require your package by specifying a relative path. Suppose the input file is at `mypack/test/mypack_test.ly`:
283
+
284
+ ```lilypond
285
+ \require "mypack:.."
286
+ ```
287
+
288
+ ### The package interface
289
+
290
+ In order to facilitate writing complex packages, lyp defines a few variables and functions:
291
+
292
+ - `lyp:current-package-dir` - the absolute directory path for the current package (at the time the package is loaded)
293
+ - `lyp:input-filename` - the absolute path for the user's file being compiled
294
+ - `lyp:input-dirname` - the absolute directory path for the user's file being compiled
295
+
296
+ ### Including files
297
+
298
+ Lyp provides the `\pinclude` and `\pincludeOnce` commands for including files residing in the current package using relative paths. The `\pincludeOnce` commands loads a given file only once:
299
+
300
+ ```lilypond
301
+ \pincludeOnce "inc/init.ily"
302
+ \pinclude "inc/template.ily"
303
+ ```
304
+
305
+ Lyp also defines a `lyp:load` scheme function for loading scheme files using relative paths without adding directories to the `%load-path`:
306
+
307
+ ```lilypond
308
+ #(if (not (defined? 'mypack:init))(lyp:load "scm/init.scm"))
309
+ ```
310
+
311
+ Loading scheme files that way is a better technique than adding directorys to `%load-path`, because this way one avoids possible name clashes, which may lead to unexpected behavior.
312
+
313
+ ### Including fonts
314
+
315
+ Lyp also supports automatic installation of fonts, based on work by [Abraham Leigh](https://github.com/tisimst). When a package is installed, lyp will copy any font files residing in the `fonts` directory into the corresponding `otf` and `svg` directories of all installed versions of lilypond.
316
+
317
+ **Note**: fonts will be only installed in versions of lilypond starting from than 2.18.2. Lyp automatically patches any version ower than 2.19.12 in order to support custom fonts.
318
+
319
+ ### Testing Packages
320
+
321
+ Packages can be tested by using the `lyp test` command, which will compile any file found inside the package directory ending in `_test.ly`:
322
+
323
+ ```bash
324
+ $ cd mypack
325
+ $ lyp test .
326
+ ```
327
+
328
+ A test file can either be a simple lilypond file which includes the package files and results in a lilypond score, or a lilypond file that performs unit tests on scheme code.
329
+
330
+ For more information on testing, see the [lyp-assert](https://github.com/noteflakes/lyp-assert) package, which is meant to be used for unit testing lilypond code, and serves as an example of how to test a package.
331
+
332
+ ### Publishing packages
333
+
334
+ In order for your package to be available to all users, you'll need to first push your code to a publically accessible git repository (for example on github). Users will then be able to install your package by using the git URL of the public repository.
335
+
336
+ You can also add your package to the lyp [public package index](https://github.com/noteflakes/lyp-index), by cloning it, editing [index.yaml](https://github.com/noteflakes/lyp-index/blob/master/index.yaml), and creating a pull request.
337
+
338
+ ## Installing and Using Lilypond
339
+
340
+ ### Installing/uninstalling a version of lilypond
341
+
342
+ When installing lilypond, the specific version to download can be specified in different ways:
343
+
344
+ ```bash
345
+ # latest stable version
346
+ $ lyp install lilypond
347
+
348
+ # latest stable version
349
+ $ lyp install lilypond@stable
350
+
351
+ # latest stable version
352
+ $ lyp install lilypond@unstable
353
+
354
+ # latest version
355
+ $ lyp install lilypond@latest
356
+
357
+ # version 2.18.1
358
+ $ lyp install lilypond@2.18.1
359
+
360
+ # highest version higher than 2.19.27
361
+ $ lyp install "lilypond>=2.19.27"
362
+
363
+ # highest 2.18 version higher than 2.18.1
364
+ $ lyp install "lilypond~>2.18.1"
365
+ ```
366
+
367
+ To uninstall a version lilypond use `lyp uninstall`
368
+
369
+ ```bash
370
+ $ lyp uninstall lilypond@2.18.2
371
+ ```
372
+
373
+ ### Showing the list of installed lilypond versions
374
+
375
+ To display all installed versions of lilypond, use the `list` command:
376
+
377
+ ```bash
378
+ $ lyp list lilypond
379
+ ```
380
+
381
+ The output will look as follows:
382
+
383
+ ```
384
+ Lilypond versions:
385
+
386
+ => 2.18.2
387
+ 2.19.12
388
+ * 2.19.35
389
+
390
+ # => - current
391
+ # =* - current && default
392
+ # * - default
393
+ ```
394
+
395
+ (For current, default settings see below)
396
+
397
+ This will also list any versions of lilypond found on the user's `$PATH` outside of the `~/.lyp` directory (these versions will be marked as 'system' versions).
398
+
399
+ ### Showing available lilypond versions
400
+
401
+ You can also list available versions of lilypond by using the `search` command:
402
+
403
+ ```bash
404
+ # display all available versions of lilypond
405
+ $ lyp search lilypond
406
+
407
+ # display all available versions higher than 2.19
408
+ $ lyp search "lilypond>=2.19"
409
+
410
+ # display all available stable versions
411
+ $ lyp search "lilypond@stable"
412
+ ````
413
+
414
+ The output will look as follows:
415
+
416
+ ```
417
+ Available versions of lilypond@stable:
418
+
419
+ 2.8.8
420
+ 2.10.0
421
+ 2.10.33
422
+ 2.12.0
423
+ 2.12.3
424
+ 2.14.0
425
+ 2.14.2
426
+ 2.16.0
427
+ 2.16.1
428
+ 2.16.2
429
+ 2.18.0
430
+ 2.18.1
431
+ * 2.18.2
432
+
433
+ * Currently installed
434
+ ```
435
+
436
+ ### Switching between lilypond versions
437
+
438
+ To switch between versions use the `lyp use`. The same version specifiers could be used as for the `lyp install` command:
439
+
440
+ ```bash
441
+ $ lyp use lilypond@2.18.2 # the 'lilypond' identifier is optional
442
+
443
+ # use latest stable/unstable versions
444
+ $ lyp use stable
445
+ $ lyp use unstable
446
+ ```
447
+
448
+ **Note**: The setting of the current lilypond version to use will be maintained for the current shell session.
449
+
450
+ In order to switch the default version of lilypond to use, add the `--default` switch:
451
+
452
+ ```bash
453
+ $ lyp use --default 2.19.35
454
+ ```
455
+
456
+ The version used can be further controlled using the `--use` and `--env` options passed to `lilypond` (see below).
457
+
458
+ As discussed [above](#showing-the-list-of-installed-lilypond-versions), the `lyp list lilypond` command displays the current and default settings. You can also display the path to the currently selected version by running `lyp which lilypond`:
459
+
460
+ ```bash
461
+ $ lyp which lilypond
462
+ #=> /Users/sharon/.lyp/lilyponds/2.18.2/bin/lilypond
463
+ ```
464
+
465
+ ### Running lilypond
466
+
467
+ Once one or more versions of lilypond are installed, the lilypond command may be used normally to compile lilypond files. Lyp adds a few extra options:
468
+
469
+ - `--use`, `-u` - use a specific version of lilypond:
470
+
471
+ ```bash
472
+ $ lilypond --use=2.19.12 ...
473
+
474
+ # version constraints can also be used:
475
+ $ lilypond --use=">=2.19.12" ...
476
+ $ lilypond --use=stable ...
477
+ $ lilypond --use=latest ...
478
+ ```
479
+
480
+ - `--env`, `-E` - use a version set by the `$LILYPOND_VERSION` environment variable:
481
+
482
+ ```bash
483
+ $ LILYPOND_VERSION=2.18.2 lilypond --env ...
484
+ ```
485
+
486
+ - `--install`, `-n` - install the specified version of lilypond if not present. This option works only in conjunction with `--env` or `--use`:
487
+
488
+ ```bash
489
+ $ lilypond -u2.19.35 -n ...
490
+ ```
491
+
492
+ - `--raw`, `-r` - do not pre-process input file (no scanning for dependencies, no wrapping).
493
+
494
+ ```bash
495
+ $ lilypond --raw ...
496
+ ```
497
+
498
+ ## Contributing
499
+
500
+ Lyp is written in Ruby, and its code is [available on github](https://github.com/noteflakes/lyp). To hack on it, simply clone the repository. To run the specs:
501
+
502
+ ```bash
503
+ $ cd lyp
504
+ $ bundle install # needs to be run only once
505
+ $ rspec
506
+ ```
507
+
508
+ Please feel free to submit issues and pull requests.