meroku 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f5b77a7020b9070c98356c545c6bad3c10cb41f
4
- data.tar.gz: 245195d10ba32e577c050181618cabe13a9a3994
3
+ metadata.gz: 6715ff22d4132899602bd83a1d6a4b0b806f8a1e
4
+ data.tar.gz: dabfae897d476694db33c1f9e978e8501a22b2f2
5
5
  SHA512:
6
- metadata.gz: 4d9f6674d08add9d0fc57b5b9d8246c7797dfe622b9cf5cbbca2da3b08e95e48dc0410e994c6cc5364cad45c87d5cbf9db37c7f5db5c3cda6f81e7a7cb94cc7b
7
- data.tar.gz: 9269502bb855e2cc21526a177bd25832ad1ae83334b65a0699a1092d05ad7cc2baaaed0be6d127cb0bd96f34acc044285e25304d4a987e72f82d6eca188fdafb
6
+ metadata.gz: 49a87725609385c18792e7652323d0a8b7a2377217c23fb2845cd4623df6d3f76c8488ac74d23e96fc96dde367f38fac552809081462bedb9b942d9f8fa0f73b
7
+ data.tar.gz: 0c9966ca3382a39d20a6008a0015cd3bc4afc200b00a7591eb944b6b677890ef9ca8ebe4ea3a7c3841c794d2950c09844ab5cce570c421fe7ef1d28560e925d9
@@ -1,3 +1,14 @@
1
1
  class App < ApplicationRecord
2
2
  belongs_to :user
3
+
4
+ after_commit :make_folder, on: [:create]
5
+
6
+ def make_folder
7
+ Rails.logger.debug "DB8 app.rb:def self.make_folder called"
8
+ system(%Q[sudo -u git mkdir /home/git/#{self.name}.git])
9
+ system(%Q[sudo -u git sh -c "cd /home/git/#{self.name}.git; git --bare init"])
10
+ system(%Q[sudo -u git sh -c "echo '#!/bin/bash' >> /home/git/#{self.name}.git/hooks/post-receive"])
11
+ system(%Q[sudo -u git sh -c 'echo "echo abc123499999999999999999999999999999" >> /home/git/#{self.name}.git/hooks/post-receive'])
12
+ system(%Q[sudo -u git sh -c 'sudo chmod +x /home/git/#{self.name}.git/hooks/post-receive'])
13
+ end
3
14
  end
@@ -1,14 +1,15 @@
1
1
  class Publickey < ApplicationRecord
2
2
  belongs_to :user
3
+ after_commit :do_refresh, on: [:create]
3
4
 
4
5
  # Updates /home/git/.ssh/authorized_keys
5
6
  # called when something added/?/etc to publickeys table
6
- def self.refresh
7
+ def do_refresh
7
8
  Rails.logger.debug "DB8 publickey.rb:def self.refresh called"
8
- Rails.logger.debug "wipwip"
9
- end
10
-
11
- def after_save
12
- Publickey.refresh
9
+ if Publickey.all.size > 0
10
+ File.write('/tmp/authorized_keys', Publickey.pluck(:data).join("\n") )
11
+ system("sudo -u git cp /tmp/authorized_keys /home/git/.ssh/authorized_keys")
12
+ File.delete('/tmp/authorized_keys')
13
+ end
13
14
  end
14
15
  end
@@ -1,3 +1,3 @@
1
1
  module Meroku
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.5"
3
3
  end
data/meroku.gemspec CHANGED
@@ -22,7 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_dependency 'escape', '~> 0.0.4'
25
- spec.add_dependency 'rest-client'
25
+
26
+ spec.add_runtime_dependency 'rest-client', '~> 0'
26
27
 
27
28
  spec.add_runtime_dependency "activesupport", "~> 5.1.4"
28
29
  spec.add_runtime_dependency "aws-sdk-ec2", "~> 1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Weerasinghe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-26 00:00:00.000000000 Z
11
+ date: 2017-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: escape
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency