Sha256: 3c90a16fbaf5e6cec4506ccf95fac627f2ca44f1cae00bcafe6497e16976a44f

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

# load the application so we can look in mods
require APP_PATH
require "cardio/commands/command"
require "cardio/mod/dirs"

module Decko
  class Commands
    class CucumberCommand < Cardio::Commands::Command
      require "decko/commands/cucumber_command/parser"

      def initialize args
        @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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decko-0.14.2 lib/decko/commands/cucumber_command.rb
decko-0.14.1 lib/decko/commands/cucumber_command.rb
decko-0.14.0 lib/decko/commands/cucumber_command.rb
decko-0.13.4 lib/decko/commands/cucumber_command.rb
decko-0.13.3 lib/decko/commands/cucumber_command.rb
decko-0.13.2 lib/decko/commands/cucumber_command.rb
decko-0.13.1 lib/decko/commands/cucumber_command.rb
decko-0.13.0 lib/decko/commands/cucumber_command.rb
decko-0.12.0 lib/decko/commands/cucumber_command.rb