geordi 0.9.1 → 0.9.2
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.
- data/lib/geordi/cuc.rb +53 -17
 - data/lib/geordi/version.rb +1 -1
 - metadata +4 -4
 
    
        data/lib/geordi/cuc.rb
    CHANGED
    
    | 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'rubygems'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'geordi/setup_firefox_for_selenium'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'ruby-debug'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            module Geordi
         
     | 
| 
       5 
6 
     | 
    
         
             
              class Cucumber
         
     | 
| 
         @@ -10,22 +11,36 @@ module Geordi 
     | 
|
| 
       10 
11 
     | 
    
         
             
                  puts "========================="
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
13 
     | 
    
         
             
                  consolidate_rerun_txt_files
         
     | 
| 
       13 
     | 
    
         
            -
                   
     | 
| 
      
 14 
     | 
    
         
            +
                  show_features_to_run
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
16 
     | 
    
         
             
                  command = use_parallel_tests? ? parallel_execution_command : serial_execution_command
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  2.times { puts }
         
     | 
| 
      
 19 
     | 
    
         
            +
                  puts "command to execute:"
         
     | 
| 
      
 20 
     | 
    
         
            +
                  puts command
         
     | 
| 
      
 21 
     | 
    
         
            +
                  puts "-----------------------------------------"
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  2.times { puts }
         
     | 
| 
       16 
24 
     | 
    
         
             
                  exec command
         
     | 
| 
       17 
25 
     | 
    
         
             
                end
         
     | 
| 
       18 
26 
     | 
    
         | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                attr_writer :argv
         
     | 
| 
      
 29 
     | 
    
         
            +
                def argv
         
     | 
| 
      
 30 
     | 
    
         
            +
                  @argv ||= ARGV
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
       19 
33 
     | 
    
         
             
                def serial_execution_command
         
     | 
| 
       20 
34 
     | 
    
         
             
                  format_args = spinner_available? ? ['--format', 'CucumberSpinner::CuriousProgressBarFormatter'] : ['--format', 'progress']
         
     | 
| 
       21 
     | 
    
         
            -
                  [use_firefox_for_selenium, "b", "cucumber", format_args, escape_shell_args( 
     | 
| 
      
 35 
     | 
    
         
            +
                  [use_firefox_for_selenium, "b", "cucumber", format_args, escape_shell_args(argv)].flatten.compact.join(" ")
         
     | 
| 
       22 
36 
     | 
    
         
             
                end
         
     | 
| 
       23 
37 
     | 
    
         | 
| 
       24 
38 
     | 
    
         | 
| 
       25 
39 
     | 
    
         
             
                def parallel_execution_command
         
     | 
| 
       26 
40 
     | 
    
         
             
                  puts "Using parallel_tests ...\n\n"
         
     | 
| 
       27 
     | 
    
         
            -
                   
     | 
| 
       28 
     | 
    
         
            -
                   
     | 
| 
      
 41 
     | 
    
         
            +
                  self.argv = argv - command_line_features
         
     | 
| 
      
 42 
     | 
    
         
            +
                  parallel_tests_args = "-t features #{command_line_features}"
         
     | 
| 
      
 43 
     | 
    
         
            +
                  cucumber_args = argv.empty? ? '' : "-o '#{escape_shell_args(argv).join(" ")}'"
         
     | 
| 
       29 
44 
     | 
    
         
             
                  [use_firefox_for_selenium, 'b', 'parallel_test', parallel_tests_args, cucumber_args].flatten.compact.join(" ")
         
     | 
| 
       30 
45 
     | 
    
         
             
                end
         
     | 
| 
       31 
46 
     | 
    
         | 
| 
         @@ -41,11 +56,40 @@ module Geordi 
     | 
|
| 
       41 
56 
     | 
    
         
             
                  end
         
     | 
| 
       42 
57 
     | 
    
         
             
                end
         
     | 
| 
       43 
58 
     | 
    
         | 
| 
      
 59 
     | 
    
         
            +
                def show_features_to_run
         
     | 
| 
      
 60 
     | 
    
         
            +
                  unless features_to_run.empty?
         
     | 
| 
      
 61 
     | 
    
         
            +
                    passed_by = (features_to_run == rerun_txt_features) ? 'rerun.txt' : 'command line'
         
     | 
| 
      
 62 
     | 
    
         
            +
                    2.times { puts }
         
     | 
| 
      
 63 
     | 
    
         
            +
                    puts "features to run (passed by #{passed_by}):"
         
     | 
| 
      
 64 
     | 
    
         
            +
                    puts "-----------------------------------------"
         
     | 
| 
      
 65 
     | 
    
         
            +
                    puts features_to_run.join("\n")
         
     | 
| 
      
 66 
     | 
    
         
            +
                    puts "-----------------------------------------"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  end
         
     | 
| 
      
 68 
     | 
    
         
            +
                end
         
     | 
| 
       44 
69 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
                def  
     | 
| 
       46 
     | 
    
         
            -
                   
     | 
| 
      
 70 
     | 
    
         
            +
                def features_to_run
         
     | 
| 
      
 71 
     | 
    
         
            +
                  @features_to_run ||= begin
         
     | 
| 
      
 72 
     | 
    
         
            +
                    features = command_line_features
         
     | 
| 
      
 73 
     | 
    
         
            +
                    features = rerun_txt_features if features.empty?
         
     | 
| 
      
 74 
     | 
    
         
            +
                    features
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
       47 
76 
     | 
    
         
             
                end
         
     | 
| 
       48 
77 
     | 
    
         | 
| 
      
 78 
     | 
    
         
            +
                def command_line_features
         
     | 
| 
      
 79 
     | 
    
         
            +
                  @command_line_features ||= argv.select do |arg|
         
     | 
| 
      
 80 
     | 
    
         
            +
                    arg =~ /.*\.feature/i
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                def rerun_txt_features
         
     | 
| 
      
 85 
     | 
    
         
            +
                  @rerun_txt_features ||= begin
         
     | 
| 
      
 86 
     | 
    
         
            +
                    if File.exists?("rerun.txt")
         
     | 
| 
      
 87 
     | 
    
         
            +
                      IO.read("rerun.txt").to_s.strip.split(/\s+/)
         
     | 
| 
      
 88 
     | 
    
         
            +
                    else
         
     | 
| 
      
 89 
     | 
    
         
            +
                      []
         
     | 
| 
      
 90 
     | 
    
         
            +
                    end
         
     | 
| 
      
 91 
     | 
    
         
            +
                  end
         
     | 
| 
      
 92 
     | 
    
         
            +
                end
         
     | 
| 
       49 
93 
     | 
    
         | 
| 
       50 
94 
     | 
    
         
             
                def consolidate_rerun_txt_files
         
     | 
| 
       51 
95 
     | 
    
         
             
                  parallel_rerun_files = Dir.glob("parallel_rerun*.txt")
         
     | 
| 
         @@ -65,16 +109,8 @@ module Geordi 
     | 
|
| 
       65 
109 
     | 
    
         
             
                  end
         
     | 
| 
       66 
110 
     | 
    
         
             
                end
         
     | 
| 
       67 
111 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                  return unless rerun_txt_exists_and_has_content?
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                  2.times { puts }
         
     | 
| 
       73 
     | 
    
         
            -
                  puts "content of rerun.txt:"
         
     | 
| 
       74 
     | 
    
         
            -
                  puts "-------------------------"
         
     | 
| 
       75 
     | 
    
         
            -
                  puts File.read('rerun.txt')
         
     | 
| 
       76 
     | 
    
         
            -
                  puts "-------------------------"
         
     | 
| 
       77 
     | 
    
         
            -
                  2.times { puts }
         
     | 
| 
      
 112 
     | 
    
         
            +
                def features_can_run_with_parallel_tests?(features)
         
     | 
| 
      
 113 
     | 
    
         
            +
                  not features.any?{ |feature| feature.include? ":" }
         
     | 
| 
       78 
114 
     | 
    
         
             
                end
         
     | 
| 
       79 
115 
     | 
    
         | 
| 
       80 
116 
     | 
    
         | 
| 
         @@ -91,7 +127,7 @@ module Geordi 
     | 
|
| 
       91 
127 
     | 
    
         | 
| 
       92 
128 
     | 
    
         | 
| 
       93 
129 
     | 
    
         
             
                def use_parallel_tests?
         
     | 
| 
       94 
     | 
    
         
            -
                  parallel_tests_available? &&  
     | 
| 
      
 130 
     | 
    
         
            +
                  parallel_tests_available? && features_can_run_with_parallel_tests?(features_to_run)
         
     | 
| 
       95 
131 
     | 
    
         
             
                end
         
     | 
| 
       96 
132 
     | 
    
         | 
| 
       97 
133 
     | 
    
         
             
              end
         
     | 
    
        data/lib/geordi/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: geordi
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 63
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 9
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.9. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 2
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.9.2
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Henning Koch
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2012-02- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2012-02-22 00:00:00 +01:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       21 
21 
     | 
    
         |