Sha256: b952e943438e5f5c523542be14e535a42a50c273f1da18fd1c9b659d031765b3

Contents?: true

Size: 701 Bytes

Versions: 2

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

require 'thor/rake_compat'

require 'mwc/utils/command'
require 'mwc/tasks'
require 'mwc'

module Mwc
  module Commands
    # Compile mruby to wasm
    class Compile < Thor::Group
      include Thor::Actions
      include Utils::Command

      name 'compile'
      description 'compile source code to wasm'
      display_on { Mwc.config.exist? }
      add_option :format, default: 'html', enum: %w[html js wasm]

      def compile
        Mwc.use(parent_options['env']) do
          # TODO: Allow change output directory
          empty_directory('dist')

          Tasks.new
          Rake::Task[parent_options['format']].invoke
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mwc-0.4.0 lib/mwc/commands/compile.rb
mwc-0.3.0 lib/mwc/commands/compile.rb