trecs 0.4.1 → 0.4.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/trecs/strategies/tmux_session_strategy.rb +9 -2
- data/lib/trecs/version.rb +1 -1
- data/lib/trecs/writers/json_writer.rb +7 -3
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8c77342d400595d338672aa1d47bb45ec43757bc
         | 
| 4 | 
            +
              data.tar.gz: 9c7611b89930b1086d33c1c10ae88c4cbdbf0895
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ef53e600a45895483fa52679146749b80fd37753931bc7ca99d95ff8ab67b900b1cde003ffe8c27a59e47c43acd879935f67c537b722cc53e59858ae518f0251
         | 
| 7 | 
            +
              data.tar.gz: 3e698602a8a3f53cd20e37c56f2942934f67eb0668d1d4c657d5bafd9433aeaedf567254ea9a04a755d928e03118bab5e22aaf25978af85387bdbd115097fce9
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -3,10 +3,10 @@ require "strategies/strategy" | |
| 3 3 | 
             
            module TRecs
         | 
| 4 4 | 
             
              class TmuxSessionStrategy < Strategy
         | 
| 5 5 | 
             
                attr_reader :recording
         | 
| 6 | 
            +
                attr_reader :format
         | 
| 6 7 |  | 
| 7 8 | 
             
                def initialize(options={})
         | 
| 8 9 | 
             
                  super(options)
         | 
| 9 | 
            -
                  # @frames = []
         | 
| 10 10 | 
             
                  @step = options.fetch(:step) { 100 }
         | 
| 11 11 | 
             
                  @color = options.fetch(:color) { true }
         | 
| 12 12 | 
             
                  set_color_or_bw
         | 
| @@ -19,6 +19,7 @@ module TRecs | |
| 19 19 | 
             
                    t += step
         | 
| 20 20 | 
             
                    current_time(t)
         | 
| 21 21 | 
             
                    current_content(get_current_frame)
         | 
| 22 | 
            +
                    current_format(format)
         | 
| 22 23 | 
             
                    save_frame
         | 
| 23 24 | 
             
                    sleep(step/1000.0)
         | 
| 24 25 | 
             
                  end
         | 
| @@ -38,7 +39,13 @@ module TRecs | |
| 38 39 | 
             
                end
         | 
| 39 40 |  | 
| 40 41 | 
             
                def set_color_or_bw
         | 
| 41 | 
            -
                   | 
| 42 | 
            +
                  if @color
         | 
| 43 | 
            +
                    @color = "-e"
         | 
| 44 | 
            +
                    @format = "ansi"
         | 
| 45 | 
            +
                  else
         | 
| 46 | 
            +
                    @color = "-C"
         | 
| 47 | 
            +
                    @format = "raw"
         | 
| 48 | 
            +
                  end
         | 
| 42 49 | 
             
                end
         | 
| 43 50 |  | 
| 44 51 | 
             
                def set_capture_command
         | 
    
        data/lib/trecs/version.rb
    CHANGED
    
    
| @@ -22,7 +22,7 @@ module TRecs | |
| 22 22 | 
             
                  time    = options.fetch(:time)
         | 
| 23 23 | 
             
                  content = options.fetch(:content)
         | 
| 24 24 | 
             
                  format  = options[:format]
         | 
| 25 | 
            -
             | 
| 25 | 
            +
             | 
| 26 26 | 
             
                  frame = {
         | 
| 27 27 | 
             
                    format: format,
         | 
| 28 28 | 
             
                    content:  content,
         | 
| @@ -35,8 +35,12 @@ module TRecs | |
| 35 35 | 
             
                  source.create_recording do |source|
         | 
| 36 36 | 
             
                    source[:format] = "json"
         | 
| 37 37 |  | 
| 38 | 
            -
                     | 
| 39 | 
            -
             | 
| 38 | 
            +
                    frames_hash = frames.each_with_object({}) { |frame, h|
         | 
| 39 | 
            +
                      h[frame.first] = frame.last.to_h
         | 
| 40 | 
            +
                    }
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                    json_string = frames_hash.to_json
         | 
| 43 | 
            +
             | 
| 40 44 | 
             
                    source.create_file('frames.json') do |f|
         | 
| 41 45 | 
             
                      f.write json_string
         | 
| 42 46 | 
             
                    end
         |