forked from Re-Volt-America/rva_pack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
60 lines (50 loc) · 1.87 KB
/
Rakefile
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
# frozen_string_literal: true
require 'json'
require_relative 'data'
task :default => %i[version]
task :version => %i[version_rva_cars version_rva_tracks version_rva_lego_tracks] do
rva_cars_json = File.read('rva_cars/packages.json')
rva_tracks_json = File.read('rva_tracks/packages.json')
rva_lego_tracks_json = File.read('rva_lego_tracks/packages.json')
rva_cars_hash = JSON.parse(rva_cars_json)['rva_cars']
rva_tracks_hash = JSON.parse(rva_tracks_json)['rva_tracks']
rva_lego_tracks_hash = JSON.parse(rva_lego_tracks_json)['rva_lego_tracks']
contents = [
'{',
"\t\"name\": \"#{RVA::NAME}\",",
"\t\"version\": \"#{RVA::VERSION}\",",
"\t\"packages\": {",
"\t\t\"rva_cars\": {",
"\t\t\t\"description\": \"#{rva_cars_hash['description']}\",",
"\t\t\t\"version\": \"#{rva_cars_hash['version']}\",",
"\t\t\t\"checksum\": \"#{rva_cars_hash['checksum']}\",",
"\t\t\t\"url\": \"#{rva_cars_hash['url']}\"",
"\t\t},",
"\t\t\"rva_tracks\": {",
"\t\t\t\"description\": \"#{rva_tracks_hash['description']}\",",
"\t\t\t\"version\": \"#{rva_tracks_hash['version']}\",",
"\t\t\t\"checksum\": \"#{rva_tracks_hash['checksum']}\",",
"\t\t\t\"url\": \"#{rva_tracks_hash['url']}\"",
"\t\t},",
"\t\t\"rva_lego_tracks\": {",
"\t\t\t\"description\": \"#{rva_lego_tracks_hash['description']}\",",
"\t\t\t\"version\": \"#{rva_lego_tracks_hash['version']}\",",
"\t\t\t\"checksum\": \"#{rva_lego_tracks_hash['checksum']}\",",
"\t\t\t\"url\": \"#{rva_lego_tracks_hash['url']}\"",
"\t\t}",
"\t}",
'}'
]
File.open('packages.json', 'w+') do |f|
contents.each { |l| f.puts(l) }
end
end
task :version_rva_cars do
system('cd rva_cars && rake version')
end
task :version_rva_tracks do
system('cd rva_tracks && rake version')
end
task :version_rva_lego_tracks do
system('cd rva_lego_tracks && rake version')
end