frontend/app/models/app.rb in meroku-2.0.4 vs frontend/app/models/app.rb in meroku-2.0.5
- old
+ new
@@ -1,3 +1,14 @@
class App < ApplicationRecord
belongs_to :user
+
+ after_commit :make_folder, on: [:create]
+
+ def make_folder
+ Rails.logger.debug "DB8 app.rb:def self.make_folder called"
+ system(%Q[sudo -u git mkdir /home/git/#{self.name}.git])
+ system(%Q[sudo -u git sh -c "cd /home/git/#{self.name}.git; git --bare init"])
+ system(%Q[sudo -u git sh -c "echo '#!/bin/bash' >> /home/git/#{self.name}.git/hooks/post-receive"])
+ system(%Q[sudo -u git sh -c 'echo "echo abc123499999999999999999999999999999" >> /home/git/#{self.name}.git/hooks/post-receive'])
+ system(%Q[sudo -u git sh -c 'sudo chmod +x /home/git/#{self.name}.git/hooks/post-receive'])
+ end
end