cyclid 0.2.4 → 0.2.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: 051d2d610dc0eb351961625c4b7803648425b8e3
4
- data.tar.gz: f318c016a0c6e3de32faea08f8cb4ac046c781ea
3
+ metadata.gz: 075e82b45f23bff6cb7e99792eb97e3d7a55e912
4
+ data.tar.gz: 2ccbb21e53f9db060786e22d641a05203c18d420
5
5
  SHA512:
6
- metadata.gz: 2b8cbf10d103bc69384c92eb32b9cb48944f6debe6bcbf2a1c37f0bcdd710c97f2077c82371373e6d57d30b15df487d0fbdd18ec9df60252335af21e0996a951
7
- data.tar.gz: 3a518369356ca89ed5a5ab340779493ec7dd1862a4822735c596366063a9f70fd8e81934dd6a725d78e93d7c5c91e6e05d1171b792d7c7f2db715c2dd1a43228
6
+ metadata.gz: e3bcc3a37f8c1bd4b83d90ed61af1bee3482d94b05b60c0966bb05f7fa433a618671d4450ab94890ffeb4fa5bd5b0c672af133067aae5dc68d3d7d0f01893501
7
+ data.tar.gz: 35cfcb20a3434bd9e0ff492c00017e64288b51cda48662417b61807e7cf4584f0cba83201592ad648f48a259c71776b55bbc3aff432f8321170dff0e134e4e7f
@@ -29,14 +29,14 @@ module Cyclid
29
29
  @pr ||= @payload['pull_request']
30
30
  end
31
31
 
32
- def pr_clone_url
33
- pull_request['base']['repo']['html_url']
34
- end
35
-
36
32
  def pr_head
37
33
  @pr_head ||= pull_request['head']
38
34
  end
39
35
 
36
+ def pr_clone_url
37
+ pr_head['repo']['html_url']
38
+ end
39
+
40
40
  def pr_sha
41
41
  pr_head['sha']
42
42
  end
@@ -25,6 +25,10 @@ module Cyclid
25
25
  def prepare(transport, buildhost, env = {})
26
26
  transport.export_env('DEBIAN_FRONTEND' => 'noninteractive')
27
27
 
28
+ # Build hosts may require an update before anything can be installed
29
+ success = transport.exec 'apt-get update'
30
+ raise 'failed to update repositories' unless success
31
+
28
32
  if env.key? :repos
29
33
  env[:repos].each do |repo|
30
34
  next unless repo.key? :url
@@ -39,6 +43,7 @@ module Cyclid
39
43
  end
40
44
  end
41
45
 
46
+ # We must update again to cache the new repositories
42
47
  success = transport.exec 'apt-get update'
43
48
  raise 'failed to update repositories' unless success
44
49
  end
@@ -25,6 +25,10 @@ module Cyclid
25
25
  def prepare(transport, buildhost, env = {})
26
26
  transport.export_env('DEBIAN_FRONTEND' => 'noninteractive')
27
27
 
28
+ # Build hosts may require an update before anything can be installed
29
+ success = transport.exec 'apt-get update'
30
+ raise 'failed to update repositories' unless success
31
+
28
32
  if env.key? :repos
29
33
  # Ensure apt-get-repository is available
30
34
  transport.exec 'apt-get install -y software-properties-common'
@@ -45,6 +49,7 @@ module Cyclid
45
49
  end
46
50
  end
47
51
 
52
+ # We must update again to cache the new repositories
48
53
  success = transport.exec 'apt-get update'
49
54
  raise 'failed to update repositories' unless success
50
55
  end
@@ -122,17 +122,11 @@ module Cyclid
122
122
 
123
123
  # Close the SSH connection
124
124
  def close
125
- logout
126
-
127
125
  @session.close
128
126
  end
129
127
 
130
128
  private
131
129
 
132
- def logout
133
- exec 'exit'
134
- end
135
-
136
130
  def build_command(cmd, path = nil, env = {})
137
131
  command = []
138
132
  if env
@@ -59,9 +59,10 @@ def generate_password
59
59
  %w($ % ^ & * _)).sample(8).join
60
60
  end
61
61
 
62
- def create_admin_user
63
- secret = SecureRandom.hex(32)
64
- password = generate_password
62
+ def create_admin_user(initial_secret, initial_password)
63
+ secret = initial_secret || SecureRandom.hex(32)
64
+ password = initial_password || generate_password
65
+
65
66
  user = User.new
66
67
  user.username = 'admin'
67
68
  user.email = 'admin@example.com'
@@ -97,7 +98,10 @@ def update_user_perms
97
98
  permissions.save!
98
99
  end
99
100
 
100
- secret, password = create_admin_user
101
+ initial_secret = ARGV[0]
102
+ initial_password = ARGV[1]
103
+
104
+ secret, password = create_admin_user(initial_secret, initial_password)
101
105
  create_admin_organization
102
106
 
103
107
  update_user_perms
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Cyclid
3
3
  module Api
4
- VERSION = '0.2.4'
4
+ VERSION = '0.2.5'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyclid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristian Van Der Vliet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-27 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj