Class: Cucumber::Cli::LanguageHelpFormatter

Inherits:
Formatter::Pretty show all
Defined in:
lib/cucumber/cli/language_help_formatter.rb

Constant Summary collapse

INCOMPLETE =
%{
The Cucumber grammar has evolved since this translation was written.
Please help us complete the translation by translating the missing words in

#{Cucumber::LANGUAGE_FILE}

Then contribute back to the Cucumber project. Details here:
http://wiki.github.com/aslakhellesoy/cucumber/spoken-languages
}

Constants included from Formatter::Console

Formatter::Console::FORMATS

Constants included from Formatter::ANSIColor

Formatter::ANSIColor::ALIASES

Instance Attribute Summary

Attributes inherited from Formatter::Pretty

#indent, #step_mother

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Formatter::Pretty

#after_background, #after_feature_element, #after_features, #after_multiline_arg, #after_outline_table, #after_table_cell, #after_table_row, #after_tags, #background_name, #before_background, #before_examples_array, #before_feature, #before_feature_element, #before_multiline_arg, #before_outline_table, #before_step, #before_step_result, #before_table_row, #comment_line, #examples_name, #exception, #feature_name, #initialize, #py_string, #scenario_name, #step_name, #table_cell_value, #tag_name

Methods included from Formatter::Io

#ensure_dir, #ensure_file, #ensure_io

Methods included from Formatter::Console

#announce, #embed, #empty_announcements, #format_step, #format_string, #print_announcement, #print_announcements, #print_counts, #print_elements, #print_exception, #print_passing_wip, #print_snippets, #print_stats, #print_steps, #print_table_row_announcements, #print_tag_limit_warnings

Methods included from Formatter::ANSIColor

#cukes, define_grey, define_real_grey, #green_cukes, #grey, #red_cukes, #yellow_cukes

Methods included from Formatter::Summary

#scenario_summary, #step_summary

Methods included from Formatter::Duration

#format_duration

Constructor Details

This class inherits a constructor from Cucumber::Formatter::Pretty

Class Method Details

.list_keywords(io, lang) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/cucumber/cli/language_help_formatter.rb', line 31

def list_keywords(io, lang)
  language = Parser::NaturalLanguage.get(nil, lang)
  raw = Parser::NaturalLanguage::KEYWORD_KEYS.map do |key|
    [key, language.keywords(key).join(" / ")]
  end
  
  print_table io, raw, :incomplete => language.incomplete?
end

.list_languages(io) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cucumber/cli/language_help_formatter.rb', line 19

def list_languages(io)
  raw = Cucumber::LANGUAGES.keys.sort.map do |lang|
    [
      lang, 
      Cucumber::LANGUAGES[lang]['name'], 
      Cucumber::LANGUAGES[lang]['native']
    ]
  end

  print_table io, raw, :check_lang => true
end

Instance Method Details

#before_visit_multiline_arg(table) ⇒ Object



48
49
50
51
52
# File 'lib/cucumber/cli/language_help_formatter.rb', line 48

def before_visit_multiline_arg(table)
  if @options[:incomplete]
    @io.puts(format_string(INCOMPLETE, :failed))
  end
end

#before_visit_table_cell_value(value, status) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/cucumber/cli/language_help_formatter.rb', line 58

def before_visit_table_cell_value(value, status)
  if @col == 1
    if(@options[:check_lang])
      @incomplete = Parser::NaturalLanguage.get(nil, value).incomplete?
    end
    status = :comment 
  elsif @incomplete
    status = :undefined
  end
  
  @col += 1
end

#before_visit_table_row(table_row) ⇒ Object



54
55
56
# File 'lib/cucumber/cli/language_help_formatter.rb', line 54

def before_visit_table_row(table_row)
  @col = 1
end