launchcraft 0.0.1.2 → 0.0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,63 +17,83 @@
17
17
  # along with launchcraft. If not, see <http://www.gnu.org/licenses/>.
18
18
  #++
19
19
 
20
- require 'os'
21
- require 'launchcraft'
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
- class Dir
24
- def self.path
25
- ((ENV.key?('PATH') and ENV['PATH'] and !ENV['PATH'].empty?) ? ENV['PATH'] : '').split(File::PATH_SEPARATOR)
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
- def self.which (bin, which=0)
31
- bin << '.exe' if OS.windows? and bin !~ /\.exe$/
47
+ module Kernel
48
+ def self.which (bin, which=0)
49
+ bin << '.exe' if OS.windows? and bin !~ /\.exe$/
32
50
 
33
- res = Dir.path.map {|path|
34
- File.join(path, bin)
35
- }.select {|bin|
36
- File.executable_real?(bin)
37
- }
51
+ res = Dir.path.map {|path|
52
+ File.join(path, bin)
53
+ }.select {|bin|
54
+ File.executable_real?(bin)
55
+ }
38
56
 
39
- if which == :all
40
- res
41
- elsif which.is_a?(Integer)
42
- res[which]
43
- else
44
- res[0]
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
- module Java
51
- BIN = Kernel.which('java').tap {|x|
52
- next x if x
53
- break File.join(ENV['JAVA_HOME'], 'bin', 'java') if ENV['JAVA_HOME']
54
- raise RuntimeError, "java bin not found."
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
- class << self
58
- def exec (user, sessid=nil)
59
- Kernel.exec(*args(user, sessid))
60
- end
75
+ class << self
76
+ def exec (user, sessid=nil)
77
+ Kernel.exec(*args(user, sessid))
78
+ end
61
79
 
62
- def launch (user, sessid=nil)
63
- Kernel.system(*args(user, sessid))
64
- end
80
+ def launch (user, sessid=nil)
81
+ Kernel.system(*args(user, sessid))
82
+ end
65
83
 
66
- def spawn (user, sessid=nil)
67
- Kernel.spawn(*args(user, sessid))
68
- end
84
+ def spawn (user, sessid=nil)
85
+ Kernel.spawn(*args(user, sessid))
86
+ end
69
87
 
70
- protected
71
- def args (user, sessid=nil)
72
- bindir = File.join(LaunchCraft.working_dir, 'bin')
73
- [BIN, '-Xmx1024M', '-Xms512M', '-cp', %w[jinput lwjgl lwjgl_util minecraft].map {|x|
74
- File.join(bindir, "#{x}.jar")
75
- }.join(File::PATH_SEPARATOR), "-Djava.library.path=#{File.join(bindir, 'natives')}", "-Dminecraft.appname=#{LaunchCraft.appname}",
76
- 'net.minecraft.client.Minecraft', user, sessid].compact
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
@@ -18,5 +18,5 @@
18
18
  #++
19
19
 
20
20
  class LaunchCraft
21
- VERSION = '0.0.1.2'.freeze
21
+ VERSION = '0.0.1.3'.freeze
22
22
  end
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: false
5
- segments:
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-28 00:00:00 +02:00
13
+ date: 2011-09-29 00:00:00 +02:00
19
14
  default_executable:
20
15
  dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: lzma-ffi
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- segments:
30
- - 0
31
- - 0
32
- - 1
33
- - 2
34
- version: 0.0.1.2
35
- type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: zip
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- segments:
46
- - 0
47
- version: "0"
48
- type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: highline
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
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/md5_file.rb
73
- - lib/launchcraft/zip.rb
74
- - lib/launchcraft/version.rb
75
- - lib/launchcraft/java.rb
76
- - lib/launchcraft/update.rb
77
- - lib/launchcraft/uri.rb
78
- - lib/launchcraft/config.rb
79
- - lib/launchcraft/auth.rb
80
- - lib/launchcraft.rb
81
- - lib/os.rb
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
- - !ruby/object:Gem::Version
97
- segments:
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
- - !ruby/object:Gem::Version
105
- segments:
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.3.7
93
+ rubygems_version: 1.5.1
112
94
  signing_key:
113
95
  specification_version: 3
114
96
  summary: Simple cli launcher for minecraft