catalog 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/bin/catalog +6 -0
- data/catalog.gemspec +1 -0
- data/lib/catalog.rb +4 -0
- data/lib/catalog/cli.rb +23 -0
- data/lib/catalog/config.rb +11 -1
- data/lib/catalog/organizer.rb +1 -1
- data/lib/catalog/services/document_mover.rb +2 -0
- data/lib/catalog/services/drawer_matcher.rb +2 -0
- data/lib/catalog/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c141dfe2ef4460a9a78967dc0a9b8efad223d97
|
4
|
+
data.tar.gz: 34dd630c49882b358e7653fc4529fa5a1512f7c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c59b050ceeac37790a6d6e0e43441e48e27f66721c6914f01a5c70808583dd1dc9f0f7c1a067e051cc07c9c37a85ab5cbc16e650770c953a90268ec7407b0d01
|
7
|
+
data.tar.gz: 6a1d4694cc3890779d40a714e31c1d9817fe1261b0d72e0563e9824057adabe7f9645b934f29c690bf10f9d143697b322071790eb7a1b944c0df0f8e203b096a
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Catalog
|
2
|
-
*Catalog prevents your download folder from being a mess on Mac
|
2
|
+
*Catalog prevents your download folder from being a mess on your Mac.*
|
3
3
|
|
4
4
|
## The problem
|
5
5
|
|
6
|
-
The *Downloads* folder on a Mac is the most
|
6
|
+
The *Downloads* folder on a Mac is the most cluttered folder there is. Even with the best intentions, we end up not cleaning it as often as we should.
|
7
7
|
|
8
|
-
*Catalog* allow us to create rules to automatically organize your downloads based on
|
8
|
+
*Catalog* allow us to create rules to automatically organize your downloads based on their origin (*i.e. http://someurl.com/path/to/file.pdf*).
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -19,7 +19,7 @@ $ touch ~/.catalog
|
|
19
19
|
|
20
20
|
## State of project
|
21
21
|
|
22
|
-
The current version **doesn't include a CLI**. You'll have to use it through IRB as you can see in the [How to use](#how-to-use) section. The next step will be to provide a CLI
|
22
|
+
The current version **doesn't include a CLI**. You'll have to use it through IRB as you can see in the [How to use](#how-to-use) section. The next step will be to provide a CLI and a way to easily deamonize this.
|
23
23
|
|
24
24
|
## How to use
|
25
25
|
|
data/bin/catalog
ADDED
data/catalog.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
18
|
spec.require_paths = ['lib']
|
18
19
|
|
19
20
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
data/lib/catalog.rb
CHANGED
data/lib/catalog/cli.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Catalog
|
2
|
+
class CLI
|
3
|
+
def initialize(args)
|
4
|
+
@args = args
|
5
|
+
@options = {}
|
6
|
+
|
7
|
+
parser = OptionParser.new do |opts|
|
8
|
+
opts.on('-p', '--path PATH', 'Path of the folder to clean') { |path| @options[:path] = path }
|
9
|
+
opts.on('-c', '--config PATH', 'Path of your .catalog file') { |path| @options[:config] = path }
|
10
|
+
end
|
11
|
+
|
12
|
+
parser.parse!(args)
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
# Override .catalog.yml file location
|
17
|
+
Catalog::Config.config_path(@options[:config]) if @options[:config]
|
18
|
+
|
19
|
+
# Run to organizer
|
20
|
+
Catalog::Organizer.new(base_path: @options[:path]).run!
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/catalog/config.rb
CHANGED
@@ -4,11 +4,21 @@ module Catalog
|
|
4
4
|
config['drawers']
|
5
5
|
end
|
6
6
|
|
7
|
+
def self.config_path(path = nil)
|
8
|
+
if path
|
9
|
+
@config_path
|
10
|
+
else
|
11
|
+
@config_path = path
|
12
|
+
end
|
13
|
+
|
14
|
+
File.expand_path(@config_path || '~/.catalog.yml')
|
15
|
+
end
|
16
|
+
|
7
17
|
private
|
8
18
|
|
9
19
|
def self.config
|
10
20
|
unless @config
|
11
|
-
raw_content = File.read(
|
21
|
+
raw_content = File.read(config_path)
|
12
22
|
@config = YAML.load(raw_content)
|
13
23
|
end
|
14
24
|
|
data/lib/catalog/organizer.rb
CHANGED
data/lib/catalog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: catalog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Garneau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,7 +55,8 @@ dependencies:
|
|
55
55
|
description: Catalog prevents your download folder from being a mess on Mac Os X.
|
56
56
|
email:
|
57
57
|
- sam@garno.me
|
58
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- catalog
|
59
60
|
extensions: []
|
60
61
|
extra_rdoc_files: []
|
61
62
|
files:
|
@@ -64,8 +65,10 @@ files:
|
|
64
65
|
- Gemfile.lock
|
65
66
|
- LICENSE.md
|
66
67
|
- README.md
|
68
|
+
- bin/catalog
|
67
69
|
- catalog.gemspec
|
68
70
|
- lib/catalog.rb
|
71
|
+
- lib/catalog/cli.rb
|
69
72
|
- lib/catalog/config.rb
|
70
73
|
- lib/catalog/errors/configuration_missing.rb
|
71
74
|
- lib/catalog/models/document.rb
|