Class: Shart::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/shart.rb

Overview

Process info a Shartfile

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.shartfile(filename) ⇒ Object



65
66
67
68
69
70
71
72
73
74
# File 'lib/shart.rb', line 65

def self.shartfile(filename)
  sync = new.tap { |dsl| dsl.instance_eval(File.read(filename), filename) }.sync
  puts "Sharting from #{sync.source.root.to_s.inspect} to #{sync.target.directory_name.inspect}"
  sync.upload do |file, object|
    puts "#{file.path}#{object.public_url}"
  end
  sync.clean do |object|
    puts "#{object.public_url}"
  end
end

Instance Method Details

#source(path) ⇒ Object



57
58
59
# File 'lib/shart.rb', line 57

def source(path)
  @source = Source.new(path)
end

#syncObject



61
62
63
# File 'lib/shart.rb', line 61

def sync
  Sync.new(@source, @target)
end

#target(directory_name, opts = {}) ⇒ Object



53
54
55
# File 'lib/shart.rb', line 53

def target(directory_name, opts={})
  @target = Target.new(directory_name, opts)
end