Class: RoleJob

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/chef/role_job.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_dir, target) ⇒ RoleJob

Returns a new instance of RoleJob.



2
3
4
# File 'lib/guard/chef/role_job.rb', line 2

def initialize(base_dir, target)
  @base_dir, @target = base_dir, target
end

Instance Method Details

#base_cmdObject



6
7
8
# File 'lib/guard/chef/role_job.rb', line 6

def base_cmd
  "cd #{@base_dir}"
end

#targetObject



10
11
12
# File 'lib/guard/chef/role_job.rb', line 10

def target
  @target
end

#updateObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/guard/chef/role_job.rb', line 14

def update
  puts "uploading changed role. (#{target}) Please wait."
  if /Updated Role #{target}!/ =~ `#{base_cmd} && rake role[#{target}]`
    puts "role (#{target}) uploaded."
    true
  else
    puts "role (#{target}) could not be uploaded."
    false
  end
end