Sha256: 46db4c310c793c4d16fb162e7aae50a81f0412d0bc2cdde0c2f0f60af541b141

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require File.expand_path("../command", __FILE__)

module Decko
  module Commands
    class CucumberCommand < Command
      def initialize args
        require "decko"
        require "./config/environment"
        @decko_args, @cucumber_args = split_args args
        @opts = {}
        Parser.new(@opts).parse!(@decko_args)
      end

      def command
        @cmd ||=
          "#{env_args} #{@opts[:executer] || 'bundle exec'} " \
          "cucumber #{require_args} #{feature_args}"
      end

      private

      def env_args
        @opts[:env].join " "
      end

      def feature_args
        if @cucumber_args.empty?
          feature_paths.join(" ")
        else
          @cucumber_args.shelljoin
        end
      end

      def require_args
        "-r #{Decko.gem_root}/features " +
          feature_paths.map { |path| "-r #{path}" }.join(" ")
      end

      def feature_paths
        Cardio::Mod.dirs.map do |p|
          Dir.glob "#{p}/features"
        end.flatten
      end
    end
  end
end

require File.expand_path("../cucumber_command/parser", __FILE__)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decko-0.11.4 lib/decko/commands/cucumber_command.rb
decko-0.11.3 lib/decko/commands/cucumber_command.rb
decko-0.11.2 lib/decko/commands/cucumber_command.rb
decko-0.11.1 lib/decko/commands/cucumber_command.rb
decko-0.11.0 lib/decko/commands/cucumber_command.rb