kagu 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cc4fa20633a483023599a2d5db4d1cfa98dfa2d
4
- data.tar.gz: ef1c98202b4db8848f137667241a8d2ff49565b5
3
+ metadata.gz: e5ee245442c267a40154a6a11b7eccd99a62be90
4
+ data.tar.gz: fbe64a1a1b1f9053817c5698fc8922b8c74faf0f
5
5
  SHA512:
6
- metadata.gz: d9f773466e3c04f84c292bca74cf0277a15dbd3fca6cb197fea176dfbfd16743c16e4ce8fa22efc26a383e0ee82e2821243a86520df1dff6dca52cab54cbdfe4
7
- data.tar.gz: 2b39cf4d9a94479848bb3e28a03d0537cbf4d94906fe391983dc59af961371364713ef17cde4a4f2fc2ad30e5b18a0ba1bc66c29426a00b19b2153c0685aa166
6
+ metadata.gz: dfb00c6c688e780c32fad7a2f0bf12c8ff25c6ff12c76025945a21a3aaf0303a98a026a45e5fd51d625a64cd41f939ce9dc88e6ee4f6bc03e77034880094fefb
7
+ data.tar.gz: c3e40682f72c76e41fbdcb88a171664fc9f5ba4ac28bd4bb8ba1e7cb0ac4ec8a0d6fc7fe9d9ed3f7ccfd9eeeae32af621844d44555ff005fd2819a5d12e74aab
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
data/lib/kagu/track.rb CHANGED
@@ -12,7 +12,6 @@ module Kagu
12
12
 
13
13
  def initialize(attributes = {})
14
14
  super
15
- raise Error.new("No such file: #{path.inspect}") if File.exists?(path) && !exists?
16
15
  end
17
16
 
18
17
  def <=>(other)
@@ -84,8 +83,9 @@ module Kagu
84
83
  end
85
84
 
86
85
  def itunes_location=(value)
87
- self.path = CGI.unescape(html_entities_decode(value).gsub('+', '%2B')).gsub(/\Afile:\/\/(localhost)?/, '')
88
- self.path = path.encode('UTF-8', 'UTF-8-MAC') if IS_MAC_OS
86
+ path = CGI.unescape(html_entities_decode(value).gsub('+', '%2B')).gsub(/\Afile:\/\/(localhost)?/, '')
87
+ path = path.encode('UTF-8', 'UTF-8-MAC') if IS_MAC_OS
88
+ self.path = path
89
89
  end
90
90
 
91
91
  def itunes_name=(value)
@@ -110,6 +110,8 @@ module Kagu
110
110
 
111
111
  def path=(value)
112
112
  @path = value.to_s.presence
113
+ raise Error.new("No such file: #{path.inspect}") if File.exists?(path) && !exists?
114
+ Kagu.logger.warn('Kagu') { "No such iTunes track: #{path.inspect}" } unless exists?
113
115
  end
114
116
 
115
117
  def title=(value)
data/lib/kagu/tracks.rb CHANGED
@@ -4,7 +4,7 @@ module Kagu
4
4
 
5
5
  include Enumerable
6
6
 
7
- EXTENSIONS = %w(.aac .flac .mp3 .wav)
7
+ EXTENSIONS = %w(.aac .flac .mp3 .wav).freeze
8
8
 
9
9
  attr_reader :library
10
10
 
@@ -207,7 +207,12 @@ describe Kagu::Track do
207
207
  }.not_to raise_error
208
208
  end
209
209
 
210
- it 'raise an error if not a file' do
210
+ it 'logs a warning if not exist' do
211
+ expect(Kagu.logger).to receive(:warn)
212
+ Kagu::Track.new(attributes.merge(path: '/tmp/bar.mp3'))
213
+ end
214
+
215
+ it 'raise an error if exists but not a file' do
211
216
  expect {
212
217
  Kagu::Track.new(attributes.merge(path: '/tmp'))
213
218
  }.to raise_error(Kagu::Error, 'No such file: "/tmp"')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kagu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Toulotte