class BodegaShopify::Syncer
Attributes
config[RW]
Public Class Methods
new(params={})
click to toggle source
# File lib/bodega-shopify/syncer.rb, line 8 def initialize params={} self.config = params[:config] end
Public Instance Methods
cli()
click to toggle source
# File lib/bodega-shopify/syncer.rb, line 12 def cli @cli ||= ShopifyTheme::Cli.new end
files()
click to toggle source
# File lib/bodega-shopify/syncer.rb, line 16 def files Dir["**/*"] end
modified_files()
click to toggle source
# File lib/bodega-shopify/syncer.rb, line 20 def modified_files files.select{ |file| !(config.ignore_files.any? { |ignore| file =~ /^#{ignore}/ } || File.directory?(file) || File.mtime(file).to_i < config.last_sync_at.to_time.to_i) } end
replace!()
click to toggle source
# File lib/bodega-shopify/syncer.rb, line 24 def replace! cli.replace cli.upload 'config/settings_data.json' end
save_config()
click to toggle source
# File lib/bodega-shopify/syncer.rb, line 29 def save_config config.last_sync_at = Time.now config.save end
sync!()
click to toggle source
# File lib/bodega-shopify/syncer.rb, line 34 def sync! modified_files.each { |file| cli.upload file } save_config end
watch()
click to toggle source
# File lib/bodega-shopify/syncer.rb, line 39 def watch cli.watch end