Sha256: d646b90b4fe653d714e656f131c2714bc89bfd552b0620999494e4426c6fb5d6

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require 'mruby/cli/commands'

module MRuby::CLI
  class App < Thor
    class_option(:build_config, {
      desc: 'The build configuration file to load.',
      default: './build_config.rb',
      aliases: '-c',
      group: 'rake',
      type: :string
    })

    class_option(:build_dir, {
      desc: 'The directory where things will be built',
      default: './build',
      aliases: '-o',
      group: 'rake',
      type: :string
    })

    desc "minirake [ARGS...]", "Execute MRuby's minirake"
    def minirake(*args)
      Rake[args: args]
    end

    desc "rake [COMMAND]", "Runs a rake command"
    def rake(command=nil)
      Rake[{
        args: [
          '--rakefile',
          Source.path.join('Rakefile').to_s
        ] + Array(command),
        env: {
          'MRUBY_CONFIG' => options[:build_config],
          'MRUBY_BUILD_DIR' => options[:build_dir]
        }
      }]
    end

    desc "build", "Builds all MRuby build targets from"
    def build
      rake('all')
    end

    desc "test", "Build and execute tests"
    def test
      rake('test')
    end

    def help(*args)
      Description.print(shell)
      super
    end

    desc 'generate TEMPLATE NAME', 'Generate a new project'
    subcommand 'generate', Commands::Generate
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mruby-cli-0.2.0 lib/mruby/cli/app.rb