Class: AuthorEngine::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/author_engine/cli.rb

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/author_engine/cli.rb', line 3

def initialize
  if ARGV[0] && ARGV[0] == "export"
    if ARGV[1] && ARGV[1].end_with?(".authorengine")
      require "author_engine/game/opal/exporter"

      AuthorEngine::OpalExporter.new(project_file: ARGV[1])
    else
      puts "author_engine export project [exported_name]"
    end

  elsif ARGV[0] && ARGV[0] == "inflate"
    if ARGV[1] && ARGV[1].end_with?(".authorengine")
      if File.exists?(ARGV[1])
        savefile = SaveFile.new(ARGV[1])
        savefile.inflate!
        puts "Inflated #{ARGV[1]}"
      end
    end

  elsif ARGV[0] && ARGV[0].end_with?(".authorengine")
    # The Loader Container handles loading projects
    AuthorEngine::Window.new.show
  else
    AuthorEngine::Window.new.show
  end
end