sicily 0.1.3 → 0.1.4
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 +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +24 -3
- data/exe/sicily +24 -45
- data/generator/god.rb +13 -0
- data/generator/google_photo.rb +17 -0
- data/generator/rules.rb +17 -0
- data/generator/schedule.rb +11 -0
- data/lib/sicily/generator.rb +18 -0
- data/lib/sicily/version.rb +1 -1
- data/sicily.gemspec +1 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3b5be431300e6ce68436d6126064a6187563139
|
4
|
+
data.tar.gz: fa017687e400cf32704eb3bbc4476e7315165b2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8b827f0e3f9aa7278a596185cd8bbf30d62af0ea02c9e6937befc6a23a6a27d4d5ad6b65fcc1e19ce89bfde7bf8428b4fc5eea834c3396393ae159f945abbdd
|
7
|
+
data.tar.gz: 5a41679daa4924a591c7c66160f2aae3d26744423b880f2cd0eceb9b8094a14c697598ae72d5dd4a1bd50b39048351572dde148d6eb5131c5e0fa2eb083de548
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.1
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -26,14 +26,35 @@ And install a node package as:
|
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
|
29
|
+
### Generate config files
|
30
|
+
|
29
31
|
Go to your project path, and then execute:
|
30
32
|
|
31
33
|
$ sicily generate
|
34
|
+
|
35
|
+
### Modify the generated files
|
36
|
+
|
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
|
+
./config/rules.rb
|
45
|
+
|
46
|
+
Sicily.on "~/your_folder" do
|
47
|
+
fit_if_photo 2000, 2000
|
48
|
+
google_photo
|
49
|
+
mv "~/your_another_folder/%Y/%m/%d"
|
50
|
+
end
|
32
51
|
|
33
|
-
|
52
|
+
Sicily.on "~/your_folder2" do
|
53
|
+
fit_if_photo 1000, 1000
|
54
|
+
cp "~/your_another_folder/%Y/%m/%d"
|
55
|
+
end
|
34
56
|
|
35
|
-
|
36
|
-
./config/rules.rb
|
57
|
+
### Start & Stop
|
37
58
|
|
38
59
|
If you want to monitor just during the current terminal session, then execute:
|
39
60
|
|
data/exe/sicily
CHANGED
@@ -10,54 +10,33 @@ command = ARGV[0]
|
|
10
10
|
case command
|
11
11
|
when "generate"
|
12
12
|
require "fileutils"
|
13
|
+
require "sicily/generator"
|
14
|
+
|
15
|
+
Dir["./generator/*.rb"].each {|file|
|
16
|
+
require file
|
17
|
+
}
|
18
|
+
|
19
|
+
FileUtils.rm_rf "./config"
|
13
20
|
FileUtils.mkdir_p "./config"
|
14
21
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
w.start = "sicily monitor"
|
19
|
-
w.dir = File.expand_path("\#{File.dirname(__FILE__)}/..")
|
20
|
-
w.keepalive
|
21
|
-
end
|
22
|
-
EOF
|
23
|
-
schedule_content = <<-EOF
|
24
|
-
every :hour do
|
25
|
-
god_file = File.expand_path("\#{File.dirname(__FILE__)}/.sicily.god")
|
26
|
-
command "god -c \#{god_file}"
|
27
|
-
end
|
28
|
-
EOF
|
29
|
-
google_photo_content = <<-EOF
|
30
|
-
Sicily.configure_google do |config|
|
31
|
-
config.id = "your id"
|
32
|
-
config.pw = "your pw"
|
33
|
-
end
|
34
|
-
EOF
|
35
|
-
rules_content = <<-EOF
|
36
|
-
Sicily.on "~/your_folder" do
|
37
|
-
fit_if_photo 2000, 2000
|
38
|
-
google_photo
|
39
|
-
mv "~/your_another_folder/%Y/%m/%d"
|
40
|
-
end
|
22
|
+
Sicily.generators.each do |generator|
|
23
|
+
File.write("./config/#{generator.filename}", generator.content)
|
24
|
+
end
|
41
25
|
|
42
|
-
Sicily.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
puts ""
|
57
|
-
puts "To upload to Google Photos,"
|
58
|
-
puts " turn on \"Allowing less secure apps to access your account\""
|
59
|
-
puts " : https://support.google.com/accounts/answer/6010255"
|
60
|
-
puts " *USE AT YOUR OWN RISK*"
|
26
|
+
files_to_edit = Sicily.generators.map { |t| t.filename }.select { |t| not t.start_with?(".") }
|
27
|
+
messages_to_display = Sicily.generators.map { |t| t.post_generate_message }.select { |t| not t.to_s.empty? }
|
28
|
+
|
29
|
+
if files_to_edit.size > 0
|
30
|
+
puts "Try edit the following files:"
|
31
|
+
files_to_edit.each do |file|
|
32
|
+
puts " ./config/#{file}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
if messages_to_display.size > 0
|
37
|
+
puts ""
|
38
|
+
puts messages_to_display.join("\n")
|
39
|
+
end
|
61
40
|
when "monitor"
|
62
41
|
`echo test >> monitor.log`
|
63
42
|
necessary_config_files = ["rules.rb"]
|
data/generator/god.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Sicily
|
2
|
+
Sicily.register_generator do |generator|
|
3
|
+
generator.filename = ".sicily.god"
|
4
|
+
generator.content = <<-EOF
|
5
|
+
God.watch do |w|
|
6
|
+
w.name = "sicily"
|
7
|
+
w.start = "sicily monitor"
|
8
|
+
w.dir = File.expand_path("\#{File.dirname(__FILE__)}/..")
|
9
|
+
w.keepalive
|
10
|
+
end
|
11
|
+
EOF
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Sicily
|
2
|
+
Sicily.register_generator do |generator|
|
3
|
+
generator.filename = "google_photo.rb"
|
4
|
+
generator.content = <<-EOF
|
5
|
+
Sicily.configure_google do |config|
|
6
|
+
config.id = "your id"
|
7
|
+
config.pw = "your pw"
|
8
|
+
end
|
9
|
+
EOF
|
10
|
+
generator.post_generate_message = <<-EOF
|
11
|
+
To upload to Google Photos,
|
12
|
+
turn on "Allowing less secure apps to access your account"
|
13
|
+
: https://support.google.com/accounts/answer/6010255
|
14
|
+
*USE AT YOUR OWN RISK*
|
15
|
+
EOF
|
16
|
+
end
|
17
|
+
end
|
data/generator/rules.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Sicily
|
2
|
+
Sicily.register_generator do |generator|
|
3
|
+
generator.filename = "rules.rb"
|
4
|
+
generator.content = <<-EOF
|
5
|
+
Sicily.on "~/your_folder" do
|
6
|
+
fit_if_photo 2000, 2000
|
7
|
+
google_photo
|
8
|
+
mv "~/your_another_folder/%Y/%m/%d"
|
9
|
+
end
|
10
|
+
|
11
|
+
Sicily.on "~/your_folder2" do
|
12
|
+
fit_if_photo 1000, 1000
|
13
|
+
cp "~/your_another_folder/%Y/%m/%d"
|
14
|
+
end
|
15
|
+
EOF
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Sicily
|
2
|
+
Sicily.register_generator do |generator|
|
3
|
+
generator.filename = ".schedule.rb"
|
4
|
+
generator.content = <<-EOF
|
5
|
+
every :hour do
|
6
|
+
god_file = File.expand_path("\#{File.dirname(__FILE__)}/.sicily.god")
|
7
|
+
command "god -c \#{god_file}"
|
8
|
+
end
|
9
|
+
EOF
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Sicily
|
2
|
+
class Generator
|
3
|
+
attr_accessor :filename, :content, :post_generate_message
|
4
|
+
end
|
5
|
+
|
6
|
+
class << self
|
7
|
+
attr_accessor :generators
|
8
|
+
end
|
9
|
+
Sicily.generators = []
|
10
|
+
|
11
|
+
def self.register_generator(&block)
|
12
|
+
return unless block_given?
|
13
|
+
|
14
|
+
generator = Generator.new
|
15
|
+
block.call generator
|
16
|
+
Sicily.generators << generator
|
17
|
+
end
|
18
|
+
end
|
data/lib/sicily/version.rb
CHANGED
data/sicily.gemspec
CHANGED
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.bindir = "exe"
|
35
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
36
|
spec.require_paths = ["lib"]
|
37
|
+
spec.required_ruby_version = '>= 2.2.5'
|
37
38
|
|
38
39
|
spec.add_dependency "listen", "~> 3.1.5"
|
39
40
|
spec.add_dependency "god", "~> 0.13.7"
|
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.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Lee
|
@@ -174,6 +174,7 @@ extra_rdoc_files: []
|
|
174
174
|
files:
|
175
175
|
- ".gitignore"
|
176
176
|
- ".rspec"
|
177
|
+
- ".ruby-version"
|
177
178
|
- ".travis.yml"
|
178
179
|
- CHANGELOG.md
|
179
180
|
- CODE_OF_CONDUCT.md
|
@@ -185,10 +186,15 @@ files:
|
|
185
186
|
- bin/console
|
186
187
|
- bin/setup
|
187
188
|
- exe/sicily
|
189
|
+
- generator/god.rb
|
190
|
+
- generator/google_photo.rb
|
191
|
+
- generator/rules.rb
|
192
|
+
- generator/schedule.rb
|
188
193
|
- lib/sicily.rb
|
189
194
|
- lib/sicily/batch_processor.rb
|
190
195
|
- lib/sicily/config.rb
|
191
196
|
- lib/sicily/file_processor.rb
|
197
|
+
- lib/sicily/generator.rb
|
192
198
|
- lib/sicily/monitor.rb
|
193
199
|
- lib/sicily/task/dummy_task.rb
|
194
200
|
- lib/sicily/task/file_task.rb
|
@@ -222,7 +228,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
228
|
requirements:
|
223
229
|
- - ">="
|
224
230
|
- !ruby/object:Gem::Version
|
225
|
-
version:
|
231
|
+
version: 2.2.5
|
226
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
233
|
requirements:
|
228
234
|
- - ">="
|