class Cor::Executor

Public Class Methods

analyze_argument(args) click to toggle source
# File lib/cor.rb, line 28
def self.analyze_argument(args)
  command = args.shift.to_s

  result = {
      :command => command.gsub(':', '_').to_sym,
      :args => args
  }

  result
end
call_command(args) click to toggle source
# File lib/cor.rb, line 13
def self.call_command(args)
  command = self.analyze_argument(args)

  if command[:command].to_s == ''
    command[:command] = :help
  end

  if self.methods(false).include?(command[:command])
    self.send(command[:command], command[:args])
  else
    puts "undefined command #{args[0]}"
    puts "ARGS: #{args.join(', ')}"
  end
end
help(args) click to toggle source
# File lib/cor.rb, line 92
    def self.help(args)
      puts <<-EOS
Cor gem provides convenient commands for Code on Rmake.

  Usage:
    cor help
    cor version
    cor command [arguments...]

  Commands:
    cor version
    cor project:create my_game_directory

  Information:
    https://github.com/akasata/cor-gem

  About Code on Rmake:
    https://core.rmake.jp/

EOS

    end
init(args) click to toggle source
# File lib/cor.rb, line 39
def self.init(args)
  FileUtils.mkdir_p(%w(./bin ./projects ./materials ./packages))
  unless File.exists?('./rmake.yml')
    source_root = File.expand_path('..', File.dirname(__FILE__))
    FileUtils.cp("#{source_root}/template_rmake.yml", './rmake.yml')
  end
end
install(args) click to toggle source
# File lib/cor.rb, line 84
def self.install(args)

end
project_checkout(args) click to toggle source
# File lib/cor.rb, line 72
def self.project_checkout(args)

end
project_create(args) click to toggle source
# File lib/cor.rb, line 47
def self.project_create(args)
  project_type = args[0]
  project_name = args[1].to_s

  unless Cor::Project_Types.include? project_type
    puts "Wrong Project Type #{project_type}"
    return
  end

  if project_name =~  /\w+/
    project_dir = "./projects/#{project_name}"
    if !File.exists?(project_dir)
      FileUtils.mkdir_p(%W(#{project_dir} #{project_dir}/materials #{project_dir}/data #{project_dir}/src))
    else
      puts "#{project_name} Project is already exists. "
    end
  else
    puts "Wrong Project Name #{project_name}. You can use [a-zA-Z_]."
  end
end
project_packaging(args) click to toggle source
# File lib/cor.rb, line 68
def self.project_packaging(args)

end
project_release(args) click to toggle source
# File lib/cor.rb, line 80
def self.project_release(args)

end
project_upload(args) click to toggle source
# File lib/cor.rb, line 76
def self.project_upload(args)

end
update(args) click to toggle source
# File lib/cor.rb, line 88
def self.update(args)

end
version(args) click to toggle source
# File lib/cor.rb, line 9
def self.version(args)
  puts "Code on Rmake gem Version #{Cor::VERSION}"
end