fos 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5b697b96a3deaf79194630f52550d4f58a13fdeb
4
+ data.tar.gz: 8a85a8f0c106371f118a1ae76938cfb8c5b44cd5
5
+ SHA512:
6
+ metadata.gz: a3d32c45813f1cc8901061692031b52582e6a955c92cf52d99a54a26c3ff163d5048bbde2c6d9b76abffe6d60418ea058849ab8748af716226bde83a21bee0be
7
+ data.tar.gz: a4bad7024ef4bc2e96494a9c60be135cbc19fb1b77bb67bac2de9a568b9099d6222708491b39a68b2cef0ad914ebdd0cde9b1d249d2f9f120f8084497bb07df8
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fos.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Scott Gordon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # fos
2
+
3
+ A Desktop and Download Folder Archiver
4
+
5
+ ## Installation
6
+
7
+ $ gem install fos
8
+
9
+ ## Usage
10
+
11
+ $ fos
12
+
13
+ ## Contributing
14
+
15
+ 1. Fork it ( https://github.com/scottyg/fos/fork )
16
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
17
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
18
+ 4. Push to the branch (`git push origin my-new-feature`)
19
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/fos ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fos'
4
+
5
+ action = Fos::Action.new
6
+ action.move
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fos/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fos"
8
+ spec.version = Fos::VERSION
9
+ spec.authors = ["Scott Gordon"]
10
+ spec.email = ["me@scottyg.net"]
11
+ spec.summary = %q{A File Archiver}
12
+ spec.description = %q{A File Archiver}
13
+ spec.homepage = "http://www.iamscottyg.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = ["fos"]
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,64 @@
1
+ require "fos/version"
2
+
3
+ module Fos
4
+ class Action
5
+ def move
6
+
7
+ # User Variables
8
+ username = File.expand_path('~')
9
+ folder = "archive" # New Folder Name
10
+
11
+ #System Paths
12
+ desktop = "#{username}/Desktop"
13
+ downloads = "#{username}/Downloads"
14
+ today = Time.now.strftime("%B %e %Y").gsub(' ', '_').gsub(/:.*/, '')
15
+
16
+ # Get Files
17
+ desktop_files = Dir.entries(desktop)
18
+ download_files = Dir.entries(downloads)
19
+
20
+ # Create Folders
21
+ if !File.directory?("#{desktop}/#{folder}")
22
+ `mkdir #{desktop}/#{folder}`
23
+ end
24
+ if !File.directory?("#{desktop}/#{folder}/#{today}")
25
+ `mkdir #{desktop}/#{folder}/#{today}`
26
+ end
27
+ if !File.directory?("#{downloads}/#{folder}")
28
+ `mkdir #{downloads}/#{folder}`
29
+ end
30
+ if !File.directory?("#{downloads}/#{folder}/#{today}")
31
+ `mkdir #{downloads}/#{folder}/#{today}`
32
+ end
33
+
34
+ #Clean Desktop
35
+ # Remove System Folders And Our New Folder
36
+ desktop_files.delete_if{|x| (x =~ /^\./) == 0 }
37
+ desktop_files.delete_if{|x| x == "#{folder}"}
38
+ desktop_files.delete_if{|x| (x =~ /Macintosh/) == 0}
39
+
40
+ # Clean File names
41
+ desktop_files = desktop_files.map{|x| x.gsub(" ", '\ ').gsub("(", '\(').gsub(")", '\)')}
42
+
43
+ # Do The Moving
44
+ desktop_files.each do |filename|
45
+ `mv #{desktop}/#{filename} #{desktop}/#{folder}/#{today}`
46
+ end
47
+
48
+ #Clean Downloads
49
+ # Remove System Folders And Our New Folder
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}`
60
+ end
61
+
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,3 @@
1
+ module Fos
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fos
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Scott Gordon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A File Archiver
42
+ email:
43
+ - me@scottyg.net
44
+ executables:
45
+ - fos
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - bin/fos
55
+ - fos.gemspec
56
+ - lib/fos.rb
57
+ - lib/fos/version.rb
58
+ homepage: http://www.iamscottyg.com
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: A File Archiver
82
+ test_files: []