Class: RailsZero::PackagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rails_zero/packages_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
# File 'app/controllers/rails_zero/packages_controller.rb', line 5

def index
  FileUtils.mkdir_p(File.dirname(archive_path))
  Dir.chdir(Rails.root) do
    command = "tar -cf '#{archive_path}' 'public/'"
    stdout_str, stderr_str, status = Open3.capture3(command)

  end
  send_file archive_path
end

#newObject



15
16
17
18
# File 'app/controllers/rails_zero/packages_controller.rb', line 15

def new
  CleanSiteJob.new.run
  head :ok
end