Class: Runch::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/runch/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommand

Returns a new instance of Command.



11
12
# File 'lib/runch/command.rb', line 11

def initialize
end

Class Method Details

.run(*arguments) ⇒ Object



6
7
8
# File 'lib/runch/command.rb', line 6

def run(*arguments)
  new.run(arguments)
end

Instance Method Details

#run(arguments) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/runch/command.rb', line 14

def run(arguments)
  Dir.mktmpdir("runch") do |dir|
    arguments.each do |file|
      FileUtils.cp(file, dir)
      basename = File.basename(file, ".*")
      system("gcc", "-o", "#{dir}/#{basename}", file)
      system("#{dir}/#{basename}")
    end
  end
end