Class: Beyond::Plugin

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/beyond/plugin.rb

Instance Method Summary collapse

Instance Method Details

#extractObject



14
15
16
17
18
19
20
# File 'app/models/beyond/plugin.rb', line 14

def extract
  Dir.chdir File.join(ENV['tenants_plugins_dir'], tenant.name) do
    unless Kernel.system "tar xzf #{archive_file_name}"
      throw "Can't extract archive"
    end
  end
end

#startObject



29
30
31
32
# File 'app/models/beyond/plugin.rb', line 29

def start
  extract
  update_attribute(:activated, true)
end

#stopObject



22
23
24
25
26
27
# File 'app/models/beyond/plugin.rb', line 22

def stop
  Dir.chdir File.join(ENV['tenants_plugins_dir'], tenant.name) do
    FileUtils.rm_r(name)
  end
  update_attribute(:activated, false)
end