-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
72 lines (57 loc) · 1.34 KB
/
Rakefile
File metadata and controls
72 lines (57 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# Rakefile -- Generate files
#
INFOFILE = "lib/neovim/info.rb"
GENERATED = [ INFOFILE]
task :default => GENERATED
task :infofile => INFOFILE
file INFOFILE => "INFO.yaml" do |f|
create_info f.name, f.source
end
task :clean do
rm_f *GENERATED
end
def commit
c = `git rev-parse --short HEAD`
$?.success? or raise "Git call failed."
c.chomp!
c
rescue
$stderr.puts $!
$stderr.puts "Warning: Git commit info could not be determined."
end
def create_info dst, src
File.open dst, "w" do |vf|
require "yaml"
m = YAML.load File.read src
name = m.keys.first
args = m[ name]
args[ :commit] = commit||"unknown"
unless args[ :authors] then
u = args.delete :author
args[ :authors] = [ u] if u
end
vf.puts 'require "neovim/meta.rb"'
vf.print "Neovim::INFO = Neovim::Meta.new #{name.inspect}"
args.each { |k,v|
vf.puts ","
vf.print " #{k.to_sym}: #{v.inspect}"
}
vf.puts
end
end
task :diffdeps do
%w(mplight).each { |gem|
c = `gem contents #{gem}`
unless $?.success? then
$stderr.puts "Gem #{gem} not installed. Cannot compare."
next
end
(c.split $/).each { |file|
if file =~ %r[/gems/#{gem}-.*/lib/(.*\.rb)$] then
ours = "lib/neovim/foreign/#$1"
sh *%W(nvim -d #{ours} #{file}) if File.exist? ours
end
}
}
end