sortobot 0.0.4 → 0.0.5

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/lib/sortobot.rb CHANGED
@@ -9,22 +9,13 @@ module Sortobot
9
9
  desc "push", "push files into directories"
10
10
  def push
11
11
  Helper.makedir
12
- Dir.foreach(Dir.pwd) do |file|
13
- if Helper.associate(file)
14
- FileUtils.mv(file, Helper.associate(file))
15
- end
16
- end
12
+ Helper.move
13
+ Helper.trim
17
14
  end
18
15
 
19
16
  desc "trim", "removes empty directories"
20
17
  def trim
21
- Dir.foreach(Dir.pwd) do |entry|
22
- if File.directory? entry
23
- if Dir.entries(entry).join == "..."
24
- FileUtils.rmdir entry
25
- end
26
- end
27
- end
18
+ Helper.trim
28
19
  end
29
20
  end
30
21
  end
@@ -11,10 +11,26 @@ module Sortobot
11
11
 
12
12
  def self.makedir
13
13
  Directories.each_value do |directory|
14
- unless Dir.exists? directory
15
- FileUtils.mkdir(directory)
16
- end
14
+ FileUtils.mkdir(directory) unless Dir.exists? directory
17
15
  end
18
16
  end
17
+
18
+ def self.trim
19
+ Dir.foreach(Dir.pwd) do |entry|
20
+ if File.directory? entry
21
+ if Dir.entries(entry).join == "..."
22
+ FileUtils.rmdir entry
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ def self.move
29
+ Dir.foreach(Dir.pwd) do |file|
30
+ if associate(file)
31
+ FileUtils.mv(file, associate(file))
32
+ end
33
+ end
34
+ end
19
35
  end
20
36
  end
@@ -1,3 +1,3 @@
1
1
  module Sortobot
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sortobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-04 00:00:00.000000000 Z
12
+ date: 2012-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &84571080 !ruby/object:Gem::Requirement
16
+ requirement: &84609690 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *84571080
24
+ version_requirements: *84609690
25
25
  description: A CLI tool for organizing files in a directory
26
26
  email:
27
27
  - mohanr2222@gmail.com