lyp 0.3.3 → 0.3.4

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: ec8334dffcd62c410ebf9f6630d95b9d980e0ad9
4
- data.tar.gz: 5aa416050909fc3b7c628e799390f94a977609d0
3
+ metadata.gz: 330317c1be8c18c423a9ab6e7efc8819c6f07b8b
4
+ data.tar.gz: cf364e9fa0ab5744da270cb696dfdacf25ef67a4
5
5
  SHA512:
6
- metadata.gz: 2e400ff952e684c0e8ba9da536e80ee015eebe742858a83c9ff9fbf4706c14b2b233881166f22fd7f63a3e17c03b6062c141942267edd8a3d0cdbf318c76375b
7
- data.tar.gz: 5c7632c1626e763ac4463b0c3ad66cc78386eba95933511a213b8f3e7267924201514a3fcca2467656e47b53857f7e3e8652eacb0e294402d894bd0b9f364a7c
6
+ metadata.gz: f9d7aa3b3ab28314f151cf845cf1bf8e8a7a94699dbe86b16cc6e1a363900575e666706ecb83cf3d7bea9b3d262a859f33813f3288d7c5a3198707aeea59dadf
7
+ data.tar.gz: 8774a353b9fee6b96eb552b4eeaa0680d9097d82be0850bf9b1bb80c4f22358fcd2b0c1773a78b5acc32a6e71adf7fc607d20de3cf4c97106edc069a3dbcd89d
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- LYP_VERSION="0.3.3"
3
+ LYP_VERSION="0.3.4"
4
4
  WORKDIR="/tmp/lyp-release-installer"
5
5
  URL_BASE="https://github.com/noteflakes/lyp/releases/download/v$LYP_VERSION"
6
6
 
data/lib/lyp.rb CHANGED
@@ -1,11 +1,9 @@
1
- def req(f); require File.expand_path("lyp/#{f}", File.dirname(__FILE__)); end
1
+ def req(f); require File.expand_path("lyp/#{f}", File.dirname(__FILE__)) end
2
2
 
3
3
  req 'base'
4
4
  req 'system'
5
5
  req 'settings'
6
6
 
7
- Lyp::System.test_rugged_gem!
8
-
9
7
  req 'template'
10
8
  req 'resolver'
11
9
  req 'wrapper'
@@ -81,6 +81,8 @@ class Lyp::CLI < Thor
81
81
  puts "\n * Currently installed\n\n"
82
82
  end
83
83
  end
84
+
85
+ PACKAGE_FMT = "%-16s => %s"
84
86
 
85
87
  def search_package(pattern)
86
88
  packages = Lyp::Package.list_lyp_index(pattern)
@@ -89,7 +91,8 @@ class Lyp::CLI < Thor
89
91
  else
90
92
  puts "\nAvailable packages on lyp-index:\n\n"
91
93
  packages.each do |p|
92
- puts " #{p[:name]}"
94
+ puts PACKAGE_FMT % [p['name'], p['description']]
95
+ # puts " #{p['name']}"
93
96
  end
94
97
  puts "\n\n"
95
98
  end
@@ -1,5 +1,4 @@
1
1
  require 'uri'
2
- require 'httpclient'
3
2
  require 'open3'
4
3
  require 'ruby-progressbar'
5
4
 
@@ -90,10 +89,11 @@ module Lyp::Lilypond
90
89
  attr_reader :forced_version
91
90
 
92
91
  def check_lilypond!
93
- # check default
94
- select_default_lilypond! unless valid_lilypond?(default_lilypond)
92
+ path = default_lilypond
93
+ select_default_lilypond! unless path && path =~ /lilypond$/
95
94
 
96
- set_current_lilypond(default_lilypond) unless valid_lilypond?(current_lilypond)
95
+ path = current_lilypond
96
+ set_current_lilypond(default_lilypond) unless path && path =~ /lilypond$/
97
97
  end
98
98
 
99
99
  def valid_lilypond?(path)
@@ -169,6 +169,7 @@ module Lyp::Lilypond
169
169
  path = File.join(path, "bin/lilypond")
170
170
  list << {
171
171
  root_path: root_path,
172
+ data_path: File.join(root_path, 'share/lilypond/current'),
172
173
  path: path,
173
174
  version: version
174
175
  }
@@ -185,8 +186,11 @@ module Lyp::Lilypond
185
186
  begin
186
187
  resp = `#{path} -v`
187
188
  if resp.lines.first =~ /LilyPond ([0-9\.]+)/i
189
+ data_path = `#{path} -e"(display (ly:get-option 'datadir))" /dev/null 2>/dev/null`
190
+
188
191
  m << {
189
192
  root_path: File.expand_path(File.join(File.dirname(path), '..')),
193
+ data_path: data_path,
190
194
  path: path,
191
195
  version: $1,
192
196
  system: true
@@ -203,7 +207,7 @@ module Lyp::Lilypond
203
207
  self_bin_dir = File.dirname(File.expand_path($0))
204
208
 
205
209
  list = `which -a lilypond`
206
- list = list.lines.map {|f| f.chomp}.reject do |l|
210
+ list = list.lines.map {|f| f.chomp}.uniq.reject do |l|
207
211
  dir = File.dirname(l)
208
212
  (dir == Gem.bindir) || (dir == Lyp::LYP_BIN_DIRECTORY) || (dir == self_bin_dir)
209
213
  end
@@ -351,6 +355,8 @@ module Lyp::Lilypond
351
355
  end
352
356
 
353
357
  def download_lilypond(url, fn, opts)
358
+ require 'httpclient'
359
+
354
360
  STDERR.puts "Downloading #{url}" unless opts[:silent]
355
361
 
356
362
  download_count = 0
@@ -469,6 +475,14 @@ module Lyp::Lilypond
469
475
  target_fn = File.join(lyp_lilypond_share_dir(version), 'lilypond/current/scm/font.scm')
470
476
  FileUtils.cp(Lyp::FONT_PATCH_FILENAME, target_fn)
471
477
  end
478
+
479
+ def patch_system_lilypond_font_scm(lilypond)
480
+ return unless Lyp::FONT_PATCH_REQ =~ Gem::Version.new(lilypond[:version])
481
+
482
+ target_fn = File.join(lilypond[:data_path], '/scm/font.scm')
483
+ puts "patch #{target_fn}"
484
+ FileUtils.cp(Lyp::FONT_PATCH_FILENAME, target_fn)
485
+ end
472
486
 
473
487
  def copy_fonts_from_all_packages(version, opts)
474
488
  return unless Lyp::FONT_COPY_REQ =~ Gem::Version.new(version)
@@ -221,6 +221,8 @@ module Lyp::Package
221
221
  end
222
222
 
223
223
  def package_repository(url, tmp_path, opts = {})
224
+ Lyp::System.test_rugged_gem!
225
+
224
226
  # Create repository
225
227
  if File.directory?(tmp_path)
226
228
  begin
@@ -274,9 +276,13 @@ module Lyp::Package
274
276
  Lyp::Lilypond.list.each do |lilypond|
275
277
  next unless req =~ Gem::Version.new(lilypond[:version])
276
278
 
277
- ly_fonts_dir = File.join(lilypond[:root_path], lilypond_fonts_path)
279
+ ly_fonts_dir = File.join(lilypond[:data_path], 'fonts')
278
280
  package_fonts_dir = File.join(package_path, 'fonts')
279
281
 
282
+ if lilypond[:system]
283
+ Lyp::Lilypond.patch_system_lilypond_font_scm(lilypond)
284
+ end
285
+
280
286
  Dir["#{package_fonts_dir}/*.otf"].each do |fn|
281
287
  target_fn = File.join(ly_fonts_dir, 'otf', File.basename(fn))
282
288
  FileUtils.cp(fn, target_fn)
@@ -294,10 +300,6 @@ module Lyp::Package
294
300
  end
295
301
  end
296
302
 
297
- def lilypond_fonts_path
298
- 'share/lilypond/current/fonts'
299
- end
300
-
301
303
  def package_git_url(package, search_index = true)
302
304
  case package
303
305
  when /^(?:(?:[^\:]+)|http|https)\:/
@@ -326,14 +328,14 @@ module Lyp::Package
326
328
 
327
329
  def list_lyp_index(pattern = nil)
328
330
  list = lyp_index['packages'].inject([]) do |m, kv|
329
- m << kv[1].merge(name: kv[0])
331
+ m << kv[1].merge('name' => kv[0])
330
332
  end
331
333
 
332
334
  if pattern
333
- list.select! {|p| p[:name] =~ /#{pattern}/}
335
+ list.select! {|p| p['name'] =~ /#{pattern}/}
334
336
  end
335
337
 
336
- list.sort_by {|p| p[:name]}
338
+ list.sort_by {|p| p['name']}
337
339
  end
338
340
 
339
341
  def lyp_index
@@ -5,10 +5,14 @@ module Lyp::System
5
5
  RUGGED_REQ = Gem::Requirement.new('>=0.23.0')
6
6
 
7
7
  def test_rugged_gem!
8
+ return if @already_tested
9
+
8
10
  return if find_rugged_gem || use_git_based_rugged_gem
9
11
 
10
12
  STDERR.puts "Lyp needs git in order to be able to install packages. Please install git and then try again."
11
13
  exit 1
14
+ ensure
15
+ @already_tested = true
12
16
  end
13
17
 
14
18
  def find_rugged_gem
@@ -1,3 +1,3 @@
1
1
  module Lyp
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -82,10 +82,6 @@ module Lyp::Package
82
82
  end
83
83
  end
84
84
 
85
- def lilypond_fonts_path
86
- 'usr/share/lilypond/current/fonts'
87
- end
88
-
89
85
  def lyp_index
90
86
  @lyp_index ||= YAML.load(`curl -s #{LYP_INDEX_URL}`)
91
87
  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: 0.3.3
4
+ version: 0.3.4
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-02-22 00:00:00.000000000 Z
11
+ date: 2016-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient