runoff 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/lib/runoff/file_writer.rb +1 -1
- data/lib/runoff/location.rb +27 -17
- data/lib/runoff/version.rb +1 -1
- data/test/location_test.rb +14 -8
- 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: 30527da833e016b926ae2d4690df9d977dc7c0eb
|
4
|
+
data.tar.gz: 36ea0b94d751a0a127c4e4db3d8024d357f517be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d1de800329cb5cac9bea6503adea06c7aec4769691f8cfabdf6e60c113f8265aea4145f2c28b8c761462ea06f90971d17611473576d5045d996b80b0bb6b005
|
7
|
+
data.tar.gz: 45bd434c446a6410cf77ffc34291e31a7a0e259c99e8ec9cd1173e2ca3ca1e24678953f7f4c65b7eb7bd93909863cadd335b0871d2c2874c2a1c277e0475743c
|
data/README.md
CHANGED
@@ -36,6 +36,5 @@ Things to do in the future versions:
|
|
36
36
|
|
37
37
|
- Parse body_xml to filter XML tags and character entities.
|
38
38
|
- Append only new messages to the previously genetrated files instead of appending everything or create different versions for the files when using `-a false` option.
|
39
|
-
- Add some colors.
|
40
39
|
|
41
40
|
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/lib/runoff/file_writer.rb
CHANGED
data/lib/runoff/location.rb
CHANGED
@@ -25,16 +25,14 @@ module Runoff
|
|
25
25
|
#
|
26
26
|
# Returns a String that contains the path to the Skype database file.
|
27
27
|
def self.default_skype_data_location(skype_username)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
case RbConfig::CONFIG['host_os']
|
29
|
+
when /mingw/
|
30
|
+
if File.exist?("#{ENV['APPDATA']}\\Skype")
|
31
|
+
format_windows_path "#{ENV['APPDATA']}\\Skype\\#{skype_username}\\main.db"
|
32
|
+
else
|
33
|
+
format_windows_path self.get_default_skype_data_location_on_windows_8(skype_username)
|
33
34
|
end
|
34
|
-
|
35
|
-
location.gsub!(/\\/, '/')
|
36
|
-
location.gsub(/^[a-zA-Z]:/, '')
|
37
|
-
elsif RbConfig::CONFIG['host_os'] =~ /linux/
|
35
|
+
when /linux/
|
38
36
|
"#{ENV['HOME']}/.Skype/#{skype_username}/main.db"
|
39
37
|
else
|
40
38
|
"#{ENV['HOME']}/Library/Application Support/Skype/#{skype_username}/main.db"
|
@@ -43,7 +41,22 @@ module Runoff
|
|
43
41
|
|
44
42
|
private
|
45
43
|
|
46
|
-
#
|
44
|
+
# Internal: Replaces backslashes with forward slashes and removes drive letter.
|
45
|
+
#
|
46
|
+
# path - String containing a directory path.
|
47
|
+
#
|
48
|
+
# Examples
|
49
|
+
#
|
50
|
+
# format_windows_path 'C:\Users\username\AppData\Roaming\Skype\skype_username\main.db'
|
51
|
+
# # => /Users/username/AppData/ROaming/Skype/skype_username/main.db
|
52
|
+
#
|
53
|
+
# Returns a String with modified directory path.
|
54
|
+
def self.format_windows_path(path)
|
55
|
+
path = path.gsub(/\\/, '/')
|
56
|
+
path.gsub(/^[a-zA-Z]:/, '')
|
57
|
+
end
|
58
|
+
|
59
|
+
# Internal: Composes the default Skype database location for the Windows 8 operating system.
|
47
60
|
#
|
48
61
|
# skype_username - A String that contains a username of the Skype account,
|
49
62
|
# which database we want to access.
|
@@ -56,14 +69,11 @@ module Runoff
|
|
56
69
|
# Returns a String that contains the path to the Skype database file.
|
57
70
|
def self.get_default_skype_data_location_on_windows_8(skype_username)
|
58
71
|
location = "#{ENV['HOME']}/AppData/Local/Packages"
|
72
|
+
skype_folder = Dir["#{location}/Microsoft.SkypeApp*"].first
|
59
73
|
|
60
|
-
|
61
|
-
if item =~ /Microsoft\.SkypeApp/
|
62
|
-
location = "#{item}/LocalState/#{skype_username}/main.db"
|
63
|
-
end
|
64
|
-
end
|
74
|
+
raise IOError.new "The default Skype directory doesn't exist." unless skype_folder
|
65
75
|
|
66
|
-
|
76
|
+
"#{skype_folder}/LocalState/#{skype_username}/main.db"
|
67
77
|
end
|
68
78
|
end
|
69
|
-
end
|
79
|
+
end
|
data/lib/runoff/version.rb
CHANGED
data/test/location_test.rb
CHANGED
@@ -3,21 +3,27 @@ require 'minitest/unit'
|
|
3
3
|
require 'runoff'
|
4
4
|
|
5
5
|
class TestLocation < MiniTest::Test
|
6
|
-
def setup
|
7
|
-
@path = Runoff::Location.default_skype_data_location 'aidzis_skype'
|
8
|
-
end
|
9
|
-
|
10
6
|
def test_must_return_a_default_path_depending_on_the_operating_system
|
7
|
+
path = Runoff::Location.default_skype_data_location 'aidzis_skype'
|
8
|
+
|
11
9
|
if RbConfig::CONFIG['host_os'] =~ /mingw/
|
10
|
+
skip
|
12
11
|
if File.exist?("#{ENV['APPDATA']}\\Skype")
|
13
|
-
assert_match /\/Users\/[a-zA-Z0-9]+\/AppData\/Roaming\/Skype\/aidzis_skype\/main\.db/,
|
12
|
+
assert_match /\/Users\/[a-zA-Z0-9]+\/AppData\/Roaming\/Skype\/aidzis_skype\/main\.db/, path
|
14
13
|
else
|
15
|
-
assert_match /\/Users\/[a-zA-Z0-9]+\/AppData\/Local\/Packages\/[a-zA-Z0-9_\/\.]+\/aidzis_skype\/main\.db/,
|
14
|
+
assert_match /\/Users\/[a-zA-Z0-9]+\/AppData\/Local\/Packages\/[a-zA-Z0-9_\/\.]+\/aidzis_skype\/main\.db/, path
|
16
15
|
end
|
17
16
|
elsif RbConfig::CONFIG['host_os'] =~ /linux/
|
18
|
-
assert_match /\/home\/[a-zA-Z0-9]+\/\.Skype\/aidzis_skype\/main\.db/,
|
17
|
+
assert_match /\/home\/[a-zA-Z0-9]+\/\.Skype\/aidzis_skype\/main\.db/, path
|
19
18
|
else
|
20
|
-
assert_match /~\/Library\/Application Support\/Skype\/aidzis_skype\/main\.db/,
|
19
|
+
assert_match /~\/Library\/Application Support\/Skype\/aidzis_skype\/main\.db/, path
|
21
20
|
end
|
22
21
|
end
|
22
|
+
|
23
|
+
def test_must_replace_backslashes_with_forward_slashes_and_remowe_drive_letter
|
24
|
+
windows_path = 'C:\\Users\\user\\AppData\\Roaming\\Skype'
|
25
|
+
unix_style_path = Runoff::Location.send :format_windows_path, windows_path
|
26
|
+
|
27
|
+
assert_equal '/Users/user/AppData/Roaming/Skype', unix_style_path
|
28
|
+
end
|
23
29
|
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: 0.3.
|
4
|
+
version: 0.3.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: 2013-
|
11
|
+
date: 2013-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -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.
|
122
|
+
rubygems_version: 2.0.3
|
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
|