lyp 0.1.6 → 0.1.7

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: a0f2b4319a508c0c584f2facf8a74525635d6e01
4
- data.tar.gz: 068c9dbce97d7fb071fd8f74408090924a8d3431
3
+ metadata.gz: 8cd933e97beb1cd0fd6fbb50a34c2eead1141ef3
4
+ data.tar.gz: b0a2289da1f2688a4b91fdeb619572c53b6aab17
5
5
  SHA512:
6
- metadata.gz: 27264b97b929a0e4124f806aae29b25bee95e4dcfcb489197420a781a33010ff92717f310c9c82078772c8da35f8d853f9c4f39d12683cd8054e1e4ebc87100d
7
- data.tar.gz: 3075d4b04dd20b8e16b8b55764a1126b83cf6fe183e6280c7f171e691f476058c81a2035497448ca6b6f645bb4afbf54a34a4d0aa78df74c7e8930129fb996a1
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
- begin
114
- Lyp::Lilypond.compile(args)
115
- rescue => e
116
- puts e.message
117
- puts e.backtrace.join("\n")
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
- Kernel.exec(lilypond, *argv)
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
@@ -1,3 +1,3 @@
1
1
  module Lyp
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lyp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner