Sha256: 12923c6818929b12feae0d6f4de8d28f6844c056626fa2ad68bdfe1f63bb82a1

Contents?: true

Size: 1.13 KB

Versions: 11

Compression:

Stored size: 1.13 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)
      ember_build(watch: watch)
    end

    private

    attr_reader :options, :paths

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

    def silent?
      options.fetch(:silent) { false }
    end

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

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

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ember-cli-rails-0.10.0 lib/ember_cli/command.rb
ember-cli-rails-0.9.0 lib/ember_cli/command.rb
ember-cli-rails-0.8.7 lib/ember_cli/command.rb
ember-cli-rails-0.8.6 lib/ember_cli/command.rb
ember-cli-rails-0.8.5 lib/ember_cli/command.rb
ember-cli-rails-0.8.4 lib/ember_cli/command.rb
ember-cli-rails-0.8.3 lib/ember_cli/command.rb
ember-cli-rails-0.8.2 lib/ember_cli/command.rb
ember-cli-rails-0.8.1 lib/ember_cli/command.rb
ember-cli-rails-0.8.0 lib/ember_cli/command.rb
ember-cli-rails-0.7.4 lib/ember_cli/command.rb