Sha256: 8eecadd02bfd6e872976c24ffb61e93193e672e121cb64106fe28cfcdf1df692

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

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
      Description.print(shell)
      super
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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