lat 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/compiler/compile.rb +65 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 051514055bc30ad3baf609b932c2b252f842ca9d864f929a6f8115ad72847de7
|
|
4
|
+
data.tar.gz: 6352e1091aab7ba991cec765bd77941eba6d92ff998684b2958fd92ccce1e17a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5c337be6a2c2d6525638fbcc0c3e57b2fcacc021501af218c2e5a452a4fb526356df6c5a5210cef99262f91f7c26c1d6cffdb0857caccc29f875547e15c5fa2
|
|
7
|
+
data.tar.gz: adbc284ef685eb4ceac54abe6dfe7a4337e29ea99f5784050ac28a47aff13194c6f61a4a26089231ed100f2a4fcc49839a1fcc39b5b4efbc6b257c365aeed51f
|
data/compiler/compile.rb
CHANGED
|
@@ -9,7 +9,71 @@ if ARGV.empty?
|
|
|
9
9
|
exit 1
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
def detect_os
|
|
13
|
+
host = RbConfig::CONFIG["host_os"]
|
|
14
|
+
return :windows if host =~ /mswin|mingw|cygwin/
|
|
15
|
+
return :macos if host =~ /darwin/
|
|
16
|
+
return :arch if File.exist?("/etc/arch-release")
|
|
17
|
+
return :debian if File.exist?("/etc/debian_version")
|
|
18
|
+
return :fedora if File.exist?("/etc/fedora-release")
|
|
19
|
+
:linux
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def love_installed?
|
|
23
|
+
if detect_os == :windows
|
|
24
|
+
common_paths = [
|
|
25
|
+
"C:/Program Files/LOVE/love.exe",
|
|
26
|
+
"C:/Program Files (x86)/LOVE/love.exe",
|
|
27
|
+
ENV["LOVE_PATH"].to_s
|
|
28
|
+
]
|
|
29
|
+
common_paths.any? { |p| File.exist?(p) }
|
|
30
|
+
else
|
|
31
|
+
system("love --version > /dev/null 2>&1")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def install_love
|
|
36
|
+
os = detect_os
|
|
37
|
+
puts "[lat] Love2D not found, attempting to install"
|
|
38
|
+
print "Do you want to install Love2d? (y/n)"
|
|
39
|
+
answer = $stdin.gets.chomp.downcase
|
|
40
|
+
|
|
41
|
+
if %w[y yes].include?(answer.downcase)
|
|
42
|
+
puts "installing love..."
|
|
43
|
+
|
|
44
|
+
case os
|
|
45
|
+
when :arch
|
|
46
|
+
system("sudo pacman -S --noconfirm love")
|
|
47
|
+
when :debian
|
|
48
|
+
system("sudo apt-get install -y love")
|
|
49
|
+
when :fedora
|
|
50
|
+
system("sudo dnf install -y love")
|
|
51
|
+
when :macos
|
|
52
|
+
if system("which brew > /dev/null 2>&1")
|
|
53
|
+
system("brew install love")
|
|
54
|
+
else
|
|
55
|
+
puts "[lat] Homebrew not found. Install Love2D from https://love2d.org"
|
|
56
|
+
exit 1
|
|
57
|
+
end
|
|
58
|
+
when :windows
|
|
59
|
+
puts "[lat] Please install Love2D from https://love2d.org"
|
|
60
|
+
puts "[lat] Set LOVE_PATH to the love.exe location:"
|
|
61
|
+
puts '[lat] setx LOVE_PATH "C:\\Program Files\\LOVE\\love.exe"'
|
|
62
|
+
else
|
|
63
|
+
puts "[lat] Can't auto-install on this system. Install LÖVE2D from https://love2d.org"
|
|
64
|
+
exit 1
|
|
65
|
+
end
|
|
66
|
+
else
|
|
67
|
+
puts "exiting..."
|
|
68
|
+
exit 1
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
|
|
12
74
|
def find_love
|
|
75
|
+
install_love unless love_installed?
|
|
76
|
+
|
|
13
77
|
candidates = [
|
|
14
78
|
"love",
|
|
15
79
|
"C:/Program Files/LOVE/love.exe",
|
|
@@ -30,7 +94,7 @@ love = find_love()
|
|
|
30
94
|
if ARGV[0] == "run"
|
|
31
95
|
latcDir = File.join(Dir.pwd, ".latc")
|
|
32
96
|
unless Dir.exist?(latcDir)
|
|
33
|
-
puts "Error: no .latc folder
|
|
97
|
+
puts "Error: no .latc folder found. Compile something first \n 'lat <input.lat> [main.lua]"
|
|
34
98
|
exit 1
|
|
35
99
|
end
|
|
36
100
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- JakeOJeff
|
|
@@ -30,7 +30,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 4.0.3
|
|
34
34
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
35
|
requirements:
|
|
36
36
|
- - ">="
|