Top Level Namespace

Defined Under Namespace

Modules: OldFormatWriter, Reader, WonkoTheSane, Writer Classes: BaseInput, BaseSanitizer, BaseVersionList, CurseVersionList, Download, DownloadsFixer, ExtractionCache, FMLVersionList, FileDownload, FileHashCache, ForgeFilesModsInput, ForgeFilesModsList, ForgeFixJarSanitizer, ForgeInstallerProfileInput, ForgePackXZUrlsSanitizer, ForgeRemoveMinecraftSanitizer, ForgeServerMainClassSanitizer, ForgeVersionList, HTTPCache, ImplicitRule, Jarmod, JenkinsInput, JenkinsVersionList, LiteLoaderVersionList, MojangExtractTweakersSanitizer, MojangInput, MojangProcessArgumentsSanitizer, MojangSplitLWJGLSanitizer, MojangTraitsSanitizer, OldFormat, OsRule, RW, Referenced, Registry, Rule, SidedRule, Timestamps, VanillaLegacyVersionList, VanillaVersionList, VersionIndex, VersionLibrary, VersionLibraryNative, WonkoVersion

Instance Method Summary collapse

Instance Method Details

#allowed_platforms_for_rules(rules) ⇒ Object



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
# File 'lib/wonko_the_sane/input/mojang_input.rb', line 1

def allowed_platforms_for_rules(rules)
  possible = ['win32', 'win64', 'lin32', 'lin64', 'osx64']

  allowed = possible
  if rules
    rules.each do |rule|
      if rule.is_a? ImplicitRule
        if rule.action == :allow
          allowed = possible
        else
          allowed = []
        end
      elsif rule.is_a? OsRule
        if rule.action == :allow
          case rule.os
          when 'windows'
            allowed << 'win32' << 'win64'
          when 'linux'
            allowed << 'lin32' << 'lin64'
          when 'osx'
            allowed << 'osx64'
          end
        elsif rule.action == :disallow
          case rule.os
          when 'windows'
            allowed.delete 'win32'
            allowed.delete 'win64'
          when 'linux'
            allowed.delete 'lin32'
            allowed.delete 'lin64'
          when 'osx'
            allowed.delete 'osx64'
          end
        end
      end
    end
  end

  allowed
end

#create_fmllib_download(file, forge_has = true) ⇒ Object



4
5
6
7
8
9
# File 'lib/wonko_the_sane/versionlists/forge_version_list.rb', line 4

def create_fmllib_download(file, forge_has = true)
  forge_base_url = 'http://files.minecraftforge.net/fmllibs/'
  multimc_base_url = 'http://files.multimc.org/fmllibs/'

  FileDownload.new (forge_has ? forge_base_url : multimc_base_url) + file, 'minecraft/lib/' + file
end

#fml_libs_mappingsObject



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
# File 'lib/wonko_the_sane/versionlists/forge_version_list.rb', line 3

def fml_libs_mappings
  def create_fmllib_download(file, forge_has = true)
    forge_base_url = 'http://files.minecraftforge.net/fmllibs/'
    multimc_base_url = 'http://files.multimc.org/fmllibs/'

    FileDownload.new (forge_has ? forge_base_url : multimc_base_url) + file, 'minecraft/lib/' + file
  end

  libs14 = [
      create_fmllib_download('argo-2.25.jar'),
      create_fmllib_download('guava-12.0.1.jar'),
      create_fmllib_download('asm-all-4.0.jar'),
      create_fmllib_download('bcprov-jdk15on-147.jar')
  ]

  {
      :'1.3.2' => [
          create_fmllib_download('argo-2.25.jar'),
          create_fmllib_download('guava-12.0.1.jar'),
          create_fmllib_download('asm-all-4.0.jar')
      ],
      :'1.4' => libs14,
      :'1.4.1' => libs14,
      :'1.4.2' => libs14,
      :'1.4.3' => libs14,
      :'1.4.4' => libs14,
      :'1.4.5' => libs14,
      :'1.4.6' => libs14,
      :'1.4.7' => libs14,
      :'1.5' => [
        create_fmllib_download('argo-small-3.2.jar'),
        create_fmllib_download('guava-14.0-rc3.jar'),
        create_fmllib_download('asm-all-4.1.jar'),
        create_fmllib_download('bcprov-jdk15on-148.jar', false),
        create_fmllib_download('deobfuscation_data_1.5.zip'),
        create_fmllib_download('scala-library.jar', false)
      ],
      :'1.5.1' => [
          create_fmllib_download('argo-small-3.2.jar'),
          create_fmllib_download('guava-14.0-rc3.jar'),
          create_fmllib_download('asm-all-4.1.jar'),
          create_fmllib_download('bcprov-jdk15on-148.jar', false),
          create_fmllib_download('deobfuscation_data_1.5.1.zip'),
          create_fmllib_download('scala-library.jar', false)
      ],
      :'1.5.2' => [
          create_fmllib_download('argo-small-3.2.jar'),
          create_fmllib_download('guava-14.0-rc3.jar'),
          create_fmllib_download('asm-all-4.1.jar'),
          create_fmllib_download('bcprov-jdk15on-148.jar', false),
          create_fmllib_download('deobfuscation_data_1.5.2.zip'),
          create_fmllib_download('scala-library.jar', false)
      ]
  }
end

#get_curse_id(name) ⇒ Object



1
2
3
4
5
# File 'lib/wonko_the_sane/tools/update_nem.rb', line 1

def get_curse_id(name)
  data = HTTPCache.get('http://minecraft.curseforge.com/mc-mods/' + name).gsub /[\n\r]/, ''
  match = data.match /<li class="view-on?-cur?se"> *<a href="http:\/\/curse.com\/project\/(\d*)">/
  match[1]
end

#update_nemObject



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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/wonko_the_sane/tools/update_nem.rb', line 7

def update_nem
  self.forgefiles_cleaned = {
    IronChests: :IronChests2
  }

  sources = WonkoTheSane.data_json 'sources.json'
  sources[:forgefiles] = {} unless sources[:forgefiles]
  sources[:jenkins] = [] unless sources[:jenkins]
  sources[:curse] = [] unless sources[:curse]

  nem_list = JSON.parse HTTPCache.get('https://raw.githubusercontent.com/SinZ163/NotEnoughMods/master/NEMP/mods.json'), symbolize_names: true
  nem_list.each do |key, value|
    name = (value[:name] ? value[:name] : key).to_sym
    case value[:function]
    when 'CheckMCForge2'
      if self.forgefiles_cleaned[name]
        name = self.forgefiles_cleaned[name]
      end
      if not sources[:forgefiles].find do |artifact, urlId| urlId == name.to_s end and not [:MinecraftForge, :FML, :Cauldron].include? name
        print "Please enter an uid for the #{"forgefiles".cyan} artifact #{name.to_s.green}: "
        uid = gets.chomp
        unless uid.empty?
          sources[:forgefiles][uid.to_sym] = name.to_s
        end
      end
    when 'CheckAE'
      # TODO
    when 'CheckAE2'
      # TODO
    when 'CheckAtomicStryker'
      # TODO
    when 'CheckBigReactors'
      # TODO
    when 'CheckBuildCraft'
      # TODO
    when 'CheckChickenBones'
      # TODO
    when 'CheckCurse'
      curse_id = value[:curse][:id] ? value[:curse][:id] : get_curse_id(value[:curse][:name] ? value[:curse][:name] : name.to_s.downcase)
      if sources[:curse].find { |obj| obj[:id] == curse_id }.nil?
        print "Please enter an uid for the #{'curse'.cyan} artifact #{name.to_s.green} (id: #{curse_id.yellow}): "
        uid = gets.chomp
        unless uid.empty?
          sources[:curse] << {
            uid: uid,
            id: curse_id,
            fileregex: value[:curse][:regex]
          }
        end
      end
    when 'CheckDropBox'
      # TODO
    when 'CheckGitHubRelease'
      # TODO
    when 'CheckHTML'
      # TODO
    when 'CheckJenkins'
      parts = value[:jenkins][:url].match /^(.*)\/job\/([^\/]*)\//
      if sources[:jenkins].find { |obj| obj[:url] == parts[1] && obj[:artifact] == parts[2] }.nil?
        print "Please enter an uid for the #{"jenkins".cyan} artifact #{name.to_s.green} from #{parts[1].yellow} (#{parts[2].red}): "
        uid = gets.chomp
        unless uid.empty?
          sources[:jenkins] << {
            uid: uid,
            url: parts[1],
            artifact: parts[2]
          }
        end
      end
    when 'CheckLunatrius'
      # TODO
    when 'CheckSpacechase'
      # TODO
    else
      print 'Unknown checker function: ' + value[:function]
    end

    # keep the writing in the loop so we don't lose progress in case of crashes or similar
    WonkoTheSane.set_data_json 'sources.json', sources
  end
end