Class: KnifeSpork::Plugins::Git

Inherits:
Plugin
  • Object
show all
Defined in:
lib/knife-spork/plugins/git.rb

Instance Method Summary collapse

Methods inherited from Plugin

#enabled?, hook, hooks, #initialize, name

Constructor Details

This class inherits a constructor from KnifeSpork::Plugins::Plugin

Instance Method Details

#after_bumpObject



37
38
39
40
41
# File 'lib/knife-spork/plugins/git.rb', line 37

def after_bump
  cookbooks.each do |cookbook|
    git_add(cookbook_path_for(cookbook),"metadata.rb")
  end
end

#after_promote_localObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/knife-spork/plugins/git.rb', line 43

def after_promote_local
  environments.each do |environment|
    git_add(environment_path,"#{environment}.json")
  end
  if config.auto_push
    branch =  if not config.branch.nil?
                config[:branch] 
              else 
                "master"
              end

    git_commit(environment_path, "promote #{cookbooks.collect{ |c| "#{c.name}@#{c.version}" }.join(",")} to #{environments.join(",")}")
    git_push(branch)
  end
end

#before_bumpObject



10
11
12
13
14
15
16
17
# File 'lib/knife-spork/plugins/git.rb', line 10

def before_bump
  git_pull(environment_path) unless cookbook_path.include?(environment_path.gsub"/environments","")
  git_pull_submodules(environment_path) unless cookbook_path.include?(environment_path.gsub"/environments","")
  cookbooks.each do |cookbook|
    git_pull(cookbook_path_for(cookbook))
    git_pull_submodules(cookbook_path_for(cookbook))
  end
end

#before_promoteObject



28
29
30
31
32
33
34
35
# File 'lib/knife-spork/plugins/git.rb', line 28

def before_promote
  cookbooks.each do |cookbook|
    git_pull(environment_path) unless cookbook_path_for(cookbook).include?(environment_path.gsub"/environments","")
    git_pull_submodules(environment_path) unless cookbook_path_for(cookbook).include?(environment_path.gsub"/environments","")
    git_pull(cookbook_path_for(cookbook))
    git_pull_submodules(cookbook_path_for(cookbook))
  end
end

#before_uploadObject



19
20
21
22
23
24
25
26
# File 'lib/knife-spork/plugins/git.rb', line 19

def before_upload
  git_pull(environment_path) unless cookbook_path.include?(environment_path.gsub"/environments","")
  git_pull_submodules(environment_path) unless cookbook_path.include?(environment_path.gsub"/environments","")
  cookbooks.each do |cookbook|
    git_pull(cookbook_path_for(cookbook))
    git_pull_submodules(cookbook_path_for(cookbook))
  end
end

#performObject



8
# File 'lib/knife-spork/plugins/git.rb', line 8

def perform; end