class StoreAgent::VersionManager

バージョン管理に使用するクラスの雛形。
デフォルトではこのクラスが使用されるが、その場合はバージョン管理を行わない。

Attributes

workspace[R]

Public Class Methods

reserved_filenames() click to toggle source

バージョン管理システムが使用するため予約されているファイル名
例えば git の場合は、.git .keep など

# File lib/store_agent/version_manager.rb, line 28
def self.reserved_filenames
  []
end

Public Instance Methods

add(*paths) click to toggle source

引数で渡されたパスをバージョン管理対象に追加する

# File lib/store_agent/version_manager.rb, line 48
def add(*params, &block)
  call_block(params, &block)
end
init click to toggle source

バージョン管理対象のリポジトリを初期化する

# File lib/store_agent/version_manager.rb, line 40
def init(*params, &block)
  call_block(params, &block)
end
read(path: "", revision: nil) click to toggle source

指定されたパスの指定リビジョン時の中身を返す

# File lib/store_agent/version_manager.rb, line 75
def read(*params, &block)
  call_block(params, &block)
end
remove(*paths, directory: false) click to toggle source

引数で渡されたパスをバージョン管理対象から除外する
パスがディレクトリの場合には、directory に true が渡される

# File lib/store_agent/version_manager.rb, line 57
def remove(*params, &block)
  call_block(params, &block)
end
revisions(path) click to toggle source

引数で渡されたパスのリビジョン一覧を返す

# File lib/store_agent/version_manager.rb, line 83
def revisions(*params, &block)
  call_block(params, &block)
end
transaction(messsage, &block) click to toggle source

引数でコミットメッセージとブロックを受け取り、トランザクション処理で実行する
ブロックの実行に成功した場合には受け取ったメッセージで変更をコミットする。
処理に失敗した場合は、ブロックの実行前の状態に戻す。

# File lib/store_agent/version_manager.rb, line 67
def transaction(*params, &block)
  call_block(params, &block)
end

Private Instance Methods

call_block(*) { || ... } click to toggle source
# File lib/store_agent/version_manager.rb, line 93
def call_block(*, &block)
  FileUtils.cd(workspace.namespace_dirname) do
    if block
      yield
    end
  end
end
relative_path(path) click to toggle source
# File lib/store_agent/version_manager.rb, line 89
def relative_path(path)
  path[(workspace.namespace_dirname.length + 1)..-1]
end