nova 0.0.2
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 +7 -0
- data/LICENSE +19 -0
- data/README.md +29 -0
- data/bin/nova +8 -0
- data/lib/generator/template/new_install/galaxy/some_star.rb +3 -0
- data/lib/generator/template/new_install/supernova.yml +16 -0
- data/lib/nova.rb +49 -0
- data/lib/nova/cli.rb +62 -0
- data/lib/nova/commands/server.rb +71 -0
- data/lib/nova/common.rb +17 -0
- data/lib/nova/common/event_handler.rb +165 -0
- data/lib/nova/common/event_handler/event.rb +147 -0
- data/lib/nova/common/features.rb +93 -0
- data/lib/nova/common/features/feature.rb +65 -0
- data/lib/nova/common/metadata.rb +65 -0
- data/lib/nova/common/metadata/data.rb +171 -0
- data/lib/nova/common/star_management.rb +164 -0
- data/lib/nova/constructor.rb +84 -0
- data/lib/nova/exceptions.rb +16 -0
- data/lib/nova/project.rb +199 -0
- data/lib/nova/remote.rb +10 -0
- data/lib/nova/remote/fake.rb +51 -0
- data/lib/nova/remote/fake/commands.rb +44 -0
- data/lib/nova/remote/fake/file_system.rb +76 -0
- data/lib/nova/remote/fake/operating_system.rb +52 -0
- data/lib/nova/remote/fake/platform.rb +89 -0
- data/lib/nova/star.rb +25 -0
- data/lib/nova/starbound.rb +14 -0
- data/lib/nova/starbound/client.rb +59 -0
- data/lib/nova/starbound/encryptor.rb +134 -0
- data/lib/nova/starbound/encryptors.rb +13 -0
- data/lib/nova/starbound/encryptors/openssl.rb +122 -0
- data/lib/nova/starbound/encryptors/plaintext.rb +64 -0
- data/lib/nova/starbound/encryptors/rbnacl.rb +67 -0
- data/lib/nova/starbound/protocol.rb +81 -0
- data/lib/nova/starbound/protocol/encryption.rb +48 -0
- data/lib/nova/starbound/protocol/exceptions.rb +38 -0
- data/lib/nova/starbound/protocol/messages.rb +116 -0
- data/lib/nova/starbound/protocol/packet.rb +267 -0
- data/lib/nova/starbound/protocol/socket.rb +231 -0
- data/lib/nova/starbound/server.rb +182 -0
- data/lib/nova/version.rb +5 -0
- data/spec/constructor_spec.rb +20 -0
- data/spec/local_spec.rb +26 -0
- data/spec/nova_spec.rb +7 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/star/some_type.rb +27 -0
- data/spec/star_spec.rb +107 -0
- data/spec/starbound/encryptor_spec.rb +33 -0
- data/spec/starbound/openssl_encryptor_spec.rb +80 -0
- data/spec/starbound/packet_spec.rb +61 -0
- data/spec/starbound/plaintext_encryptor_spec.rb +27 -0
- data/spec/starbound/protocol_spec.rb +163 -0
- data/spec/starbound/rbnacl_encryptor_spec.rb +70 -0
- metadata +166 -0
data/lib/nova/remote.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'nova/remote/fake/commands'
|
2
|
+
require 'nova/remote/fake/file_system'
|
3
|
+
require 'nova/remote/fake/operating_system'
|
4
|
+
require 'nova/remote/fake/platform'
|
5
|
+
|
6
|
+
module Nova
|
7
|
+
module Remote
|
8
|
+
|
9
|
+
# This is a fake remote. It does nothing. Really. You can trust
|
10
|
+
# me.
|
11
|
+
class Fake
|
12
|
+
|
13
|
+
# Returns a platform instance. Caches the instance across
|
14
|
+
# method calls.
|
15
|
+
#
|
16
|
+
# @see Platform
|
17
|
+
# @return [Platform]
|
18
|
+
def platform
|
19
|
+
@_platform ||= Platform.new
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns a command instance. Caches the instance across method
|
23
|
+
# calls.
|
24
|
+
#
|
25
|
+
# @see Commands
|
26
|
+
# @return [Commands]
|
27
|
+
def command
|
28
|
+
@_command ||= Commands.new
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns an operating system instance. Caches the instance
|
32
|
+
# across method calls.
|
33
|
+
#
|
34
|
+
# @see OperatingSystem
|
35
|
+
# @return [OperatingSystem]
|
36
|
+
def operating_system
|
37
|
+
@_operating_system ||= OperatingSystem.new
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns a file system instance. Caches the instance across
|
41
|
+
# method calls.
|
42
|
+
#
|
43
|
+
# @see FileSystem
|
44
|
+
# @return [FileSystem]
|
45
|
+
def file_system
|
46
|
+
@_file_system ||= FileSystem.new
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'command/runner'
|
2
|
+
|
3
|
+
module Nova
|
4
|
+
module Remote
|
5
|
+
class Fake
|
6
|
+
|
7
|
+
# Manages running commands.
|
8
|
+
#
|
9
|
+
# @abstract
|
10
|
+
class Commands
|
11
|
+
|
12
|
+
# Creates a CommandLine with its default runner.
|
13
|
+
#
|
14
|
+
# @abstract
|
15
|
+
# @note Does nothing. Since we're a fake remote, we'll
|
16
|
+
# overwrite the backend with a fake one.
|
17
|
+
# @see https://github.com/redjazz96/command-runner
|
18
|
+
# @param command [String] the command to run.
|
19
|
+
# @param arguments [String] the arguments to be passed to the
|
20
|
+
# command.
|
21
|
+
# @return [Command::Runner] the runner.
|
22
|
+
def line(command, arguments = "", options = {})
|
23
|
+
options.merge! :logger => Nova.logger
|
24
|
+
c = Command::Runner.new(command, arguments, options)
|
25
|
+
c.backend = Command::Runner::Backends::Fake.new
|
26
|
+
c
|
27
|
+
end
|
28
|
+
|
29
|
+
# Checks to see if the command exists.
|
30
|
+
#
|
31
|
+
# @abstract
|
32
|
+
# @note Does nothing. Always returns false since this is the
|
33
|
+
# fake remote.
|
34
|
+
# @param command [String] the command to check the existance
|
35
|
+
# of.
|
36
|
+
# @return [Boolean]
|
37
|
+
def command_exists?(command)
|
38
|
+
false
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Nova
|
2
|
+
module Remote
|
3
|
+
class Fake
|
4
|
+
|
5
|
+
# Handles filesystem stuff, like downloading files and
|
6
|
+
# decompressing ifles.
|
7
|
+
class FileSystem
|
8
|
+
# Grabs the file from file and puts it somewhere else. If
|
9
|
+
# it's a local file (checked by #file_exists?), it just copies
|
10
|
+
# it. If it's not, it opens a connection to the server to try
|
11
|
+
# to download the file.
|
12
|
+
#
|
13
|
+
# @note Does nothing.
|
14
|
+
# @abstract
|
15
|
+
# @param file [String] the file to download. Can be a path
|
16
|
+
# name or URI.
|
17
|
+
# @param options [Hash{Symbol => Object}] the options for
|
18
|
+
# grabbing the files.
|
19
|
+
# @option options [String] :to the file to save to. If this
|
20
|
+
# doesn't exist, it's guessed from the file name.
|
21
|
+
# @option options [Boolean, String] :decompress the file after
|
22
|
+
# saving it. If it's a string, the decompressed file is
|
23
|
+
# extracted there. Otherwise, it's guessed from the
|
24
|
+
# filename.
|
25
|
+
# @return [Boolean]
|
26
|
+
def grab_file(file, options = {})
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
30
|
+
# Checks to see if the file exists on the file system.
|
31
|
+
#
|
32
|
+
# @note Does nothing.
|
33
|
+
# @abstract
|
34
|
+
# @param file [String] the file to check.
|
35
|
+
# @return [Boolean]
|
36
|
+
def file_exists?(file)
|
37
|
+
false
|
38
|
+
end
|
39
|
+
|
40
|
+
# Decompress the given file, to the given directory.
|
41
|
+
#
|
42
|
+
# @note Does nothing.
|
43
|
+
# @abstract
|
44
|
+
# @param file [String] the file to decompress.
|
45
|
+
# @param to [String] the directory to decompress to.
|
46
|
+
# @return [void]
|
47
|
+
def decompress_file(file, to)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
# Untars the given file.
|
53
|
+
#
|
54
|
+
# @note Does nothing.
|
55
|
+
# @abstract
|
56
|
+
# @return [void]
|
57
|
+
def untar_file(f, to)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Unzips the file.
|
61
|
+
#
|
62
|
+
# @note Does nothing.
|
63
|
+
# @abstract
|
64
|
+
def unzip_file(f, to)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Unrars the given file.
|
68
|
+
#
|
69
|
+
# @note Does nothing.
|
70
|
+
# @abstract
|
71
|
+
def unrar_file(f, to)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Nova
|
2
|
+
module Remote
|
3
|
+
class Fake
|
4
|
+
|
5
|
+
# Handles operating system tasks like installing packages or
|
6
|
+
# creating users.
|
7
|
+
#
|
8
|
+
# @abstract
|
9
|
+
class OperatingSystem
|
10
|
+
|
11
|
+
# Creates a user with the given name and options.
|
12
|
+
#
|
13
|
+
# @abstract
|
14
|
+
# @note Does nothing. As such, it always returns false.
|
15
|
+
# @param name [String, Symbol] the name of the user.
|
16
|
+
# @param options [Hash<Symbol, Object>] the options for the
|
17
|
+
# user.
|
18
|
+
# @option options [Boolean] :system whether or not the user is
|
19
|
+
# a system user. Defaults to +false+.
|
20
|
+
# @option options [Boolean] :nologin whether or not the user
|
21
|
+
# is able to log in. Defaults to +false+.
|
22
|
+
# @option options [String] :password the user's password.
|
23
|
+
# Defaults to +nil+.
|
24
|
+
# @return [Boolean] whether or not the user creation was
|
25
|
+
# successful.
|
26
|
+
def create_user(name, options = {})
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
30
|
+
# Installs packages for the corresponding operating system.
|
31
|
+
#
|
32
|
+
# @abstract
|
33
|
+
# @note Does nothing. As such, it always returns false.
|
34
|
+
# @param packages [Hash<Symbol, Array<String>>] the symbol is
|
35
|
+
# the name of the OS, the array is the packages to install
|
36
|
+
# for that OS.
|
37
|
+
# @option packages [Array<String>] :ubuntu the packages to
|
38
|
+
# install for debian-based OSs (Ubuntu, Debian, Mint).
|
39
|
+
# @option packages [Array<String>] :red_hat the packages to
|
40
|
+
# install for red hat-based OSs (REHL, Fedora, CentOS).
|
41
|
+
# @option packages [Array<String>] :arch the packages to
|
42
|
+
# install for arch.
|
43
|
+
# @return [Boolean] whether or not the package installation
|
44
|
+
# was successful.
|
45
|
+
def install_packages(packages)
|
46
|
+
false
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Nova
|
2
|
+
module Remote
|
3
|
+
class Fake
|
4
|
+
|
5
|
+
# The platform information.
|
6
|
+
#
|
7
|
+
# @abstract
|
8
|
+
class Platform
|
9
|
+
|
10
|
+
# The list of platforms that this platform matches.
|
11
|
+
#
|
12
|
+
# @abstract
|
13
|
+
# @note Since this is a Fake remote, it defaults to none.
|
14
|
+
# @return [Array<Symbol>] the platform list.
|
15
|
+
def types
|
16
|
+
[]
|
17
|
+
end
|
18
|
+
|
19
|
+
# Tries to determine the platform version, but if it can't, it
|
20
|
+
# defaults to nil.
|
21
|
+
#
|
22
|
+
# @abstract
|
23
|
+
# @note Since this is a Fake remote, it defaults to nil.
|
24
|
+
# @return [nil, String]
|
25
|
+
def version
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
|
29
|
+
# True for linux? or osx?
|
30
|
+
# @api public
|
31
|
+
# @see OS#posix?
|
32
|
+
# @return [Boolean]
|
33
|
+
def posix?; false; end
|
34
|
+
|
35
|
+
# True if the OS is based on the linux kernel, false for
|
36
|
+
# windows, OSX, or cygwin.
|
37
|
+
# @api public
|
38
|
+
# @see OS#linux?
|
39
|
+
# @return [Boolean]
|
40
|
+
def linux?; false; end
|
41
|
+
|
42
|
+
# True if the OS is OSX, false for linux, windows, or cygwin.
|
43
|
+
# @see OS#osx?
|
44
|
+
# @api public
|
45
|
+
# @return [Boolean]
|
46
|
+
def osx?; false; end
|
47
|
+
|
48
|
+
# True if the OS is Windows or jruby?, false for linux or
|
49
|
+
# windows.
|
50
|
+
# @api public
|
51
|
+
# @see OS#windows?
|
52
|
+
# @return [Boolean]
|
53
|
+
def windows?; false; end
|
54
|
+
|
55
|
+
# True if the ruby is based on the JRuby implementation.
|
56
|
+
# @api public
|
57
|
+
# @see OS#jruby?
|
58
|
+
# @return [Boolean]
|
59
|
+
def jruby?; false; end
|
60
|
+
|
61
|
+
# True if the ruby is based on the Iron Ruby implementation.
|
62
|
+
# @api public
|
63
|
+
# @see OS#iron_ruby?
|
64
|
+
# @return [Boolean]
|
65
|
+
def iron_ruby?; false; end
|
66
|
+
|
67
|
+
# True if ruby is running with cygwin.
|
68
|
+
# @api public
|
69
|
+
# @see OS#cygwin?
|
70
|
+
# @return [Boolean]
|
71
|
+
def cygwin?; false; end
|
72
|
+
|
73
|
+
# The number of bits the processor can handle.
|
74
|
+
# @api public
|
75
|
+
# @see OS#bits
|
76
|
+
# @return [Numeric]
|
77
|
+
def bits; 32; end
|
78
|
+
|
79
|
+
# Where /dev/null is located on the computer (/dev/null for
|
80
|
+
# anything but Windows, NUL for Windows).
|
81
|
+
# @api public
|
82
|
+
# @see OS#dev_null
|
83
|
+
# @return [String]
|
84
|
+
def dev_null; "/dev/null"; end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/lib/nova/star.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'nova/common'
|
2
|
+
require 'nova/remote/fake'
|
3
|
+
|
4
|
+
module Nova
|
5
|
+
|
6
|
+
# This binds together all of our default includes.
|
7
|
+
class Star
|
8
|
+
|
9
|
+
include Common::EventHandler
|
10
|
+
include Common::Metadata
|
11
|
+
include Common::StarManagement
|
12
|
+
include Common::Features
|
13
|
+
|
14
|
+
star_type :star
|
15
|
+
|
16
|
+
# @!parse include Common::EventHandler::InstanceMethods
|
17
|
+
# @!parse extend Common::EventHandler::ClassMethods
|
18
|
+
# @!parse include Common::Metadata::InstanceMethods
|
19
|
+
# @!parse extend Common::Metadata::ClassMethods
|
20
|
+
# @!parse include Common::StarManagement::InstanceMethods
|
21
|
+
# @!parse extend Common::StarManagement::ClassMethods
|
22
|
+
# @!parse include Common::Features::InstanceMethods
|
23
|
+
# @!parse extend Common::Features::ClassMethods
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Nova
|
2
|
+
|
3
|
+
# The networking module of Nova. It's meant to be fast,
|
4
|
+
# secure, and cross-platform compatible.
|
5
|
+
module Starbound
|
6
|
+
|
7
|
+
autoload :Protocol, "nova/starbound/protocol"
|
8
|
+
autoload :Encryptor, "nova/starbound/encryptor"
|
9
|
+
autoload :Encryptors, "nova/starbound/encryptors"
|
10
|
+
autoload :Client, "nova/starbound/client"
|
11
|
+
autoload :Server, "nova/starbound/server"
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'socket'
|
2
|
+
|
3
|
+
module Nova
|
4
|
+
module Starbound
|
5
|
+
|
6
|
+
# A client for Nova.
|
7
|
+
class Client
|
8
|
+
|
9
|
+
# The options that were passed to the client on initialization.
|
10
|
+
#
|
11
|
+
# @return [Hash]
|
12
|
+
attr_reader :options
|
13
|
+
|
14
|
+
# The underlying protocol that powers this client.
|
15
|
+
#
|
16
|
+
# @return [Protocol]
|
17
|
+
attr_reader :protocol
|
18
|
+
|
19
|
+
# The default options when dealing with this class.
|
20
|
+
DEFAULT_OPTIONS = {
|
21
|
+
:type => :tcp,
|
22
|
+
:host => "127.0.0.1",
|
23
|
+
:port => 2010
|
24
|
+
}
|
25
|
+
|
26
|
+
# Initialize with the given options.
|
27
|
+
#
|
28
|
+
# @param options [Hash]
|
29
|
+
def initialize(options = {})
|
30
|
+
@options = DEFAULT_OPTIONS.merge(options)
|
31
|
+
@protocol_options = (@options.delete(:protocol) || {}).dup
|
32
|
+
@protocol = Protocol.new @protocol_options.merge(:type => :client)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Do the handshake with the server.
|
36
|
+
#
|
37
|
+
# @return [void]
|
38
|
+
def handshake
|
39
|
+
@protocol.socket = socket
|
40
|
+
@protocol.handshake
|
41
|
+
end
|
42
|
+
|
43
|
+
# Create the socket.
|
44
|
+
#
|
45
|
+
# @return [Object]
|
46
|
+
def socket
|
47
|
+
@_socket ||= case options[:type]
|
48
|
+
when :tcp
|
49
|
+
TCPSocket.new(options[:host], options[:port])
|
50
|
+
when :unix
|
51
|
+
UNIXSocket.new(options[:path])
|
52
|
+
when :pipe
|
53
|
+
options[:pipe]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
module Nova
|
2
|
+
module Starbound
|
3
|
+
|
4
|
+
# An encryptor is used to encrypt the data in the exchange for the
|
5
|
+
# starbound protocol.
|
6
|
+
#
|
7
|
+
# @abstract
|
8
|
+
class Encryptor
|
9
|
+
|
10
|
+
# @overload encryptor_name(name)
|
11
|
+
# Sets the encryptor's name. Used for negotiation of
|
12
|
+
# encryption protocols.
|
13
|
+
#
|
14
|
+
# @param name [String] the name of the encryptor.
|
15
|
+
# @return [void]
|
16
|
+
# @overload encryptor_name
|
17
|
+
# Gets the encryptor's name.
|
18
|
+
#
|
19
|
+
# @return [String]
|
20
|
+
def self.encryptor_name(name = nil)
|
21
|
+
if name
|
22
|
+
@encryptor_name = name
|
23
|
+
else
|
24
|
+
@encryptor_name
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Registers a subclass with the Encryptor class for use with the
|
29
|
+
# protocol.
|
30
|
+
#
|
31
|
+
# @param preference [Numeric] a number that is used to sort the
|
32
|
+
# encryptors by preference.
|
33
|
+
# @return [void]
|
34
|
+
def self.register!(preference)
|
35
|
+
@preference = preference
|
36
|
+
Encryptor.encryptors.push(self)
|
37
|
+
end
|
38
|
+
|
39
|
+
class << self
|
40
|
+
|
41
|
+
# The preference for this encryptor. Used to sort the
|
42
|
+
# encryptors.
|
43
|
+
#
|
44
|
+
# @return [Numeric]
|
45
|
+
attr_reader :preference
|
46
|
+
end
|
47
|
+
|
48
|
+
# The encryptors that are defined.
|
49
|
+
#
|
50
|
+
# @return [Array<Encryptor>]
|
51
|
+
def self.encryptors
|
52
|
+
@encryptors ||= []
|
53
|
+
end
|
54
|
+
|
55
|
+
# The encryptors, sorted by preference.
|
56
|
+
#
|
57
|
+
# @return [Array<Encryptor>]
|
58
|
+
def self.sorted_encryptors
|
59
|
+
encryptors.sort do |a, b|
|
60
|
+
b.preference <=> a.preference
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Whether or not this encryptor is available. Defaults to
|
65
|
+
# false.
|
66
|
+
#
|
67
|
+
# @return [Boolean]
|
68
|
+
def self.available?
|
69
|
+
false
|
70
|
+
end
|
71
|
+
|
72
|
+
# Returns whether or not this is a plaintext encryptor, or one
|
73
|
+
# equivalent. Defaults to false, so most encryptors shouldn't
|
74
|
+
# have to overwrite this.
|
75
|
+
#
|
76
|
+
# @return [Boolean]
|
77
|
+
def self.plaintext?
|
78
|
+
false
|
79
|
+
end
|
80
|
+
|
81
|
+
# The options. These are mostly use internally.
|
82
|
+
#
|
83
|
+
# @return [Hash<Symbol, Object>]
|
84
|
+
attr_reader :options
|
85
|
+
|
86
|
+
# Initialize the encryptor.
|
87
|
+
#
|
88
|
+
# @raise [NotImplementedError] if {.available?} returns false.
|
89
|
+
def initialize
|
90
|
+
@options = {}
|
91
|
+
|
92
|
+
unless self.class.available?
|
93
|
+
raise NotImplementedError,
|
94
|
+
"#{self.class.encryptor_name} is not avialable!"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# @!method encrypt(packet)
|
99
|
+
# Encrypts the given packet with the encryptor.
|
100
|
+
#
|
101
|
+
# @param packet [Packet] the packet to encrypt.
|
102
|
+
# @return [Packet] the encrypted packet.
|
103
|
+
# @!method decrypt(packet)
|
104
|
+
# Decrypts the given packet with the encryptor.
|
105
|
+
#
|
106
|
+
# @param packet [Packet] the packet to decrypt.
|
107
|
+
# @return [Packet] the decrypted packet.
|
108
|
+
# @!method private_key!
|
109
|
+
# Generates the private key for this encryptor.
|
110
|
+
#
|
111
|
+
# @return [void]
|
112
|
+
# @!method public_key
|
113
|
+
# Returns the public key to be sent to the other remote.
|
114
|
+
#
|
115
|
+
# @return [String]
|
116
|
+
# @!method other_public_key=(pub_key)
|
117
|
+
# Sets the public key of the other remote.
|
118
|
+
#
|
119
|
+
# @param pub_key [String] the public key of the remote.
|
120
|
+
# @return [void]
|
121
|
+
[:encrypt, :decrypt, :private_key!, :public_key,
|
122
|
+
:other_public_key=].each do |m|
|
123
|
+
|
124
|
+
define_method(m) do |*args|
|
125
|
+
raise NotImplementedError,
|
126
|
+
"tried to call #{m} on #{self.class.encryptor_name}"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
require 'nova/starbound/encryptors'
|