fde-file_crawler 0.1.1 → 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
  SHA1:
3
- metadata.gz: eb5d990c02650c75fd05c7e417aecee6199080ce
4
- data.tar.gz: bf0c91651b25ea6fc611ed8080b9dc77964dd2b1
3
+ metadata.gz: 8fc9e045915b14e58b88665d5707d886ff40dbe1
4
+ data.tar.gz: 5b71b93e7e4092e69755fc296b97c9f36d05abcc
5
5
  SHA512:
6
- metadata.gz: cdd32c51bb286a034b1a891b6f16be67d9434f9d5b234ba7738bb0abb7dd0d95d2280be81a5e00f29050c120719af1065f43bf8b481508ffcbd78ed77a85a137
7
- data.tar.gz: 149605184ee0260f6e828e97f319838ac42b1b483e8b7cc18763362f8d583734b65bb973fc1f2fe683498b38102162a7b29bd47515d35561da65581efd3d0e7a
6
+ metadata.gz: ffe478d4c341a2029d3a97dfd82fe421cb7db58376c7a53d0c6f2d3fb394fa0bba79b806844f26188e08896ccc6d018739773fd840124bd765aeec1f0c2738fc
7
+ data.tar.gz: 36ec7f419e322b8a6ce745f5841bfc10d19cd2c2da7f4e8e659760ab0148aab2acfa9d908e76a6c733c84a80c8941112562c7c8827eb3acb3da86b2d9ad9243b
Binary file
data/file_crawler.gemspec CHANGED
@@ -32,4 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "bundler", "~> 1.15"
33
33
  spec.add_development_dependency "rake", "~> 10.0"
34
34
  spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "pry"
36
+ spec.add_development_dependency "pry-remote"
37
+ spec.add_development_dependency "pry-nav"
35
38
  end
@@ -1,5 +1,5 @@
1
1
  module FDE
2
2
  module FileCrawler
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data/lib/file_crawler.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'file_crawler/version'
2
- require 'file_crawler/crawler'
3
2
 
4
3
  module FDE
5
4
 
@@ -15,5 +14,36 @@ module FDE
15
14
  def self.configure
16
15
  yield self.config
17
16
  end
17
+
18
+ def self.watch(query = nil, &block)
19
+ unless query.nil?
20
+ yield self.crawl(query)
21
+ else
22
+ yield self.crawl
23
+ end
24
+ end
25
+
26
+ def self.crawl(query = /.*\.*/i)
27
+ path = self.config.path_to_directory
28
+ files = Dir.entries(path)
29
+ files -= %w[. ..]
30
+ files.select { |file| query.match(file) }
31
+ end
32
+
33
+ def self.copy(file, target)
34
+ FileUtils.copy(path_for(file), target)
35
+ end
36
+
37
+ def self.delete(file)
38
+ FileUtils.rm(path_for(file))
39
+ end
40
+
41
+ def self.move(file, target)
42
+ FileUtils.mv(path_for(file), target)
43
+ end
44
+
45
+ def self.path_for(file)
46
+ "#{self.config.path_to_directory}#{file}"
47
+ end
18
48
  end
19
49
  end
data/text2.txt ADDED
@@ -0,0 +1 @@
1
+ Text
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fde-file_crawler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Langenegger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-10 00:00:00.000000000 Z
11
+ date: 2017-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,48 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-remote
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-nav
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
55
97
  description: This file crawler helps to decect if there are new files in a directory.
56
98
  email:
57
99
  - f.langenegger@fadendaten.ch
@@ -69,10 +111,11 @@ files:
69
111
  - Rakefile
70
112
  - bin/console
71
113
  - bin/setup
114
+ - fde-file_crawler-0.1.1.gem
72
115
  - file_crawler.gemspec
73
116
  - lib/file_crawler.rb
74
- - lib/file_crawler/crawler.rb
75
117
  - lib/file_crawler/version.rb
118
+ - text2.txt
76
119
  homepage: https://github.com/fashion-data-exchange/file_crawler
77
120
  licenses:
78
121
  - MIT
@@ -1,10 +0,0 @@
1
- module FDE
2
- module FileCrawler
3
- def self.crawl(query = /.*\.*/i)
4
- path = self.config.path_to_directory
5
- files = Dir.entries(path)
6
- files -= %w[. ..]
7
- files.select { |file| query.match(file) }
8
- end
9
- end
10
- end