LilyPond-Ruby 0.0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a5c247479c72432681e120f021e8f7bc478fd98d1307e0258bd083f2f04fd604
4
+ data.tar.gz: 39f4325ab9da401e2856c68577ce5acc7159189ae3dc6ea8e4097779bd096d44
5
+ SHA512:
6
+ metadata.gz: dae1def60d5a8d81ef598625f3067b644a58aadff548bea017ad8e90b02c589033739b687add9f0f26ecb5e0650fa38ff8350815efdde2409367c69543f90da7
7
+ data.tar.gz: 8cdf10c843a017db7f9b0d87cda082af7a329501f16f9b47250a8c5df473350667bdd19f2c1ba669af98051c0e97d03f4bd02df8e4f67a6c8bf5ebcab4ea48be
data/bin/abc2ly ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ script="$0"
3
+ if test -L "$script"; then
4
+ # readlink is not POSIX, but present on all platforms we care about.
5
+ # On macOS, it does not support the recursive following of symlinks,
6
+ # so we only resolve one link and hope for the best.
7
+ script="$(readlink -f "$script" 2>/dev/null || readlink "$script")"
8
+ fi
9
+ root="$(dirname "$script")/.."
10
+ exec "$root/libexec/python3.10" "$root/libexec/abc2ly" "$@"
data/bin/convert-ly ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ script="$0"
3
+ if test -L "$script"; then
4
+ # readlink is not POSIX, but present on all platforms we care about.
5
+ # On macOS, it does not support the recursive following of symlinks,
6
+ # so we only resolve one link and hope for the best.
7
+ script="$(readlink -f "$script" 2>/dev/null || readlink "$script")"
8
+ fi
9
+ root="$(dirname "$script")/.."
10
+ exec "$root/libexec/python3.10" "$root/libexec/convert-ly" "$@"
data/bin/etf2ly ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ script="$0"
3
+ if test -L "$script"; then
4
+ # readlink is not POSIX, but present on all platforms we care about.
5
+ # On macOS, it does not support the recursive following of symlinks,
6
+ # so we only resolve one link and hope for the best.
7
+ script="$(readlink -f "$script" 2>/dev/null || readlink "$script")"
8
+ fi
9
+ root="$(dirname "$script")/.."
10
+ exec "$root/libexec/python3.10" "$root/libexec/etf2ly" "$@"
data/bin/lilymidi ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ script="$0"
3
+ if test -L "$script"; then
4
+ # readlink is not POSIX, but present on all platforms we care about.
5
+ # On macOS, it does not support the recursive following of symlinks,
6
+ # so we only resolve one link and hope for the best.
7
+ script="$(readlink -f "$script" 2>/dev/null || readlink "$script")"
8
+ fi
9
+ root="$(dirname "$script")/.."
10
+ exec "$root/libexec/python3.10" "$root/libexec/lilymidi" "$@"
data/bin/lilypond ADDED
Binary file
data/bin/lilypond-book ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ script="$0"
3
+ if test -L "$script"; then
4
+ # readlink is not POSIX, but present on all platforms we care about.
5
+ # On macOS, it does not support the recursive following of symlinks,
6
+ # so we only resolve one link and hope for the best.
7
+ script="$(readlink -f "$script" 2>/dev/null || readlink "$script")"
8
+ fi
9
+ root="$(dirname "$script")/.."
10
+ exec "$root/libexec/python3.10" "$root/libexec/lilypond-book" "$@"
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ script="$0"
3
+ if test -L "$script"; then
4
+ # readlink is not POSIX, but present on all platforms we care about.
5
+ # On macOS, it does not support the recursive following of symlinks,
6
+ # so we only resolve one link and hope for the best.
7
+ script="$(readlink -f "$script" 2>/dev/null || readlink "$script")"
8
+ fi
9
+ root="$(dirname "$script")/.."
10
+ exec "$root/libexec/python3.10" "$root/libexec/lilypond-invoke-editor" "$@"
data/bin/lilysong ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ script="$0"
3
+ if test -L "$script"; then
4
+ # readlink is not POSIX, but present on all platforms we care about.
5
+ # On macOS, it does not support the recursive following of symlinks,
6
+ # so we only resolve one link and hope for the best.
7
+ script="$(readlink -f "$script" 2>/dev/null || readlink "$script")"
8
+ fi
9
+ root="$(dirname "$script")/.."
10
+ exec "$root/libexec/python3.10" "$root/libexec/lilysong" "$@"
data/bin/midi2ly ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ script="$0"
3
+ if test -L "$script"; then
4
+ # readlink is not POSIX, but present on all platforms we care about.
5
+ # On macOS, it does not support the recursive following of symlinks,
6
+ # so we only resolve one link and hope for the best.
7
+ script="$(readlink -f "$script" 2>/dev/null || readlink "$script")"
8
+ fi
9
+ root="$(dirname "$script")/.."
10
+ exec "$root/libexec/python3.10" "$root/libexec/midi2ly" "$@"
data/bin/musicxml2ly ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ script="$0"
3
+ if test -L "$script"; then
4
+ # readlink is not POSIX, but present on all platforms we care about.
5
+ # On macOS, it does not support the recursive following of symlinks,
6
+ # so we only resolve one link and hope for the best.
7
+ script="$(readlink -f "$script" 2>/dev/null || readlink "$script")"
8
+ fi
9
+ root="$(dirname "$script")/.."
10
+ exec "$root/libexec/python3.10" "$root/libexec/musicxml2ly" "$@"
@@ -0,0 +1,48 @@
1
+ require "open3"
2
+
3
+ class LilyPond
4
+ LYPATH = File.expand_path("../../bin/lilypond", __FILE__)
5
+ class << self
6
+
7
+ def version
8
+ output, error, status = Open3.capture3(LYPATH, "--version")
9
+ if status.success?
10
+ puts output
11
+ else
12
+ puts error
13
+ end
14
+ end
15
+
16
+ def generate_pdf_with_lilypond(file_name, lilypond_code)
17
+ Open3.popen3(LYPATH, '--pdf', file_name) do |stdin, stdout, stderr, wait_thr|
18
+ # Write the Lilypond code to stdin
19
+ stdin.write(lilypond_code)
20
+ stdin.close
21
+
22
+ # Wait for the process to complete
23
+ Process.detach(wait_thr.pid)
24
+
25
+ # Read and process the output and error streams
26
+ loop do
27
+ # Wait for output to become available for reading
28
+ ready = IO.select([stdout, stderr])
29
+ next unless ready
30
+
31
+ # Read available data from the streams
32
+ ready[0].each do |stream|
33
+ data = stream.read_nonblock(1024)
34
+ puts data # or process the data as necessary
35
+ end
36
+ rescue IO::WaitReadable, IO::WaitWritable
37
+ # Continue waiting if the streams are not yet ready
38
+ IO.select([stdout, stderr])
39
+ retry
40
+ rescue EOFError
41
+ # Stop waiting if the streams have been closed
42
+ break
43
+ end
44
+ end
45
+ end
46
+
47
+ end # end self
48
+ end # end LilyPond
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: LilyPond-Ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Lee Whittaker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-03-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This gem provides a library to access and control Lilypond from Ruby
14
+ email: whittakerlee81@gmail.com
15
+ executables:
16
+ - lilypond
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/abc2ly
21
+ - bin/convert-ly
22
+ - bin/etf2ly
23
+ - bin/lilymidi
24
+ - bin/lilypond
25
+ - bin/lilypond-book
26
+ - bin/lilypond-invoke-editor
27
+ - bin/lilysong
28
+ - bin/midi2ly
29
+ - bin/musicxml2ly
30
+ - lib/lilypond-ruby.rb
31
+ homepage: https://github.com/Okomikeruko/LilyPond-Ruby
32
+ licenses:
33
+ - MIT
34
+ metadata: {}
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubygems_version: 3.1.6
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Access and control Lilypond from within Ruby
54
+ test_files: []