where_to 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmY0ZmI3NzkxOWZmZjVmYzg3MGZkN2U1NjlhZTU1MjBlNGU2NGU1Zg==
4
+ MmViZGMxMGNjYjRiZTMxMjM2OGFjZmUxMDgzYTgzMWQ2ZDg5MGFjZQ==
5
5
  data.tar.gz: !binary |-
6
- ODgwMTY4YjM1ZmIwOTJkZTVhYWQ0ZjE3NmY4YzYwNDBhZDcxMjk4ZQ==
6
+ YTcwMjIyYzMzN2ZiN2FiMTJiM2U2ZDhkZTIwM2M5MWY0NWMzY2M3Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGRmNzZkYjY2NTlmMDY1MmE1NmJlNWVkMDVmYTZiMWNmMTdkODcwNmJjNzkw
10
- OTA2NTA2MzJiMDExZTE4YzA4Y2QyYTY4ZWZlMzI1NjRlZGI1YTM0NTEzMWY5
11
- MjJmMDE1ZWNlNzIwYzE4ZjVlMzM3MGZhOTE0NmNmMzljYzQ5YTk=
9
+ Njk0ZTMyMmViZjk4Y2Y3MTM4MTMzMGNjNTQ1MDQyYjgyYjJmN2FjNDJmZjYz
10
+ NjhkNWRlODU1YjNmYjY2ODkxZDE1ZjA5N2U1OWU3MzdhNWI2NDYyZGYwZDI1
11
+ ODY3YWNiN2ZjZTg2NzZlMzQ0OWJmMGE2YjBjOGZmZDc1NmQwYzc=
12
12
  data.tar.gz: !binary |-
13
- MGEyMDJhZTY0MzhkYmFhNGQwZGJlZWZmYWViMjhjNGE5Njg1ODI3MWQxNjk3
14
- YmQwMmNiMmNmYmJlZDRkOWM0Yjg1ZDVkYWRiMjM4YzJlNjcyNDlkMWFkNmQw
15
- YjI2YjcwZmY5ZTE3MDEzM2M0YTczMzJjMWVmYzQ0YmNmZTEwYjU=
13
+ NmUzOTUzMzcwMTZmYWNkOTYzMWUxYWQyZDg3NDJiYTBhYWQ0ZjdkZDI5NjI3
14
+ OTA1OWM5OGY4YmZhYTM5NmJjZWM4NGQyNzlmYmM1MDEyODljM2JkNzQ3MWJj
15
+ ZGY3ZDQ2YTg0ZjJiOTg5ZDE2ZWI3MzZmZTE1MmEwMTZiY2IzOWU=
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .DS_Store
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /Gemfile.lock
data/bin/whereto CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'gli'
3
3
  require_relative '../lib/where_to'
4
+ require_relative '../lib/where_to_cli/helpers'
4
5
 
5
6
  include GLI::App
7
+ include WhereToCLI
6
8
 
7
9
  PROMPT_DESCRIPTORS = Hash.new do |hash, key|
8
10
  hash[key] = "a #{key}"
@@ -55,13 +57,13 @@ command :organize do |cmd|
55
57
 
56
58
  cmd.action do |global_options, options, args|
57
59
  puts ''
58
- location = args[0]
59
- raise "The location '#{location}' does not exist" unless File.exist? location
60
+ location = Helpers::check_location!(args.first)
60
61
 
61
62
  @options = options
62
63
 
63
64
  Dir.chdir location
64
65
  files = Dir.glob "*#{options[:ext]}"
66
+ raise WhereTo::NoFilesError.new(options[:ext], location) if files.none?
65
67
  puts "I found the following files:"
66
68
  files.each { |file| puts file }
67
69
  puts ''
@@ -0,0 +1,7 @@
1
+ module WhereTo
2
+ class NoFilesError < RuntimeError
3
+ def initialize(extension, location)
4
+ super("I couldn't find any files with the extension #{extension} in #{location}")
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module WhereTo
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/where_to.rb CHANGED
@@ -1,7 +1,17 @@
1
1
  require 'date'
2
2
 
3
3
  # Require all the libraries!
4
- Dir[File.dirname(__FILE__) + "/where_to/**/*.rb"].each { |f| require_relative f }
4
+ require_files = %w(
5
+ configuration
6
+ episode_formatter
7
+ location
8
+ locator
9
+ tvdb
10
+ version
11
+ error/no_files_error
12
+ ).each do |require_file|
13
+ require_relative "where_to/#{require_file}"
14
+ end
5
15
 
6
16
  module WhereTo
7
17
  class << self
@@ -0,0 +1,9 @@
1
+ module WhereToCLI
2
+ module Helpers
3
+ def self.check_location!(location)
4
+ return '.' if location.nil?
5
+ raise "The location '#{location}' does not exist" unless File.exist? location
6
+ location
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: where_to
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Toniazzo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-07 00:00:00.000000000 Z
11
+ date: 2015-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,10 +142,12 @@ files:
142
142
  - lib/where_to.rb
143
143
  - lib/where_to/configuration.rb
144
144
  - lib/where_to/episode_formatter.rb
145
+ - lib/where_to/error/no_files_error.rb
145
146
  - lib/where_to/location.rb
146
147
  - lib/where_to/locator.rb
147
148
  - lib/where_to/tvdb.rb
148
149
  - lib/where_to/version.rb
150
+ - lib/where_to_cli/helpers.rb
149
151
  - where_to.gemspec
150
152
  homepage: https://github.com/jutonz/where_to
151
153
  licenses: