fde-file_crawler 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78a844517927d32ed56430193409a66541f69c43
4
- data.tar.gz: 465ac7224f5d2666e8238d65ad1d0c4ea2c78e01
3
+ metadata.gz: 0d0f14417036814ba9682befc46803b8384cad24
4
+ data.tar.gz: f7bf404dbfd33354c7ec07952df1143c774a4f71
5
5
  SHA512:
6
- metadata.gz: dbc36ae845dc6cdc878e219170af9a22e3e990932890ae54de2920eb3ac6d03074268e4ca9967a530d52f2e6884c45cd6e98b9e052c1098fbab6767db6707acf
7
- data.tar.gz: 4309522a0dae6b0d059b12594d258490eb868e0aba4967dcc9f50a1e46e5f8e85de0fc57f5452a4c4982bd255a6bf8fa694a79699ee2c248ed8a05e72afa6f35
6
+ metadata.gz: 54f62fc76a26fbe25cb37ce9abc839c3ef0e56208398d17db884c2e9e82da6f3868f4bd5c708e5472fd0684666a5ae88df380855053a3c9a7aeb32fdb0d1c968
7
+ data.tar.gz: 6f1fb1f3d5b61e9cae0a6ebac4c372b96f7bf4ce839ff50bb93a4e69cd8b44bf2a600333abcdd1f90e3c2d43cfd3d3557d82fc3e785fd8466cf906bb03542e0b
@@ -3,3 +3,7 @@ language: ruby
3
3
  rvm:
4
4
  - 2.4.0
5
5
  before_install: gem install bundler -v 1.15.4
6
+
7
+ notifications:
8
+ slack: fadendaten:tWoet2mtObvbwSZSyUAY93jl
9
+ email: false
data/README.md CHANGED
@@ -1,39 +1,5 @@
1
- # FileCrawler
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/file_crawler`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'file_crawler'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install file_crawler
1
+ [![Gem Version](https://badge.fury.io/rb/fde-file_crawler.svg)](https://badge.fury.io/rb/fde-file_crawler)
2
+ [![Build Status](https://travis-ci.org/fashion-data-exchange/file_crawler.svg?branch=master)](https://travis-ci.org/fashion-data-exchange/file_crawler)
3
+ [![Code Climate](https://codeclimate.com/github/fashion-data-exchange/file_crawler/badges/gpa.svg)](https://codeclimate.com/github/fashion-data-exchange/file_crawler)
22
4
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- 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).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/file_crawler.
36
-
37
- ## License
38
-
39
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
5
+ # FileCrawler
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "file_crawler"
4
+ require "fde/file_crawler"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -1,7 +1,8 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "file_crawler/version"
4
+ require "fde/file_crawler/version"
5
+
5
6
  Gem::Specification.new do |spec|
6
7
  spec.name = "fde-file_crawler"
7
8
  spec.version = FDE::FileCrawler::VERSION
@@ -1,10 +1,11 @@
1
- require 'file_crawler/version'
1
+ require 'fde/file_crawler/version'
2
2
 
3
3
  module FDE
4
-
5
4
  module FileCrawler
5
+ class NoCopyTargetDefined < StandardError; end
6
+
6
7
  class Config
7
- attr_accessor :path_to_directory
8
+ attr_accessor :path_in_directory, :path_out_directory
8
9
  end
9
10
 
10
11
  def self.config
@@ -24,14 +25,20 @@ module FDE
24
25
  end
25
26
 
26
27
  def self.crawl(query = /.*\.*/i)
27
- path = self.config.path_to_directory
28
+ path = self.config.path_in_directory
28
29
  files = Dir.entries(path)
29
30
  files -= %w[. ..]
30
31
  files.select { |file| query.match(file) }
31
32
  end
32
33
 
33
- def self.copy(file, target)
34
- FileUtils.copy(path_for(file), target)
34
+ def self.copy(file, target = nil)
35
+ if self.config.path_out_directory && target.nil?
36
+ FileUtils.copy(path_for(file), self.config.path_out_directory)
37
+ elsif target.nil?
38
+ raise NoCopyTargetDefined
39
+ else
40
+ FileUtils.copy(path_for(file), target)
41
+ end
35
42
  end
36
43
 
37
44
  def self.delete(file)
@@ -43,7 +50,7 @@ module FDE
43
50
  end
44
51
 
45
52
  def self.path_for(file)
46
- "#{self.config.path_to_directory}#{file}"
53
+ "#{self.config.path_in_directory}#{file}"
47
54
  end
48
55
  end
49
56
  end
@@ -1,5 +1,5 @@
1
1
  module FDE
2
2
  module FileCrawler
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
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.2.1
4
+ version: 0.3.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-12 00:00:00.000000000 Z
11
+ date: 2017-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,8 +112,8 @@ files:
112
112
  - bin/console
113
113
  - bin/setup
114
114
  - fde-file_crawler.gemspec
115
- - lib/file_crawler.rb
116
- - lib/file_crawler/version.rb
115
+ - lib/fde/file_crawler.rb
116
+ - lib/fde/file_crawler/version.rb
117
117
  homepage: https://github.com/fashion-data-exchange/file_crawler
118
118
  licenses:
119
119
  - MIT