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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76e64409a6f2d4e87cf9b4523428e07f37881b29
4
- data.tar.gz: cb8090e33791b96f0911a457225f94c3348486fe
3
+ metadata.gz: 81287f01814e747861a7d0e691a2d131e8bdd402
4
+ data.tar.gz: 46e228e6cae5e56000ff6103d507785e90894f56
5
5
  SHA512:
6
- metadata.gz: c58d95c022d9418557330a5888913ff72f4d73337c9af353f95edc2a6ad7cd0a7c6f07afb1f36e547bd2ad25c5d891e19466d3e68b14f5bc317ed3ecef057180
7
- data.tar.gz: 9639131d7e886b13c5e86ef6bc6979f6c0af83c2941430b60b8ce246b85b651728210bfbbc73c17f6f6e42c00ccf91036d6ae7e7bee40b9e3ee3087230450b2b
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
- #begin
23
+ begin
24
24
  command.execute ARGV
25
- #rescue StandardError => e
26
- # warn e.message.colorize :red
27
- # puts 'Terminated.'.colorize :yellow
28
- #end
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
  #
@@ -27,6 +27,13 @@ module Runoff
27
27
 
28
28
  runoff <COMMAND> [SKYPE_USERNAME] [OPTIONS]
29
29
 
30
+ Commands:
31
+
32
+ all - Exports all chats
33
+ some - Exports only specified chats
34
+
35
+ Options:
36
+
30
37
  END
31
38
 
32
39
  opts.on '-h', '--help', 'Displays help' do
@@ -1,3 +1,3 @@
1
1
  module Runoff
2
- VERSION = '2.0.1'
2
+ VERSION = '2.0.2'
3
3
  end
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.1
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: 2014-11-15 00:00:00.000000000 Z
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