Class: RunShell::Shell

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/run_shell/shell.rb

Class Method Summary collapse

Class Method Details

.runObject

attr_accessible :whodunnit, :file_path, :content, :result



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/run_shell/shell.rb', line 5

def self.run
    if File.exists?(RunShell.config.shell_path)
      content = File.read(RunShell.config.shell_path)
      result = system content
      shell = Shell.new(file_path:RunShell.config.shell_path, content:content, result:result, whodunnit:RunShell.whodunnit)
      shell.save
    end

    if !RunShell.config.shell_command.blank?
      content = RunShell.config.shell_command
      result = system content
      shell = Shell.new(content:content, result:result, whodunnit:RunShell.whodunnit)
      shell.save
    end
end