lumia-server 1.0.2.alpha → 1.0.3.alpha

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22162e5f148845c889253b7afb640b59c36d4de2163d6a4fc5f05392499ba690
4
- data.tar.gz: db89e490d7991c37dd09f8c2b72f7cb712170dbcba7764f9438a041fcf6b2577
3
+ metadata.gz: ccd868250272bbd6a41a48ebe03cc60d5dcb72c8a4a7235cb4c1429073d2a91a
4
+ data.tar.gz: 68f8c1aa6543a003b9f8d3c842b34dcc2a24d77dcaf36a27888b445949009060
5
5
  SHA512:
6
- metadata.gz: 9759df4c2f5bea86157efa48a821370b6ee953c647a3e7b5f7640cbc4f3a003065b41001d378b58bf00a697689c4996d6f0deb87b5df72c0de7f59e1284e25cb
7
- data.tar.gz: c0552c83ffdfe398034ee9823446663e67f45e35a04dd43f6a572e8dd74fb55db75bf90fe2c6b57deac5229c556a2e67d3155675c02416ac80ef96b4e70caa1f
6
+ metadata.gz: 494623bde5973e41308cef2dfb540dc796b0d2de9bd9b3eb60f35559fd29dab9e439d8c178b0a3c0c7090351f550436b9f8cadfad6534a329161c9062e88e4da
7
+ data.tar.gz: f855610c3c48e1a5d8ce1f7a5996800d7fb2eafd97ae5a7b58611829f93d35b7438be8b80592f67cefa46f4d61d6912c70425f3ea2add9065d40ec87f26f2e27
@@ -1,9 +1,13 @@
1
+ require 'lumia-server/version'
2
+ require 'lumia-server/command/command'
3
+
1
4
  module LumiaServer
2
5
  module CLI
3
6
 
4
7
  autoload :Exec, 'lumia-server/command/exec'
5
8
  autoload :Start, 'lumia-server/command/start'
6
9
  autoload :Build, 'lumia-server/command/build'
10
+ autoload :Clean, 'lumia-server/command/clean'
7
11
 
8
12
  extend self
9
13
 
@@ -16,7 +20,7 @@ module LumiaServer
16
20
  def command(arg)
17
21
  name = arg.to_s.downcase
18
22
  unless (name = constants.detect { |c| c.to_s.downcase == name })
19
- $stderr.puts "Unknown command provided: #{arg}"
23
+ puts "Unknown command provided: #{arg}"
20
24
  exit 1
21
25
  end
22
26
  const_get(name)
@@ -1,30 +1,42 @@
1
- require 'lumia-server/command/command'
2
- require 'lumia-server/platform'
3
1
  require 'lumia-server/server'
4
2
 
5
3
  module LumiaServer
6
4
  module CLI
7
5
  class Build < Command
8
6
 
7
+ require 'erb'
8
+
9
9
  def run
10
10
  error('server.json was not found') unless File.exist?('server.json')
11
11
  @data = JSON.parse(File.read('server.json'))
12
12
 
13
- server = Server.new(@data)
14
- server.info
15
- server.install_platform
16
- server.install_mods
17
- log('Server has been installed')
18
- end
13
+ puts 'Initialising server..'
14
+ @server = Server.new(@data)
19
15
 
20
- def install_mods(name)
21
- count = 0
22
- if @data.key?(name)
23
- @data[name].each do |mod|
24
- log('Installing ' + (mod.key?['name'] ? mod['name'] : 'Unknown') + '..')
16
+ puts 'Copying files..'
17
+ Dir.glob("src/**/*").each do |file|
18
+ unless File.directory?(file)
19
+ out = file.sub('src', 'build')
20
+ out = File.join(File.dirname(out), File.basename(out, '.erb'))
21
+ FileUtils.mkdir_p File.dirname(out)
22
+ File.open(file) do |fh|
23
+ erb = ERB.new(fh.read)
24
+ File.open(out, 'w') do |f|
25
+ f.write erb.result(binding)
26
+ end
27
+ end
25
28
  end
26
29
  end
27
- count
30
+
31
+ puts 'Installing platform..'
32
+ @server.install_platform
33
+
34
+ puts 'Installing mods..'
35
+ @server.install_mods
36
+
37
+ @server.info
38
+
39
+ puts 'Done. Server has been installed.'
28
40
  end
29
41
  end
30
42
  end
@@ -0,0 +1,10 @@
1
+ module LumiaServer
2
+ module CLI
3
+ class Clean < Command
4
+
5
+ def run
6
+ FileUtils.rm_rf('build')
7
+ end
8
+ end
9
+ end
10
+ end
@@ -4,19 +4,19 @@ module LumiaServer
4
4
  module CLI
5
5
  class Command
6
6
 
7
+ require 'fileutils'
7
8
  require 'json'
8
9
 
10
+ attr_reader :args
11
+ attr_reader :options
12
+
9
13
  def initialize(args, options)
10
14
  @args = args
11
15
  @options = options
12
16
  end
13
17
 
14
- def log(message)
15
- $stdout.puts(message)
16
- end
17
-
18
18
  def error(message)
19
- $stderr.puts message
19
+ puts "Error: #{message}"
20
20
  exit 1
21
21
  end
22
22
 
@@ -1,5 +1,3 @@
1
- require 'lumia-server/command/command'
2
-
3
1
  module LumiaServer
4
2
  module CLI
5
3
  class Exec < Command
@@ -1,5 +1,3 @@
1
- require 'lumia-server/command/command'
2
-
3
1
  module LumiaServer
4
2
  module CLI
5
3
  class Start < Command
@@ -19,12 +19,12 @@ module LumiaServer
19
19
  if provider.nil?
20
20
  if VERSIONS.key?(version)
21
21
  file = 'paperclip.jar'
22
- IO.copy_stream(open(VERSIONS[version]), file)
22
+ IO.copy_stream(open(VERSIONS[version]), File.join('build', file))
23
23
  else
24
24
  raise 'Invalid platform version provided'
25
25
  end
26
26
  else
27
- provider.install(nil)
27
+ provider.install('build')
28
28
  end
29
29
  end
30
30
  end
@@ -14,7 +14,7 @@ module LumiaServer
14
14
 
15
15
  def install
16
16
  unless provider.nil?
17
- provider.install('plugins')
17
+ provider.install('build/plugins')
18
18
  end
19
19
  end
20
20
  end
@@ -1,4 +1,5 @@
1
1
  require 'lumia-server/plugin'
2
+ require 'lumia-server/platform'
2
3
  require 'lumia-server/provider'
3
4
 
4
5
  module LumiaServer
@@ -7,39 +8,38 @@ module LumiaServer
7
8
  require 'fileutils'
8
9
 
9
10
  attr_reader :platform
10
- attr_reader :plugins
11
+ attr_reader :mods
11
12
 
12
13
  def initialize(data)
13
14
  @platform = Platform.new(data['platform'])
14
- @plugins = []
15
+ @mods = []
15
16
  if data.key?('mods')
16
17
  data['mods'].each do |mod|
17
- @plugins << Plugin.new(mod)
18
+ @mods << Plugin.new(mod)
18
19
  end
19
20
  end
20
21
  end
21
22
 
22
23
  def info
23
- $stderr.puts " "
24
- $stderr.puts "Server Information:"
25
- $stderr.puts "-------------------"
26
- $stderr.puts "Platform: #{print(platform.name, 'Unknown')} (#{print(platform.version, '0.0.0')})"
27
- $stderr.puts "Plugins (#{plugins.length}):"
28
- plugins.each do |mod|
29
- $stderr.puts " - #{print(mod.name, 'Unknown')} (#{print(mod.version, '0.0.0')})"
24
+ puts " "
25
+ puts "Server Information:"
26
+ puts "-------------------"
27
+ puts "Platform: #{print(platform.name, 'Unknown')} (#{print(platform.version, '0.0.0')})"
28
+ puts "Plugins (#{mods.length}):"
29
+ mods.each do |mod|
30
+ puts " - #{print(mod.name, 'Unknown')} (#{print(mod.version, '0.0.0')})"
30
31
  end
31
- $stderr.puts " "
32
+ puts " "
32
33
  end
33
34
 
34
35
  def install_platform
35
- $stdout.puts "Installing platform.."
36
- FileUtils.mkdir_p 'plugins'
36
+ FileUtils.mkdir_p 'build/plugins'
37
37
  platform.install
38
38
  end
39
39
 
40
40
  def install_mods
41
- plugins.each do |mod|
42
- $stdout.puts "Installing #{mod.name}.."
41
+ mods.each do |mod|
42
+ puts "Installing #{mod.name}.."
43
43
  mod.install
44
44
  end
45
45
  end
@@ -1,3 +1,3 @@
1
1
  module LumiaServer
2
- VERSION = "1.0.2.alpha".freeze
2
+ VERSION = "1.0.3.alpha".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumia-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2.alpha
4
+ version: 1.0.3.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conreptio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-29 00:00:00.000000000 Z
11
+ date: 2017-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -49,6 +49,7 @@ files:
49
49
  - lib/lumia-server.rb
50
50
  - lib/lumia-server/cli.rb
51
51
  - lib/lumia-server/command/build.rb
52
+ - lib/lumia-server/command/clean.rb
52
53
  - lib/lumia-server/command/command.rb
53
54
  - lib/lumia-server/command/exec.rb
54
55
  - lib/lumia-server/command/start.rb