Sha256: 30f67cf568c2a926112a675e8f5ff84d219a015d11592a3c38b9d8b48f89d01c

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require "cocaine"

module EmberCli
  class Command
    def initialize(paths:, options: {})
      @paths = paths
      @options = options
    end

    def test
      line = Cocaine::CommandLine.new(paths.ember, "test --environment test")

      line.command
    end

    def build(watch: false)
      line = Cocaine::CommandLine.new(paths.ember, [
        "build",
        ("--watch" if watch),
        ("--watcher :watcher" if process_watcher),
        "--environment :environment",
        "--output-path :output_path",
        "2> :error_file",
      ].compact.join(" "))

      line.command(
        environment: build_environment,
        output_path: paths.dist,
        watcher: process_watcher,
        error_file: paths.build_error_file,
      )
    end

    private

    attr_reader :options, :paths

    def process_watcher
      options.fetch(:watcher) { EmberCli.configuration.watcher }
    end

    def build_environment
      if EmberCli.env == "production"
        "production"
      else
        "development"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ember-cli-rails-0.5.8 lib/ember_cli/command.rb
ember-cli-rails-0.5.7 lib/ember_cli/command.rb
ember-cli-rails-0.5.6 lib/ember_cli/command.rb