launchcraft 0.0.1.2 → 0.0.1.3
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.
- data/lib/launchcraft/java.rb +65 -45
- data/lib/launchcraft/version.rb +1 -1
- metadata +57 -75
data/lib/launchcraft/java.rb
CHANGED
@@ -17,63 +17,83 @@
|
|
17
17
|
# along with launchcraft. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
if RUBY_PLATFORM =~ /java/
|
21
|
+
class LaunchCraft
|
22
|
+
class Java
|
23
|
+
def self.exec (user, sessid=nil)
|
24
|
+
bindir = File.join(LaunchCraft.working_dir, 'bin')
|
25
|
+
::Java::java.lang.System.setProperty('org.lwjgl.librarypath', File.join(bindir, 'natives'))
|
26
|
+
::Java::java.lang.System.setProperty('net.java.games.input.librarypath', File.join(bindir, 'natives'))
|
27
|
+
::Java::java.lang.System.setProperty('minecraft.appname', LaunchCraft.appname)
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
|
29
|
+
%w[jinput lwjgl lwjgl_util minecraft].each {|x|
|
30
|
+
::Kernel.require(File.join(bindir, "#{x}.jar"))
|
31
|
+
}
|
32
|
+
|
33
|
+
::Java::net.minecraft.client.Minecraft.main([user, sessid].compact.to_java(:String))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
else
|
38
|
+
require 'os'
|
39
|
+
require 'launchcraft'
|
40
|
+
|
41
|
+
class Dir
|
42
|
+
def self.path
|
43
|
+
((ENV.key?('PATH') and ENV['PATH'] and !ENV['PATH'].empty?) ? ENV['PATH'] : '').split(File::PATH_SEPARATOR)
|
44
|
+
end
|
26
45
|
end
|
27
|
-
end
|
28
46
|
|
29
|
-
module Kernel
|
30
|
-
|
31
|
-
|
47
|
+
module Kernel
|
48
|
+
def self.which (bin, which=0)
|
49
|
+
bin << '.exe' if OS.windows? and bin !~ /\.exe$/
|
32
50
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
51
|
+
res = Dir.path.map {|path|
|
52
|
+
File.join(path, bin)
|
53
|
+
}.select {|bin|
|
54
|
+
File.executable_real?(bin)
|
55
|
+
}
|
38
56
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
57
|
+
if which == :all
|
58
|
+
res
|
59
|
+
elsif which.is_a?(Integer)
|
60
|
+
res[which]
|
61
|
+
else
|
62
|
+
res[0]
|
63
|
+
end
|
45
64
|
end
|
46
65
|
end
|
47
|
-
end
|
48
66
|
|
49
|
-
class LaunchCraft
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
67
|
+
class LaunchCraft
|
68
|
+
class Java
|
69
|
+
BIN = Kernel.which('java').tap {|x|
|
70
|
+
next x if x
|
71
|
+
break File.join(ENV['JAVA_HOME'], 'bin', 'java') if ENV['JAVA_HOME']
|
72
|
+
raise RuntimeError, "java bin not found."
|
73
|
+
}
|
56
74
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
75
|
+
class << self
|
76
|
+
def exec (user, sessid=nil)
|
77
|
+
Kernel.exec(*args(user, sessid))
|
78
|
+
end
|
61
79
|
|
62
|
-
|
63
|
-
|
64
|
-
|
80
|
+
def launch (user, sessid=nil)
|
81
|
+
Kernel.system(*args(user, sessid))
|
82
|
+
end
|
65
83
|
|
66
|
-
|
67
|
-
|
68
|
-
|
84
|
+
def spawn (user, sessid=nil)
|
85
|
+
Kernel.spawn(*args(user, sessid))
|
86
|
+
end
|
69
87
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
88
|
+
protected
|
89
|
+
def args (user, sessid=nil)
|
90
|
+
bindir = File.join(LaunchCraft.working_dir, 'bin')
|
91
|
+
[BIN, '-Xmx1024M', '-Xms512M', '-cp', %w[jinput lwjgl lwjgl_util minecraft].map {|x|
|
92
|
+
File.join(bindir, "#{x}.jar")
|
93
|
+
}.join(File::PATH_SEPARATOR), "-Dorg.lwjgl.librarypath=#{File.join(bindir, 'natives')}",
|
94
|
+
"-Dnet.java.games.input.librarypath=#{File.join(bindir, 'natives')}", "-Dminecraft.appname=#{LaunchCraft.appname}",
|
95
|
+
'net.minecraft.client.Minecraft', user, sessid].compact
|
96
|
+
end
|
77
97
|
end
|
78
98
|
end
|
79
99
|
end
|
data/lib/launchcraft/version.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launchcraft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 2
|
10
|
-
version: 0.0.1.2
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1.3
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
|
-
- shura
|
8
|
+
- shura
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-29 00:00:00 +02:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
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
|
-
- !ruby/object:Gem::
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
none: false
|
55
|
-
requirements:
|
56
|
-
- - ">="
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
61
|
-
type: :runtime
|
62
|
-
version_requirements: *id003
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: lzma-ffi
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.1.2
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: zip
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: highline
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
63
49
|
description: Simple cli launcher for minecraft
|
64
50
|
email: shura1991@gmail.com
|
65
51
|
executables:
|
66
|
-
- minecraft
|
52
|
+
- minecraft
|
67
53
|
extensions: []
|
68
54
|
|
69
55
|
extra_rdoc_files: []
|
70
56
|
|
71
57
|
files:
|
72
|
-
- lib/launchcraft
|
73
|
-
- lib/
|
74
|
-
- lib/launchcraft/
|
75
|
-
- lib/launchcraft/
|
76
|
-
- lib/launchcraft/
|
77
|
-
- lib/launchcraft/
|
78
|
-
- lib/launchcraft/
|
79
|
-
- lib/launchcraft/
|
80
|
-
- lib/launchcraft.rb
|
81
|
-
- lib/
|
82
|
-
- bin/minecraft
|
58
|
+
- lib/launchcraft.rb
|
59
|
+
- lib/os.rb
|
60
|
+
- lib/launchcraft/md5_file.rb
|
61
|
+
- lib/launchcraft/zip.rb
|
62
|
+
- lib/launchcraft/version.rb
|
63
|
+
- lib/launchcraft/java.rb
|
64
|
+
- lib/launchcraft/update.rb
|
65
|
+
- lib/launchcraft/uri.rb
|
66
|
+
- lib/launchcraft/config.rb
|
67
|
+
- lib/launchcraft/auth.rb
|
68
|
+
- bin/minecraft
|
83
69
|
has_rdoc: true
|
84
70
|
homepage: http://github.com/shurizzle/launchcraft
|
85
71
|
licenses: []
|
@@ -88,27 +74,23 @@ post_install_message:
|
|
88
74
|
rdoc_options: []
|
89
75
|
|
90
76
|
require_paths:
|
91
|
-
- lib
|
77
|
+
- lib
|
92
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
79
|
none: false
|
94
80
|
requirements:
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
- 0
|
99
|
-
version: "0"
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: "0"
|
100
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
85
|
none: false
|
102
86
|
requirements:
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
- 0
|
107
|
-
version: "0"
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
108
90
|
requirements: []
|
109
91
|
|
110
92
|
rubyforge_project:
|
111
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.5.1
|
112
94
|
signing_key:
|
113
95
|
specification_version: 3
|
114
96
|
summary: Simple cli launcher for minecraft
|