lino 3.2.0.pre.7 → 3.2.0.pre.8
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/Gemfile.lock +1 -1
 - data/lib/lino/executors/childprocess.rb +2 -1
 - data/lib/lino/executors/mock.rb +52 -3
 - data/lib/lino/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: da0833b0822fedee12bfa81350d5e87a69ef51bb9b4abc7f9f4537d5b851d3fe
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f3bc82e3a0f6af9b1ae512a8db77b01626b39b089616371a35bb523a625a3551
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e901b165f5fa1da7678057e04217b90558f7ef19f788b575e1dd3e1a5af825615e46040c33c24135899af5fa1ca1d8b150b83f225aeff568facc3498a2092f95
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9bd2103be29ad1026863b39df46a33d2a9618343d06ce517a01558087d6f18a85501c9a3a12fb04ab526ac6a22b56a9d8f29f0ee4269cf5b4ba013da3c5a1b58
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
| 
         @@ -39,7 +39,8 @@ module Lino 
     | 
|
| 
       39 
39 
     | 
    
         
             
                  def start_process(process, opts)
         
     | 
| 
       40 
40 
     | 
    
         
             
                    process.duplex = true if opts[:stdin]
         
     | 
| 
       41 
41 
     | 
    
         
             
                    process.start
         
     | 
| 
       42 
     | 
    
         
            -
                    process.io.stdin.write(opts[:stdin]) if opts[:stdin]
         
     | 
| 
      
 42 
     | 
    
         
            +
                    process.io.stdin.write(opts[:stdin].read) if opts[:stdin]
         
     | 
| 
      
 43 
     | 
    
         
            +
                    process.io.stdin.close if opts[:stdin]
         
     | 
| 
       43 
44 
     | 
    
         
             
                  end
         
     | 
| 
       44 
45 
     | 
    
         | 
| 
       45 
46 
     | 
    
         
             
                  def set_output_streams(process, opts)
         
     | 
    
        data/lib/lino/executors/mock.rb
    CHANGED
    
    | 
         @@ -3,7 +3,7 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Lino
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Executors
         
     | 
| 
       5 
5 
     | 
    
         
             
                class Mock
         
     | 
| 
       6 
     | 
    
         
            -
                  attr_reader : 
     | 
| 
      
 6 
     | 
    
         
            +
                  attr_reader :executions, :stdout_contents, :stderr_contents
         
     | 
| 
       7 
7 
     | 
    
         
             
                  attr_accessor :exit_code
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                  def initialize
         
     | 
| 
         @@ -11,7 +11,10 @@ module Lino 
     | 
|
| 
       11 
11 
     | 
    
         
             
                  end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                  def execute(command_line, opts = {})
         
     | 
| 
       14 
     | 
    
         
            -
                     
     | 
| 
      
 14 
     | 
    
         
            +
                    execution = { command_line:, opts:, exit_code: @exit_code }
         
     | 
| 
      
 15 
     | 
    
         
            +
                    execution = process_streams(execution, opts)
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                    @executions << execution
         
     | 
| 
       15 
18 
     | 
    
         | 
| 
       16 
19 
     | 
    
         
             
                    return if @exit_code.zero?
         
     | 
| 
       17 
20 
     | 
    
         | 
| 
         @@ -20,9 +23,55 @@ module Lino 
     | 
|
| 
       20 
23 
     | 
    
         
             
                    )
         
     | 
| 
       21 
24 
     | 
    
         
             
                  end
         
     | 
| 
       22 
25 
     | 
    
         | 
| 
      
 26 
     | 
    
         
            +
                  def fail_all_executions
         
     | 
| 
      
 27 
     | 
    
         
            +
                    self.exit_code = 1
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def write_to_stdout(contents)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    @stdout_contents = contents
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  def write_to_stderr(contents)
         
     | 
| 
      
 35 
     | 
    
         
            +
                    @stderr_contents = contents
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
       23 
38 
     | 
    
         
             
                  def reset
         
     | 
| 
       24 
     | 
    
         
            -
                    @ 
     | 
| 
      
 39 
     | 
    
         
            +
                    @executions = []
         
     | 
| 
       25 
40 
     | 
    
         
             
                    @exit_code = 0
         
     | 
| 
      
 41 
     | 
    
         
            +
                    @stdout_contents = nil
         
     | 
| 
      
 42 
     | 
    
         
            +
                    @stderr_contents = nil
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  private
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  def process_streams(execution, opts)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    execution = process_stdout(execution, opts[:stdout])
         
     | 
| 
      
 49 
     | 
    
         
            +
                    execution = process_stderr(execution, opts[:stderr])
         
     | 
| 
      
 50 
     | 
    
         
            +
                    process_stdin(execution, opts[:stdin])
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                  def process_stdout(execution, stdout)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    if stdout && stdout_contents
         
     | 
| 
      
 55 
     | 
    
         
            +
                      stdout.write(stdout_contents)
         
     | 
| 
      
 56 
     | 
    
         
            +
                      return execution.merge(stdout_contents:)
         
     | 
| 
      
 57 
     | 
    
         
            +
                    end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                    execution
         
     | 
| 
      
 60 
     | 
    
         
            +
                  end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                  def process_stderr(execution, stderr)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    if stderr && stderr_contents
         
     | 
| 
      
 64 
     | 
    
         
            +
                      stderr.write(stderr_contents)
         
     | 
| 
      
 65 
     | 
    
         
            +
                      return execution.merge(stderr_contents:)
         
     | 
| 
      
 66 
     | 
    
         
            +
                    end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                    execution
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  def process_stdin(execution, stdin)
         
     | 
| 
      
 72 
     | 
    
         
            +
                    return execution.merge(stdin_contents: stdin.read) if stdin
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                    execution
         
     | 
| 
       26 
75 
     | 
    
         
             
                  end
         
     | 
| 
       27 
76 
     | 
    
         
             
                end
         
     | 
| 
       28 
77 
     | 
    
         
             
              end
         
     | 
    
        data/lib/lino/version.rb
    CHANGED