downloads_sorter 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/downloads_sorter.gemspec +1 -1
- data/lib/downloads_sorter.rb +3 -2
- data/test/download_sorter_test.rb +5 -4
- metadata +2 -3
- data/lib/downloads_sorter/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88676a8201e39b9211c483c4c2f1e16be6764ba8
|
4
|
+
data.tar.gz: 33091d22e15617312bdb0603b64c7e8fcc2f4a5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 306cf80dbe15470ea6fdc8d1b9ed81302a8537d2058163054158550fdbbb25d015a969f75ad28d286c50bf527d2e0affab52d461a56a52c443f79fbb0bb14162
|
7
|
+
data.tar.gz: 64ac116f2ff6bfc00c161525dd22458e9c573b8d8d8622fb1c60f5b4bc04ef3ae30fc5b438f9d9c245946095f7c220aea5a6517351c7f8208d6a0cb99f540a52
|
data/downloads_sorter.gemspec
CHANGED
data/lib/downloads_sorter.rb
CHANGED
@@ -2,14 +2,15 @@ require 'fileutils'
|
|
2
2
|
class NoPathError < Exception; end;
|
3
3
|
|
4
4
|
class DownloadsSorter
|
5
|
-
VERSION = "0.0.
|
5
|
+
VERSION = "0.0.2"
|
6
6
|
PATH = File.join(Dir.home, "Downloads")
|
7
7
|
Images = %w{ *.jpg *.png *.jpeg}
|
8
8
|
Documents = %w{ *.pdf *.doc *.docx *.txt}
|
9
9
|
Audio = %w{ *.mp3 }
|
10
10
|
Books = %w{ *.epub }
|
11
11
|
Apps = %w{ *.dmg }
|
12
|
-
|
12
|
+
Archives = %w{ .zip .tar .gzip}
|
13
|
+
SUB_DIRS = %w{ Images Documents Audio Books Apps Archives}
|
13
14
|
|
14
15
|
|
15
16
|
attr_reader :dir_path
|
@@ -15,15 +15,15 @@ class DownloadsSorterTest < MiniTest::Test
|
|
15
15
|
|
16
16
|
def teardown
|
17
17
|
Dir.chdir(TEST_PATH) do
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
DownloadsSorter::SUB_DIRS.each do |dir|
|
19
|
+
`rm -rf #{dir}` if Dir.exists?(dir)
|
20
|
+
end
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
def seed_folder
|
25
25
|
Dir.chdir(TEST_PATH) do
|
26
|
-
%w{ file1.png file2.pdf file3.jpeg file4.txt file5.docx file6.xlsx file7.csv file.dump file.mp3 file.mp4 }.each do |file|
|
26
|
+
%w{ file1.png file2.pdf file3.jpeg file4.txt file5.docx file6.xlsx file7.csv file.dump file.mp3 file.mp4 test.zip }.each do |file|
|
27
27
|
File.new(file, 'w+')
|
28
28
|
end
|
29
29
|
end
|
@@ -43,6 +43,7 @@ class DownloadsSorterTest < MiniTest::Test
|
|
43
43
|
ds.sort
|
44
44
|
assert(true, File.exists?("tmp/Downloads/Images/file1.png"))
|
45
45
|
assert(true, File.exists?("tmp/Downloads/Documents/file5.docx"))
|
46
|
+
assert(true, File.exists?("tmp/Downloads/Archives/test.zip"))
|
46
47
|
Dir.chdir(TEST_PATH) do
|
47
48
|
assert(1, Dir.glob("*").count)
|
48
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: downloads_sorter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kavinder Dhaliwal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -54,7 +54,6 @@ files:
|
|
54
54
|
- bin/dl_sort
|
55
55
|
- downloads_sorter.gemspec
|
56
56
|
- lib/downloads_sorter.rb
|
57
|
-
- lib/downloads_sorter/version.rb
|
58
57
|
- test/download_sorter_test.rb
|
59
58
|
homepage: ''
|
60
59
|
licenses:
|