gherkin_language 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/Rakefile +1 -1
 - data/features/exception.feature +3 -3
 - data/features/report.feature +4 -4
 - data/gherkin_language.gemspec +3 -3
 - data/lib/gherkin_language/language_tool_process.rb +9 -5
 - data/lib/gherkin_language.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 64ac2d6528d260d768cb41f99652df3136d2ee37
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 50b629fb5eac7a1b92f304e9149b822570a94f58
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c9d4a7dd3070e35c596915ba52d869093b42fbc618b9cae5d85150384595a35f14aada491707312090cbbe4f1639427988df139a03da7646543c9de4514e8ea0
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: dec28b8ddb723c0dbfca0b2611feb7542b0715fb592b11ce9af631759cb9cd0b5ba7b04a1086544ae6169d95627febb77db498064827b9c03e850ae315268816
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/features/exception.feature
    CHANGED
    
    | 
         @@ -21,7 +21,7 @@ Feature: Exception 
     | 
|
| 
       21 
21 
     | 
    
         
             
                Given a file named "test.feature" with:
         
     | 
| 
       22 
22 
     | 
    
         
             
                  """
         
     | 
| 
       23 
23 
     | 
    
         
             
                  Feature: Test
         
     | 
| 
       24 
     | 
    
         
            -
                    Scenario:  
     | 
| 
      
 24 
     | 
    
         
            +
                    Scenario: Scenario
         
     | 
| 
       25 
25 
     | 
    
         
             
                      Given an test
         
     | 
| 
       26 
26 
     | 
    
         
             
                      When execute
         
     | 
| 
       27 
27 
     | 
    
         
             
                      Then pass
         
     | 
| 
         @@ -36,7 +36,7 @@ Feature: Exception 
     | 
|
| 
       36 
36 
     | 
    
         
             
                Given a file named "test.feature" with:
         
     | 
| 
       37 
37 
     | 
    
         
             
                  """
         
     | 
| 
       38 
38 
     | 
    
         
             
                  Feature: Test
         
     | 
| 
       39 
     | 
    
         
            -
                    Scenario:  
     | 
| 
      
 39 
     | 
    
         
            +
                    Scenario: Scenario
         
     | 
| 
       40 
40 
     | 
    
         
             
                      Given a test
         
     | 
| 
       41 
41 
     | 
    
         
             
                      When exicute
         
     | 
| 
       42 
42 
     | 
    
         
             
                      Then pass
         
     | 
| 
         @@ -46,7 +46,7 @@ Feature: Exception 
     | 
|
| 
       46 
46 
     | 
    
         
             
                  """
         
     | 
| 
       47 
47 
     | 
    
         
             
                  [misspelling] MORFOLOGIK_RULE_EN_US
         
     | 
| 
       48 
48 
     | 
    
         
             
                    Possible spelling mistake found
         
     | 
| 
       49 
     | 
    
         
            -
                    Context: Given a test when exicute then pass
         
     | 
| 
      
 49 
     | 
    
         
            +
                    Context: Test  Scenario  Given a test when exicute then pass
         
     | 
| 
       50 
50 
     | 
    
         
             
                    Replacements: execute
         
     | 
| 
       51 
51 
     | 
    
         
             
                    References: test.feature
         
     | 
| 
       52 
52 
     | 
    
         | 
    
        data/features/report.feature
    CHANGED
    
    | 
         @@ -22,7 +22,7 @@ Feature: Report 
     | 
|
| 
       22 
22 
     | 
    
         
             
                Given a file named "test.feature" with:
         
     | 
| 
       23 
23 
     | 
    
         
             
                  """
         
     | 
| 
       24 
24 
     | 
    
         
             
                  Feature: Test
         
     | 
| 
       25 
     | 
    
         
            -
                    Scenario:  
     | 
| 
      
 25 
     | 
    
         
            +
                    Scenario: Scenario
         
     | 
| 
       26 
26 
     | 
    
         
             
                      Given an test
         
     | 
| 
       27 
27 
     | 
    
         
             
                      When execute
         
     | 
| 
       28 
28 
     | 
    
         
             
                      Then pass
         
     | 
| 
         @@ -32,7 +32,7 @@ Feature: Report 
     | 
|
| 
       32 
32 
     | 
    
         
             
                  """
         
     | 
| 
       33 
33 
     | 
    
         
             
                  [misspelling] EN_A_VS_AN
         
     | 
| 
       34 
34 
     | 
    
         
             
                    Use 'a' instead of 'an' if the following word doesn't start with a vowel sound, e.g. 'a sentence', 'a university'
         
     | 
| 
       35 
     | 
    
         
            -
                    Context: Given an test when execute then pass
         
     | 
| 
      
 35 
     | 
    
         
            +
                    Context: Test  Scenario  Given an test when execute then pass
         
     | 
| 
       36 
36 
     | 
    
         
             
                    Replacements: a
         
     | 
| 
       37 
37 
     | 
    
         
             
                    References: test.feature
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
         @@ -42,7 +42,7 @@ Feature: Report 
     | 
|
| 
       42 
42 
     | 
    
         
             
                Given a file named "test.feature" with:
         
     | 
| 
       43 
43 
     | 
    
         
             
                  """
         
     | 
| 
       44 
44 
     | 
    
         
             
                  Feature: Test
         
     | 
| 
       45 
     | 
    
         
            -
                    Scenario:  
     | 
| 
      
 45 
     | 
    
         
            +
                    Scenario: Scenario
         
     | 
| 
       46 
46 
     | 
    
         
             
                      Given a test
         
     | 
| 
       47 
47 
     | 
    
         
             
                      When exicute
         
     | 
| 
       48 
48 
     | 
    
         
             
                      Then pass
         
     | 
| 
         @@ -52,7 +52,7 @@ Feature: Report 
     | 
|
| 
       52 
52 
     | 
    
         
             
                  """
         
     | 
| 
       53 
53 
     | 
    
         
             
                  [misspelling] MORFOLOGIK_RULE_EN_US
         
     | 
| 
       54 
54 
     | 
    
         
             
                    Possible spelling mistake found
         
     | 
| 
       55 
     | 
    
         
            -
                    Context: Given a test when exicute then pass
         
     | 
| 
      
 55 
     | 
    
         
            +
                    Context: Test  Scenario  Given a test when exicute then pass
         
     | 
| 
       56 
56 
     | 
    
         
             
                    Replacements: execute
         
     | 
| 
       57 
57 
     | 
    
         
             
                    References: test.feature
         
     | 
| 
       58 
58 
     | 
    
         
             
                  1 unknown words: exicute
         
     | 
    
        data/gherkin_language.gemspec
    CHANGED
    
    | 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       2 
2 
     | 
    
         
             
              s.name        = 'gherkin_language'
         
     | 
| 
       3 
     | 
    
         
            -
              s.version     = '0. 
     | 
| 
       4 
     | 
    
         
            -
              s.date        = '2016- 
     | 
| 
      
 3 
     | 
    
         
            +
              s.version     = '0.2.0'
         
     | 
| 
      
 4 
     | 
    
         
            +
              s.date        = '2016-04-23'
         
     | 
| 
       5 
5 
     | 
    
         
             
              s.summary     = 'Gherkin Language'
         
     | 
| 
       6 
     | 
    
         
            -
              s.description = 'Check language  
     | 
| 
      
 6 
     | 
    
         
            +
              s.description = 'Check language of Gherkin Files'
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.authors     = ['Stefan Rohe']
         
     | 
| 
       8 
8 
     | 
    
         
             
              s.homepage    = 'http://github.com/funkwerk/gherkin_language/'
         
     | 
| 
       9 
9 
     | 
    
         
             
              s.files       = `git ls-files`.split("\n")
         
     | 
| 
         @@ -16,7 +16,7 @@ require 'digest' 
     | 
|
| 
       16 
16 
     | 
    
         
             
            class LanguageToolProcess
         
     | 
| 
       17 
17 
     | 
    
         
             
              attr_accessor :errors, :unknown_words
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
              VERSION = 'LanguageTool-3. 
     | 
| 
      
 19 
     | 
    
         
            +
              VERSION = 'LanguageTool-3.3'.freeze
         
     | 
| 
       20 
20 
     | 
    
         
             
              URL = "https://www.languagetool.org/download/#{VERSION}.zip".freeze
         
     | 
| 
       21 
21 
     | 
    
         
             
              NGRAM_VERSION = 'ngrams-en-20150817'.freeze
         
     | 
| 
       22 
22 
     | 
    
         
             
              NGRAM_URL = "https://languagetool.org/download/ngram-data/#{NGRAM_VERSION}.zip".freeze
         
     | 
| 
         @@ -60,23 +60,27 @@ class LanguageToolProcess 
     | 
|
| 
       60 
60 
     | 
    
         
             
                Dir.chdir("#{@path}/#{VERSION}/") do
         
     | 
| 
       61 
61 
     | 
    
         
             
                  command = 'java -jar languagetool-commandline.jar '
         
     | 
| 
       62 
62 
     | 
    
         
             
                  command += '--list-unknown ' if @check_unknown_words
         
     | 
| 
       63 
     | 
    
         
            -
                  command += '--api --language en- 
     | 
| 
      
 63 
     | 
    
         
            +
                  command += '--api --language en-us '
         
     | 
| 
       64 
64 
     | 
    
         
             
                  command += "--languagemodel #{@ngrams_path}" if @ngrams
         
     | 
| 
       65 
     | 
    
         
            -
                  @p = IO.popen("#{command} -", 'r+')
         
     | 
| 
      
 65 
     | 
    
         
            +
                  @p = IO.popen("#{command} - 2>&1", 'r+')
         
     | 
| 
       66 
66 
     | 
    
         
             
                end
         
     | 
| 
       67 
67 
     | 
    
         
             
              end
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
69 
     | 
    
         
             
              def tag(sentences)
         
     | 
| 
       70 
70 
     | 
    
         
             
                output = ''
         
     | 
| 
       71 
71 
     | 
    
         
             
                Dir.chdir("#{@path}/#{VERSION}/") do
         
     | 
| 
       72 
     | 
    
         
            -
                  p = IO.popen('java -jar languagetool-commandline.jar --taggeronly --api --language en-US -', 'r+')
         
     | 
| 
      
 72 
     | 
    
         
            +
                  p = IO.popen('java -jar languagetool-commandline.jar --taggeronly --api --language en-US - 2>/dev/null', 'r+')
         
     | 
| 
       73 
73 
     | 
    
         
             
                  sentences.each { |sentence| p.write sentence }
         
     | 
| 
       74 
74 
     | 
    
         
             
                  p.close_write
         
     | 
| 
       75 
75 
     | 
    
         
             
                  line = p.readline
         
     | 
| 
       76 
76 
     | 
    
         
             
                  loop do
         
     | 
| 
       77 
77 
     | 
    
         
             
                    break if line == "<!--\n"
         
     | 
| 
       78 
78 
     | 
    
         
             
                    output << line
         
     | 
| 
       79 
     | 
    
         
            -
                     
     | 
| 
      
 79 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 80 
     | 
    
         
            +
                      line = p.readline
         
     | 
| 
      
 81 
     | 
    
         
            +
                    rescue EOFError
         
     | 
| 
      
 82 
     | 
    
         
            +
                      break
         
     | 
| 
      
 83 
     | 
    
         
            +
                    end
         
     | 
| 
       80 
84 
     | 
    
         
             
                  end
         
     | 
| 
       81 
85 
     | 
    
         
             
                  p.close
         
     | 
| 
       82 
86 
     | 
    
         
             
                end
         
     | 
    
        data/lib/gherkin_language.rb
    CHANGED
    
    | 
         @@ -29,7 +29,7 @@ class GherkinLanguage 
     | 
|
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         
             
                @references = {}
         
     | 
| 
       31 
31 
     | 
    
         
             
                @line_to_reference = {}
         
     | 
| 
       32 
     | 
    
         
            -
                @exceptions = %w(SENTENCE_FRAGMENT) 
     | 
| 
      
 32 
     | 
    
         
            +
                @exceptions = %w(SENTENCE_FRAGMENT ENGLISH_WORD_REPEAT_BEGINNING_RULE)
         
     | 
| 
       33 
33 
     | 
    
         
             
                @ngram = ngram
         
     | 
| 
       34 
34 
     | 
    
         
             
                @unknown_words = unknown_words
         
     | 
| 
       35 
35 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: gherkin_language
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Stefan Rohe
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-04-23 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: gherkin
         
     | 
| 
         @@ -66,7 +66,7 @@ dependencies: 
     | 
|
| 
       66 
66 
     | 
    
         
             
                - - ">="
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
68 
     | 
    
         
             
                    version: 0.6.2
         
     | 
| 
       69 
     | 
    
         
            -
            description: Check language  
     | 
| 
      
 69 
     | 
    
         
            +
            description: Check language of Gherkin Files
         
     | 
| 
       70 
70 
     | 
    
         
             
            email: 
         
     | 
| 
       71 
71 
     | 
    
         
             
            executables:
         
     | 
| 
       72 
72 
     | 
    
         
             
            - gherkin_language
         
     |