dst-mods 1.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/dst-mods.rb +37 -0
- data/lib/dst-mods/__module__.rb +5 -0
- data/lib/dst-mods/mod.rb +35 -0
- data/lib/dst-mods/mod_info.rb +39 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3d34b42f26a8807645cb16d6b0d3e41ee6f6e5be
|
4
|
+
data.tar.gz: 2d1b5b78c983f8e9dcd5c50a7d98385288060b8d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e89e7510ab41c59a5ce862ffc5c1070296848689cb2662b167057a0dd5f0308394c5a22e37e90c2c83f4724c094b0cfb8ea398ffefc3f3783650cff3aa4aefe
|
7
|
+
data.tar.gz: 89008400c6b81d8ffd15b6311a5eafe0a7daa076c433cd1333926a5818507b6e0e37ff354a156fcf076719fe07a5f038d4f6a546c5c92abace83b22d3bfae192
|
data/lib/dst-mods.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
require 'dst-mods/mod_info'
|
3
|
+
require 'dst-mods/mod'
|
4
|
+
|
5
|
+
module DST
|
6
|
+
|
7
|
+
module Mods
|
8
|
+
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
def each_in_directory(d)
|
13
|
+
return enum_for(__callee__, d) unless block_given?
|
14
|
+
|
15
|
+
Dir[File.join(d, "*")].each do |path|
|
16
|
+
begin
|
17
|
+
m = Mod.load!(path)
|
18
|
+
rescue
|
19
|
+
# Not a valid module. Move on.
|
20
|
+
else
|
21
|
+
yield m
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
alias_method :each_in_folder, :each_in_directory
|
26
|
+
|
27
|
+
|
28
|
+
def in_directory(d)
|
29
|
+
each_in_directory(d).to_a
|
30
|
+
end
|
31
|
+
alias_method :in_folder, :in_directory
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/lib/dst-mods/mod.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative '__module__'
|
2
|
+
|
3
|
+
require_relative 'mod_info'
|
4
|
+
|
5
|
+
module DST::Mods
|
6
|
+
|
7
|
+
class Mod
|
8
|
+
|
9
|
+
attr_reader :path, :info
|
10
|
+
|
11
|
+
def initialize(path:, info:)
|
12
|
+
@path = path
|
13
|
+
@info = info
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.load!(path)
|
17
|
+
info_path = File.join(path, "modinfo.lua")
|
18
|
+
self.new(
|
19
|
+
path: File.absolute_path(path),
|
20
|
+
info: ModInfo.load!(info_path)
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
# For convenience, we'll define a shortcut method for
|
26
|
+
# each of the ModInfo::Keys.
|
27
|
+
ModInfo::Keys.each do |k|
|
28
|
+
define_method k do
|
29
|
+
info[k]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative '__module__'
|
2
|
+
|
3
|
+
require 'recsym'
|
4
|
+
require 'ruby-lua'
|
5
|
+
|
6
|
+
module DST::Mods
|
7
|
+
|
8
|
+
module ModInfo
|
9
|
+
|
10
|
+
# The variables have a special meaning when used inside
|
11
|
+
# of a modinfo.lua file. So, let's grab them!
|
12
|
+
Keys = [
|
13
|
+
:name, :description, :author, :version,
|
14
|
+
:forumthread, :api_version, :priority,
|
15
|
+
:dst_compatible, :all_clients_require_mod,
|
16
|
+
:client_only_mod, :icon_atlas, :icon,
|
17
|
+
:configuration_options
|
18
|
+
]
|
19
|
+
|
20
|
+
|
21
|
+
# Loads the specified modinfo.lua file and returns
|
22
|
+
# the keys that we care about.
|
23
|
+
def self.load!(path)
|
24
|
+
lua = Language::Lua.new
|
25
|
+
lua.load(path)
|
26
|
+
|
27
|
+
retval = {}
|
28
|
+
Keys.each do |k|
|
29
|
+
retval[k] = lua.var(true, k.to_s)
|
30
|
+
end
|
31
|
+
|
32
|
+
RecSym.this(retval)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dst-mods
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.alpha.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Lauber
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: recsym
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
description: Extract data from Don't Starve Together mods
|
28
|
+
email: constructible.truth@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/dst-mods.rb
|
34
|
+
- lib/dst-mods/__module__.rb
|
35
|
+
- lib/dst-mods/mod.rb
|
36
|
+
- lib/dst-mods/mod_info.rb
|
37
|
+
homepage: https://github.com/briandamaged/dst-mods
|
38
|
+
licenses:
|
39
|
+
- MIT
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.3.1
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 2.4.6
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Extract data from Don't Starve Together mods
|
61
|
+
test_files: []
|