cide 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/CHANGELOG.md +5 -0
- data/cide.gemspec +1 -1
- data/lib/cide.rb +36 -2
- data/lib/cide_template.erb +11 -0
- data/lib/ssh_config +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30a2f95075fe4906e536539c360fddaffdf271ba
|
4
|
+
data.tar.gz: f0f615e78197b0a54391b3812b74aff2c26e8a32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee97b84d524086f7a8b7adc129811696f95ab1401c1b06940d6f5aef3bb1d475ac4219203ddc96caa5df7b5d325838fc1f1be1b019d3a31c311d14cdfd8b14e7
|
7
|
+
data.tar.gz: c487bcdd7b5650ca4c31f2fdc3876156adb82af50fa01473b0954216b8788cc07a9a4e44d94805b8bdf88ebbd55203f3d629b65c6245cda37277df1cae474b61
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/cide.gemspec
CHANGED
data/lib/cide.rb
CHANGED
@@ -12,11 +12,17 @@ require 'thor'
|
|
12
12
|
# The juicy bits are defined in CIDE::CLI
|
13
13
|
module CIDE
|
14
14
|
DOCKERFILE = 'Dockerfile'
|
15
|
-
|
15
|
+
SSH_CONFIG_FILE = 'ssh_config'
|
16
|
+
TEMP_SSH_KEY = 'id_rsa.tmp'
|
17
|
+
DOCKERFILE_TEMPLATE = File.read(
|
18
|
+
File.expand_path('../cide_template.erb', __FILE__),
|
19
|
+
)
|
20
|
+
SSH_CONFIG_CONTENTS = File.read(File.expand_path('../ssh_config', __FILE__))
|
16
21
|
CONFIG_FILE = '.cide.yml'
|
17
22
|
|
18
23
|
CIDE_DIR = '/cide'
|
19
24
|
CIDE_SRC_DIR = File.join(CIDE_DIR, '/src')
|
25
|
+
CIDE_SSH_DIR = File.join(CIDE_DIR, '/.ssh')
|
20
26
|
|
21
27
|
module_function
|
22
28
|
|
@@ -39,6 +45,7 @@ module CIDE
|
|
39
45
|
export_dir: './artifacts',
|
40
46
|
host_export_dir: nil,
|
41
47
|
run: 'script/ci',
|
48
|
+
ssh_key: nil,
|
42
49
|
) do
|
43
50
|
|
44
51
|
alias_method :image=, :from=
|
@@ -49,7 +56,7 @@ module CIDE
|
|
49
56
|
end
|
50
57
|
|
51
58
|
def to_dockerfile
|
52
|
-
ERB.new(
|
59
|
+
ERB.new(DOCKERFILE_TEMPLATE, nil, '<>-').result(binding)
|
53
60
|
end
|
54
61
|
|
55
62
|
def merge!(opts = {})
|
@@ -98,6 +105,11 @@ module CIDE
|
|
98
105
|
aliases: ['r'],
|
99
106
|
default: nil
|
100
107
|
|
108
|
+
method_option 'ssh_key',
|
109
|
+
desc: 'The ssh key to put into the docker image',
|
110
|
+
aliases: ['s'],
|
111
|
+
default: nil
|
112
|
+
|
101
113
|
def build
|
102
114
|
setup_docker
|
103
115
|
|
@@ -110,6 +122,18 @@ module CIDE
|
|
110
122
|
|
111
123
|
tag = "cide/#{config.name}"
|
112
124
|
|
125
|
+
if config.ssh_key && File.exist?(config.ssh_key)
|
126
|
+
say_status :SSHkey, 'Creating temp ssh key file within directory'
|
127
|
+
ssh_key_contents = File.read(config.ssh_key)
|
128
|
+
File.write(TEMP_SSH_KEY, ssh_key_contents)
|
129
|
+
config.ssh_key = TEMP_SSH_KEY
|
130
|
+
at_exit do
|
131
|
+
File.unlink(TEMP_SSH_KEY)
|
132
|
+
end
|
133
|
+
else
|
134
|
+
say_status :SSHKey, 'No SSH key specified'
|
135
|
+
end
|
136
|
+
|
113
137
|
say_status :config, config.to_h
|
114
138
|
|
115
139
|
# FIXME: Move Dockerfile out of the way if it exists
|
@@ -123,6 +147,16 @@ module CIDE
|
|
123
147
|
say_status :Dockerfile, 'Using existing Dockerfile'
|
124
148
|
end
|
125
149
|
|
150
|
+
if !File.exist?(SSH_CONFIG_FILE)
|
151
|
+
say_status :ssh_config, 'Creating temporary ssh config'
|
152
|
+
File.write(SSH_CONFIG_FILE, SSH_CONFIG_CONTENTS)
|
153
|
+
at_exit do
|
154
|
+
File.unlink(SSH_CONFIG_FILE)
|
155
|
+
end
|
156
|
+
else
|
157
|
+
say_status :ssh_config, 'Using existing ssh config'
|
158
|
+
end
|
159
|
+
|
126
160
|
docker :build, '-t', tag, '.'
|
127
161
|
|
128
162
|
return unless config.export
|
data/lib/cide_template.erb
CHANGED
@@ -13,6 +13,17 @@ RUN <%= cmd %>
|
|
13
13
|
ENV HOME <%= CIDE_DIR %>
|
14
14
|
WORKDIR <%= CIDE_SRC_DIR %>
|
15
15
|
|
16
|
+
# SSH config
|
17
|
+
<% if ssh_key -%>
|
18
|
+
ADD ssh_config <%= File.expand_path('config', CIDE_SSH_DIR) %>
|
19
|
+
RUN chmod 400 <%= File.expand_path('config', CIDE_SSH_DIR) %>
|
20
|
+
|
21
|
+
ADD <%= ssh_key %> <%= File.expand_path('id_rsa', CIDE_SSH_DIR) %>
|
22
|
+
RUN chmod 400 <%= File.expand_path('id_rsa', CIDE_SSH_DIR) %>
|
23
|
+
RUN chmod 755 <%= CIDE_SSH_DIR %>
|
24
|
+
RUN chown -R cide:cide <%= CIDE_DIR %>
|
25
|
+
<% end %>
|
26
|
+
|
16
27
|
# Before
|
17
28
|
|
18
29
|
<% if before['run'] -%>
|
data/lib/ssh_config
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zimbatm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- cide.gemspec
|
77
77
|
- lib/cide.rb
|
78
78
|
- lib/cide_template.erb
|
79
|
+
- lib/ssh_config
|
79
80
|
homepage: https://github.com/zimbatm/cide
|
80
81
|
licenses:
|
81
82
|
- MIT
|