fos 1.0.2 → 1.0.3
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.
- data/README.md +7 -2
- data/lib/fos.rb +37 -51
- data/lib/fos/version.rb +1 -1
- metadata +18 -12
- checksums.yaml +0 -7
data/README.md
CHANGED
data/lib/fos.rb
CHANGED
|
@@ -4,61 +4,47 @@ module Fos
|
|
|
4
4
|
class Action
|
|
5
5
|
def move
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# General Variables
|
|
8
8
|
username = File.expand_path('~')
|
|
9
9
|
folder = "archive" # New Folder Name
|
|
10
|
-
|
|
11
|
-
#System Paths
|
|
12
|
-
desktop = "#{username}/Desktop"
|
|
13
|
-
downloads = "#{username}/Downloads"
|
|
14
10
|
today = Time.now.strftime("%B %e %Y").gsub(' ', '_').gsub(/:.*/, '')
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
download_files.delete_if{|x| (x =~ /^\./) == 0 }
|
|
51
|
-
download_files.delete_if{|x| x == "#{folder}"}
|
|
52
|
-
download_files.delete_if{|x| (x =~ /Macintosh/) == 0}
|
|
53
|
-
|
|
54
|
-
# Clean File names
|
|
55
|
-
download_files = download_files.map{|x| x.gsub(" ", '\ ').gsub("(", '\(').gsub(")", '\)')}
|
|
56
|
-
|
|
57
|
-
# Do The Moving
|
|
58
|
-
download_files.each do |filename|
|
|
59
|
-
`mv #{downloads}/#{filename} #{downloads}/#{folder}/#{today}`
|
|
11
|
+
default_folders = ['Desktop', 'Downloads']
|
|
12
|
+
|
|
13
|
+
# Do for each folder
|
|
14
|
+
default_folders.each do |this_folder|
|
|
15
|
+
|
|
16
|
+
# Get Path
|
|
17
|
+
current_path = "#{username}/#{this_folder}"
|
|
18
|
+
|
|
19
|
+
# Get Files
|
|
20
|
+
current_files = Dir.entries(current_path)
|
|
21
|
+
|
|
22
|
+
# Create Folders
|
|
23
|
+
if !File.directory?("#{current_path}/#{folder}")
|
|
24
|
+
`mkdir #{current_path}/#{folder}`
|
|
25
|
+
end
|
|
26
|
+
if !File.directory?("#{current_path}/#{folder}/#{today}")
|
|
27
|
+
`mkdir #{current_path}/#{folder}/#{today}`
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Remove System Folders And Our New Folder
|
|
31
|
+
current_files.delete_if{|x| (x =~ /^\./) == 0 }
|
|
32
|
+
current_files.delete_if{|x| x == "#{folder}"}
|
|
33
|
+
current_files.delete_if{|x| (x =~ /Macintosh/) == 0}
|
|
34
|
+
|
|
35
|
+
# Clean File names
|
|
36
|
+
current_files = current_files.map{|x| x.gsub(" ", '\ ').gsub("(", '\(').gsub(")", '\)')}
|
|
37
|
+
|
|
38
|
+
# Do The Moving
|
|
39
|
+
current_files.each do |filename|
|
|
40
|
+
`mv #{current_path}/#{filename} #{current_path}/#{folder}/#{today}`
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Finished
|
|
44
|
+
puts "Cleaned #{current_path}"
|
|
45
|
+
|
|
60
46
|
end
|
|
61
47
|
|
|
62
48
|
end
|
|
63
49
|
end
|
|
64
|
-
end
|
|
50
|
+
end
|
data/lib/fos/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,41 +1,46 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fos
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
|
+
prerelease:
|
|
5
6
|
platform: ruby
|
|
6
7
|
authors:
|
|
7
8
|
- Scott Gordon
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
12
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: bundler
|
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
16
18
|
requirements:
|
|
17
|
-
- -
|
|
19
|
+
- - ~>
|
|
18
20
|
- !ruby/object:Gem::Version
|
|
19
21
|
version: '1.6'
|
|
20
22
|
type: :development
|
|
21
23
|
prerelease: false
|
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
23
26
|
requirements:
|
|
24
|
-
- -
|
|
27
|
+
- - ~>
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
26
29
|
version: '1.6'
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
|
28
31
|
name: rake
|
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
30
34
|
requirements:
|
|
31
|
-
- -
|
|
35
|
+
- - ! '>='
|
|
32
36
|
- !ruby/object:Gem::Version
|
|
33
37
|
version: '0'
|
|
34
38
|
type: :development
|
|
35
39
|
prerelease: false
|
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
37
42
|
requirements:
|
|
38
|
-
- -
|
|
43
|
+
- - ! '>='
|
|
39
44
|
- !ruby/object:Gem::Version
|
|
40
45
|
version: '0'
|
|
41
46
|
description: A Desktop and Download Folder Archiver
|
|
@@ -46,7 +51,7 @@ executables:
|
|
|
46
51
|
extensions: []
|
|
47
52
|
extra_rdoc_files: []
|
|
48
53
|
files:
|
|
49
|
-
-
|
|
54
|
+
- .gitignore
|
|
50
55
|
- Gemfile
|
|
51
56
|
- LICENSE
|
|
52
57
|
- README.md
|
|
@@ -58,25 +63,26 @@ files:
|
|
|
58
63
|
homepage: http://scottyg.github.io/fos/
|
|
59
64
|
licenses:
|
|
60
65
|
- MIT
|
|
61
|
-
metadata: {}
|
|
62
66
|
post_install_message:
|
|
63
67
|
rdoc_options: []
|
|
64
68
|
require_paths:
|
|
65
69
|
- lib
|
|
66
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
none: false
|
|
67
72
|
requirements:
|
|
68
|
-
- -
|
|
73
|
+
- - ! '>='
|
|
69
74
|
- !ruby/object:Gem::Version
|
|
70
75
|
version: '0'
|
|
71
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
|
+
none: false
|
|
72
78
|
requirements:
|
|
73
|
-
- -
|
|
79
|
+
- - ! '>='
|
|
74
80
|
- !ruby/object:Gem::Version
|
|
75
81
|
version: '0'
|
|
76
82
|
requirements: []
|
|
77
83
|
rubyforge_project:
|
|
78
|
-
rubygems_version:
|
|
84
|
+
rubygems_version: 1.8.23
|
|
79
85
|
signing_key:
|
|
80
|
-
specification_version:
|
|
86
|
+
specification_version: 3
|
|
81
87
|
summary: A Desktop and Download Folder Archiver
|
|
82
88
|
test_files: []
|
checksums.yaml
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
SHA1:
|
|
3
|
-
metadata.gz: da6a96a496bd77b3817d89182e04144a744a0d00
|
|
4
|
-
data.tar.gz: 21c62dad6abc22f64bb7db9a34ad16802891b20e
|
|
5
|
-
SHA512:
|
|
6
|
-
metadata.gz: 0bff1a2e9f29ba2474305245ffce46b6b8a5a94d7916c6b1e4f7011c3d1b29b559199b2ca587fff67e7e98ce276cd364166b3d325a418a59280958b207163593
|
|
7
|
-
data.tar.gz: a0e18040dbfb1cc03a4e181b9c4f7de4449194090f75b6e78c57f406d53f90b8fc32a4fe8f017e6b5313a7fa0c40d83afc7d05a7b93ed6add5d653e5bf3ab302
|