lyp 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lyp/cli.rb +21 -5
- data/lib/lyp/lilypond.rb +10 -5
- data/lib/lyp/package.rb +23 -0
- data/lib/lyp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cd933e97beb1cd0fd6fbb50a34c2eead1141ef3
|
4
|
+
data.tar.gz: b0a2289da1f2688a4b91fdeb619572c53b6aab17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ade7918db91666a7386a9d8b1fdd5f93a8347d30b08d0528faee0ca7d44c4347f4ae03f335f65941ba441a0b771c12ce383b4e0d06e57d3a06e2471f3f490e5d
|
7
|
+
data.tar.gz: 53970054a2052fa366d1e9a7d28c5698167921a4b1666b622a8c325ce31c504ec38345858c7d295733805b9f714ce404bf28f56f113806a07d2b6600d755f12f
|
data/lib/lyp/cli.rb
CHANGED
@@ -110,12 +110,26 @@ class Lyp::CLI < Thor
|
|
110
110
|
Lyp::Lilypond.check_lilypond!
|
111
111
|
end
|
112
112
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
113
|
+
Lyp::Lilypond.compile(args)
|
114
|
+
end
|
115
|
+
|
116
|
+
desc "test [<option>...]", "Runs package tests on local directory"
|
117
|
+
method_option :install, aliases: '-i', type: :boolean, desc: 'Install the requested version of lilypond if not present'
|
118
|
+
method_option :env, aliases: '-e', type: :boolean, desc: 'Use version set by LILYPOND_VERSION environment variable'
|
119
|
+
def test(*args)
|
120
|
+
$stderr.puts "Lyp #{Lyp::VERSION}"
|
121
|
+
|
122
|
+
if options[:env]
|
123
|
+
Lyp::Lilypond.force_env_version!
|
124
|
+
if options[:install] && !Lyp::Lilypond.forced_lilypond
|
125
|
+
Lyp::Lilypond.install(Lyp::Lilypond.forced_version)
|
126
|
+
end
|
127
|
+
else
|
128
|
+
# check lilypond default / current settings
|
129
|
+
Lyp::Lilypond.check_lilypond!
|
118
130
|
end
|
131
|
+
|
132
|
+
Lyp::Package.run_tests('.')
|
119
133
|
end
|
120
134
|
|
121
135
|
desc "install <PACKAGE|lilypond|self>...", "Install a package or a version of lilypond. When 'install self' is invoked, lyp installs itself in ~/.lyp."
|
@@ -241,4 +255,6 @@ begin
|
|
241
255
|
Lyp::CLI.start(ARGV)
|
242
256
|
rescue => e
|
243
257
|
puts e.message
|
258
|
+
puts e.backtrace.join("\n")
|
259
|
+
exit(1)
|
244
260
|
end
|
data/lib/lyp/lilypond.rb
CHANGED
@@ -5,17 +5,22 @@ require 'ruby-progressbar'
|
|
5
5
|
|
6
6
|
module Lyp::Lilypond
|
7
7
|
class << self
|
8
|
-
def compile(argv)
|
8
|
+
def compile(argv, opts = {})
|
9
9
|
fn = Lyp.wrap(argv.pop)
|
10
10
|
argv << fn
|
11
11
|
|
12
|
-
invoke(argv)
|
12
|
+
invoke(argv, opts)
|
13
13
|
end
|
14
14
|
|
15
|
-
def invoke(argv)
|
15
|
+
def invoke(argv, opts = {})
|
16
16
|
lilypond = detect_use_version_argument(argv) || current_lilypond
|
17
|
-
|
18
|
-
|
17
|
+
|
18
|
+
case opts[:mode]
|
19
|
+
when :system
|
20
|
+
system("#{lilypond} #{argv.join(" ")}")
|
21
|
+
else
|
22
|
+
Kernel.exec(lilypond, *argv)
|
23
|
+
end
|
19
24
|
end
|
20
25
|
|
21
26
|
def detect_use_version_argument(argv)
|
data/lib/lyp/package.rb
CHANGED
@@ -362,5 +362,28 @@ module Lyp::Package
|
|
362
362
|
def tag_version(tag)
|
363
363
|
(tag =~ TAG_VERSION_RE) ? $1 : nil
|
364
364
|
end
|
365
|
+
|
366
|
+
def run_tests(dir, opts = {})
|
367
|
+
t1 = Time.now
|
368
|
+
test_count = 0
|
369
|
+
fail_count = 0
|
370
|
+
|
371
|
+
Dir["#{dir}/**/*_test.ly"].each do |fn|
|
372
|
+
test_count += 1
|
373
|
+
|
374
|
+
unless Lyp::Lilypond.compile([fn], mode: :system)
|
375
|
+
fail_count += 1
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
if test_count == 0
|
380
|
+
STDERR.puts "No test files found"
|
381
|
+
else
|
382
|
+
puts "\nFinished in %.2g seconds\n%d files, %d failures" % [
|
383
|
+
Time.now - t1, test_count, fail_count
|
384
|
+
]
|
385
|
+
exit(fail_count > 0 ? 1 : 0)
|
386
|
+
end
|
387
|
+
end
|
365
388
|
end
|
366
389
|
end
|
data/lib/lyp/version.rb
CHANGED