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 +4 -4
- data/fde-file_crawler-0.1.1.gem +0 -0
- data/file_crawler.gemspec +3 -0
- data/lib/file_crawler/version.rb +1 -1
- data/lib/file_crawler.rb +31 -1
- data/text2.txt +1 -0
- metadata +46 -3
- data/lib/file_crawler/crawler.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fc9e045915b14e58b88665d5707d886ff40dbe1
|
4
|
+
data.tar.gz: 5b71b93e7e4092e69755fc296b97c9f36d05abcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/file_crawler/version.rb
CHANGED
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.
|
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-
|
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
|