Class: Itamae::Plugin::Resource::Ghq

Inherits:
Resource::Base
  • Object
show all
Defined in:
lib/itamae/plugin/resource/ghq.rb

Instance Method Summary collapse

Instance Method Details

#action_create(options) ⇒ Object



18
19
20
21
22
# File 'lib/itamae/plugin/resource/ghq.rb', line 18

def action_create(options)
  unless current.exist
    run_command(["ghq", "get", attributes.repository])
  end
end

#action_update(options) ⇒ Object



24
25
26
27
28
29
# File 'lib/itamae/plugin/resource/ghq.rb', line 24

def action_update(options)
  result = run_command(["ghq", "get", "-u", attributes.repository])
  unless result.stdout.match(/is up to date/)
    updated!
  end
end

#set_current_attributesObject



10
11
12
13
14
15
16
# File 'lib/itamae/plugin/resource/ghq.rb', line 10

def set_current_attributes
  super
  ensure_ghq_availability

  result = run_command("ghq list | grep '#{attributes.repository}$'", error: false)
  current.exist = result.exit_status == 0
end