openmeta.rb 1.3.1 → 1.3.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
- SHA1:
3
- metadata.gz: b526c286d3a9b6571647d09cc6de5369d409eca0
4
- data.tar.gz: f0dd005385f43c0498bc39adad9e72806cfd6980
5
2
  SHA512:
6
- metadata.gz: 2db1a91510bf57b0a96f77b90b5be6c92fe314f13b357b2c0aa177e2ad1783792111ec56909b7d875615b3d39c88fff56887e7565ddae6c60dfac794cf93f93b
7
- data.tar.gz: 7be4ac476f96b5394d97da073b10ceeba592002541d9273e3035f063826bc06e20776433156812229f008f7624312527de48a317543744943696f74710f89bad
3
+ data.tar.gz: 9209f5e1021db9d1223a0c725c50bdd6b1b0bf8636ef6843f756fad4fc930ce4ab3c23b75ef30b80c6ba133eceeeee093f0e0314f6810d9038e8147ad06d15fd
4
+ metadata.gz: 8c489230b0f0e4d3cc86f44d7c5f0cbcb46f28672dc5c4e6c2da96e04b689a2dc631454f34215df2a2270221c4b8faafe4f9abd469702defc84a86d460c067d0
5
+ SHA1:
6
+ data.tar.gz: e1f8b8523dcf22c33b4e24b6e1ed0c76952d7f41
7
+ metadata.gz: 95a114abb8668fe3a971e3ee349d462992ad442d
data/Guardfile CHANGED
@@ -5,7 +5,7 @@ notification :growl
5
5
 
6
6
  group :backend do
7
7
 
8
- guard 'rspec', :rvm => ["macruby-nightly"], :notification => true do
8
+ guard 'rspec', :rvm => ["macruby"], :notification => true do
9
9
 
10
10
  watch(%r{^spec/.+_spec\.rb$})
11
11
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
data/lib/openmeta.rb CHANGED
@@ -85,13 +85,13 @@ module Openmeta
85
85
  def remove_tags(tags, from_files)
86
86
  from_files = fu_list(from_files)
87
87
 
88
+ return if tags.empty?
89
+
88
90
  from_files.each { |file|
89
- # duplicate a frozen array
90
- existing_tags = get_tags(file).dup
91
- unless existing_tags.empty?
92
- existing_tags.delete_if { |t| tags.include?(t) }
93
- set_tags(existing_tags, file)
94
- end
91
+ existing_tags = get_tags(file) # frozen array
92
+ next if existing_tags.nil? or existing_tags.empty?
93
+
94
+ set_tags(existing_tags - tags, file)
95
95
  }
96
96
  end
97
97
 
@@ -1,4 +1,4 @@
1
1
  module Openmeta
2
- VERSION = '1.3.1'
2
+ VERSION = '1.3.2'
3
3
  end
4
4
 
@@ -15,8 +15,12 @@ describe "Openmeta" do
15
15
  expect { Openmeta.get_tags("/path/to/nowhere") }.to raise_error(Openmeta::ObjCError)
16
16
  end
17
17
 
18
- it "should not raise Error if file does not contains tags" do
19
- expect { Openmeta.clone(@testfiles[0], @testfiles[1]) }.should_not raise_error
18
+ it "should not raise error if file does not contains tags" do
19
+ expect { Openmeta.clone(@testfiles[0], @testfiles[1]) }.to_not raise_error
20
+ end
21
+
22
+ it "should not raise error when removing nonexisting tags" do
23
+ expect { Openmeta.remove_tags(['NonExistingTag'], @testfiles[1]) }.to_not raise_error
20
24
  end
21
25
 
22
26
  it "should set tags and rating correctly" do
@@ -58,6 +62,7 @@ describe "Openmeta" do
58
62
  rtags.should match_array(tags)
59
63
  end
60
64
 
65
+
61
66
  after :all do
62
67
  FileUtils.safe_unlink(@testfiles)
63
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openmeta.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zhao Cai
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2013-03-31 00:00:00 Z
12
+ date: 2013-04-02 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor