Sha256: c2f62939861775c0df9c375193f852444dcd78df38f2be3fd861c2a181428644
Contents?: true
Size: 1.44 KB
Versions: 16
Compression:
Stored size: 1.44 KB
Contents
require 'thor' module Gamefic module Sdk class Shell < Thor map %w[--version -v] => :version map [:create, :new] => :init desc "--version, -v", "Print the version" def version puts "gamefic-sdk #{Gamefic::Sdk::VERSION}" puts "gamefic #{Gamefic::VERSION}" end desc 'init DIRECTORY_NAME', 'Create a new project in DIRECTORY_NAME' option :gem, type: :boolean, aliases: [:g, :library, :rubygem], desc: 'Make a gem project' def init(directory_name) scaffold = options[:gem] ? 'library' : 'project' Gamefic::Sdk::Scaffold.build scaffold, directory_name puts "Gamefic project initialized at #{File.realpath(directory_name)}" end desc 'diagram TYPE', 'Get diagram data' long_desc %( SDK "diagrams" are datasets that can be used in analysis tools and graphical data representations. The dataset is provided in JSON format. The diagram types are entities, rooms, actions, verbs, syntaxes, and commands. ) option :directory, type: :string, aliases: :d, desc: 'The project directory', default: '.' def diagram type main = Pathname.new(options[:directory]).join('main.rb').realpath.to_s require_relative main plot = Gamefic::Plot.new diagram = Gamefic::Sdk::Diagram.new(plot) puts diagram.get(type).to_json end end end end
Version data entries
16 entries across 16 versions & 1 rubygems