sicily 0.1.5 → 0.1.6

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: 4a629cc27f49bb182ca951daf71ea7ee3d2331d5
4
- data.tar.gz: 234f34293f5ed0c91de1faf3edf057fb7fc2aaca
3
+ metadata.gz: 5f6d06dfcf656ff02bef26a923b9684d5a28851e
4
+ data.tar.gz: 5ead2b24d7137cd9eafe16b7f43df83997ec4e0f
5
5
  SHA512:
6
- metadata.gz: 6d2374a89542c67d991116e4cba6cffb3328d94f091e68fbacc023c7a6901e299090761d3e7d75b89723fc0a363471f9e3daf9832d1be87c90871294ec551441
7
- data.tar.gz: 51f67a612250656c27aeaf0b1a744c5201aa759ebd6e586ee99df6bcf0de7a740057c6730fdbe30a70fb6b33a2e6659e6270360c9699744d4037a6d8302f65d4
6
+ metadata.gz: f1faa2887227d90898a5efa500d2933bd6e6915621d46db189e7038bb292bae273bc1956f306c17b6789dae943d3ef9dae925db41794efa140afec3693574bff
7
+ data.tar.gz: 8987884e10095901ddccf3ede93d061f97796d8fbe280304ede4afead9843e098972f90534eb43c4e07f202da32cf413f4fae8a082ec258b224b357f39d3d8bb
@@ -1,5 +1,7 @@
1
1
  sudo: false
2
+ os: osx
2
3
  language: ruby
3
4
  rvm:
4
- - 2.4.0
5
- before_install: gem install bundler -v 1.16.1
5
+ - 2.3.1
6
+ before_install:
7
+ - brew install gd
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.6
4
+ * It consumes already existing files on start-up.
5
+
6
+ ## 0.1.5
7
+ * It waits 10 seconds before taking actions in case when file is still changing
8
+
3
9
  ## 0.1.4
4
10
  * Add required ruby version
5
11
  * It's now easy to add new generator.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sicily (0.1.5)
4
+ sicily (0.1.6)
5
5
  concurrent-ruby (~> 1.0.5)
6
6
  exifr (~> 1.3.3)
7
7
  fastimage (~> 2.1.1)
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/sicily.svg)](https://badge.fury.io/rb/sicily)
2
+ [![Build Status](https://travis-ci.org/eunjae-lee/sicily.svg?branch=master)](https://travis-ci.org/eunjae-lee/sicily)
2
3
 
3
4
  # Sicily
4
5
 
@@ -30,17 +31,12 @@ And install a node package as:
30
31
 
31
32
  Go to your project path, and then execute:
32
33
 
34
+ $ mkdir my-project
35
+ $ cd my-project
33
36
  $ sicily generate
34
37
 
35
38
  ### Modify the generated files
36
39
 
37
- `./config/google_photo.rb`
38
-
39
- Sicily.configure_google do |config|
40
- config.id = "your id"
41
- config.pw = "your pw"
42
- end
43
-
44
40
  `./config/rules.rb`
45
41
 
46
42
  Sicily.on '~/your_folder' do
@@ -59,6 +55,13 @@ Go to your project path, and then execute:
59
55
  rm
60
56
  end
61
57
 
58
+ `./config/google_photo.rb` (optional)
59
+
60
+ Sicily.configure_google do |config|
61
+ config.id = 'your id'
62
+ config.pw = 'your pw'
63
+ end
64
+
62
65
  ### Start & Stop
63
66
 
64
67
  If you want to monitor just during the current terminal session, then execute:
@@ -8,12 +8,14 @@ module Sicily
8
8
  class Config
9
9
  attr_reader :forbid_new_file_in_subfolder,
10
10
  :num_thread_pool,
11
- :delay_on_file_monitoring
11
+ :delay_on_file_monitoring,
12
+ :consume_on_start
12
13
 
13
14
  def initialize
14
15
  @forbid_new_file_in_subfolder = true
15
16
  @num_thread_pool = 50
16
17
  @delay_on_file_monitoring = 10
18
+ @consume_on_start = true
17
19
  end
18
20
  end
19
21
 
@@ -8,6 +8,24 @@ require 'sicily/error/monitor_error'
8
8
  module Sicily
9
9
  class Monitor
10
10
  def on(path, &user_rule_block)
11
+ consume_all(path, &user_rule_block)
12
+ attach_monitor(path, &user_rule_block)
13
+ end
14
+
15
+ private
16
+
17
+ def consume_all(path, &user_rule_block)
18
+ return unless Sicily.config.consume_on_start
19
+
20
+ files = already_existing_files(path)
21
+ BatchProcessor.new(files).run(&user_rule_block)
22
+ end
23
+
24
+ def already_existing_files(path)
25
+ Dir["#{File.expand_path(path)}/**/*"]
26
+ end
27
+
28
+ def attach_monitor(path, &user_rule_block)
11
29
  Sicily.logger.info "Starting a monitor on #{path}"
12
30
  path = validate_and_expand_path(path)
13
31
  start_listener(path) do |files|
@@ -21,8 +39,6 @@ module Sicily
21
39
  path
22
40
  end
23
41
 
24
- private
25
-
26
42
  def start_listener(path)
27
43
  delay = Sicily.config.delay_on_file_monitoring
28
44
  listener = Listen.to(path, wait_for_delay: delay) do |_modified, added, _removed|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sicily
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sicily
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Eunjae Lee