Module: Sicily

Defined in:
lib/sicily.rb,
lib/sicily/config.rb,
lib/sicily/logger.rb,
lib/sicily/monitor.rb,
lib/sicily/version.rb,
lib/sicily/generator.rb,
lib/sicily/path_helper.rb,
lib/sicily/task_loader.rb,
lib/sicily/generator/god.rb,
lib/sicily/file_processor.rb,
lib/sicily/task/file_task.rb,
lib/sicily/util/exif_util.rb,
lib/sicily/util/file_util.rb,
lib/sicily/batch_processor.rb,
lib/sicily/generator/rules.rb,
lib/sicily/monitor_wrapper.rb,
lib/sicily/task/dummy_task.rb,
lib/sicily/util/image_util.rb,
lib/sicily/task/resize_task.rb,
lib/sicily/generator/schedule.rb,
lib/sicily/error/monitor_error.rb,
lib/sicily/generator/application.rb,
lib/sicily/generator/google_photo.rb,
lib/sicily/task/google_photo_task.rb,
lib/sicily/util/notification_util.rb

Defined Under Namespace

Modules: Task, Util Classes: BatchProcessor, Config, FileProcessor, Generator, GoogleCredential, LoggerWrapper, Monitor, MonitorError, MonitorWrapper, TaskLoader

Constant Summary collapse

VERSION =
'0.1.8'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



5
6
7
# File 'lib/sicily/config.rb', line 5

def config
  @config
end

.config_googleObject

Returns the value of attribute config_google.



7
8
9
# File 'lib/sicily/task/google_photo_task.rb', line 7

def config_google
  @config_google
end

.generatorsObject

Returns the value of attribute generators.



5
6
7
# File 'lib/sicily/generator.rb', line 5

def generators
  @generators
end

.loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/sicily/logger.rb', line 7

def logger
  @logger
end

Class Method Details

.configure(&block) ⇒ Object



24
25
26
# File 'lib/sicily/config.rb', line 24

def self.configure(&block)
  block.call Sicily.config if block_given?
end

.configure_google(&block) ⇒ Object



16
17
18
19
# File 'lib/sicily/task/google_photo_task.rb', line 16

def self.configure_google(&block)
  return if block.nil?
  block.call Sicily.config_google
end

.lib_pathObject



8
9
10
# File 'lib/sicily/path_helper.rb', line 8

def self.lib_path
  File.expand_path(File.join(File.dirname(__FILE__), '..'))
end

.load_all_configsObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/sicily/config.rb', line 28

def self.load_all_configs
  return unless $SICILY_LOAD_USER_CONFIGS

  Sicily.logger.debug "#{Sicily.generators.size} generators found."
  Sicily.generators.each do |generator|
    path = File.expand_path "#{Sicily.user_config_path}/#{generator.filename}"
    next unless generator.load_on_start
    Sicily.logger.debug "ConfigLoader : #{path}"
    load path
  end
end

.load_all_tasksObject



41
42
43
# File 'lib/sicily/task_loader.rb', line 41

def self.load_all_tasks
  TaskLoader.new.load_all_tasks
end

.load_generatorsObject



22
23
24
25
26
27
# File 'lib/sicily/generator.rb', line 22

def self.load_generators
  Dir["#{Sicily.lib_path}/sicily/generator/*.rb"].each do |file|
    file = File.expand_path file
    require file
  end
end

.on(path, &user_rule_block) ⇒ Object



18
19
20
# File 'lib/sicily.rb', line 18

def self.on(path, &user_rule_block)
  MonitorWrapper.on path, &user_rule_block
end

.register_generator(&block) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/sicily/generator.rb', line 14

def self.register_generator(&block)
  return unless block_given?

  generator = Generator.new
  block.call generator
  Sicily.generators << generator
end

.user_config_pathObject



4
5
6
# File 'lib/sicily/path_helper.rb', line 4

def self.user_config_path
  "#{Dir.pwd}/config"
end