This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lambda do | |
jar_path = File.join(ROOT_DIR, 'vendor', 'SpaceMule', 'dist', 'SpaceMule.jar') | |
# Win32 requires us to manually require all the jars before requiring | |
# main jar. | |
Dir[File.dirname(jar_path) + "/lib/*.jar"].each { |jar| require jar } | |
require jar_path | |
# Scala <-> Ruby interoperability. | |
class Object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Finder { | |
def find( | |
source: Locatable, | |
sourceJumpgates: Set[SolarSystemPoint], | |
sourceSs: Option[SolarSystem], | |
sourceSsGalaxyCoords: Option[Coords], | |
target: Locatable, | |
targetJumpgates: Set[SolarSystemPoint], | |
targetSs: Option[SolarSystem], | |
targetSsGalaxyCoords: Option[Coords], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[#<Java::SpacemuleModulesPathfinderObjects::GalaxyPoint:0x46c34>, #<Java::ScalaCollectionImmutable::HashSet:0x838d2a>, Java::Scala::None, Java::Scala::None, #<Java::SpacemuleModulesPathfinderObjects::GalaxyPoint:0x1af2cc0>, #<Java::ScalaCollectionImmutable::HashSet:0x166d133>, Java::Scala::None, Java::Scala::None, Java::Scala::None] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Finder { | |
def test(t: Option[Int]) { println(t.get) } | |
} | |
>> SpaceMule::PfO.Finder.test(Some(3)) | |
3 | |
=> nil | |
>> SpaceMule::PfO.Finder.test(None) | |
NameError: no method 'test' for arguments (org.jruby.RubyClass) on Java::SpacemuleModulesPathfinderObjects::Finder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Finder { | |
def none = None | |
def test(t: Option[Int]) { println(t.get) } | |
} | |
>> f = SpaceMule::PfO.Finder | |
=> Java::SpacemuleModulesPathfinderObjects::Finder | |
>> | |
?> f.test(f.none) | |
NativeException: java.util.NoSuchElementException: None.get |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lambda do | |
jar_path = File.join(ROOT_DIR, 'vendor', 'SpaceMule', 'dist', 'SpaceMule.jar') | |
# Win32 requires us to manually require all the jars before requiring | |
# main jar. | |
Dir[File.dirname(jar_path) + "/lib/*.jar"].each { |jar| require jar } | |
require jar_path | |
# Scala <-> Ruby interoperability. | |
class Object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Invokes SpaceMule pathfinder. | |
module SpaceMule::Pathfinder | |
# Scala constants | |
Coords = SpaceMule::Pmg.classes.geom.Coords | |
Pf = SpaceMule::SmModules.pathfinder | |
PfO = Pf.objects | |
def self.invoke(source, target, avoid_npc) | |
avoidable_points = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server has encountered an error! | |
UNEXPECTED EXCEPTION: java.lang.RuntimeException: could not shut down process: java.lang.UNIXProcess@fde438 | |
Message: | |
{"params":{"version":"2011-1104-1211","web_player_id":2567,"server_player_id":909},"id":"1320523371429","action":"players|login"} | |
Backtrace: | |
org.jruby.RubyIO.obliterateProcess(RubyIO.java:4049) | |
org.jruby.util.ShellLauncher$POpenProcess.destroy(ShellLauncher.java:886) | |
org.jruby.RubyIO.obliterateProcess(RubyIO.java:4053) | |
org.jruby.RubyIO.close2(RubyIO.java:1998) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec::Matchers.define :be_created_from_static_ss_configuration do | |
|configuration| | |
def check_planet(position_str, ss_conditions, data) | |
exp_to = "Expected planet @ #{position_str} to" | |
if SsObject::Planet.where(ss_conditions).exists? | |
planet = SsObject::Planet.where(ss_conditions).first | |
owned_by_player = ! planet.player_id.nil? | |
@errors << "#{exp_to} have owned_by_player: #{data["owned_by_player"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jruby-1.6.5 :018 > c = ActiveRecord::Base.connection.raw_connection.with_connection_retry_guard { |c| c } | |
=> #<Java::ComMysqlJdbc::JDBC4Connection:0x1200320> | |
jruby-1.6.5 :019 > c.create_statement | |
=> #<Java::ComMysqlJdbc::StatementImpl:0x16f974f> |