catalog 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd0b3cd70c85b5bd03633460099dbe638c5276da
4
- data.tar.gz: 4778008a6d5863df65ba2f8d01bee7408ab82253
3
+ metadata.gz: fbe2e0974fc3a6ebd971be5c8c6840deaddbf31b
4
+ data.tar.gz: e60c2f1e768b51932ab231d34677a6bd847509fb
5
5
  SHA512:
6
- metadata.gz: 274bcea64b0b28a55d5fa8f9abd5cd961ada060d8c8d35e8931dbb38adf53163f58a59d31fae4da4b7fb8bb6965281452bbabd86db05926bc66d51cfc65d10e8
7
- data.tar.gz: 3bb23e9d4ba7070a23afd16301936a3f09a5e20039d8c1cfdc061d2467460369660387b98880ac6d0c2112957809441a7fed92ad8d8c4b27af6ed40a64c6d3c3
6
+ metadata.gz: dde4a5fa55fb32c80911bbbd2d3fed24c6836e1944a9fb6037770d0a60a4ea6d268a64fb136c9d2856f88435361e1901a22cb37f88a44beb4cb8b2909e42cd77
7
+ data.tar.gz: ad3d8eb200633a8b296c10eaabf71faeab7cadb4985f95e7f8867b162fe4bd058f31ac6e8979babbe45dfaf8d1cbff975db6d67848936e2acb6c64057b2d1b7e
@@ -2,13 +2,11 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  catalog (0.1.1)
5
- hashie
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
9
  diff-lcs (1.2.5)
11
- hashie (3.3.1)
12
10
  rake (10.3.2)
13
11
  rspec (3.0.0)
14
12
  rspec-core (~> 3.0.0)
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2014 Samuel Garneau
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,64 @@
1
+ # Catalog
2
+ *Catalog prevents your download folder from being a mess on Mac Os X.*
3
+
4
+ ## The problem
5
+
6
+ The *Downloads* folder on a Mac is the most clusttered folder there is. Even with the best intentions, we end up not cleaning it as often as we should.
7
+
8
+ *Catalog* allow us to create rules to automatically organize your downloads based on its origin (*i.e. http://someurl.com/path/to/file.pdf*).
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ # Install `catalog` gem
14
+ $ gem install catalog
15
+
16
+ # Create the configuration file
17
+ $ touch ~/.catalog
18
+ ```
19
+
20
+ ## State of project
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 using guard and a way to easily deamonize this.
23
+
24
+ ## How to use
25
+
26
+ As mentionned above, *catalog* does not offer a CLI at the moment. You have to load it with IRB.
27
+
28
+ ```ruby
29
+ > require 'catalog'
30
+ => true
31
+
32
+ # Default location is ~/Downloads
33
+ > Catalog::Organizer.new.run!
34
+ => true
35
+
36
+ # However, you can specify your own
37
+ > Catalog::Organizer.new(base_path: '/Volumes/Downloads/').run!
38
+ => true
39
+ ```
40
+
41
+ #### `~/.catalog` example
42
+
43
+ ```yaml
44
+ drawers:
45
+ # Basecamp related files
46
+ - rule: basecamp.com\/39\/projects\/12837347\/
47
+ path: /Users/garno/Downloads/Basecamp/ProjectName/
48
+ - rule: basecamp.com
49
+ path: /Users/garno/Downloads/Basecamp/
50
+
51
+ # DMGs
52
+ - rule: \.(?:dmg)$
53
+ path: /Users/garno/Downloads/DMGs/
54
+
55
+ # Alfred workflows
56
+ - rule: \.(?:alfredworkflow)$
57
+ path: /Users/garno/Downloads/Alfred workflows/
58
+ ```
59
+
60
+ **Rules order is really important** since a file will be moved according to the first matched rule.
61
+
62
+ ## License
63
+
64
+ Catalog is © 2014 Samuel Garneau and may be freely distributed under the MIT license. See the LICENSE.md file for more information.
@@ -8,10 +8,10 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Catalog::VERSION
9
9
  spec.authors = ['Samuel Garneau']
10
10
  spec.email = ['sam@garno.me']
11
- spec.description = 'Catalog prevent your download folder from being a mess on Mac Os X.'
12
- spec.summary = 'Catalog prevent your download folder from being a mess on Mac Os X.'
11
+ spec.description = 'Catalog prevents your download folder from being a mess on Mac Os X.'
12
+ spec.summary = 'Catalog prevents your download folder from being a mess on Mac Os X.'
13
13
  spec.homepage = 'https://github.com/garno/catalog'
14
- spec.license = 'BSD 3-Clause'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.require_paths = ['lib']
@@ -19,6 +19,4 @@ Gem::Specification.new do |spec|
19
19
  spec.add_development_dependency 'bundler', '~> 1.3'
20
20
  spec.add_development_dependency 'rake'
21
21
  spec.add_development_dependency 'rspec'
22
-
23
- spec.add_dependency 'hashie'
24
22
  end
@@ -1,5 +1,4 @@
1
1
  require 'yaml'
2
- require 'hashie'
3
2
  require 'shellwords'
4
3
 
5
4
  # Core
@@ -1,7 +1,7 @@
1
1
  module Catalog
2
2
  module Config
3
3
  def self.drawers
4
- config.drawers
4
+ config['drawers']
5
5
  end
6
6
 
7
7
  private
@@ -9,8 +9,7 @@ module Catalog
9
9
  def self.config
10
10
  unless @config
11
11
  raw_content = File.read(File.expand_path('~/.catalog.yml'))
12
- yaml_content = YAML.load(raw_content)
13
- @config = Hashie::Mash.new(yaml_content)
12
+ @config = YAML.load(raw_content)
14
13
  end
15
14
 
16
15
  @config
@@ -8,7 +8,9 @@ module Catalog
8
8
  end
9
9
 
10
10
  def self.all
11
- Catalog::Config.drawers.map { |attributes| self.class.new(attributes) }
11
+ Catalog::Config.drawers.map do |attributes|
12
+ Catalog::Drawer.new(rule: attributes['rule'], path: attributes['path'])
13
+ end
12
14
  end
13
15
  end
14
16
  end
@@ -1,7 +1,7 @@
1
1
  module Catalog
2
2
  class Organizer
3
- def initialize(base_path:)
4
- @base_path = base_path
3
+ def initialize(base_path: nil)
4
+ @base_path = base_path || '~/Downloads/*'
5
5
  end
6
6
 
7
7
  def run!
@@ -12,6 +12,8 @@ module Catalog
12
12
  DocumentMover.new(document: document, drawer: matcher.drawer).move!
13
13
  end
14
14
  end
15
+
16
+ true
15
17
  end
16
18
 
17
19
  private
@@ -1,3 +1,3 @@
1
1
  module Catalog
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catalog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Garneau
@@ -52,21 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: hashie
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- description: Catalog prevent your download folder from being a mess on Mac Os X.
55
+ description: Catalog prevents your download folder from being a mess on Mac Os X.
70
56
  email:
71
57
  - sam@garno.me
72
58
  executables: []
@@ -76,6 +62,8 @@ files:
76
62
  - ".gitignore"
77
63
  - Gemfile
78
64
  - Gemfile.lock
65
+ - LICENSE.md
66
+ - README.md
79
67
  - catalog.gemspec
80
68
  - lib/catalog.rb
81
69
  - lib/catalog/config.rb
@@ -91,7 +79,7 @@ files:
91
79
  - spec/spec_helper.rb
92
80
  homepage: https://github.com/garno/catalog
93
81
  licenses:
94
- - BSD 3-Clause
82
+ - MIT
95
83
  metadata: {}
96
84
  post_install_message:
97
85
  rdoc_options: []
@@ -112,5 +100,5 @@ rubyforge_project:
112
100
  rubygems_version: 2.2.2
113
101
  signing_key:
114
102
  specification_version: 4
115
- summary: Catalog prevent your download folder from being a mess on Mac Os X.
103
+ summary: Catalog prevents your download folder from being a mess on Mac Os X.
116
104
  test_files: []