lib/trackman/assets/asset.rb in trackman-0.4.2 vs lib/trackman/assets/asset.rb in trackman-0.4.3

- old
+ new

@@ -1,13 +1,10 @@ module Trackman module Assets class Asset - extend Components::AssetFactory - extend Components::Conventions - extend Components::Diffable - extend Components::Shippable - include Components::Hashable + extend Components::AssetFactory, Components::Conventions + extend Components::Diffable, Components::Shippable include Comparable def initialize attributes = {} @assets = [] @@ -17,11 +14,11 @@ attr_accessor :virtual_path attr_reader :path, :assets def to_remote - RemoteAsset.new(:path => @path, :virtual_path => self.virtual_path) + RemoteAsset.create(:path => @path, :virtual_path => self.virtual_path) end def ==(other) return false if other.nil? other_path = other.path.is_a?(Pathname) ? other.path : Pathname.new(other.path) @@ -48,11 +45,15 @@ end def is_child_of(parent) parent.assets.include? self end - + + def to_s + "<#{self.class}:\npath=#{path}\nfile_hash=#{file_hash}>" + end + def self.all return [] unless maintenance_path.exist? assets = [maintenance_page] + maintenance_page.assets assets = assets + [error_page] + error_page.assets if error_path.exist? @@ -61,9 +62,10 @@ end def self.sync local = Asset.all remote = RemoteAsset.all + diff_result = diff(local, remote) Debugger.trace diff_result.inspect ship diff_result \ No newline at end of file