mfd 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/mfd/cli.rb CHANGED
@@ -1,9 +1,11 @@
1
- require 'mfd/asset'
2
1
  require 'optparse'
2
+ require 'mfd/asset'
3
3
 
4
4
  module Mfd
5
5
  class Cli
6
6
 
7
+ NOW = Time.now
8
+
7
9
  def initialize
8
10
  @predicates = ['(true)']
9
11
  @print_command = false
@@ -124,28 +126,13 @@ module Mfd
124
126
  end
125
127
 
126
128
  @opt.on('-e file-ext-name', '--type file-ext-name', ".e.g -e 'mp3'
127
- #{' ' * 35}ContentType 字符串不便记忆,为了方便使用,本程序将常用的
128
- #{' ' * 35}文件类型的后缀名和 kMDItemKind 字符串建立关联,可以使用本选项
129
- #{' ' * 35}来指定要搜索的文件的后缀名, 可以使用\"-l\"选项查看所有支持的后
130
- #{' ' * 35}缀名以及关联
129
+ #{' ' * 35}搜索文件扩展名等于指定值的文件
131
130
  ") do |type|
132
- unless Mfd::Asset::KIND_MAP[type]
133
- STDERR.puts "Not supported file ext name: #{type}, use `mfd -l' to see all supported file ext names`"
134
- exit(1)
135
- end
136
- @predicates << 'kMDItemKind == "*%s*"cdw' % escape(Mfd::Asset::KIND_MAP[type])
137
- end
138
-
139
- @opt.on('-l', '--list-types', "kMDItemKind 字符串不便记忆,为了方便使用,本程序将常用的
140
- #{' ' * 35}文件类型的后缀名和 kMDItemKind 字符串建立关联,使用本选项
141
- #{' ' * 35}看所有支持的后缀名以及关联
142
- ") do
143
- puts
144
- Mfd::Asset::KIND_MAP.keys.sort.each do |e|
145
- printf "\t%-10s : %s\n", e, Mfd::Asset::KIND_MAP[e]
131
+ if Mfd::Asset::KIND_MAP[type]
132
+ @predicates << '(kMDItemFSName == "*.%s" || kMDItemKind == "%s"cdw)' % [type, escape(Mfd::Asset::KIND_MAP[type])]
133
+ else
134
+ @predicates << 'kMDItemFSName == "*.%s"' % type
146
135
  end
147
- puts
148
- exit
149
136
  end
150
137
 
151
138
  @opt.on('-k kind', '--kind kind', "e.g. --kind \"HTML Document\"
data/lib/mfd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mfd
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/mfd.gemspec CHANGED
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_development_dependency "bundler", "~> 1.17"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "bundler", ">= 1.17"
28
+ spec.add_development_dependency "rake", ">= 10.0"
29
+ spec.add_development_dependency "rspec", ">= 3.0"
30
30
  spec.add_development_dependency "pry-byebug", ">= 3.6.0"
31
31
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mfd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-29 00:00:00.000000000 Z
11
+ date: 2023-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.17'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.17'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
@@ -95,7 +95,7 @@ homepage: https://github.com/lululau/mfd
95
95
  licenses:
96
96
  - MIT
97
97
  metadata: {}
98
- post_install_message:
98
+ post_install_message:
99
99
  rdoc_options: []
100
100
  require_paths:
101
101
  - lib
@@ -110,8 +110,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  requirements: []
113
- rubygems_version: 3.0.3
114
- signing_key:
113
+ rubygems_version: 3.4.1
114
+ signing_key:
115
115
  specification_version: 4
116
116
  summary: ''
117
117
  test_files: []