vikingio 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +22 -22
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/Output/VikingIOInstaller.exe +0 -0
- data/README.md +13 -13
- data/Rakefile +2 -2
- data/bin/vikingio +10 -10
- data/dlls/VikingIO.Network.Client.dll +0 -0
- data/dlls/VikingIO.Network.dll +0 -0
- data/lib/vikingio/cli.rb +53 -49
- data/lib/vikingio/cli/client.rb +157 -157
- data/lib/vikingio/cli/commands.rb +539 -512
- data/lib/vikingio/cli/helpers.rb +115 -115
- data/lib/vikingio/cli/version.rb +5 -5
- data/lib/vikingio/cli/zip.vbs +16 -0
- data/templates/MessageTemplate.cs +25 -25
- data/templates/NetworkManager.cs +33 -33
- data/templates/Program.cs +21 -21
- data/templates/ServerNodeTemplate.cs +39 -39
- data/templates/VikingIO.Config.cs +8 -8
- data/vikingio-cli.gemspec +26 -23
- data/vikingio.iss +13 -0
- metadata +48 -3
data/lib/vikingio/cli/helpers.rb
CHANGED
@@ -1,115 +1,115 @@
|
|
1
|
-
module VikingIO
|
2
|
-
module CLI
|
3
|
-
NETRC_PATH = File.join(Dir.home, ".netrc")
|
4
|
-
NETRC_ENTRY_RX = /machine\s+vikingio.com\s+login\s+(.*)\s+password\s+(.*)[\s+]?/i
|
5
|
-
APP_DATA_FILENAME = ".vikingio"
|
6
|
-
NODE_DATA_FILENAME = "Nodefile"
|
7
|
-
|
8
|
-
def self.node_data_path
|
9
|
-
File.join(Dir.pwd, "Assets", "VikingIO", NODE_DATA_FILENAME)
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.get_node_data
|
13
|
-
return unless File.exist?(self.node_data_path)
|
14
|
-
d = File.read(self.node_data_path)
|
15
|
-
return JSON.parse(d)
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.save_node_data(data)
|
19
|
-
File.open(self.node_data_path, 'w') do |f|
|
20
|
-
f << data.to_json
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.get_app_data
|
25
|
-
return unless File.exist?(self.app_data_path)
|
26
|
-
d = File.read(self.app_data_path)
|
27
|
-
return JSON.parse(d)
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.link_app(app)
|
31
|
-
File.open(self.app_data_path, 'w') do |f|
|
32
|
-
f << app.to_json
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.unlink_app
|
37
|
-
return unless File.exist?(self.app_data_path)
|
38
|
-
FileUtils.rm_rf(app_data_path)
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.linked?
|
42
|
-
File.exist?(self.app_data_path)
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.authenticated?
|
46
|
-
return true if VikingIO::CLI.netrc_exist? && VikingIO::CLI.in_netrc?
|
47
|
-
return false
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.app_data_path
|
51
|
-
File.join(Dir.pwd, APP_DATA_FILENAME)
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.netrc_contents
|
55
|
-
File.read(NETRC_PATH)
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.netrc_exist?()
|
59
|
-
File.exist?(NETRC_PATH)
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.in_netrc?()
|
63
|
-
netrc_contents =~ /machine\s+vikingio.com/i
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.get_netrc_key
|
67
|
-
data = NETRC_ENTRY_RX.match(netrc_contents)
|
68
|
-
|
69
|
-
email = data[1]
|
70
|
-
key = data[2]
|
71
|
-
|
72
|
-
return key
|
73
|
-
end
|
74
|
-
|
75
|
-
def self.update_netrc_key(new_password)
|
76
|
-
netrc = netrc_contents
|
77
|
-
|
78
|
-
data = NETRC_ENTRY_RX.match(netrc)
|
79
|
-
|
80
|
-
existing_email = data[1]
|
81
|
-
existing_password = data[2]
|
82
|
-
|
83
|
-
netrc.gsub!(existing_password, new_password)
|
84
|
-
|
85
|
-
save_netrc(netrc)
|
86
|
-
end
|
87
|
-
|
88
|
-
def self.add_netrc_key(email, key)
|
89
|
-
netrc = netrc_contents
|
90
|
-
|
91
|
-
netrc += "machine vikingio.com\n login " + email + "\n password " + key + "\n"
|
92
|
-
|
93
|
-
save_netrc(netrc)
|
94
|
-
end
|
95
|
-
|
96
|
-
def self.create_netrc(email, key)
|
97
|
-
netrc = "machine vikingio.com\n login " + email + "\n password " + key + "\n"
|
98
|
-
save_netrc(netrc)
|
99
|
-
end
|
100
|
-
|
101
|
-
def self.remove_netrc_key
|
102
|
-
netrc = netrc_contents
|
103
|
-
|
104
|
-
netrc.gsub!(NETRC_ENTRY_RX, "")
|
105
|
-
|
106
|
-
save_netrc(netrc)
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.save_netrc(netrc_contents)
|
110
|
-
File.open(NETRC_PATH, 'w') { |file| file.write(netrc_contents) }
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
end
|
1
|
+
module VikingIO
|
2
|
+
module CLI
|
3
|
+
NETRC_PATH = File.join(Dir.home, ".netrc")
|
4
|
+
NETRC_ENTRY_RX = /machine\s+vikingio.com\s+login\s+(.*)\s+password\s+(.*)[\s+]?/i
|
5
|
+
APP_DATA_FILENAME = ".vikingio"
|
6
|
+
NODE_DATA_FILENAME = "Nodefile"
|
7
|
+
|
8
|
+
def self.node_data_path
|
9
|
+
File.join(Dir.pwd, "Assets", "VikingIO", NODE_DATA_FILENAME)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.get_node_data
|
13
|
+
return unless File.exist?(self.node_data_path)
|
14
|
+
d = File.read(self.node_data_path)
|
15
|
+
return JSON.parse(d)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.save_node_data(data)
|
19
|
+
File.open(self.node_data_path, 'w') do |f|
|
20
|
+
f << data.to_json
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.get_app_data
|
25
|
+
return unless File.exist?(self.app_data_path)
|
26
|
+
d = File.read(self.app_data_path)
|
27
|
+
return JSON.parse(d)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.link_app(app)
|
31
|
+
File.open(self.app_data_path, 'w') do |f|
|
32
|
+
f << app.to_json
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.unlink_app
|
37
|
+
return unless File.exist?(self.app_data_path)
|
38
|
+
FileUtils.rm_rf(app_data_path)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.linked?
|
42
|
+
File.exist?(self.app_data_path)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.authenticated?
|
46
|
+
return true if VikingIO::CLI.netrc_exist? && VikingIO::CLI.in_netrc?
|
47
|
+
return false
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.app_data_path
|
51
|
+
File.join(Dir.pwd, APP_DATA_FILENAME)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.netrc_contents
|
55
|
+
File.read(NETRC_PATH)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.netrc_exist?()
|
59
|
+
File.exist?(NETRC_PATH)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.in_netrc?()
|
63
|
+
netrc_contents =~ /machine\s+vikingio.com/i
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.get_netrc_key
|
67
|
+
data = NETRC_ENTRY_RX.match(netrc_contents)
|
68
|
+
|
69
|
+
email = data[1]
|
70
|
+
key = data[2]
|
71
|
+
|
72
|
+
return key
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.update_netrc_key(new_password)
|
76
|
+
netrc = netrc_contents
|
77
|
+
|
78
|
+
data = NETRC_ENTRY_RX.match(netrc)
|
79
|
+
|
80
|
+
existing_email = data[1]
|
81
|
+
existing_password = data[2]
|
82
|
+
|
83
|
+
netrc.gsub!(existing_password, new_password)
|
84
|
+
|
85
|
+
save_netrc(netrc)
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.add_netrc_key(email, key)
|
89
|
+
netrc = netrc_contents
|
90
|
+
|
91
|
+
netrc += "machine vikingio.com\n login " + email + "\n password " + key + "\n"
|
92
|
+
|
93
|
+
save_netrc(netrc)
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.create_netrc(email, key)
|
97
|
+
netrc = "machine vikingio.com\n login " + email + "\n password " + key + "\n"
|
98
|
+
save_netrc(netrc)
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.remove_netrc_key
|
102
|
+
netrc = netrc_contents
|
103
|
+
|
104
|
+
netrc.gsub!(NETRC_ENTRY_RX, "")
|
105
|
+
|
106
|
+
save_netrc(netrc)
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.save_netrc(netrc_contents)
|
110
|
+
File.open(NETRC_PATH, 'w') { |file| file.write(netrc_contents) }
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
data/lib/vikingio/cli/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
module VikingIO
|
2
|
-
module CLI
|
3
|
-
VERSION = "0.0.
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module VikingIO
|
2
|
+
module CLI
|
3
|
+
VERSION = "0.0.8"
|
4
|
+
end
|
5
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
'Get command-line arguments.
|
2
|
+
Set objArgs = WScript.Arguments
|
3
|
+
InputFolder = objArgs(0)
|
4
|
+
ZipFile = objArgs(1)
|
5
|
+
|
6
|
+
'Create empty ZIP file.
|
7
|
+
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
|
8
|
+
|
9
|
+
Set objShell = CreateObject("Shell.Application")
|
10
|
+
|
11
|
+
Set source = objShell.NameSpace(InputFolder).Items
|
12
|
+
|
13
|
+
objShell.NameSpace(ZipFile).CopyHere(source)
|
14
|
+
|
15
|
+
'Required!
|
16
|
+
wScript.Sleep 2000
|
@@ -1,25 +1,25 @@
|
|
1
|
-
using System.Collections;
|
2
|
-
|
3
|
-
using VikingIO.Network;
|
4
|
-
using VikingIO.Network.Messaging;
|
5
|
-
|
6
|
-
public class [MESSAGE_NAME] : BaseNetworkMessage
|
7
|
-
{
|
8
|
-
|
9
|
-
public [MESSAGE_NAME]()
|
10
|
-
{
|
11
|
-
|
12
|
-
}
|
13
|
-
|
14
|
-
public override void Deserialize(INetIncomingMessage serializedMessage)
|
15
|
-
{
|
16
|
-
GetMessageInformation(serializedMessage);
|
17
|
-
// Deserialize your message data here
|
18
|
-
}
|
19
|
-
|
20
|
-
public override void Serialize(INetOutgoingMessage message)
|
21
|
-
{
|
22
|
-
// Serialize your message data here
|
23
|
-
}
|
24
|
-
|
25
|
-
}
|
1
|
+
using System.Collections;
|
2
|
+
|
3
|
+
using VikingIO.Network;
|
4
|
+
using VikingIO.Network.Messaging;
|
5
|
+
|
6
|
+
public class [MESSAGE_NAME] : BaseNetworkMessage
|
7
|
+
{
|
8
|
+
|
9
|
+
public [MESSAGE_NAME]()
|
10
|
+
{
|
11
|
+
|
12
|
+
}
|
13
|
+
|
14
|
+
public override void Deserialize(INetIncomingMessage serializedMessage)
|
15
|
+
{
|
16
|
+
GetMessageInformation(serializedMessage);
|
17
|
+
// Deserialize your message data here
|
18
|
+
}
|
19
|
+
|
20
|
+
public override void Serialize(INetOutgoingMessage message)
|
21
|
+
{
|
22
|
+
// Serialize your message data here
|
23
|
+
}
|
24
|
+
|
25
|
+
}
|
data/templates/NetworkManager.cs
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
using UnityEngine;
|
2
|
-
using System;
|
3
|
-
using System.Collections;
|
4
|
-
|
5
|
-
using VikingIO.Network;
|
6
|
-
using VikingIO.Network.Messaging;
|
7
|
-
|
8
|
-
public class NetworkManager : VikingSingleton<NetworkManager>
|
9
|
-
{
|
10
|
-
protected NetworkManager()
|
11
|
-
{
|
12
|
-
}
|
13
|
-
|
14
|
-
private VikingClient m_NetClient;
|
15
|
-
|
16
|
-
public VikingClient Client
|
17
|
-
{
|
18
|
-
get { return m_NetClient; }
|
19
|
-
}
|
20
|
-
|
21
|
-
void Awake()
|
22
|
-
{
|
23
|
-
m_NetClient = new VikingClient(VikingIOConfig.APP_NAME, VikingIOConfig.APP_ID);
|
24
|
-
|
25
|
-
Instance.Client.Start(true);
|
26
|
-
|
27
|
-
Debug.LogWarning("VikingIO NetworkManager started");
|
28
|
-
}
|
29
|
-
|
30
|
-
void Update()
|
31
|
-
{
|
32
|
-
Instance.Client.Update();
|
33
|
-
}
|
1
|
+
using UnityEngine;
|
2
|
+
using System;
|
3
|
+
using System.Collections;
|
4
|
+
|
5
|
+
using VikingIO.Network;
|
6
|
+
using VikingIO.Network.Messaging;
|
7
|
+
|
8
|
+
public class NetworkManager : VikingSingleton<NetworkManager>
|
9
|
+
{
|
10
|
+
protected NetworkManager()
|
11
|
+
{
|
12
|
+
}
|
13
|
+
|
14
|
+
private VikingClient m_NetClient;
|
15
|
+
|
16
|
+
public VikingClient Client
|
17
|
+
{
|
18
|
+
get { return m_NetClient; }
|
19
|
+
}
|
20
|
+
|
21
|
+
void Awake()
|
22
|
+
{
|
23
|
+
m_NetClient = new VikingClient(VikingIOConfig.APP_NAME, VikingIOConfig.APP_ID);
|
24
|
+
|
25
|
+
Instance.Client.Start(true);
|
26
|
+
|
27
|
+
Debug.LogWarning("VikingIO NetworkManager started");
|
28
|
+
}
|
29
|
+
|
30
|
+
void Update()
|
31
|
+
{
|
32
|
+
Instance.Client.Update();
|
33
|
+
}
|
34
34
|
}
|
data/templates/Program.cs
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
using System;
|
2
|
-
using System.Collections.Generic;
|
3
|
-
using System.Text;
|
4
|
-
|
5
|
-
using VikingIO.Network;
|
6
|
-
|
7
|
-
namespace VikingIO.ServerNode
|
8
|
-
{
|
9
|
-
class Program
|
10
|
-
{
|
11
|
-
static void Main(string[] args)
|
12
|
-
{
|
13
|
-
if (args.Length == 0)
|
14
|
-
{
|
15
|
-
Console.WriteLine("Supply port as first argument.");
|
16
|
-
return;
|
17
|
-
}
|
18
|
-
VikingServer.Instance.SetNode(new [MODULE_NAME]());
|
19
|
-
VikingServer.Instance.Start("[APP_NAME]", int.Parse(args[0]));
|
20
|
-
}
|
21
|
-
}
|
1
|
+
using System;
|
2
|
+
using System.Collections.Generic;
|
3
|
+
using System.Text;
|
4
|
+
|
5
|
+
using VikingIO.Network;
|
6
|
+
|
7
|
+
namespace VikingIO.ServerNode
|
8
|
+
{
|
9
|
+
class Program
|
10
|
+
{
|
11
|
+
static void Main(string[] args)
|
12
|
+
{
|
13
|
+
if (args.Length == 0)
|
14
|
+
{
|
15
|
+
Console.WriteLine("Supply port as first argument.");
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
VikingServer.Instance.SetNode(new [MODULE_NAME]());
|
19
|
+
VikingServer.Instance.Start("[APP_NAME]", int.Parse(args[0]));
|
20
|
+
}
|
21
|
+
}
|
22
22
|
}
|
@@ -1,39 +1,39 @@
|
|
1
|
-
using System;
|
2
|
-
using System.Collections;
|
3
|
-
using System.Collections.Generic;
|
4
|
-
|
5
|
-
using VikingIO.Network;
|
6
|
-
using VikingIO.Network.Messaging;
|
7
|
-
|
8
|
-
public class [SERVER_NAME] : IVikingNode
|
9
|
-
{
|
10
|
-
public void Start()
|
11
|
-
{
|
12
|
-
Console.WriteLine("[[SERVER_NAME]] Start");
|
13
|
-
}
|
14
|
-
|
15
|
-
public void OnConnect(NetConnection conn)
|
16
|
-
{
|
17
|
-
Console.WriteLine(conn.RemoteEndPoint.ToString () + " connected.");
|
18
|
-
}
|
19
|
-
|
20
|
-
public void OnDisconnect(NetConnection conn)
|
21
|
-
{
|
22
|
-
Console.WriteLine(conn.RemoteEndPoint.ToString () + " disconnected.");
|
23
|
-
}
|
24
|
-
|
25
|
-
public void Stop()
|
26
|
-
{
|
27
|
-
Console.WriteLine("[[SERVER_NAME]] Stop");
|
28
|
-
}
|
29
|
-
|
30
|
-
public void Update(float dt)
|
31
|
-
{
|
32
|
-
|
33
|
-
}
|
34
|
-
|
35
|
-
public void FixedUpdate(float dt)
|
36
|
-
{
|
37
|
-
|
38
|
-
}
|
39
|
-
}
|
1
|
+
using System;
|
2
|
+
using System.Collections;
|
3
|
+
using System.Collections.Generic;
|
4
|
+
|
5
|
+
using VikingIO.Network;
|
6
|
+
using VikingIO.Network.Messaging;
|
7
|
+
|
8
|
+
public class [SERVER_NAME] : IVikingNode
|
9
|
+
{
|
10
|
+
public void Start()
|
11
|
+
{
|
12
|
+
Console.WriteLine("[[SERVER_NAME]] Start");
|
13
|
+
}
|
14
|
+
|
15
|
+
public void OnConnect(NetConnection conn)
|
16
|
+
{
|
17
|
+
Console.WriteLine(conn.RemoteEndPoint.ToString () + " connected.");
|
18
|
+
}
|
19
|
+
|
20
|
+
public void OnDisconnect(NetConnection conn)
|
21
|
+
{
|
22
|
+
Console.WriteLine(conn.RemoteEndPoint.ToString () + " disconnected.");
|
23
|
+
}
|
24
|
+
|
25
|
+
public void Stop()
|
26
|
+
{
|
27
|
+
Console.WriteLine("[[SERVER_NAME]] Stop");
|
28
|
+
}
|
29
|
+
|
30
|
+
public void Update(float dt)
|
31
|
+
{
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
public void FixedUpdate(float dt)
|
36
|
+
{
|
37
|
+
|
38
|
+
}
|
39
|
+
}
|