runoff 2.0.1 → 2.0.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/bin/runoff +9 -5
- data/lib/runoff/adapters/adapter.rb +30 -0
- data/lib/runoff/adapters/json_adapter.rb +0 -17
- data/lib/runoff/adapters/txt_adapter.rb +8 -17
- data/lib/runoff/commandline/none.rb +7 -0
- data/lib/runoff/version.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: 81287f01814e747861a7d0e691a2d131e8bdd402
         | 
| 4 | 
            +
              data.tar.gz: 46e228e6cae5e56000ff6103d507785e90894f56
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 90fe6c30aa132ee4aa7d27178c5b169957bf1963dfc4559001f6b63880d918f7725930d94129c88e7d446743fa1a4b228b2b38fb13cb434c6a9c2c53f30b4e01
         | 
| 7 | 
            +
              data.tar.gz: 577bb4c9148a6eb094a423bc36dd7ab94646456d8f16a2e1c54951af50f7db06be7d4a139f2ac7e8698ae485d56838acac258feb914161da7ea0ac0549b59825
         | 
    
        data/bin/runoff
    CHANGED
    
    | @@ -20,12 +20,16 @@ if command | |
| 20 20 | 
             
              command.parser.order!
         | 
| 21 21 | 
             
              command.parser.parse!
         | 
| 22 22 |  | 
| 23 | 
            -
               | 
| 23 | 
            +
              begin
         | 
| 24 24 | 
             
                command.execute ARGV
         | 
| 25 | 
            -
               | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 25 | 
            +
              rescue StandardError => e
         | 
| 26 | 
            +
                if ENV['DEBUG']
         | 
| 27 | 
            +
                  raise e
         | 
| 28 | 
            +
                else
         | 
| 29 | 
            +
                  warn e.message.colorize :red
         | 
| 30 | 
            +
                  puts 'Terminated.'.colorize :yellow
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
              end
         | 
| 29 33 | 
             
            else
         | 
| 30 34 | 
             
              puts available_commands['_none'].parser.help
         | 
| 31 35 | 
             
            end
         | 
| @@ -26,6 +26,36 @@ module Runoff | |
| 26 26 | 
             
                  def format_body_xml(xml_content)
         | 
| 27 27 | 
             
                    xml_content
         | 
| 28 28 | 
             
                  end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                  # Public: Parses a chatname into a human readable name.
         | 
| 31 | 
            +
                  #
         | 
| 32 | 
            +
                  # raw_chatname - A String with a Skype chatname.
         | 
| 33 | 
            +
                  #
         | 
| 34 | 
            +
                  # Examples
         | 
| 35 | 
            +
                  #
         | 
| 36 | 
            +
                  #   parse_chatname "#first_user/$second_user;d3d86c6b0e3b8320"
         | 
| 37 | 
            +
                  #   #=> first_user_second_user
         | 
| 38 | 
            +
                  #
         | 
| 39 | 
            +
                  #   parse_chatname "19:g7f8hg76f8g9d6f5ghj4357346@thread.skype"
         | 
| 40 | 
            +
                  #   #=> g7f8hg76f8g9d6f5ghj4357346
         | 
| 41 | 
            +
                  #
         | 
| 42 | 
            +
                  #   parse_chatname "john_doe"
         | 
| 43 | 
            +
                  #   #=> john_doe
         | 
| 44 | 
            +
                  #
         | 
| 45 | 
            +
                  # Returns a valid name.
         | 
| 46 | 
            +
                  def parse_chatname(raw_chatname)
         | 
| 47 | 
            +
                    case raw_chatname
         | 
| 48 | 
            +
                    when /\:(?<hash>.+)@/
         | 
| 49 | 
            +
                      $~[:hash]
         | 
| 50 | 
            +
                    when /#(?<first_participant>.*)\/\$(?<second_participant>.*);/
         | 
| 51 | 
            +
                      first_participant  = $~[:first_participant]
         | 
| 52 | 
            +
                      second_participant = $~[:second_participant]
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                      [first_participant, second_participant].reject(&:empty?).join('_')
         | 
| 55 | 
            +
                    else
         | 
| 56 | 
            +
                      raw_chatname
         | 
| 57 | 
            +
                    end
         | 
| 58 | 
            +
                  end
         | 
| 29 59 | 
             
                end
         | 
| 30 60 | 
             
              end
         | 
| 31 61 | 
             
            end
         | 
| @@ -40,23 +40,6 @@ module Runoff | |
| 40 40 | 
             
                    parse_chatname(chatname) + '.json'
         | 
| 41 41 | 
             
                  end
         | 
| 42 42 |  | 
| 43 | 
            -
                  # Public: Parses a chatname into a human readable name.
         | 
| 44 | 
            -
                  #
         | 
| 45 | 
            -
                  # raw_chatname - A String with a Skype chatname.
         | 
| 46 | 
            -
                  #
         | 
| 47 | 
            -
                  # Examples
         | 
| 48 | 
            -
                  #
         | 
| 49 | 
            -
                  #   parse_chatname "#first_user/$second_user;d3d86c6b0e3b8320"
         | 
| 50 | 
            -
                  #   # => first_user_second_user
         | 
| 51 | 
            -
                  #
         | 
| 52 | 
            -
                  # Returns a valid name.
         | 
| 53 | 
            -
                  def parse_chatname(raw_chatname)
         | 
| 54 | 
            -
                    pattern = /^#(.*)\/\$(.*);.*$/
         | 
| 55 | 
            -
                    parts = raw_chatname.match(pattern).captures
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                    parts.reject(&:empty?).join('_')
         | 
| 58 | 
            -
                  end
         | 
| 59 | 
            -
             | 
| 60 43 | 
             
                  # Public: Formats the provided data buffer so that it could be writter to
         | 
| 61 44 | 
             
                  #         a JSON file.
         | 
| 62 45 | 
             
                  #
         | 
| @@ -12,6 +12,8 @@ module Runoff | |
| 12 12 | 
             
                  #
         | 
| 13 13 | 
             
                  #   build_entry { chatname: "#first_user/$second_user;d3d86c6b0e3b8320" ... }
         | 
| 14 14 | 
             
                  #   # => "[2014-04-18 20:20:12] first_user: This is a text"
         | 
| 15 | 
            +
                  #
         | 
| 16 | 
            +
                  # Returns a string
         | 
| 15 17 | 
             
                  def build_entry(row)
         | 
| 16 18 | 
             
                    formated_data = []
         | 
| 17 19 |  | 
| @@ -33,28 +35,17 @@ module Runoff | |
| 33 35 | 
             
                  #   get_file_name "#first_user/$second_user;d3d86c6b0e3b8320"
         | 
| 34 36 | 
             
                  #   # => first_user_second_user.txt
         | 
| 35 37 | 
             
                  #
         | 
| 38 | 
            +
                  #   get_file_name "19:g7f8hg76f8g9d6f5ghj4357346@thread.skype"
         | 
| 39 | 
            +
                  #   #=> g7f8hg76f8g9d6f5ghj4357346.txt
         | 
| 40 | 
            +
                  #
         | 
| 41 | 
            +
                  #   get_file_name "john_doe"
         | 
| 42 | 
            +
                  #   #=> john_doe.txt
         | 
| 43 | 
            +
                  #
         | 
| 36 44 | 
             
                  # Returns a valid file name.
         | 
| 37 45 | 
             
                  def get_file_name(chatname)
         | 
| 38 46 | 
             
                    parse_chatname(chatname) + '.txt'
         | 
| 39 47 | 
             
                  end
         | 
| 40 48 |  | 
| 41 | 
            -
                  # Public: Parses a chatname into a human readable name.
         | 
| 42 | 
            -
                  #
         | 
| 43 | 
            -
                  # raw_chatname - A String with a Skype chatname.
         | 
| 44 | 
            -
                  #
         | 
| 45 | 
            -
                  # Examples
         | 
| 46 | 
            -
                  #
         | 
| 47 | 
            -
                  #   parse_chatname "#first_user/$second_user;d3d86c6b0e3b8320"
         | 
| 48 | 
            -
                  #   # => first_user_second_user
         | 
| 49 | 
            -
                  #
         | 
| 50 | 
            -
                  # Returns a valid name.
         | 
| 51 | 
            -
                  def parse_chatname(raw_chatname)
         | 
| 52 | 
            -
                    pattern = /^#(.*)\/\$(.*);.*$/
         | 
| 53 | 
            -
                    parts = raw_chatname.match(pattern).captures
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                    parts.reject(&:empty?).join('_')
         | 
| 56 | 
            -
                  end
         | 
| 57 | 
            -
             | 
| 58 49 | 
             
                  # Public: Formats the provided data buffer so that it could be writter to
         | 
| 59 50 | 
             
                  #         a text file.
         | 
| 60 51 | 
             
                  #
         | 
    
        data/lib/runoff/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: runoff
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.0. | 
| 4 | 
            +
              version: 2.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Aigars Dzerviniks
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2017-02-25 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: sequel
         | 
| @@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 119 119 | 
             
                  version: '0'
         | 
| 120 120 | 
             
            requirements: []
         | 
| 121 121 | 
             
            rubyforge_project: 
         | 
| 122 | 
            -
            rubygems_version: 2.0.14
         | 
| 122 | 
            +
            rubygems_version: 2.0.14.1
         | 
| 123 123 | 
             
            signing_key: 
         | 
| 124 124 | 
             
            specification_version: 4
         | 
| 125 125 | 
             
            summary: Tool to export Skype chat history from the SQLite database to text files
         |