Class: CapistranoBootstrap

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano-bootstrap.rb

Constant Summary collapse

UPDATE_INTERVAL =

Update configuration repository every day

60 * 60 * 24

Class Method Summary collapse

Class Method Details

.invoke(repository, args = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/capistrano-bootstrap.rb', line 9

def invoke(repository, args = {})
  args[:config_dir] ||= "config/capistrano"
  args[:target_path] ||= "config/.config_repo"

  if !File.directory? args[:target_path]
    clone_repository(repository, "./config/.config_repo")
  elsif repository_needs_update?(args[:target_path])
    update_repository(args[:target_path])
  end

  tags = get_repository_tags(args[:target_path]).map { |x| Versionomy.parse(x) }.sort
  if configuration_needs_update?(args[:target_path], tags)
    update_capistrano_configuration(args[:target_path], args[:config_dir], tags)
  end
end