Sha256: fc70b2317acc748095c1f07fc495ec7995bb1be0cd1d484e9190cd696260fe72

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

require 'thor'
require 'cukestart/generator/structure'
require 'cukestart/generator/feature'

module Cukestart
  class Cli < Thor

    desc 'project <project_name>', 'Create your project'
    method_option :front, :desc => 'If it will be a front test project', :type => :boolean, :aliases => 'f'
    method_option :page_object, :desc => 'Will use page_object', :type => :boolean, :aliases => 'p'
    map %w(p) => :project
    def project(project_name)
      Cukestart::Generator::Structure.start([project_name, options[:front], options[:page_object]])
    end

    desc 'feature <feature_name>', 'Create a feature file'
    map %w(f) => :feature
    def feature(feature_name)
      Cukestart::Generator::Feature.start([feature_name])
    end

    desc 'version', 'Show Cukestart gem version'
    map %w(-v --version) => :version
    def version
      puts "Cukestart #{File.read(File.expand_path('../version', __FILE__))}"
    end

    desc 'list', 'List all features and scenarios in project or folder'
    method_option :feature, :desc => 'List all feature and its scenarios if asked', :type => :boolean
    method_option :scenario, :desc => 'List all scenarios', :type => :boolean
    def list
      features = `ls -d -1 **/* \| grep '\.feature'`
      features = features.split("\n")
      features.each do |feature|
        puts "--- #{feature}  ---"
        feature_name = `cat #{feature} | grep 'Feature:'`
        puts feature_name if options[:feature]
        scenarios = `cat #{feature} | grep 'Scenario:'`
        scenarios = scenarios.split("\n")
        scenarios.each do |scenario|
          puts scenario if options[:scenario]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cukestart-0.3.0 lib/cukestart/cli.rb