Class: Opsk::Push

Inherits:
Thor::Group
  • Object
show all
Includes:
Thorable, Thor::Actions
Defined in:
lib/opskeleton/push.rb

Instance Method Summary collapse

Methods included from Thorable

#artifact, #artifact_path, #check_root, included, #machines, #meta, #name, #type_of

Instance Method Details

#pushObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/opskeleton/push.rb', line 33

def push
  Dir["modules/*"].reject{|o| not File.directory?(o)}.each do |d|
    begin
 if File.exists?("#{d}/.git")
    g = Git.init(d)
    add_writable(g,options['protocol'].to_sym)
    if !options['dry'] and g.diff('origin').stats[:files].keys.length > 0
resp = yes?("Push #{d}? (y/n)") unless options['all']
if(options['all'] or resp)
  say "pushing #{d} .."
  g.push('writable') 
  g.pull
end
    end
 end
    rescue => e
 say "Failed to push #{d} due to #{e}"
    end
  end
end

#validateObject



28
29
30
# File 'lib/opskeleton/push.rb', line 28

def validate
  check_root
end