runoff 0.1.3 → 0.2.0
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 +6 -14
- data/README.md +5 -1
- data/bin/runoff +0 -0
- data/lib/runoff/composition.rb +7 -8
- data/lib/runoff/file_writer.rb +55 -16
- data/lib/runoff/location.rb +2 -2
- data/lib/runoff/source.rb +25 -3
- data/lib/runoff/version.rb +1 -1
- data/runoff.gemspec +1 -0
- data/test/runoff_composition_test.rb +6 -6
- data/test/runoff_file_writer_test.rb +43 -15
- data/test/runoff_locations_test.rb +3 -3
- data/test/runoff_source_test.rb +25 -3
- metadata +26 -44
- checksums.yaml.gz.sig +0 -0
- data/gem-public_cert.pem +0 -22
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
checksums.yaml
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
metadata.gz: !binary |-
|
|
9
|
-
ODM4OGYzZTBlMDM0MmY2NGYxNTIxYTk3YzkxOTAxY2QzYWU0MmZkY2ZlMjFm
|
|
10
|
-
NTZiMDU3NjgxODJiZTE0MzIxZDM3NjU0NzEwNzQ2ZjMzZGQ5NWUwYTQzZmU5
|
|
11
|
-
NTkwZTg5YTlmNjg0M2NmYTE3MjRhNjI0MWRlN2UyYmMyMDc2OTc=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
MmRhYzdiNjliNDVhMjIyYmI5YzRmMGM0NThhZDllMjU3ODhhZjM3YjgzMDAy
|
|
14
|
-
NzY4NzQyMDg4NTEyOGEwYzA5YjNhNmNmYWUwMGY3Mzc5N2Y0NjNlZjY3NDAx
|
|
15
|
-
ZmVmYzY3NTVkOWQ1YmE3ODk2Y2RlNmY5MWY5YjM2OGU5ZDBmZTk=
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 07466177c09c57169067c0d8a59dbc5ad4e4d921
|
|
4
|
+
data.tar.gz: 660f59d6d1adfa80f4bd7a9931988ebb446aa7d2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 4f26579401ab7ac73d8a7447a9101c190a4241f5dc1d95cd916542018211139b91eb3613f751eef813a372b74ff4c9b75e4d0cd8c4d6d677451c1d47d0c4677e
|
|
7
|
+
data.tar.gz: db956c7fcc9b3abf62149162b2bf68996b93c34d149d0321f9fb04f710df9b435627ee2fc7555ee05e372b4c103864834f450a150d415810d1fd371970c214d4
|
data/README.md
CHANGED
|
@@ -26,6 +26,10 @@ To export specific chats.
|
|
|
26
26
|
|
|
27
27
|
runoff chat skype_username -t ~/skype_backup
|
|
28
28
|
|
|
29
|
+
If you don't want to put files into an archive, use `--no-archive` option
|
|
30
|
+
|
|
31
|
+
runoff all skype_username --no-archive
|
|
32
|
+
|
|
29
33
|
If you're confused, you can get some help.
|
|
30
34
|
|
|
31
35
|
runoff help all
|
|
@@ -35,7 +39,7 @@ If you're confused, you can get some help.
|
|
|
35
39
|
Things to do in the future versions:
|
|
36
40
|
|
|
37
41
|
- Parse body_xml to filter XML tags and character entities.
|
|
38
|
-
- Append only new messages to the previously genetrated files instead of appending everything or create different versions for the files
|
|
42
|
+
- Append only new messages to the previously genetrated files instead of appending everything or create different versions for the files when using `--no-archive option`.
|
|
39
43
|
- Add some colors.
|
|
40
44
|
|
|
41
45
|
If you have something to say about this gem or anything else, you can find me on Twitter as [@AigarsDz](http://twitter.com/AigarsDz "@AigarsDz").
|
data/bin/runoff
CHANGED
|
File without changes
|
data/lib/runoff/composition.rb
CHANGED
|
@@ -20,9 +20,7 @@ module Runoff
|
|
|
20
20
|
#
|
|
21
21
|
# Raises IOError if the file cannot be found
|
|
22
22
|
def initialize(main_db_file_path)
|
|
23
|
-
unless File.exists? main_db_file_path
|
|
24
|
-
raise IOError, "File doesn't exist"
|
|
25
|
-
end
|
|
23
|
+
raise IOError, "File doesn't exist" unless File.exists? main_db_file_path
|
|
26
24
|
|
|
27
25
|
skype_database = Sequel.connect "sqlite://#{main_db_file_path}"
|
|
28
26
|
@messages = skype_database.from :Messages
|
|
@@ -50,7 +48,8 @@ module Runoff
|
|
|
50
48
|
# Examples
|
|
51
49
|
#
|
|
52
50
|
# get_chatnames
|
|
53
|
-
# # => [['something-more', 'somethindg-else'],
|
|
51
|
+
# # => [['something-more', 'somethindg-else'],
|
|
52
|
+
# ['#something/$more;6521032', '#something/$else;8971263']]
|
|
54
53
|
#
|
|
55
54
|
# Returns two Array objects containing parsed chatnames and partly parsed chatnames.
|
|
56
55
|
def get_chatnames
|
|
@@ -82,14 +81,14 @@ module Runoff
|
|
|
82
81
|
private
|
|
83
82
|
|
|
84
83
|
# Internal: Performs the export process.
|
|
85
|
-
#
|
|
86
|
-
# chat_records -
|
|
87
84
|
Array of chat records read from database
|
|
85
|
+
#
|
|
86
|
+
# chat_records - Array of chat records read from database
|
|
88
87
|
#
|
|
89
88
|
# Examples
|
|
90
89
|
#
|
|
91
90
|
# run_export [{chatname: '#sadsad/$kjhkjh;9878977', 123123213, 'Aidzis', ''}]
|
|
92
91
|
# # => 1
|
|
93
|
-
#
|
|
92
|
+
#
|
|
94
93
|
# Returns the count of the exported files.
|
|
95
94
|
def run_export(chat_records, destination_path)
|
|
96
95
|
chat_records.each do |record|
|
|
@@ -101,4 +100,4 @@ module Runoff
|
|
|
101
100
|
@exported_filenames.count
|
|
102
101
|
end
|
|
103
102
|
end
|
|
104
|
-
end
|
|
103
|
+
end
|
data/lib/runoff/file_writer.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'zip/zip'
|
|
2
|
+
|
|
1
3
|
module Runoff
|
|
2
4
|
# Public: Methods used for writing to files.
|
|
3
5
|
module FileWriter
|
|
@@ -10,21 +12,37 @@ module Runoff
|
|
|
10
12
|
#
|
|
11
13
|
# save_to_file record, '/home/username/skype_backup'
|
|
12
14
|
def save_to_file(chat_record, output_directory)
|
|
13
|
-
datetime = Time.at chat_record[:timestamp]
|
|
14
|
-
output_record = "[#{datetime.strftime "%Y-%m-%d %H:%M:%S"}] "
|
|
15
|
-
output_record << "#{chat_record[:from_dispname]}: #{parse_body_xml chat_record[:body_xml]}"
|
|
16
15
|
filename = "#{output_directory}/#{parse_chatname chat_record[:chatname]}.txt"
|
|
17
16
|
|
|
17
|
+
Dir.mkdir(output_directory) unless File.exists?(output_directory)
|
|
18
18
|
File.open(filename, 'a') do |file|
|
|
19
|
-
file.puts
|
|
19
|
+
file.puts build_entry(chat_record)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
filename
|
|
23
23
|
rescue StandardError
|
|
24
|
-
puts 'An error occured while
|
|
24
|
+
puts 'An error occured while saving a file'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Public: Creates a String with one entry from the chat.
|
|
28
|
+
#
|
|
29
|
+
# chat_record - a Hash containing data about a single chat message.
|
|
30
|
+
#
|
|
31
|
+
# Examples
|
|
32
|
+
#
|
|
33
|
+
# build_entry { timestamp: 213213232, from_dispname: 'aidzis', body_xml: 'This is text.' }
|
|
34
|
+
# # => [2013-04-13 14:23:57] aidzis: This is text.
|
|
35
|
+
#
|
|
36
|
+
# Returns a String with a chat entry.
|
|
37
|
+
def build_entry(chat_record)
|
|
38
|
+
datetime = Time.at chat_record[:timestamp]
|
|
39
|
+
output_record = "[#{datetime.strftime "%Y-%m-%d %H:%M:%S"}] "
|
|
40
|
+
output_record << "#{chat_record[:from_dispname]}: #{parse_body_xml chat_record[:body_xml]}"
|
|
41
|
+
|
|
42
|
+
output_record
|
|
25
43
|
end
|
|
26
44
|
|
|
27
|
-
#
|
|
45
|
+
# Public: Converts chatname from database to a valid file name.
|
|
28
46
|
#
|
|
29
47
|
# raw_chatname - A String with a chatname read from the database.
|
|
30
48
|
#
|
|
@@ -42,7 +60,7 @@ module Runoff
|
|
|
42
60
|
trim_dashes chatname
|
|
43
61
|
end
|
|
44
62
|
|
|
45
|
-
#
|
|
63
|
+
# Public: Removes extra characters from the end of a chatname.
|
|
46
64
|
#
|
|
47
65
|
# raw_chatname - A String with a chatname read from the database
|
|
48
66
|
#
|
|
@@ -59,7 +77,7 @@ module Runoff
|
|
|
59
77
|
first_group || second_group
|
|
60
78
|
end
|
|
61
79
|
|
|
62
|
-
#
|
|
80
|
+
# Public: Removes unnecessary dashes from the begining and the end of the string.
|
|
63
81
|
#
|
|
64
82
|
# string - A String possibly containing dashes at the beggining or the end
|
|
65
83
|
#
|
|
@@ -71,23 +89,44 @@ module Runoff
|
|
|
71
89
|
#
|
|
72
90
|
# Returns a string without leading and ending dashes.
|
|
73
91
|
def trim_dashes(string)
|
|
74
|
-
clean_string = string.gsub
|
|
75
|
-
clean_string.gsub
|
|
92
|
+
clean_string = string.gsub(/^-+/, '')
|
|
93
|
+
clean_string.gsub(/-+$/, '')
|
|
76
94
|
end
|
|
77
95
|
|
|
78
96
|
# Public: Remove Skype emotion tags.
|
|
79
|
-
#
|
|
80
|
-
# text -
|
|
81
97
|
String containing XML data
|
|
98
|
+
#
|
|
99
|
+
# text - String containing XML data
|
|
82
100
|
#
|
|
83
101
|
# Examples
|
|
84
102
|
#
|
|
85
103
|
# parse_body_xml "Some text <ss type="laugh">:D</ss>"
|
|
86
104
|
# # => "Some text :D"
|
|
87
|
-
#
|
|
105
|
+
#
|
|
88
106
|
# Returns the duplicated String.
|
|
89
107
|
def parse_body_xml(text)
|
|
90
|
-
clean_text = text.gsub
|
|
91
|
-
clean_text.gsub
|
|
108
|
+
clean_text = text.gsub(/<ss type=".+">/, '')
|
|
109
|
+
clean_text.gsub(/<\/ss>/, '')
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Public: Compresses all the exported files into a Zip archive.
|
|
113
|
+
#
|
|
114
|
+
# output_directory - A String with the path to the directory, wher the file will be saved.
|
|
115
|
+
#
|
|
116
|
+
# Examples
|
|
117
|
+
#
|
|
118
|
+
# archive '/home/username/skype-backup'
|
|
119
|
+
def archive(output_directory)
|
|
120
|
+
timestamp = Time.now.strftime "%Y%m%d%H%M%S"
|
|
121
|
+
|
|
122
|
+
Zip::ZipFile.open "#{output_directory}-#{timestamp}.zip", Zip::ZipFile::CREATE do |zipfile|
|
|
123
|
+
Dir.entries(output_directory).each do |file|
|
|
124
|
+
if File.file?("#{output_directory}/#{file}")
|
|
125
|
+
zipfile.add file, "#{output_directory}/#{file}"
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
FileUtils.rm_rf output_directory
|
|
92
131
|
end
|
|
93
132
|
end
|
|
94
|
-
end
|
|
133
|
+
end
|
data/lib/runoff/location.rb
CHANGED
|
@@ -28,8 +28,8 @@ module Runoff
|
|
|
28
28
|
if RbConfig::CONFIG['host_os'] =~ /mingw/
|
|
29
29
|
location = "#{ENV['APPDATA']}\\Skype\\#{skype_username}\\main.db"
|
|
30
30
|
|
|
31
|
-
location.gsub!
|
|
32
|
-
location.gsub
|
|
31
|
+
location.gsub!(/\\/, '/')
|
|
32
|
+
location.gsub(/^[a-zA-Z]:/, '')
|
|
33
33
|
elsif RbConfig::CONFIG['host_os'] =~ /linux/
|
|
34
34
|
"#{ENV['HOME']}/.Skype/#{skype_username}/main.db"
|
|
35
35
|
else
|
data/lib/runoff/source.rb
CHANGED
|
@@ -20,6 +20,8 @@ module Runoff
|
|
|
20
20
|
|
|
21
21
|
method_option :from, aliases: '-f', desc: 'Specify the location of the main.db file'
|
|
22
22
|
method_option :to, aliases: '-t', desc: 'Specify where to put export files'
|
|
23
|
+
method_option :archive, aliases: '-a', type: :boolean, default: true,
|
|
24
|
+
desc: 'Specify whether to save files in a Zip archive'
|
|
23
25
|
|
|
24
26
|
# Public: Exports all chat history from the Skype database.
|
|
25
27
|
#
|
|
@@ -35,6 +37,7 @@ module Runoff
|
|
|
35
37
|
destination = get_destination
|
|
36
38
|
|
|
37
39
|
print_result composition.export(destination)
|
|
40
|
+
try_to_archive composition, destination
|
|
38
41
|
|
|
39
42
|
rescue IOError => e
|
|
40
43
|
puts e
|
|
@@ -52,6 +55,8 @@ module Runoff
|
|
|
52
55
|
|
|
53
56
|
method_option :from, aliases: '-f', desc: 'Specify the location of the main.db file'
|
|
54
57
|
method_option :to, aliases: '-t', desc: 'Specify where to put export files'
|
|
58
|
+
method_option :archive, aliases: '-a', type: :boolean, default: true,
|
|
59
|
+
desc: 'Specify whether to save files in a Zip archive'
|
|
55
60
|
|
|
56
61
|
# Public: Exports specified chats from the Skype database.
|
|
57
62
|
#
|
|
@@ -68,12 +73,13 @@ module Runoff
|
|
|
68
73
|
chatnames, raw_chatnames = composition.get_chatnames
|
|
69
74
|
|
|
70
75
|
list_chatnames chatnames
|
|
71
|
-
indecies = ask
|
|
76
|
+
indecies = ask 'Which chats do you want to export? (Enter indecies) '
|
|
72
77
|
indecies = indecies.split.map { |index| index.to_i }
|
|
73
78
|
selected_chatnames = []
|
|
74
79
|
|
|
75
80
|
indecies.each { |index| selected_chatnames << raw_chatnames[index] }
|
|
76
81
|
print_result composition.export_chats(selected_chatnames, destination)
|
|
82
|
+
try_to_archive composition, destination
|
|
77
83
|
|
|
78
84
|
rescue IOError => e
|
|
79
85
|
puts e
|
|
@@ -113,7 +119,7 @@ module Runoff
|
|
|
113
119
|
#
|
|
114
120
|
# Returns a String containing a path to the destination directory.
|
|
115
121
|
def get_destination
|
|
116
|
-
options[:to] || Location.home_path
|
|
122
|
+
options[:to] || "#{Location.home_path}/skype-backup"
|
|
117
123
|
end
|
|
118
124
|
|
|
119
125
|
# Internal: Informs the user that the application has finished running.
|
|
@@ -126,7 +132,7 @@ module Runoff
|
|
|
126
132
|
# # => Finished: 4 files were exported
|
|
127
133
|
def print_result(count)
|
|
128
134
|
if count == 1
|
|
129
|
-
puts
|
|
135
|
+
puts 'Finished: 1 file was exported'
|
|
130
136
|
elsif count > 1
|
|
131
137
|
puts "Finished: #{count} files were exported"
|
|
132
138
|
end
|
|
@@ -145,5 +151,21 @@ module Runoff
|
|
|
145
151
|
chatnames.each_with_index { |n, i| puts "[#{i}] #{n}" }
|
|
146
152
|
puts
|
|
147
153
|
end
|
|
154
|
+
|
|
155
|
+
# Internal: performs archiving if an --archive option is provided
|
|
156
|
+
#
|
|
157
|
+
# composition - A Compositon object
|
|
158
|
+
# destination - A String containing a path to the export directory.
|
|
159
|
+
#
|
|
160
|
+
# Examples
|
|
161
|
+
#
|
|
162
|
+
# try_to_archive composition, '/home/username/skype-backup'
|
|
163
|
+
def try_to_archive(composition, destination)
|
|
164
|
+
if options[:archive]
|
|
165
|
+
composition.archive destination
|
|
166
|
+
end
|
|
167
|
+
rescue StandardError
|
|
168
|
+
puts 'Faild to create an archive'
|
|
169
|
+
end
|
|
148
170
|
end
|
|
149
171
|
end
|
data/lib/runoff/version.rb
CHANGED
data/runoff.gemspec
CHANGED
|
@@ -9,22 +9,22 @@ describe Runoff::Composition do
|
|
|
9
9
|
->{ composition = Runoff::Composition.new 'not_existing.db' }.must_raise IOError
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
it
|
|
12
|
+
it 'must have a getter method for exported filenames' do
|
|
13
13
|
@composition.must_respond_to :exported_filenames
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
it
|
|
16
|
+
it 'must return parsed chatnames together with partly parsed chatnames' do
|
|
17
17
|
chatnames, raw_chatnames = @composition.get_chatnames
|
|
18
18
|
|
|
19
19
|
chatnames.must_equal ['something-more', 'something-else']
|
|
20
20
|
raw_chatnames.must_equal ['#something/$more;', '#something/$else;']
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
it
|
|
23
|
+
it 'must have a save_to_file method' do
|
|
24
24
|
@composition.must_respond_to :save_to_file
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
it
|
|
27
|
+
it 'must return a count of the exported filenames' do
|
|
28
28
|
file_count = @composition.send(
|
|
29
29
|
:run_export,
|
|
30
30
|
[{
|
|
@@ -40,14 +40,14 @@ describe Runoff::Composition do
|
|
|
40
40
|
FileUtils.rm_rf 'test/tmp/.'
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
it
|
|
43
|
+
it 'must return a count of the exported filenames when called for all chats' do
|
|
44
44
|
file_count = @composition.export 'test/tmp'
|
|
45
45
|
|
|
46
46
|
file_count.must_equal 2
|
|
47
47
|
FileUtils.rm_rf 'test/tmp/.'
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
it
|
|
50
|
+
it 'must return a count of the exported filenames when called for specific chats' do
|
|
51
51
|
file_count = @composition.export_chats ['#something/$more;', '#something/$else;'], 'test/tmp'
|
|
52
52
|
|
|
53
53
|
file_count.must_equal 2
|
|
@@ -6,15 +6,15 @@ describe Runoff::FileWriter do
|
|
|
6
6
|
before do
|
|
7
7
|
@incorrect_chat_record = {
|
|
8
8
|
chatname: '#something/$;521357125362',
|
|
9
|
-
timestamp:
|
|
9
|
+
timestamp: 1366280218,
|
|
10
10
|
from_dispname: 'Aidzis',
|
|
11
11
|
body_xml: ''
|
|
12
12
|
}
|
|
13
13
|
@chat_record = {
|
|
14
14
|
chatname: '#something/$more;521357125362',
|
|
15
|
-
timestamp:
|
|
15
|
+
timestamp: 1366280218,
|
|
16
16
|
from_dispname: 'Aidzis',
|
|
17
|
-
body_xml: ''
|
|
17
|
+
body_xml: 'This is a text.'
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
class ClassWithFileWriterMixin
|
|
@@ -24,64 +24,92 @@ describe Runoff::FileWriter do
|
|
|
24
24
|
@test_object = ClassWithFileWriterMixin.new
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
it
|
|
27
|
+
it 'must return a string without Skype emotion XML tags' do
|
|
28
28
|
string = 'Some text <ss type="laugh">:D</ss>'
|
|
29
29
|
clean_string = @test_object.parse_body_xml string
|
|
30
30
|
|
|
31
31
|
clean_string.must_equal 'Some text :D'
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
it
|
|
35
|
-
string =
|
|
34
|
+
it 'must remove all starting and ending dashes from a string' do
|
|
35
|
+
string = '---example--'
|
|
36
36
|
valid_name = @test_object.trim_dashes string
|
|
37
37
|
|
|
38
38
|
valid_name.must_equal 'example'
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
it
|
|
41
|
+
it 'must return a valid and readable name from a raw chatname' do
|
|
42
42
|
raw_chatname = '#something/$else;521357125362'
|
|
43
43
|
chatname = @test_object.parse_chatname raw_chatname
|
|
44
44
|
|
|
45
45
|
chatname.must_equal 'something-else'
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
it
|
|
48
|
+
it 'must return a valid and readable name from broken chatname records' do
|
|
49
49
|
raw_chatname = '#something/$521357125362'
|
|
50
50
|
chatname = @test_object.parse_chatname raw_chatname
|
|
51
51
|
|
|
52
52
|
chatname.must_equal 'something'
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
it
|
|
55
|
+
it 'must return a chatname without the extra symbols' do
|
|
56
56
|
raw_chatname = '#something/$else;521357125362'
|
|
57
57
|
chatname = @test_object.partly_parse_chatname raw_chatname
|
|
58
58
|
|
|
59
59
|
chatname.must_equal '#something/$else;'
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
it
|
|
62
|
+
it 'must return a chatname without the extra symbols for broken chatname records' do
|
|
63
63
|
raw_chatname = '#something/$521357125362'
|
|
64
64
|
chatname = @test_object.partly_parse_chatname raw_chatname
|
|
65
65
|
|
|
66
66
|
chatname.must_equal '#something/$'
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
+
it 'must build a chat entry from a database record' do
|
|
70
|
+
entry = @test_object.build_entry @chat_record
|
|
71
|
+
|
|
72
|
+
entry.must_equal '[2013-04-18 13:16:58] Aidzis: This is a text.'
|
|
73
|
+
end
|
|
74
|
+
|
|
69
75
|
describe "#save_to_file" do
|
|
70
|
-
after
|
|
76
|
+
after do
|
|
77
|
+
FileUtils.rm_rf 'test/tmp/.'
|
|
78
|
+
Dir.glob('test/*.zip').each do |archive|
|
|
79
|
+
File.delete archive
|
|
80
|
+
end
|
|
81
|
+
end
|
|
71
82
|
|
|
72
|
-
it
|
|
83
|
+
it 'must write chat content to file' do
|
|
73
84
|
@test_object.save_to_file @chat_record, 'test/tmp'
|
|
74
85
|
@test_object.save_to_file @incorrect_chat_record, 'test/tmp'
|
|
75
|
-
Dir[
|
|
86
|
+
Dir['test/tmp/**/*'].length.must_equal 2
|
|
76
87
|
end
|
|
77
88
|
|
|
78
|
-
it
|
|
89
|
+
it 'must append to a file if the filename already exists' do
|
|
79
90
|
@additional_chat_record = @chat_record
|
|
80
91
|
|
|
81
92
|
@test_object.save_to_file @chat_record, 'test/tmp'
|
|
82
93
|
@test_object.save_to_file @incorrect_chat_record, 'test/tmp'
|
|
83
94
|
@test_object.save_to_file @additional_chat_record, 'test/tmp'
|
|
84
|
-
Dir[
|
|
95
|
+
Dir['test/tmp/**/*'].length.must_equal 2
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it 'must create a Zip file of the file output directory' do
|
|
100
|
+
output_directory = 'test/tmp'
|
|
101
|
+
files = %w[first.txt second.txt]
|
|
102
|
+
|
|
103
|
+
Dir.mkdir(output_directory) unless File.exists?(output_directory)
|
|
104
|
+
files.each do |filename|
|
|
105
|
+
File.new "#{output_directory}/#{filename}", 'w'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
@test_object.archive output_directory
|
|
109
|
+
Dir["test/*.zip"].length.must_equal 1
|
|
110
|
+
|
|
111
|
+
Dir.glob('test/*.zip').each do |archive|
|
|
112
|
+
File.delete archive
|
|
85
113
|
end
|
|
86
114
|
end
|
|
87
115
|
end
|
|
@@ -4,7 +4,7 @@ require 'runoff'
|
|
|
4
4
|
|
|
5
5
|
describe Runoff::Location do
|
|
6
6
|
describe '.default_skype_data_location' do
|
|
7
|
-
it
|
|
7
|
+
it 'must return a default path depending on the operating system' do
|
|
8
8
|
path = Runoff::Location.default_skype_data_location 'aidzis_skype'
|
|
9
9
|
|
|
10
10
|
if RbConfig::CONFIG['host_os'] =~ /mingw/
|
|
@@ -17,8 +17,8 @@ describe Runoff::Location do
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
describe
|
|
21
|
-
it
|
|
20
|
+
describe '.home_path' do
|
|
21
|
+
it 'must return a path to the user home directory depending on the operating system' do
|
|
22
22
|
path = Runoff::Location.home_path
|
|
23
23
|
|
|
24
24
|
if RbConfig::CONFIG['host_os'] =~ /mingw/
|
data/test/runoff_source_test.rb
CHANGED
|
@@ -3,11 +3,33 @@ require 'minitest/autorun'
|
|
|
3
3
|
require 'runoff'
|
|
4
4
|
|
|
5
5
|
describe Runoff::Source do
|
|
6
|
-
|
|
6
|
+
before { @source = Runoff::Source.new }
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
after do
|
|
9
|
+
FileUtils.rm_rf 'test/tmp/.'
|
|
10
|
+
Dir.glob('test/*.zip').each do |archive|
|
|
11
|
+
File.delete archive
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'must export all the chats from a Skype database into text files and print a count of the exported files' do
|
|
16
|
+
command = 'all -f test/test_db.sqlite -t test/tmp'
|
|
10
17
|
|
|
11
18
|
->{ Runoff::Source.start command.split }.must_output "Finished: 2 files were exported\n"
|
|
12
19
|
end
|
|
20
|
+
|
|
21
|
+
it 'must raise a StandardError if no Skype username or --form option is provided' do
|
|
22
|
+
->{ @source.send :get_composition, nil }.must_raise StandardError
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'must print how many files were exported' do
|
|
26
|
+
->{ @source.send :print_result, 1 }.must_output "Finished: 1 file was exported\n"
|
|
27
|
+
->{ @source.send :print_result, 5 }.must_output "Finished: 5 files were exported\n"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'must print all available chatnames' do
|
|
31
|
+
chatnames = ['something-more', 'something-else']
|
|
32
|
+
|
|
33
|
+
->{ @source.send :list_chatnames, chatnames }.must_output "[0] something-more\n[1] something-else\n\n"
|
|
34
|
+
end
|
|
13
35
|
end
|
metadata
CHANGED
|
@@ -1,86 +1,69 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runoff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aigars Dzerviniks
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
|
-
cert_chain:
|
|
11
|
-
-
|
|
12
|
-
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURuakNDQW9hZ0F3SUJB
|
|
13
|
-
Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREJLTVJvd0dBWURWUVFEREJGa2Vt
|
|
14
|
-
VnkKZG1sdWFXdHpMbUZwWjJGeWN6RVhNQlVHQ2dtU0pvbVQ4aXhrQVJrV0Iy
|
|
15
|
-
OTFkR3h2YjJzeEV6QVJCZ29Ka2lhSgprL0lzWkFFWkZnTmpiMjB3SGhjTk1U
|
|
16
|
-
TXdNekkxTVRjek9EVTRXaGNOTVRRd016STFNVGN6T0RVNFdqQktNUm93CkdB
|
|
17
|
-
WURWUVFEREJGa2VtVnlkbWx1YVd0ekxtRnBaMkZ5Y3pFWE1CVUdDZ21TSm9t
|
|
18
|
-
VDhpeGtBUmtXQjI5MWRHeHYKYjJzeEV6QVJCZ29Ka2lhSmsvSXNaQUVaRmdO
|
|
19
|
-
amIyMHdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBdwpnZ0VLQW9J
|
|
20
|
-
QkFRQzBXYXJpYUl6cmpkU3pBY1VNNGs3a1VmWkdrNFMxZWFIY2J5OTdhRHV0
|
|
21
|
-
QjNGTnp5Q3VGZnhVCjdQdndyR29aS0FGVEY1Mnc5aitKeDljV0FPbzlaTENz
|
|
22
|
-
ZmJKd040ZjdrTVM4emRYVWJ0d3ovL0V4NnNacG9vZE4KZENnSUM2TXJvUXdL
|
|
23
|
-
L3ZjNXExYi90ZVdTNFFCNElmcEVqNlJZYjhRYUptWjBJR252aXJmWE9wVlh5
|
|
24
|
-
N05ISXdmVApTc0R5dGFCRTFzaVAwZ3g0YTlpNVNaTjVHM1UydmJFbmE5aDI3
|
|
25
|
-
OC9nOVdsSnFCN1ZrcW9YTi9zeUE4L1VIeHVlClcvS1lGVDFXZ2xpR0l3aXhs
|
|
26
|
-
K0FJeVFwNGxscEJsOUgzbnU3ZFN2bmRyOVVIUmRsa3pZeEZWM0ZjM0V1cnBp
|
|
27
|
-
UE0KT1BTanpJL0c4V3hJYWkrVWVaY2lERjFJc1lpNXRhY0hBZ01CQUFHamdZ
|
|
28
|
-
NHdnWXN3Q1FZRFZSMFRCQUl3QURBTApCZ05WSFE4RUJBTUNCTEF3SFFZRFZS
|
|
29
|
-
ME9CQllFRkhDSmZLQ3V0ZkhETGdmMUpLak9WNnVHTHVqTE1DZ0dBMVVkCkVR
|
|
30
|
-
UWhNQitCSFdSNlpYSjJhVzVwYTNNdVlXbG5ZWEp6UUc5MWRHeHZiMnN1WTI5
|
|
31
|
-
dE1DZ0dBMVVkRWdRaE1CK0IKSFdSNlpYSjJhVzVwYTNNdVlXbG5ZWEp6UUc5
|
|
32
|
-
MWRHeHZiMnN1WTI5dE1BMEdDU3FHU0liM0RRRUJCUVVBQTRJQgpBUUNudHBP
|
|
33
|
-
UXZveDhUVlN3d1h5MXFDMnVadnZQNTV6WjZoeHl6emJIZFJxd0FBT25zc2ZB
|
|
34
|
-
VkFaSGlYVGZMZFFPCjg3Z3lMYk81YlZRa0dOa3laemRWTWJjNTlhNEg2ZEtT
|
|
35
|
-
cjZBbWNDdGIvdGYrWldqR1U3b0F2UkZuWVJ3aGlyRkwKWThNTDNVZEQyVGdE
|
|
36
|
-
REFYQU9IS1Vsc3E2dEtsVTFORXNMdjFCUkJOa0xQbzI1WHlFU1R6SlRWM2M4
|
|
37
|
-
ZkluNmlLcgpaL3BOenhBZDlSN29TOExDZlhhTGhQeG85dkVyVVZLd3Q2NHpk
|
|
38
|
-
YUtiQUNrampabkNab2VhaGxPd2dzVnN5bDBvCjQ0aXhMbXE0dTE1a0grUFRr
|
|
39
|
-
dHFPWFp1ck5FWmdTMlRSWG5GRG9TWmRtT3IxMjM2ZS9SNTBzc1dlR0dIUUox
|
|
40
|
-
V2wKN2ZZbFZpQThPY2Z3aGdyaDcyc05mVHpTCi0tLS0tRU5EIENFUlRJRklD
|
|
41
|
-
QVRFLS0tLS0K
|
|
42
|
-
date: 2013-04-03 00:00:00.000000000 Z
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2013-04-27 00:00:00.000000000 Z
|
|
43
12
|
dependencies:
|
|
44
13
|
- !ruby/object:Gem::Dependency
|
|
45
14
|
name: thor
|
|
46
15
|
requirement: !ruby/object:Gem::Requirement
|
|
47
16
|
requirements:
|
|
48
|
-
- -
|
|
17
|
+
- - '>='
|
|
49
18
|
- !ruby/object:Gem::Version
|
|
50
19
|
version: '0'
|
|
51
20
|
type: :runtime
|
|
52
21
|
prerelease: false
|
|
53
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
23
|
requirements:
|
|
55
|
-
- -
|
|
24
|
+
- - '>='
|
|
56
25
|
- !ruby/object:Gem::Version
|
|
57
26
|
version: '0'
|
|
58
27
|
- !ruby/object:Gem::Dependency
|
|
59
28
|
name: sqlite3
|
|
60
29
|
requirement: !ruby/object:Gem::Requirement
|
|
61
30
|
requirements:
|
|
62
|
-
- -
|
|
31
|
+
- - '>='
|
|
63
32
|
- !ruby/object:Gem::Version
|
|
64
33
|
version: '0'
|
|
65
34
|
type: :runtime
|
|
66
35
|
prerelease: false
|
|
67
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
68
37
|
requirements:
|
|
69
|
-
- -
|
|
38
|
+
- - '>='
|
|
70
39
|
- !ruby/object:Gem::Version
|
|
71
40
|
version: '0'
|
|
72
41
|
- !ruby/object:Gem::Dependency
|
|
73
42
|
name: sequel
|
|
74
43
|
requirement: !ruby/object:Gem::Requirement
|
|
75
44
|
requirements:
|
|
76
|
-
- -
|
|
45
|
+
- - '>='
|
|
77
46
|
- !ruby/object:Gem::Version
|
|
78
47
|
version: '0'
|
|
79
48
|
type: :runtime
|
|
80
49
|
prerelease: false
|
|
81
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
82
51
|
requirements:
|
|
83
|
-
- -
|
|
52
|
+
- - '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rubyzip
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '>='
|
|
84
67
|
- !ruby/object:Gem::Version
|
|
85
68
|
version: '0'
|
|
86
69
|
description: runoff provides functionality to export all the Skype chat history or
|
|
@@ -98,7 +81,6 @@ files:
|
|
|
98
81
|
- README.md
|
|
99
82
|
- Rakefile
|
|
100
83
|
- bin/runoff
|
|
101
|
-
- gem-public_cert.pem
|
|
102
84
|
- lib/runoff.rb
|
|
103
85
|
- lib/runoff/composition.rb
|
|
104
86
|
- lib/runoff/file_writer.rb
|
|
@@ -121,17 +103,17 @@ require_paths:
|
|
|
121
103
|
- lib
|
|
122
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
105
|
requirements:
|
|
124
|
-
- -
|
|
106
|
+
- - '>='
|
|
125
107
|
- !ruby/object:Gem::Version
|
|
126
108
|
version: '0'
|
|
127
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
110
|
requirements:
|
|
129
|
-
- -
|
|
111
|
+
- - '>='
|
|
130
112
|
- !ruby/object:Gem::Version
|
|
131
113
|
version: '0'
|
|
132
114
|
requirements: []
|
|
133
115
|
rubyforge_project:
|
|
134
|
-
rubygems_version: 2.0.
|
|
116
|
+
rubygems_version: 2.0.0
|
|
135
117
|
signing_key:
|
|
136
118
|
specification_version: 4
|
|
137
119
|
summary: Tool to export Skype chat history from the SQLite database to text files
|
checksums.yaml.gz.sig
DELETED
|
Binary file
|
data/gem-public_cert.pem
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
|
2
|
-
MIIDnjCCAoagAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMRowGAYDVQQDDBFkemVy
|
|
3
|
-
dmluaWtzLmFpZ2FyczEXMBUGCgmSJomT8ixkARkWB291dGxvb2sxEzARBgoJkiaJ
|
|
4
|
-
k/IsZAEZFgNjb20wHhcNMTMwMzI1MTczODU4WhcNMTQwMzI1MTczODU4WjBKMRow
|
|
5
|
-
GAYDVQQDDBFkemVydmluaWtzLmFpZ2FyczEXMBUGCgmSJomT8ixkARkWB291dGxv
|
|
6
|
-
b2sxEzARBgoJkiaJk/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
|
|
7
|
-
ggEKAoIBAQC0WariaIzrjdSzAcUM4k7kUfZGk4S1eaHcby97aDutB3FNzyCuFfxU
|
|
8
|
-
7PvwrGoZKAFTF52w9j+Jx9cWAOo9ZLCsfbJwN4f7kMS8zdXUbtwz//Ex6sZpoodN
|
|
9
|
-
dCgIC6MroQwK/vc5q1b/teWS4QB4IfpEj6RYb8QaJmZ0IGnvirfXOpVXy7NHIwfT
|
|
10
|
-
SsDytaBE1siP0gx4a9i5SZN5G3U2vbEna9h278/g9WlJqB7VkqoXN/syA8/UHxue
|
|
11
|
-
W/KYFT1WgliGIwixl+AIyQp4llpBl9H3nu7dSvndr9UHRdlkzYxFV3Fc3EurpiPM
|
|
12
|
-
OPSjzI/G8WxIai+UeZciDF1IsYi5tacHAgMBAAGjgY4wgYswCQYDVR0TBAIwADAL
|
|
13
|
-
BgNVHQ8EBAMCBLAwHQYDVR0OBBYEFHCJfKCutfHDLgf1JKjOV6uGLujLMCgGA1Ud
|
|
14
|
-
EQQhMB+BHWR6ZXJ2aW5pa3MuYWlnYXJzQG91dGxvb2suY29tMCgGA1UdEgQhMB+B
|
|
15
|
-
HWR6ZXJ2aW5pa3MuYWlnYXJzQG91dGxvb2suY29tMA0GCSqGSIb3DQEBBQUAA4IB
|
|
16
|
-
AQCntpOQvox8TVSwwXy1qC2uZvvP55zZ6hxyzzbHdRqwAAOnssfAVAZHiXTfLdQO
|
|
17
|
-
87gyLbO5bVQkGNkyZzdVMbc59a4H6dKSr6AmcCtb/tf+ZWjGU7oAvRFnYRwhirFL
|
|
18
|
-
Y8ML3UdD2TgDDAXAOHKUlsq6tKlU1NEsLv1BRBNkLPo25XyESTzJTV3c8fIn6iKr
|
|
19
|
-
Z/pNzxAd9R7oS8LCfXaLhPxo9vErUVKwt64zdaKbACkjjZnCZoeahlOwgsVsyl0o
|
|
20
|
-
44ixLmq4u15kH+PTktqOXZurNEZgS2TRXnFDoSZdmOr1236e/R50ssWeGGHQJ1Wl
|
|
21
|
-
7fYlViA8Ocfwhgrh72sNfTzS
|
|
22
|
-
-----END CERTIFICATE-----
|
data.tar.gz.sig
DELETED
|
Binary file
|
metadata.gz.sig
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a�HHV�5���e�̪��͡�f�8G���d�����9�bK�n aQ���#6�8�Yt�%0|��M��7D"�[F� _J�jh"��Y���%����B��pBa"ukkh�,�t� ���vJ1�Fw�ih+�\�J���{��4�7�Ai��c�m�|=���ɼ�Dq|���
|