Class: FsTemplate::FromCommand

Inherits:
Object
  • Object
show all
Includes:
FromHash
Defined in:
lib/fs_template/from_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command.



4
5
6
# File 'lib/fs_template/from_command.rb', line 4

def command
  @command
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/fs_template/from_command.rb', line 4

def path
  @path
end

Instance Method Details

#with_tmp_dirObject



6
7
8
9
10
11
12
13
14
# File 'lib/fs_template/from_command.rb', line 6

def with_tmp_dir
  dir = "/tmp/#{rand(1000000000000000000)}"
  `mkdir #{dir}`
  Dir.chdir(dir) do
    yield dir
  end
ensure
  ec "rm -rf #{dir}", :silent => true
end