macos-tags 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: 82c78fd9522862d6b9cb20ab934d95a3fa360149aa65407cd2cafd6dcd4147ce
4
- data.tar.gz: 20ce035ae6cf80790deb97a309374093df9ecc6bf34935a2711e0702daae0d7b
3
+ metadata.gz: 0e47fb26f220e9d54bac48836c66eaba9407be443adaa28ba89cc5be2e24056d
4
+ data.tar.gz: 2b812d5151cc5da520d8283b52615efb909b52466d0b10329f403022d6ac8e11
5
5
  SHA512:
6
- metadata.gz: 3029529f13d354ba29bcc84066200a4674fe9b685e63e9573592e18045866bb3daf45f224fbc6d1985c2985cfdf73f366fc3ead2625edbabb2172d67a12187fe
7
- data.tar.gz: 1ef9c59fa9c593325c831e5225e410bd72001525f2c719a8a3648ebc61808cb24e3ecb0f804433b1246ddadbb87b5253c1a6cb023a028e260f87b0915cf3d50d
6
+ metadata.gz: cb200e699d05ea397e7269082f8a42bf4545c0917e5947f485fbcdb936270f7a1f73f653836bb92ed368dc7c7db48dc3c919636a72a99ca1b9bf3c6db81b118d
7
+ data.tar.gz: d5147776d7f28a81f80c40b29b3b64561d540fab5b9a873c5760ddc4a645427ebfbac257b5d235c5fc865eb7d99c94cf05301ec8eb5db1f715c75487c21c4b41
data/CHANGELOG.md CHANGED
@@ -1,8 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0] - 2021-05-07
4
+
5
+ ### Added
6
+
7
+ - Return empty array if no tags are found
8
+
3
9
  ## [0.1.0] - 2021-05-06
4
10
 
5
11
  ### Added
12
+
6
13
  - Find all tags in the system
7
14
  - Find all tags on a file
8
15
  - Find files by tag
data/README.md CHANGED
@@ -76,7 +76,14 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
76
76
 
77
77
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
78
78
 
79
+ ## Release Steps
80
+
81
+ 1. Bump `MacosTags::VERSION` && `git commit -m "Bump version"`
82
+ 2. `git tag <new version>`
83
+ 3. `git push origin --tags`
84
+ 4. bundle exec rake build
85
+ 5. bundle exec rake release
86
+
79
87
  ## Contributing
80
88
 
81
89
  Bug reports and pull requests are welcome on GitHub at https://github.com/tomoya55/macos-tags.
82
-
data/lib/macos-tags.rb CHANGED
@@ -120,7 +120,7 @@ module MacosTags
120
120
  end
121
121
 
122
122
  def tags
123
- parse_raw_tags.value.map do |raw_tag|
123
+ (parse_raw_tags&.value || []).map do |raw_tag|
124
124
  label, color_val = raw_tag.value.split("\n")
125
125
  Tag.new(label: label, color: Color.new(color_val.to_i))
126
126
  end
@@ -129,7 +129,9 @@ module MacosTags
129
129
  private
130
130
 
131
131
  def parse_raw_tags
132
- plist.load_binary_str(xattr[XATTR_TAGS])
132
+ if xattr[XATTR_TAGS]
133
+ plist.load_binary_str(xattr[XATTR_TAGS])
134
+ end
133
135
  end
134
136
  end
135
137
  end
@@ -1,3 +1,3 @@
1
1
  module MacosTags
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -6,4 +6,12 @@ describe MacosTags do
6
6
  _(MacosTags.all_tags).must_be_kind_of(Array)
7
7
  end
8
8
  end
9
+
10
+ describe MacosTags::TagParser do
11
+ it "must returns empty list if no tags are found" do
12
+ Tempfile.create('tag_parser_test', '/tmp') do |f|
13
+ _(MacosTags::TagParser.new(f).tags).must_equal([])
14
+ end
15
+ end
16
+ end
9
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macos-tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomoya Hirano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-06 00:00:00.000000000 Z
11
+ date: 2021-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-xattr