wonko_the_sane 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/wonko_the_sane +12 -28
- data/data/sources.json +0 -5
- data/lib/wonko_the_sane.rb +6 -26
- data/lib/wonko_the_sane/input/base_input.rb +5 -10
- data/lib/wonko_the_sane/input/forge_installer_profile_input.rb +29 -47
- data/lib/wonko_the_sane/input/forgefiles_mods_input.rb +4 -7
- data/lib/wonko_the_sane/input/jenkins_input.rb +11 -15
- data/lib/wonko_the_sane/input/mojang_input.rb +52 -61
- data/lib/wonko_the_sane/{reader_writer.rb → new_format.rb} +31 -35
- data/lib/wonko_the_sane/old_format.rb +123 -0
- data/lib/wonko_the_sane/registry.rb +38 -23
- data/lib/wonko_the_sane/rules.rb +6 -6
- data/lib/wonko_the_sane/timestamps.rb +4 -4
- data/lib/wonko_the_sane/tools/update_nem.rb +20 -18
- data/lib/wonko_the_sane/util/configuration.rb +54 -2
- data/lib/wonko_the_sane/util/deep_storage_cache.rb +10 -8
- data/lib/wonko_the_sane/util/extraction_cache.rb +5 -4
- data/lib/wonko_the_sane/util/file_hash_cache.rb +6 -6
- data/lib/wonko_the_sane/util/http_cache.rb +50 -105
- data/lib/wonko_the_sane/util/maven_identifier.rb +8 -14
- data/lib/wonko_the_sane/util/task_stack.rb +7 -6
- data/lib/wonko_the_sane/{version_parser.rb → util/version_parser.rb} +10 -14
- data/lib/wonko_the_sane/version.rb +1 -1
- data/lib/wonko_the_sane/versionlists/base_version_list.rb +22 -15
- data/lib/wonko_the_sane/versionlists/curse_version_list.rb +15 -16
- data/lib/wonko_the_sane/versionlists/forge_version_list.rb +34 -37
- data/lib/wonko_the_sane/versionlists/forgefiles_mods_list.rb +3 -7
- data/lib/wonko_the_sane/versionlists/jenkins_version_list.rb +6 -15
- data/lib/wonko_the_sane/versionlists/liteloader_version_list.rb +18 -28
- data/lib/wonko_the_sane/versionlists/vanilla_legacy_version_list.rb +6 -6
- data/lib/wonko_the_sane/versionlists/vanilla_version_list.rb +6 -8
- data/lib/wonko_the_sane/wonko_version.rb +32 -12
- metadata +71 -15
- data/lib/wonko_the_sane/wonkoweb_uploader.rb +0 -162
@@ -1,36 +1,32 @@
|
|
1
|
-
require 'hashie'
|
2
|
-
|
3
1
|
module Reader
|
4
2
|
def read_version_index(data)
|
5
|
-
|
6
|
-
|
7
|
-
index =
|
8
|
-
|
9
|
-
json.versions.each do |ver|
|
3
|
+
data = data.with_indifferent_access
|
4
|
+
index = VersionIndex.new data[:uid]
|
5
|
+
index.name = data[:name]
|
6
|
+
data[:versions].each do |ver|
|
10
7
|
v = WonkoVersion.new
|
11
8
|
v.is_complete = false
|
12
|
-
v.uid =
|
9
|
+
v.uid = data[:uid]
|
13
10
|
v.version = ver[:version]
|
14
11
|
v.type = ver[:type]
|
15
12
|
v.time = ver[:time]
|
16
13
|
index.versions << v
|
17
14
|
end
|
18
15
|
|
19
|
-
|
16
|
+
index
|
20
17
|
end
|
21
18
|
|
22
19
|
def read_download(data, key)
|
23
20
|
if data[key.to_sym]
|
24
|
-
data[key.to_sym].map
|
25
|
-
Download.from_json key, dl
|
26
|
-
end
|
21
|
+
data[key.to_sym].map { |dl| Download.from_json key, dl }
|
27
22
|
else
|
28
23
|
[]
|
29
24
|
end
|
30
25
|
end
|
31
26
|
|
32
|
-
def read_resource(data
|
33
|
-
return if
|
27
|
+
def read_resource(data)
|
28
|
+
return if !data || !data.is_a?(Object)
|
29
|
+
res = WonkoVersion::Resources.new
|
34
30
|
res.traits = data[:'general.traits'] if data[:'general.traits']
|
35
31
|
res.folders = data[:'general.folders'] if data[:'general.folders']
|
36
32
|
res.launchMethod = data[:'general.launcher'] if data[:'general.launcher']
|
@@ -38,6 +34,7 @@ module Reader
|
|
38
34
|
res.downloads << read_download(data, 'general.downloads')
|
39
35
|
res.downloads << read_download(data, 'java.libraries')
|
40
36
|
res.downloads << read_download(data, 'java.natives')
|
37
|
+
res.downloads << read_download(data, 'mc.jarmods')
|
41
38
|
res.downloads.flatten!
|
42
39
|
|
43
40
|
res.mainClass = data[:'java.mainClass']
|
@@ -46,32 +43,31 @@ module Reader
|
|
46
43
|
res.minecraftArguments = data[:'mc.arguments']
|
47
44
|
res.tweakers = data[:'mc.tweakers']
|
48
45
|
res.jarModTarget = data[:'mc.jarModTarget'] if data[:'mc.jarModTarget']
|
46
|
+
res
|
49
47
|
end
|
50
48
|
|
51
49
|
def read_version(data)
|
52
|
-
|
50
|
+
data = data.with_indifferent_access
|
53
51
|
|
54
52
|
file = WonkoVersion.new
|
55
53
|
file.is_complete = true
|
56
54
|
|
57
|
-
file.uid =
|
58
|
-
file.version =
|
59
|
-
file.time =
|
60
|
-
file.type =
|
61
|
-
file.requires =
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
if Rule.allowed_on_side rules, :client
|
68
|
-
read_resource data, file.client
|
55
|
+
file.uid = data[:uid]
|
56
|
+
file.version = data[:version]
|
57
|
+
file.time = data[:time]
|
58
|
+
file.type = data[:type]
|
59
|
+
file.requires = data[:requires].map { |req| Referenced.new(req[:uid], req[:version]) } if data[:requires]
|
60
|
+
|
61
|
+
data[:data].each do |group|
|
62
|
+
rules = group[:rules] ? group[:rules] : [ImplicitRule.new(:allow)]
|
63
|
+
if Rule.allowed_on_side(rules, :client) && Rule.allowed_on_side(rules, :server)
|
64
|
+
file.common = read_resource group
|
69
65
|
elsif Rule.allowed_on_side rules, :server
|
70
|
-
|
66
|
+
file.server = read_resource group
|
71
67
|
else
|
72
|
-
read_resource
|
68
|
+
file.client = read_resource group
|
73
69
|
end
|
74
|
-
end if
|
70
|
+
end if data[:data]
|
75
71
|
|
76
72
|
file
|
77
73
|
end
|
@@ -84,7 +80,7 @@ end
|
|
84
80
|
module Writer
|
85
81
|
def write_version_index(index)
|
86
82
|
json = {
|
87
|
-
formatVersion:
|
83
|
+
formatVersion: 10,
|
88
84
|
uid: index.uid,
|
89
85
|
name: index.name,
|
90
86
|
versions: []
|
@@ -106,7 +102,7 @@ module Writer
|
|
106
102
|
data[:'general.launcher'] = resource.launchMethod if resource.launchMethod
|
107
103
|
data[:'general.folders'] = resource.folders if resource.folders and not resource.folders.empty?
|
108
104
|
resource.downloads.each do |dl|
|
109
|
-
data[dl.type] = []
|
105
|
+
data[dl.type] = [] unless data[dl.type]
|
110
106
|
data[dl.type] << dl.to_json
|
111
107
|
end
|
112
108
|
data[:'java.mainClass'] = resource.mainClass if resource.mainClass and resource.mainClass != ''
|
@@ -117,8 +113,8 @@ module Writer
|
|
117
113
|
data[:'mc.assets'] = resource.assets if resource.assets and resource.assets != ''
|
118
114
|
data[:'mc.arguments'] = resource.minecraftArguments if resource.minecraftArguments and resource.minecraftArguments != ''
|
119
115
|
|
120
|
-
|
121
|
-
if side == :client
|
116
|
+
unless data.empty?
|
117
|
+
if side == :client || side == :server
|
122
118
|
data[:rules] = [
|
123
119
|
ImplicitRule.new(:disallow).to_json,
|
124
120
|
SidedRule.new(:allow, side).to_json
|
@@ -131,7 +127,7 @@ module Writer
|
|
131
127
|
def write_version(version)
|
132
128
|
# metadata
|
133
129
|
json = {
|
134
|
-
formatVersion:
|
130
|
+
formatVersion: 10,
|
135
131
|
uid: version.uid,
|
136
132
|
version: version.version,
|
137
133
|
time: version.time.to_s,
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
module OldFormatWriter
|
4
|
+
def write_version(version)
|
5
|
+
# metadata
|
6
|
+
json = {
|
7
|
+
formatVersion: 0,
|
8
|
+
uid: version.uid,
|
9
|
+
name: version.uid,
|
10
|
+
fileId: version.uid,
|
11
|
+
version: version.version,
|
12
|
+
time: Time.at(version.time).iso8601,
|
13
|
+
releaseTime: Time.at(version.time).iso8601,
|
14
|
+
type: version.type,
|
15
|
+
requires: [],
|
16
|
+
order: order_for(version.uid)
|
17
|
+
}
|
18
|
+
json[:requires] = version.requires.map do |req|
|
19
|
+
obj = { uid: req.uid }
|
20
|
+
obj[:version] = req.version if req.version
|
21
|
+
obj
|
22
|
+
end if version.requires and not version.requires.empty?
|
23
|
+
json[:id] = version.version if version.uid == 'net.minecraft'
|
24
|
+
|
25
|
+
resource = version.client
|
26
|
+
|
27
|
+
vanilla_req = version.requires.find { |r| r.uid == 'net.minecraft' }
|
28
|
+
|
29
|
+
json[:mainClass] = resource.mainClass if resource.mainClass && resource.mainClass != ''
|
30
|
+
json[:appletClass] = resource.appletClass if resource.appletClass && resource.appletClass != ''
|
31
|
+
json[:assets] = resource.assets if resource.assets && resource.assets != ''
|
32
|
+
json[:mcVersion] = vanilla_req.version if vanilla_req
|
33
|
+
json[:minecraftArguments] = resource.minecraftArguments
|
34
|
+
|
35
|
+
vanilla = Registry.instance.retrieve 'net.minecraft', json[:mcVersion] if json[:mcVersion]
|
36
|
+
|
37
|
+
json[:'+tweakers'] = resource.tweakers if resource.tweakers && !resource.tweakers.empty?
|
38
|
+
|
39
|
+
natives = {}
|
40
|
+
json[:'+libraries'] = resource.downloads
|
41
|
+
.select { |dl| dl.type == 'java.libraries' || dl.type == 'java.natives' }
|
42
|
+
.reject { |lib| lib.name.start_with? 'net.minecraft:minecraft:' }
|
43
|
+
.map do |lib|
|
44
|
+
result = { name: lib.name }
|
45
|
+
if lib.explicit_url?
|
46
|
+
result[:'MMC-absoluteUrl'] = lib.url
|
47
|
+
elsif !lib.url.nil? && lib.maven_base_url != 'https://libraries.minecraft.net/'
|
48
|
+
result[:url] = lib.url
|
49
|
+
end
|
50
|
+
result[:rules] = lib.rules.map { |r| r.to_json } unless lib.rules.nil?
|
51
|
+
|
52
|
+
if lib.name.include?('org.scala-lang') || lib.name.include?('com.typesafe')
|
53
|
+
result[:'MMC-hint'] = 'forge-pack-xz'
|
54
|
+
end
|
55
|
+
|
56
|
+
in_vanilla = if vanilla
|
57
|
+
vanilla.client.downloads
|
58
|
+
.select { |dl| dl.type == 'java.libraries' || dl.type == 'java.natives' }
|
59
|
+
.find { |dl| dl.name == lib.name }
|
60
|
+
end
|
61
|
+
if !in_vanilla.nil? && in_vanilla == lib
|
62
|
+
# it's already there, no need to add it
|
63
|
+
else
|
64
|
+
if in_vanilla.nil?
|
65
|
+
result[:insert] = 'append' unless version.uid == 'net.minecraft'
|
66
|
+
if %w(minecraftforge forge fml liteloader).include? lib.maven.artifact
|
67
|
+
result[:'MMC-depend'] = 'hard'
|
68
|
+
end
|
69
|
+
else
|
70
|
+
result[:insert] = 'replace'
|
71
|
+
end
|
72
|
+
|
73
|
+
[lib, result]
|
74
|
+
end
|
75
|
+
end.reject { |i| i.nil? }.map do |array|
|
76
|
+
lib = array[0]
|
77
|
+
result = array[1]
|
78
|
+
if lib.type == 'java.libraries'
|
79
|
+
result
|
80
|
+
else
|
81
|
+
# reconstruct insane natives
|
82
|
+
# mojang: you invented this fancy^Wweird rules system, and then you don't use it?
|
83
|
+
natives[lib.name] ||= {}
|
84
|
+
osrule = lib.rules[1]
|
85
|
+
if natives[lib.name].key? osrule.os
|
86
|
+
nil
|
87
|
+
else
|
88
|
+
natives[lib.name][osrule.os] = result
|
89
|
+
result[:url] = result[:url].sub /(32|64)/, '${arch}' if result[:url]
|
90
|
+
result[:'MMC-absoluteUrl'] = result[:'MMC-absoluteUrl'].sub /(32|64)/, '${arch}' if result[:'MMC-absoluteUrl']
|
91
|
+
result[:rules][1][:os].delete :arch
|
92
|
+
result
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end.reject { |i| i.nil? }
|
96
|
+
|
97
|
+
json[:'+jarMods'] = resource.downloads.select { |dl| dl.type == 'mc.jarmods' }.map do |lib|
|
98
|
+
{}
|
99
|
+
end
|
100
|
+
|
101
|
+
json
|
102
|
+
end
|
103
|
+
|
104
|
+
def order_for(uid)
|
105
|
+
case uid
|
106
|
+
when 'net.minecraftforge'
|
107
|
+
5
|
108
|
+
when 'com.mumfrey.liteloader'
|
109
|
+
10
|
110
|
+
when 'net.minecraft'
|
111
|
+
-2
|
112
|
+
when 'org.lwjgl'
|
113
|
+
-1
|
114
|
+
else
|
115
|
+
0
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class OldFormat
|
121
|
+
include OldFormatWriter
|
122
|
+
end
|
123
|
+
$old_format = OldFormat.new
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
class Registry
|
2
4
|
def version_index(uid)
|
3
5
|
return VersionIndex.new uid unless File.exists? VersionIndex.local_filename uid
|
@@ -6,49 +8,62 @@ class Registry
|
|
6
8
|
|
7
9
|
def store_version_index(index)
|
8
10
|
File.write index.local_filename, JSON.pretty_generate($rw.write_version_index index)
|
9
|
-
|
11
|
+
FileUtils.copy index.local_filename, "#{Registry.out_dir}/#{index.uid}.json" unless Registry.out_dir.blank?
|
10
12
|
end
|
11
13
|
|
12
14
|
def index
|
13
|
-
return {
|
15
|
+
return {index: []} unless File.exists? 'files/index.json'
|
14
16
|
$rw.read_index JSON.parse File.read 'files/index.json'
|
15
17
|
end
|
16
18
|
|
17
19
|
def store(version)
|
18
20
|
if version.is_a? Array
|
19
|
-
version.each do |f|
|
21
|
+
version.each do |f|
|
22
|
+
store(f)
|
23
|
+
end
|
20
24
|
else
|
21
|
-
BaseSanitizer.sanitize(version, DownloadsFixer).each do |
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
BaseSanitizer.sanitize(version, DownloadsFixer).each do |ver|
|
26
|
+
begin
|
27
|
+
Dir.mkdir 'files/' + ver.uid unless Dir.exist? 'files/' + ver.uid
|
28
|
+
File.write ver.local_filename + '.new', JSON.pretty_generate($rw.write_version ver)
|
29
|
+
File.write ver.local_filename, JSON.pretty_generate($old_format.write_version ver)
|
30
|
+
unless Registry.out_dir.blank?
|
31
|
+
FileUtils.copy ver.local_filename + '.new', "#{Registry.out_dir}/#{ver.uid}-#{ver.version}.new.json"
|
32
|
+
FileUtils.copy ver.local_filename, "#{Registry.out_dir}/#{ver.uid}-#{ver.version}.json"
|
33
|
+
end
|
34
|
+
|
35
|
+
vindex = version_index ver.uid
|
36
|
+
vindex.add_version ver
|
37
|
+
store_version_index vindex
|
38
|
+
|
39
|
+
ind = index
|
40
|
+
next if ind[:index].find { |i| ver.uid == i[:uid] } # early exit if the uid already exists in the index
|
41
|
+
ind[:formatVersion] = 0
|
42
|
+
ind[:index] << {uid: ver.uid}
|
43
|
+
File.write 'files/index.json', JSON.pretty_generate($rw.write_index ind)
|
44
|
+
rescue Exception => e
|
45
|
+
Logging.logger[ver.uid].error 'Unable to store: ' + ver.version
|
46
|
+
raise e
|
47
|
+
end
|
35
48
|
end
|
36
49
|
end
|
37
|
-
rescue Exception => e
|
38
|
-
Logging.logger[version.uid].error 'Unable to store: ' + version.version
|
39
|
-
raise e
|
40
50
|
end
|
41
51
|
|
42
52
|
def retrieve(id, version)
|
43
53
|
if File.exist? WonkoVersion.local_filename(id, version)
|
44
|
-
$rw.read_version JSON.parse File.read(WonkoVersion.local_filename
|
54
|
+
$rw.read_version JSON.parse File.read(WonkoVersion.local_filename(id, version) + '.new')
|
45
55
|
else
|
46
56
|
nil
|
47
57
|
end
|
48
58
|
end
|
49
59
|
|
50
60
|
def self.instance
|
51
|
-
|
52
|
-
|
61
|
+
FileUtils.mkdir_p 'files' unless Dir.exist? 'files'
|
62
|
+
FileUtils.mkdir_p out_dir unless out_dir.blank? || Dir.exists?(out_dir)
|
63
|
+
@instance ||= Registry.new
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.out_dir
|
67
|
+
WonkoTheSane.configuration.out_dir
|
53
68
|
end
|
54
69
|
end
|
data/lib/wonko_the_sane/rules.rb
CHANGED
@@ -11,21 +11,21 @@ class Rule
|
|
11
11
|
|
12
12
|
def self.allowed_on_side(rules, side)
|
13
13
|
allowed = :allow
|
14
|
-
rules.each do |rule|
|
14
|
+
rules.map { |r| r.is_a?(Rule) ? r : Rule.from_json(r) }.each do |rule|
|
15
15
|
if rule.is_a? ImplicitRule
|
16
16
|
allowed = rule.action
|
17
17
|
elsif rule.is_a? SidedRule
|
18
|
-
allowed = rule.action if rule.side
|
18
|
+
allowed = rule.action if rule.side == side
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
21
|
+
allowed == :allow
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.from_json(obj)
|
25
25
|
if obj.key? :os
|
26
26
|
return OsRule.new obj[:action].to_sym, obj[:os][:name], obj[:os][:version], obj[:os][:arch]
|
27
27
|
elsif obj.key? :side
|
28
|
-
return SidedRule.new obj[:action].to_sym, obj[:side]
|
28
|
+
return SidedRule.new obj[:action].to_sym, obj[:side].to_sym
|
29
29
|
else
|
30
30
|
return ImplicitRule.new obj[:action].to_sym
|
31
31
|
end
|
@@ -50,7 +50,7 @@ class OsRule < Rule
|
|
50
50
|
obj[:os] = { name: @os }
|
51
51
|
obj[:os][:version] = @os_version if @os_version
|
52
52
|
obj[:os][:arch] = @os_arch if @os_arch
|
53
|
-
|
53
|
+
obj
|
54
54
|
end
|
55
55
|
end
|
56
56
|
class SidedRule < Rule
|
@@ -64,6 +64,6 @@ class SidedRule < Rule
|
|
64
64
|
def to_json
|
65
65
|
obj = super
|
66
66
|
obj[:side] = @side
|
67
|
-
|
67
|
+
obj
|
68
68
|
end
|
69
69
|
end
|
@@ -4,8 +4,8 @@ class Timestamps
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def get(uid, version, default = nil)
|
7
|
-
if @json[uid.to_sym]
|
8
|
-
|
7
|
+
if @json[uid.to_sym] && @json[uid.to_sym][version.to_sym]
|
8
|
+
@json[uid.to_sym][version.to_sym]
|
9
9
|
elsif default.nil?
|
10
10
|
raise 'No timestamp available for ' + uid + ': ' + version
|
11
11
|
elsif default.is_a? String
|
@@ -24,7 +24,7 @@ class Timestamps
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.get(uid, version, default = nil)
|
27
|
-
|
28
|
-
|
27
|
+
@me ||= Timestamps.new
|
28
|
+
@me.get uid, version, default
|
29
29
|
end
|
30
30
|
end
|
@@ -1,31 +1,31 @@
|
|
1
1
|
def get_curse_id(name)
|
2
2
|
data = HTTPCache.get('http://minecraft.curseforge.com/mc-mods/' + name).gsub /[\n\r]/, ''
|
3
3
|
match = data.match /<li class="view-on?-cur?se"> *<a href="http:\/\/curse.com\/project\/(\d*)">/
|
4
|
-
|
4
|
+
match[1]
|
5
5
|
end
|
6
6
|
|
7
7
|
def update_nem
|
8
|
-
|
8
|
+
self.forgefiles_cleaned = {
|
9
9
|
IronChests: :IronChests2
|
10
10
|
}
|
11
11
|
|
12
12
|
sources = WonkoTheSane.data_json 'sources.json'
|
13
|
-
sources[:forgefiles] = {}
|
14
|
-
sources[:jenkins] = []
|
15
|
-
sources[:curse] = []
|
13
|
+
sources[:forgefiles] = {} unless sources[:forgefiles]
|
14
|
+
sources[:jenkins] = [] unless sources[:jenkins]
|
15
|
+
sources[:curse] = [] unless sources[:curse]
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
nem_list = JSON.parse HTTPCache.get('https://raw.githubusercontent.com/SinZ163/NotEnoughMods/master/NEMP/mods.json'), symbolize_names: true
|
18
|
+
nem_list.each do |key, value|
|
19
19
|
name = (value[:name] ? value[:name] : key).to_sym
|
20
20
|
case value[:function]
|
21
21
|
when 'CheckMCForge2'
|
22
|
-
if
|
23
|
-
name =
|
22
|
+
if self.forgefiles_cleaned[name]
|
23
|
+
name = self.forgefiles_cleaned[name]
|
24
24
|
end
|
25
25
|
if not sources[:forgefiles].find do |artifact, urlId| urlId == name.to_s end and not [:MinecraftForge, :FML, :Cauldron].include? name
|
26
26
|
print "Please enter an uid for the #{"forgefiles".cyan} artifact #{name.to_s.green}: "
|
27
27
|
uid = gets.chomp
|
28
|
-
|
28
|
+
unless uid.empty?
|
29
29
|
sources[:forgefiles][uid.to_sym] = name.to_s
|
30
30
|
end
|
31
31
|
end
|
@@ -42,14 +42,14 @@ def update_nem
|
|
42
42
|
when 'CheckChickenBones'
|
43
43
|
# TODO
|
44
44
|
when 'CheckCurse'
|
45
|
-
|
46
|
-
if
|
47
|
-
print "Please enter an uid for the #{
|
45
|
+
curse_id = value[:curse][:id] ? value[:curse][:id] : get_curse_id(value[:curse][:name] ? value[:curse][:name] : name.to_s.downcase)
|
46
|
+
if sources[:curse].find { |obj| obj[:id] == curse_id }.nil?
|
47
|
+
print "Please enter an uid for the #{'curse'.cyan} artifact #{name.to_s.green} (id: #{curse_id.yellow}): "
|
48
48
|
uid = gets.chomp
|
49
|
-
|
49
|
+
unless uid.empty?
|
50
50
|
sources[:curse] << {
|
51
51
|
uid: uid,
|
52
|
-
id:
|
52
|
+
id: curse_id,
|
53
53
|
fileregex: value[:curse][:regex]
|
54
54
|
}
|
55
55
|
end
|
@@ -61,11 +61,11 @@ def update_nem
|
|
61
61
|
when 'CheckHTML'
|
62
62
|
# TODO
|
63
63
|
when 'CheckJenkins'
|
64
|
-
parts = value[:jenkins][:url].match
|
65
|
-
if
|
64
|
+
parts = value[:jenkins][:url].match /^(.*)\/job\/([^\/]*)\//
|
65
|
+
if sources[:jenkins].find { |obj| obj[:url] == parts[1] && obj[:artifact] == parts[2] }.nil?
|
66
66
|
print "Please enter an uid for the #{"jenkins".cyan} artifact #{name.to_s.green} from #{parts[1].yellow} (#{parts[2].red}): "
|
67
67
|
uid = gets.chomp
|
68
|
-
|
68
|
+
unless uid.empty?
|
69
69
|
sources[:jenkins] << {
|
70
70
|
uid: uid,
|
71
71
|
url: parts[1],
|
@@ -77,6 +77,8 @@ def update_nem
|
|
77
77
|
# TODO
|
78
78
|
when 'CheckSpacechase'
|
79
79
|
# TODO
|
80
|
+
else
|
81
|
+
print 'Unknown checker function: ' + value[:function]
|
80
82
|
end
|
81
83
|
|
82
84
|
# keep the writing in the loop so we don't lose progress in case of crashes or similar
|