lyp 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/lilypond +4 -6
- data/lib/lyp/cli/commands.rb +32 -19
- data/lib/lyp/lilypond.rb +41 -12
- data/lib/lyp/package.rb +192 -4
- data/lib/lyp/resolver.rb +17 -11
- data/lib/lyp/templates/deps_wrapper.rb +2 -3
- data/lib/lyp/version.rb +1 -1
- data/lib/lyp/wrapper.rb +8 -3
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be14f9ec309c846d05866736f78ba82458ba4f5b
|
4
|
+
data.tar.gz: b5ffae67c9ef47ec416ec61d763913cdc89b9459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5899a965576c65a6d07bd07ff716889e85042044d2efdbf8d16d47adfe09e57965479b75873a0ef0b5ae1c0b293529268fbe28472e97c7a360695df5b5b3e04
|
7
|
+
data.tar.gz: a075ab18c0270b3c057db6ae9c3f365f9c8b4c26c7cf1df4c89fd79c6e896f495cfcc5356cf8c301c93aaa8833df16e5a40bf795112899fd88b344ea7b87bf10
|
data/README.md
CHANGED
data/bin/lilypond
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'lyp/version'
|
4
|
-
require 'lyp
|
5
|
-
require 'lyp/settings'
|
6
|
-
require 'lyp/lilypond'
|
4
|
+
require 'lyp'
|
7
5
|
|
8
6
|
STDERR.puts "Lyp version #{Lyp::VERSION}"
|
9
7
|
|
@@ -24,8 +22,8 @@ else
|
|
24
22
|
|
25
23
|
begin
|
26
24
|
Lyp::Lilypond.compile(ARGV)
|
27
|
-
rescue => e
|
28
|
-
|
29
|
-
|
25
|
+
# rescue => e
|
26
|
+
# STDERR.puts e.message
|
27
|
+
# exit 1
|
30
28
|
end
|
31
29
|
end
|
data/lib/lyp/cli/commands.rb
CHANGED
@@ -45,7 +45,7 @@ command :list do |c|
|
|
45
45
|
Lyp::System.test_installed_status!
|
46
46
|
|
47
47
|
pattern = args.first
|
48
|
-
if pattern
|
48
|
+
if pattern == 'lilypond'
|
49
49
|
STDOUT.puts LILYPOND_PREAMBLE
|
50
50
|
Lyp::Lilypond.list.each {|info| puts format_lilypond_entry(info)}
|
51
51
|
STDOUT.puts LILYPOND_LEGEND
|
@@ -64,9 +64,6 @@ command :compile do |c|
|
|
64
64
|
begin
|
65
65
|
raise "File not specified" if args.empty?
|
66
66
|
Lyp::Lilypond.compile(ARGV[1..-1])
|
67
|
-
rescue => e
|
68
|
-
STDERR.puts e.message
|
69
|
-
exit 1
|
70
67
|
end
|
71
68
|
end
|
72
69
|
end
|
@@ -78,13 +75,35 @@ command :search do |c|
|
|
78
75
|
Lyp::System.test_installed_status!
|
79
76
|
|
80
77
|
pattern = args.first
|
81
|
-
|
78
|
+
pattern =~ Lyp::PACKAGE_RE
|
79
|
+
package, version = $1, $2
|
80
|
+
req = (version && Gem::Requirement.new(version)) rescue nil
|
81
|
+
|
82
|
+
if package == 'lilypond'
|
82
83
|
begin
|
83
|
-
versions = Lyp::Lilypond.search
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
versions = Lyp::Lilypond.search(version)
|
85
|
+
|
86
|
+
if versions.empty?
|
87
|
+
puts "\nNo versions of lilypond are available for download\n\n"
|
88
|
+
else
|
89
|
+
puts "\nAvailable versions of lilypond:\n\n"
|
90
|
+
versions.each do |v|
|
91
|
+
prefix = v[:installed] ? " * " : " "
|
92
|
+
puts "#{prefix}#{v[:version]}"
|
93
|
+
end
|
94
|
+
puts "\n * Currently installed\n\n"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
else
|
98
|
+
packages = Lyp::Package.list_lyp_index(pattern)
|
99
|
+
if packages.empty?
|
100
|
+
puts "\nNo matching package found in lyp-index\n\n"
|
101
|
+
else
|
102
|
+
puts "\nAvailable packages:\n\n"
|
103
|
+
packages.each do |p|
|
104
|
+
puts " #{p[:name]}"
|
105
|
+
end
|
106
|
+
puts "\n\n"
|
88
107
|
end
|
89
108
|
end
|
90
109
|
end
|
@@ -106,11 +125,11 @@ command :install do |c|
|
|
106
125
|
when /^lilypond(?:@(.+))?$/
|
107
126
|
Lyp::System.test_installed_status!
|
108
127
|
Lyp::Lilypond.install($1, opts.__hash__)
|
128
|
+
else
|
129
|
+
Lyp::System.test_installed_status!
|
130
|
+
Lyp::Package.install(package)
|
109
131
|
end
|
110
132
|
end
|
111
|
-
# rescue => e
|
112
|
-
# STDERR.puts e.message
|
113
|
-
# exit 1
|
114
133
|
end
|
115
134
|
end
|
116
135
|
end
|
@@ -131,9 +150,6 @@ command :use do |c|
|
|
131
150
|
|
132
151
|
lilypond = Lyp::Lilypond.use(version, opts.__hash__)
|
133
152
|
puts "Using version #{lilypond[:version]}"
|
134
|
-
rescue => e
|
135
|
-
STDERR.puts e.message
|
136
|
-
exit 1
|
137
153
|
end
|
138
154
|
end
|
139
155
|
end
|
@@ -157,9 +173,6 @@ command :uninstall do |c|
|
|
157
173
|
Lyp::Lilypond.uninstall($1)
|
158
174
|
end
|
159
175
|
end
|
160
|
-
rescue => e
|
161
|
-
STDERR.puts e.message
|
162
|
-
exit 1
|
163
176
|
end
|
164
177
|
end
|
165
178
|
end
|
data/lib/lyp/lilypond.rb
CHANGED
@@ -8,7 +8,6 @@ module Lyp::Lilypond
|
|
8
8
|
argv << fn
|
9
9
|
|
10
10
|
invoke(argv)
|
11
|
-
exec("#{current_lilypond} #{argv.join(' ')}")
|
12
11
|
end
|
13
12
|
|
14
13
|
def invoke(argv)
|
@@ -142,7 +141,7 @@ module Lyp::Lilypond
|
|
142
141
|
BASE_URL = "http://download.linuxaudio.org/lilypond/binaries"
|
143
142
|
|
144
143
|
# Returns a list of versions of lilyponds available for download
|
145
|
-
def search
|
144
|
+
def search(version_specifier = nil)
|
146
145
|
require 'open-uri'
|
147
146
|
require 'nokogiri'
|
148
147
|
|
@@ -156,19 +155,39 @@ module Lyp::Lilypond
|
|
156
155
|
versions << $1
|
157
156
|
end
|
158
157
|
end
|
159
|
-
|
158
|
+
|
159
|
+
installed_versions = list.map {|l| l[:version]}
|
160
|
+
versions.select {|v| version_match(v, version_specifier, versions)}.map do |v|
|
161
|
+
{
|
162
|
+
version: v,
|
163
|
+
installed: installed_versions.include?(v)
|
164
|
+
}
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def version_match(version, specifier, all_versions)
|
169
|
+
case specifier
|
170
|
+
when 'latest'
|
171
|
+
version == all_versions.last
|
172
|
+
when 'stable'
|
173
|
+
Gem::Version.new(version).segments[1].even?
|
174
|
+
when 'unstable'
|
175
|
+
Gem::Version.new(version).segments[1].odd?
|
176
|
+
else
|
177
|
+
Gem::Requirement.new(specifier) =~ Gem::Version.new(version)
|
178
|
+
end
|
160
179
|
end
|
161
180
|
|
162
181
|
def latest_stable_version
|
163
|
-
search.reverse.find {|l| Gem::Version.new(l).segments[1]
|
182
|
+
search.reverse.find {|l| Gem::Version.new(l[:version]).segments[1].even?}[:version]
|
164
183
|
end
|
165
184
|
|
166
185
|
def latest_unstable_version
|
167
|
-
search.reverse.find {|l| Gem::Version.new(l).segments[1]
|
186
|
+
search.reverse.find {|l| Gem::Version.new(l[:version]).segments[1].odd?}[:version]
|
168
187
|
end
|
169
188
|
|
170
189
|
def latest_version
|
171
|
-
search.last
|
190
|
+
search.last[:version]
|
172
191
|
end
|
173
192
|
|
174
193
|
def install(version_specifier, opts = {})
|
@@ -195,10 +214,13 @@ module Lyp::Lilypond
|
|
195
214
|
latest_version
|
196
215
|
else
|
197
216
|
req = Gem::Requirement.new(version_specifier)
|
198
|
-
search.reverse.find {|
|
217
|
+
lilypond = search.reverse.find {|l| req =~ Gem::Version.new(l[:version])}
|
218
|
+
if lilypond
|
219
|
+
lilypond[:version]
|
220
|
+
else
|
221
|
+
raise "Could not find version matching #{version_specifier}"
|
222
|
+
end
|
199
223
|
end
|
200
|
-
rescue => e
|
201
|
-
raise "Invalid version specified: #{version_specifier}"
|
202
224
|
end
|
203
225
|
|
204
226
|
def detect_lilypond_platform
|
@@ -339,11 +361,11 @@ module Lyp::Lilypond
|
|
339
361
|
lilypond = lilypond_list.first
|
340
362
|
when 'stable'
|
341
363
|
lilypond = lilypond_list.find do |v|
|
342
|
-
Gem::Version.new(v[:version]).segments[1]
|
364
|
+
Gem::Version.new(v[:version]).segments[1].even?
|
343
365
|
end
|
344
366
|
when 'unstable'
|
345
367
|
lilypond = lilypond_list.find do |v|
|
346
|
-
Gem::Version.new(v[:version]).segments[1]
|
368
|
+
Gem::Version.new(v[:version]).segments[1].odd?
|
347
369
|
end
|
348
370
|
else
|
349
371
|
version = "~>#{version}.0" if version =~ /^\d+\.\d+$/
|
@@ -382,7 +404,14 @@ module Lyp::Lilypond
|
|
382
404
|
end
|
383
405
|
|
384
406
|
def exec(cmd)
|
385
|
-
|
407
|
+
Open3.popen3(cmd) do |_in, _out, _err, wait_thr|
|
408
|
+
exit_value = wait_thr.value
|
409
|
+
if exit_value != 0
|
410
|
+
raise "Error executing cmd #{cmd}: #{_err.read}"
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
# raise unless system(cmd)
|
386
415
|
end
|
387
416
|
end
|
388
417
|
end
|
data/lib/lyp/package.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'rugged'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'yaml'
|
5
|
+
|
1
6
|
module Lyp::Package
|
2
7
|
class << self
|
3
8
|
|
@@ -14,15 +19,198 @@ module Lyp::Package
|
|
14
19
|
x =~ Lyp::PACKAGE_RE; x_package, x_version = $1, $2
|
15
20
|
y =~ Lyp::PACKAGE_RE; y_package, y_version = $1, $2
|
16
21
|
|
17
|
-
x_version = x_version && Gem::Version.new(x_version)
|
18
|
-
y_version = y_version && Gem::Version.new(y_version)
|
22
|
+
x_version = (x_version && Gem::Version.new(x_version) rescue x)
|
23
|
+
y_version = (y_version && Gem::Version.new(y_version) rescue y)
|
19
24
|
|
20
|
-
if x_package == y_package
|
25
|
+
if (x_package == y_package) && (x_version.class == y_version.class)
|
21
26
|
x_version <=> y_version
|
22
27
|
else
|
23
|
-
|
28
|
+
x <=> y
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
32
|
+
|
33
|
+
def install(package_specifier, opts = {})
|
34
|
+
unless package_specifier =~ Lyp::PACKAGE_RE
|
35
|
+
raise "Invalid package specifier #{package_specifier}"
|
36
|
+
end
|
37
|
+
package, version = $1, $2
|
38
|
+
|
39
|
+
url = package_git_url(package)
|
40
|
+
tmp_path = git_url_to_temp_path(url)
|
41
|
+
|
42
|
+
repo = package_repository(url, tmp_path, opts)
|
43
|
+
version = checkout_package_version(repo, version, opts)
|
44
|
+
|
45
|
+
# Copy files
|
46
|
+
package_path = git_url_to_package_path(
|
47
|
+
package !~ /\// ? package : url, version
|
48
|
+
)
|
49
|
+
|
50
|
+
FileUtils.mkdir_p(File.dirname(package_path))
|
51
|
+
FileUtils.rm_rf(package_path)
|
52
|
+
FileUtils.cp_r(tmp_path, package_path)
|
53
|
+
|
54
|
+
install_package_dependencies(package_path, opts)
|
55
|
+
|
56
|
+
puts "\nInstalled #{package}@#{version}\n\n" unless opts[:silent]
|
57
|
+
|
58
|
+
# return the installed version
|
59
|
+
version
|
60
|
+
end
|
61
|
+
|
62
|
+
def package_repository(url, tmp_path, opts = {})
|
63
|
+
# Create repository
|
64
|
+
if File.directory?(tmp_path)
|
65
|
+
repo = Rugged::Repository.new(tmp_path)
|
66
|
+
repo.fetch('origin', [repo.head.name])
|
67
|
+
else
|
68
|
+
FileUtils.mkdir_p(File.dirname(tmp_path))
|
69
|
+
puts "Cloning #{url}..." unless opts[:silent]
|
70
|
+
repo = Rugged::Repository.clone_at(url, tmp_path)
|
71
|
+
end
|
72
|
+
repo
|
73
|
+
end
|
74
|
+
|
75
|
+
def checkout_package_version(repo, version, opts = {})
|
76
|
+
# Select commit to checkout
|
77
|
+
if version.nil? || (version == '')
|
78
|
+
puts "Checkout master branch..." unless opts[:silent]
|
79
|
+
repo.checkout('master', strategy: :force)
|
80
|
+
version = 'head'
|
81
|
+
else
|
82
|
+
tag = select_git_tag(repo, version)
|
83
|
+
unless tag
|
84
|
+
raise "Could not find tag matching #{version_specifier}"
|
85
|
+
end
|
86
|
+
puts "Checkout #{tag.name} tag" unless opts[:silent]
|
87
|
+
repo.checkout(tag.name, strategy: :force)
|
88
|
+
version = tag_version(tag)
|
89
|
+
end
|
90
|
+
version
|
91
|
+
end
|
92
|
+
|
93
|
+
def install_package_dependencies(package_path, opts = {})
|
94
|
+
# Install any missing sub-dependencies
|
95
|
+
sub_deps = []
|
96
|
+
|
97
|
+
resolver = Lyp::Resolver.new("#{package_path}/package.ly")
|
98
|
+
deps_tree = resolver.get_dependency_tree(ignore_missing: true)
|
99
|
+
deps_tree[:dependencies].each do |package_name, leaf|
|
100
|
+
sub_deps << leaf[:clause] if leaf[:versions].empty?
|
101
|
+
end
|
102
|
+
sub_deps.each {|d| install(d, opts)}
|
103
|
+
end
|
104
|
+
|
105
|
+
def package_git_url(package, search_index = true)
|
106
|
+
case package
|
107
|
+
when /^(?:(?:[^\:]+)|http|https)\:/
|
108
|
+
package
|
109
|
+
when /^([^\.]+\..+)\/[^\/]+\/.+(?<!\.git)$/ # .git missing from end of URL
|
110
|
+
"https://#{package}.git"
|
111
|
+
when /^([^\.]+\..+)\/.+/
|
112
|
+
"https://#{package}"
|
113
|
+
when /^[^\/]+\/[^\/]+$/
|
114
|
+
"https://github.com/#{package}.git"
|
115
|
+
else
|
116
|
+
if search_index && (url = search_lyp_index(package))
|
117
|
+
package_git_url(url, false) # make sure url is qualified
|
118
|
+
else
|
119
|
+
raise "Invalid package specified"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
LYP_INDEX_URL = "https://raw.githubusercontent.com/noteflakes/lyp-index/master/index.yaml"
|
125
|
+
|
126
|
+
def search_lyp_index(package)
|
127
|
+
entry = lyp_index['packages'][package]
|
128
|
+
entry && entry['url']
|
129
|
+
end
|
130
|
+
|
131
|
+
def list_lyp_index(pattern = nil)
|
132
|
+
list = lyp_index['packages'].inject([]) do |m, kv|
|
133
|
+
m << kv[1].merge(name: kv[0])
|
134
|
+
end
|
135
|
+
|
136
|
+
if pattern
|
137
|
+
list.select! {|p| p[:name] =~ /#{pattern}/}
|
138
|
+
end
|
139
|
+
|
140
|
+
list.sort_by {|p| p[:name]}
|
141
|
+
end
|
142
|
+
|
143
|
+
def lyp_index
|
144
|
+
@lyp_index ||= YAML.load(open(LYP_INDEX_URL))
|
145
|
+
end
|
146
|
+
|
147
|
+
TEMP_REPO_ROOT_PATH = "/tmp/lyp/repos"
|
148
|
+
|
149
|
+
def git_url_to_temp_path(url)
|
150
|
+
case url
|
151
|
+
when /^(?:http|https)\:(?:\/\/)?(.+)$/
|
152
|
+
path = $1.gsub(/\.git$/, '')
|
153
|
+
"#{TEMP_REPO_ROOT_PATH}/#{path}"
|
154
|
+
when /^(?:.+@)([^\:]+)\:(?:\/\/)?(.+)$/
|
155
|
+
domain, path = $1, $2.gsub(/\.git$/, '')
|
156
|
+
"#{TEMP_REPO_ROOT_PATH}/#{domain}/#{path}"
|
157
|
+
else
|
158
|
+
raise "Invalid URL #{url}"
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def git_url_to_package_path(url, version)
|
163
|
+
version = 'head' if version.nil? || (version == '')
|
164
|
+
|
165
|
+
case url
|
166
|
+
when /^(?:http|https)\:(?:\/\/)?(.+)$/
|
167
|
+
path = $1.gsub(/\.git$/, '')
|
168
|
+
"#{Lyp::packages_dir}/#{path}@#{version}"
|
169
|
+
when /^(?:.+@)([^\:]+)\:(?:\/\/)?(.+)$/
|
170
|
+
domain, path = $1, $2.gsub(/\.git$/, '')
|
171
|
+
"#{Lyp::packages_dir}/#{domain}/#{path}@#{version}"
|
172
|
+
else
|
173
|
+
if url !~ /\//
|
174
|
+
"#{Lyp::packages_dir}/#{url}@#{version}"
|
175
|
+
else
|
176
|
+
raise "Invalid URL #{url}"
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
TAG_VERSION_RE = /^v?(\d.*)$/
|
182
|
+
|
183
|
+
def select_git_tag(repo, version_specifier)
|
184
|
+
return if version_specifier.nil? || (version_specifier == '')
|
185
|
+
|
186
|
+
req = Gem::Requirement.new(version_specifier) rescue nil
|
187
|
+
|
188
|
+
repo_tags(repo).reverse.find do |t|
|
189
|
+
if req && (v = tag_version(t))
|
190
|
+
req =~ Gem::Version.new(v)
|
191
|
+
else
|
192
|
+
t.name == version_specifier
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns a list of tags sorted by version
|
198
|
+
def repo_tags(repo)
|
199
|
+
tags = []
|
200
|
+
repo.tags.each {|t| tags << t}
|
201
|
+
|
202
|
+
tags.sort do |x, y|
|
203
|
+
x_version, y_version = tag_version(x), tag_version(y)
|
204
|
+
if x_version && y_version
|
205
|
+
Gem::Version.new(x_version) <=> Gem::Version.new(y_version)
|
206
|
+
else
|
207
|
+
x.name <=> y.name
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def tag_version(tag)
|
213
|
+
(tag.name =~ TAG_VERSION_RE) ? $1 : nil
|
214
|
+
end
|
27
215
|
end
|
28
216
|
end
|
data/lib/lyp/resolver.rb
CHANGED
@@ -43,7 +43,7 @@ class Lyp::Resolver
|
|
43
43
|
#
|
44
44
|
# Since files to be processed are added to a queue, this method loops through
|
45
45
|
# the queue until it's empty.
|
46
|
-
def get_dependency_tree
|
46
|
+
def get_dependency_tree(opts = {})
|
47
47
|
tree = {
|
48
48
|
dependencies: {},
|
49
49
|
queue: [],
|
@@ -53,11 +53,13 @@ class Lyp::Resolver
|
|
53
53
|
queue_file_for_processing(@user_file, tree, tree)
|
54
54
|
|
55
55
|
while job = pull_file_from_queue(tree)
|
56
|
-
process_lilypond_file(job[:path], tree, job[:leaf])
|
56
|
+
process_lilypond_file(job[:path], tree, job[:leaf], opts)
|
57
57
|
end
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
unless opts[:ignore_missing]
|
60
|
+
squash_old_versions(tree)
|
61
|
+
remove_unfulfilled_dependencies(tree)
|
62
|
+
end
|
61
63
|
|
62
64
|
tree
|
63
65
|
end
|
@@ -68,7 +70,7 @@ class Lyp::Resolver
|
|
68
70
|
#
|
69
71
|
# The leaf argument is a pointer to the current leaf on the tree on which to
|
70
72
|
# add dependencies. This is how transitive dependencies are represented.
|
71
|
-
def process_lilypond_file(path, tree, leaf)
|
73
|
+
def process_lilypond_file(path, tree, leaf, opts)
|
72
74
|
# path is expected to be absolute
|
73
75
|
return if tree[:processed_files][path]
|
74
76
|
|
@@ -82,7 +84,7 @@ class Lyp::Resolver
|
|
82
84
|
qualified_path = File.expand_path(path, dir)
|
83
85
|
queue_file_for_processing(qualified_path, tree, leaf)
|
84
86
|
when REQUIRE
|
85
|
-
find_package_versions(path, tree, leaf)
|
87
|
+
find_package_versions(path, tree, leaf, opts)
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
@@ -101,7 +103,7 @@ class Lyp::Resolver
|
|
101
103
|
|
102
104
|
# Find available packaging matching the package specifier, and queue them for
|
103
105
|
# processing any include files or transitive dependencies.
|
104
|
-
def find_package_versions(ref, tree, leaf)
|
106
|
+
def find_package_versions(ref, tree, leaf, opts)
|
105
107
|
return {} unless ref =~ Lyp::PACKAGE_RE
|
106
108
|
ref_package = $1
|
107
109
|
version_clause = $2
|
@@ -109,7 +111,7 @@ class Lyp::Resolver
|
|
109
111
|
matches = find_matching_packages(ref, tree)
|
110
112
|
|
111
113
|
# Raise if no match found and we're at top of the tree
|
112
|
-
if matches.empty? && (tree == leaf)
|
114
|
+
if matches.empty? && (tree == leaf) && !opts[:ignore_missing]
|
113
115
|
raise "No package found for requirement #{ref}"
|
114
116
|
end
|
115
117
|
|
@@ -137,9 +139,13 @@ class Lyp::Resolver
|
|
137
139
|
req = Gem::Requirement.new(req_version || '>=0')
|
138
140
|
|
139
141
|
available_packages(tree).select do |package, sub_tree|
|
140
|
-
if package =~ Lyp::PACKAGE_RE
|
141
|
-
version = Gem::Version.new($2 || '0')
|
142
|
-
|
142
|
+
if (package =~ Lyp::PACKAGE_RE) && (req_package == $1)
|
143
|
+
version = Gem::Version.new($2 || '0') rescue nil
|
144
|
+
if version.nil?
|
145
|
+
req_version.nil? || (req_version == $2)
|
146
|
+
else
|
147
|
+
req =~ version
|
148
|
+
end
|
143
149
|
else
|
144
150
|
nil
|
145
151
|
end
|
@@ -11,8 +11,7 @@
|
|
11
11
|
# package-refs is a hash table with an entry for each package reference made
|
12
12
|
# using \require, either in user files or in package files (for transitive dependencies).
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
`
|
16
15
|
#(begin
|
17
16
|
(define package-refs (make-hash-table))`
|
18
17
|
|
@@ -54,5 +53,5 @@ require = #(define-void-function (parser location package)(string?)
|
|
54
53
|
`
|
55
54
|
#(ly:debug "package loader is ready")
|
56
55
|
#(ly:set-option 'relative-includes #t)
|
57
|
-
\include "{{_[:user_file]}}"
|
56
|
+
\include "{{File.expand_path(_[:user_file])}}"
|
58
57
|
`
|
data/lib/lyp/version.rb
CHANGED
data/lib/lyp/wrapper.rb
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
|
3
3
|
module Lyp
|
4
|
+
WRAPPER_TEMPLATE = Lyp::Template.new(IO.read(
|
5
|
+
File.expand_path('templates/deps_wrapper.rb', File.dirname(__FILE__))
|
6
|
+
))
|
7
|
+
|
4
8
|
def self.wrap(fn)
|
5
9
|
r = Lyp::Resolver.new(fn).resolve_package_dependencies
|
6
10
|
|
7
11
|
unless r[:package_paths].empty?
|
8
|
-
|
12
|
+
FileUtils.mkdir_p('/tmp/lyp/wrappers')
|
13
|
+
fn = "/tmp/lyp/wrappers/#{File.basename(fn)}"
|
14
|
+
#Tempfile.new('lyp-deps-wrapper.ly').path
|
9
15
|
|
10
|
-
|
11
|
-
File.open(fn, 'w+') {|f| f << t.render(r)}
|
16
|
+
File.open(fn, 'w+') {|f| f << WRAPPER_TEMPLATE.render(r)}
|
12
17
|
end
|
13
18
|
fn
|
14
19
|
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.0.
|
4
|
+
version: 0.0.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-01-
|
11
|
+
date: 2016-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -110,6 +110,26 @@ dependencies:
|
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 2.7.1
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rugged
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0.23'
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 0.23.3
|
123
|
+
type: :runtime
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0.23'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.23.3
|
113
133
|
description: Lyp is a tool for managing lilypond versions and lilypond packages
|
114
134
|
email: ciconia@gmail.com
|
115
135
|
executables:
|
@@ -135,7 +155,7 @@ files:
|
|
135
155
|
- lib/lyp/templates/deps_wrapper.rb
|
136
156
|
- lib/lyp/version.rb
|
137
157
|
- lib/lyp/wrapper.rb
|
138
|
-
homepage: http://github.com/
|
158
|
+
homepage: http://github.com/noteflakes/lyp
|
139
159
|
licenses:
|
140
160
|
- MIT
|
141
161
|
metadata: {}
|