phtools 0.2.4 → 0.3.0.pre.alpha

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
  SHA1:
3
- metadata.gz: f2b4a9e0f8e817daa66178993aa0d7338cc4640f
4
- data.tar.gz: d5ebce5d0aa61183a4e018ae04c2d59b20673980
3
+ metadata.gz: b2ba039340b6db82d48a60d8f61bc675ad8c7f55
4
+ data.tar.gz: c68da1cc277fffea7af2746ec5c0a35301f7f03b
5
5
  SHA512:
6
- metadata.gz: bb219b0a0dca4df74ce3ac11af40ce59893076a6c8c0c353d14e4951c97233aad4da2f50fb0cde74c26042aca13dc14fccc4ce60fad66c1d03ea2f1cf39960c6
7
- data.tar.gz: 702e6dd55560a82cc537589a830c610f17c90be5f03ff4c2c6347b364f8f0ca31af867e9722bf63332da4b90fdb959d13031c657586857625bcf8b3bc5659684
6
+ metadata.gz: 9417503eb41d424de70de88973b4f43c50778948bf2b41c6601b8a1e383ebbccd3a3e38b72b571abfc19d0f01cc3e4041efd1a82c5932a873759b279ca451739
7
+ data.tar.gz: 1de101093f41bf5e058226a79fe21610a099ad53dc842880854c13fe714092f90bae814ea5879b91427752c32185a8d6294d531df1991aeae5a01c426d8dd8ee
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format Fuubar
2
- --color
1
+ --format documentation
2
+ --color
data/Guardfile CHANGED
@@ -1,10 +1,11 @@
1
1
  # A sample Guardfile
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
- # notification :terminal_notifier, app_name: "ftools"
5
- notification :tmux, display_message: false
4
+ notification :terminal_notifier, app_name: "phtools"
5
+ # notification :terminal_title
6
+ # notification :tmux, display_message: false
6
7
 
7
- guard 'cucumber' do
8
+ guard 'cucumber', notification: true do
8
9
  watch(%r{^features/.+\.feature$})
9
10
  watch(%r{^features/support/.+$}) { 'features' }
10
11
  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/{m[1]}.feature")][0] || 'features' }
data/History.md ADDED
@@ -0,0 +1,6 @@
1
+ # RELEASED
2
+
3
+ ## [v0.3.0-alpha](https://github.com/andrewbiz/phtools/compare/v0.3.0-alpha...v0.2.4)
4
+
5
+ * Improved phtools - now it supports DIRs and FILEMASKs parameters
6
+ * Added aruba (cucumber) tests for phls
data/exe/phls CHANGED
@@ -11,17 +11,20 @@ module PhTools
11
11
  ***************************************************
12
12
  phtools - *Keep Your Photos In Order* (c) ANB
13
13
  ***************************************************
14
- #{tool_name} scans given directories and
15
- generates list of files to standard output.
14
+ #{tool_name} scans given directories and generates list of files to standard output.
16
15
  In short it acts like a smart 'ls' command (or 'dir' in Windows).
17
- It is a good starting point for all other phtools to be used with pipes.
18
- phtools friendly files: #{file_type * ','}
16
+ Set DIRs to be scanned as a parameters. If no DIRs are set - current dir (.)
17
+ will be scanned. Set FILEMASKs as a parameters - and only files matching the
18
+ masks will be processed. If no FILEMASK is set *.* will be used by-default.
19
+ To avoid unnessesary mask extraction by OS - put it in ''.
20
+ Note, #{tool_name} works only with phtools-friendly file types: #{file_type * ','}
21
+ #{tool_name} is a starting point for all other phtools to be connected via pipes.
19
22
 
20
- Example: #{tool_name} -r abc |ftclname => recursively scans 'abc' dir and
21
- sends all found phtools friendly files to ftclname command.
23
+ Example: #{tool_name} abc '*aaa*' | phrename -a anb => scans 'abc' folder and
24
+ sends all found phtools friendly files filtered with *aaa* to phrename command.
22
25
 
23
26
  Usage:
24
- #{tool_name} [-D] [-r] [DIR_OR_FILE...]
27
+ #{tool_name} [-D] [-r] [DIR_OR_FILEMASK...]
25
28
  #{tool_name} -h | --help
26
29
  #{tool_name} -v | --version
27
30
 
data/lib/phls.rb CHANGED
@@ -12,11 +12,16 @@ module PhTools
12
12
  end
13
13
 
14
14
  def run!
15
- @options_cli['DIR_OR_FILE'] = ['.'] if @options_cli['DIR_OR_FILE'].empty?
16
- @options_cli['DIR_OR_FILE'].each do |item|
17
- if File.exist?(item)
18
- File.directory?(item) ? output_dir(item) : output_file(item)
19
- end
15
+ dirs_to_scan = []
16
+ filemasks = []
17
+ @options_cli['DIR_OR_FILEMASK'].each do |item|
18
+ File.directory?(item) ? dirs_to_scan << item : filemasks << item
19
+ end
20
+ dirs_to_scan = ['.'] if dirs_to_scan.empty?
21
+ filemasks = ['*.*'] if filemasks.empty?
22
+ dirs_to_scan.each do |dir|
23
+ fmask = File.join(dir, @options_cli['--recursive'] ? '**' : '', "{#{filemasks * ','}}")
24
+ Dir.glob(fmask, File::FNM_CASEFOLD).each { |f| output_file(f) if File.file?(f) }
20
25
  end
21
26
 
22
27
  rescue SignalException
@@ -29,17 +34,9 @@ module PhTools
29
34
 
30
35
  private
31
36
 
32
- def output_dir(item)
33
- fmask = File.join(item, @options_cli['--recursive'] ? '**' : '',
34
- "{#{@file_type.map { |i| "*.#{i}" } * ','}}")
35
- files_to_process = Dir.glob(fmask, File::FNM_CASEFOLD |
36
- File::FNM_DOTMATCH)
37
- files_to_process.each { |f| output_file(f) }
38
- end
39
-
40
37
  def output_file(file)
41
- @os.output(File.join(File.dirname(file), File.basename(file))) if
42
- @file_type.include?(File.extname(file).slice(1..-1).downcase)
38
+ ftype = File.extname(file).empty? ? '' : File.extname(file).slice(1..-1).downcase
39
+ @os.output(File.join(File.dirname(file), File.basename(file))) if @file_type.include?(ftype)
43
40
  end
44
41
  end
45
42
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module PhTools
3
- VERSION = '0.2.4'
3
+ VERSION = '0.3.0-alpha'
4
4
  end
data/lib/phtools.rb CHANGED
@@ -24,7 +24,7 @@ Please run phtools in a terminal via CLI commands:
24
24
  phclname\t(#{Phclname::about}),
25
25
  phevent\t(#{Phevent::about}),
26
26
  phfixdate\t(#{Phfixdate::about}),
27
- phfixmd\t(#{Phfixfmd::about}),
27
+ phfixfmd\t(#{Phfixfmd::about}),
28
28
  phls\t(#{Phls::about}),
29
29
  phmtags\t(#{Phmtags::about}),
30
30
  phrename \t(#{Phrename::about}),
data/phtools.gemspec CHANGED
@@ -28,12 +28,15 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 1.12'
30
30
  spec.add_development_dependency 'rake', '~> 10.0'
31
- spec.add_development_dependency 'rspec', '~> 2.9'
32
- spec.add_development_dependency 'rspec-its', '~> 1.0'
33
- spec.add_development_dependency 'cucumber', '~> 1.3'
31
+ spec.add_development_dependency 'rspec', '~> 3.0'
32
+ spec.add_development_dependency 'rspec-its'
33
+ spec.add_development_dependency 'cucumber', '~> 2.0'
34
34
  spec.add_development_dependency 'aruba', '~> 0.14'
35
35
  spec.add_development_dependency 'fuubar'
36
36
  spec.add_development_dependency 'rubocop'
37
+ spec.add_development_dependency 'guard'
38
+ spec.add_development_dependency 'guard-rspec'
39
+ spec.add_development_dependency 'guard-cucumber'
37
40
  spec.add_development_dependency 'pry'
38
41
 
39
42
  if RbConfig::CONFIG['target_os'] =~ /darwin/i
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bizyaev
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.9'
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
- version: '2.9'
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-its
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '1.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cucumber
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.3'
75
+ version: '2.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.3'
82
+ version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: aruba
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,48 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: guard-cucumber
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
125
167
  - !ruby/object:Gem::Dependency
126
168
  name: pry
127
169
  requirement: !ruby/object:Gem::Requirement
@@ -221,6 +263,7 @@ files:
221
263
  - ".travis.yml"
222
264
  - Gemfile
223
265
  - Guardfile
266
+ - History.md
224
267
  - LICENSE.txt
225
268
  - README.md
226
269
  - Rakefile
@@ -267,9 +310,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
267
310
  version: 2.0.0
268
311
  required_rubygems_version: !ruby/object:Gem::Requirement
269
312
  requirements:
270
- - - ">="
313
+ - - ">"
271
314
  - !ruby/object:Gem::Version
272
- version: '0'
315
+ version: 1.3.1
273
316
  requirements:
274
317
  - ExifTool by Phil Harvey (http://www.sno.phy.queensu.ca/~phil/exiftool/)
275
318
  rubyforge_project: