minke 1.13.7 → 1.13.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/bin/minke +3 -1
- data/docker/Dockerfile +14 -6
- data/docker/entrypoint.sh +16 -0
- data/lib/minke.rb +1 -32
- data/lib/minke/docker/network.rb +2 -2
- data/lib/minke/helpers/shell.rb +3 -3
- data/lib/minke/logger.rb +31 -0
- data/lib/minke/scripts/minke +25 -34
- data/lib/minke/tasks/bundle.rb +2 -13
- data/lib/minke/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec16a6f8bb966d59cb0305eb6abc45e93b31939a
|
4
|
+
data.tar.gz: 960268cd2550e92d486b51017a11c61c01e7d174
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f72fe2a479b1298b9365ed4f6f6dc7d6af2e17f4e305122a3b99d44d77b64a67b7f8285682a878de40c768b86287ca26046d0d9fada2f72f0a76921e47c2367c
|
7
|
+
data.tar.gz: 763efb3149550d65dce85329d5a825d8bb8eb48f8514796d1bceaf41bbfc2b2f5f8d5be12b1deaca64b6864a7349087a51cbba19ac28d06090e9c6b1dff0f568
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -30,7 +30,7 @@ after_deploy:
|
|
30
30
|
docker build -t nicholasjackson/minke --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD` .;
|
31
31
|
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
|
32
32
|
docker push nicholasjackson/minke:latest;
|
33
|
-
docker tag nicholasjackson/minke nicholasjackson/minke:1.13.
|
34
|
-
docker push nicholasjackson/minke:1.13.
|
33
|
+
docker tag nicholasjackson/minke nicholasjackson/minke:1.13.8;
|
34
|
+
docker push nicholasjackson/minke:1.13.8;
|
35
35
|
curl https://hooks.microbadger.com/images/nicholasjackson/minke/tkpohfdrYPE0B0TL5NzLcOap4k0=;
|
36
36
|
fi
|
data/bin/minke
CHANGED
@@ -79,6 +79,8 @@ subcommands = {
|
|
79
79
|
|
80
80
|
global.order!
|
81
81
|
command = ARGV.shift
|
82
|
+
subcommands[command].order!
|
83
|
+
|
82
84
|
|
83
85
|
def load_config config_file, verbose
|
84
86
|
reader = Minke::Config::Reader.new Minke::Logging.create_logger(verbose)
|
@@ -159,4 +161,4 @@ when "generate"
|
|
159
161
|
doGenerate(options)
|
160
162
|
when "encrypt"
|
161
163
|
doEncrypt(options)
|
162
|
-
end
|
164
|
+
end
|
data/docker/Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
FROM
|
1
|
+
FROM ruby:latest
|
2
2
|
|
3
3
|
ENV COMPOSE_VERSION 1.7.1
|
4
4
|
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
@@ -25,14 +25,22 @@ RUN echo "deb https://apt.dockerproject.org/repo debian-jessie main" > /etc/apt/
|
|
25
25
|
RUN apt-get update
|
26
26
|
RUN apt-get -y install docker-engine=1.10.3-0~jessie
|
27
27
|
|
28
|
-
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 && curl -L get.rvm.io | bash -s stable --ruby=2.3.1 --with-gems="bundle"
|
29
|
-
|
30
28
|
RUN curl -o /usr/local/bin/docker-compose -L \
|
31
29
|
"https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-Linux-x86_64" \
|
32
30
|
&& chmod +x /usr/local/bin/docker-compose
|
33
31
|
|
34
|
-
COPY .bashrc /root/.bashrc
|
35
|
-
|
36
32
|
COPY Gemfile Gemfile
|
33
|
+
COPY entrypoint.sh /
|
34
|
+
RUN chmod +x /entrypoint.sh
|
35
|
+
|
36
|
+
RUN bundle install
|
37
|
+
|
38
|
+
RUN ls -las /usr/local/bundle/gems
|
39
|
+
|
40
|
+
RUN mkdir /usr/local/backup
|
41
|
+
|
42
|
+
RUN cp -R /usr/local/bundle/* /usr/local/backup
|
43
|
+
|
44
|
+
ENTRYPOINT ["/entrypoint.sh"]
|
37
45
|
|
38
|
-
|
46
|
+
CMD ["--help"]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
INSTALL="echo \"#Copying cache\" && cp -r /usr/local/backup/* /usr/local/bundle/ && gem install bundler && bundle install"
|
4
|
+
COMMAND="bundle exec minke $@"
|
5
|
+
|
6
|
+
if [[ $1 != \generate* ]]; then
|
7
|
+
if [ "$(ls -A ./vendor)" ]; then
|
8
|
+
eval $COMMAND
|
9
|
+
else
|
10
|
+
eval "$INSTALL && $COMMAND"
|
11
|
+
fi
|
12
|
+
fi
|
13
|
+
|
14
|
+
if [[ $1 = \generate* ]]; then
|
15
|
+
eval $COMMAND
|
16
|
+
fi
|
data/lib/minke.rb
CHANGED
@@ -19,6 +19,7 @@ require 'open3'
|
|
19
19
|
|
20
20
|
require 'minke/version'
|
21
21
|
require 'minke/command'
|
22
|
+
require 'minke/logger'
|
22
23
|
|
23
24
|
require 'minke/helpers/copy'
|
24
25
|
require 'minke/helpers/rake'
|
@@ -54,35 +55,3 @@ require 'minke/generators/shell_script'
|
|
54
55
|
|
55
56
|
require 'minke/encryption/encryption'
|
56
57
|
require 'minke/encryption/key_locator'
|
57
|
-
|
58
|
-
module Minke
|
59
|
-
class Logging
|
60
|
-
@@debug = false
|
61
|
-
@@ret = "\n"
|
62
|
-
|
63
|
-
def self.create_logger verbose = false
|
64
|
-
Logger.new(STDOUT).tap do |l|
|
65
|
-
l.datetime_format = ''
|
66
|
-
l.formatter = proc do |severity, datetime, progname, msg|
|
67
|
-
case severity
|
68
|
-
when 'ERROR'
|
69
|
-
s = "#{@@ret if @@debug}#{'ERROR'.colorize(:red)}: #{msg.chomp('')}\n"
|
70
|
-
@@debug = false
|
71
|
-
s
|
72
|
-
when 'INFO'
|
73
|
-
s = "#{@@ret if @@debug}#{'INFO'.colorize(:green)}: #{msg.chomp('')}\n"
|
74
|
-
@@debug = false
|
75
|
-
s
|
76
|
-
when 'DEBUG'
|
77
|
-
if verbose == true
|
78
|
-
"#{'DEBUG'.colorize(:yellow)}: #{msg.chomp('')}\n"
|
79
|
-
else
|
80
|
-
@@debug = true
|
81
|
-
"#{'.'.colorize(:yellow)}"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
data/lib/minke/docker/network.rb
CHANGED
@@ -11,7 +11,7 @@ module Minke
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def remove
|
14
|
-
@shell_runner.execute("docker network rm #{@network_name}") unless find_network.to_s == ''
|
14
|
+
@shell_runner.execute("docker network rm #{@network_name}", true) unless find_network.to_s == ''
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -20,4 +20,4 @@ module Minke
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
data/lib/minke/helpers/shell.rb
CHANGED
@@ -7,7 +7,7 @@ module Minke
|
|
7
7
|
|
8
8
|
##
|
9
9
|
# Executes a shell command and returns the return status
|
10
|
-
def execute command
|
10
|
+
def execute command, ignore_error=false
|
11
11
|
@logger.debug command
|
12
12
|
|
13
13
|
Open3.popen2e(command) do |stdin, stdout_err, wait_thr|
|
@@ -16,7 +16,7 @@ module Minke
|
|
16
16
|
end
|
17
17
|
|
18
18
|
exit_status = wait_thr.value
|
19
|
-
unless exit_status.success?
|
19
|
+
unless exit_status.success? || ignore_error == true
|
20
20
|
raise "Error executing command: #{command}"
|
21
21
|
end
|
22
22
|
end
|
@@ -48,4 +48,4 @@ module Minke
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
data/lib/minke/logger.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Minke
|
2
|
+
class Logging
|
3
|
+
@@debug = false
|
4
|
+
@@ret = "\n"
|
5
|
+
|
6
|
+
def self.create_logger verbose = false
|
7
|
+
Logger.new(STDOUT).tap do |l|
|
8
|
+
l.datetime_format = ''
|
9
|
+
l.formatter = proc do |severity, datetime, progname, msg|
|
10
|
+
case severity
|
11
|
+
when 'ERROR'
|
12
|
+
s = "#{@@ret if @@debug}#{'ERROR'.colorize(:red)}: #{msg.chomp('')}\n"
|
13
|
+
@@debug = false
|
14
|
+
s
|
15
|
+
when 'INFO'
|
16
|
+
s = "#{@@ret if @@debug}#{'INFO'.colorize(:green)}: #{msg.chomp('')}\n"
|
17
|
+
@@debug = false
|
18
|
+
s
|
19
|
+
when 'DEBUG'
|
20
|
+
if verbose == true
|
21
|
+
"#{'DEBUG'.colorize(:yellow)}: #{msg.chomp('')}\n"
|
22
|
+
else
|
23
|
+
@@debug = true
|
24
|
+
"#{'.'.colorize(:yellow)}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/minke/scripts/minke
CHANGED
@@ -1,51 +1,42 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
MINKE_VERSION="1.13.7"
|
3
|
-
ERROR="Please specify a command e.g. ./minke build"
|
4
3
|
|
5
4
|
DOCKER_SOCK="/var/run/docker.sock:/var/run/docker.sock"
|
6
5
|
NEW_UUID=$(base64 /dev/urandom | tr -d '/+' | head -c 32 | tr '[:upper:]' '[:lower:]')
|
7
6
|
|
8
|
-
|
9
|
-
GEMSET=$(<.ruby-gemset)
|
10
|
-
fi
|
11
|
-
|
12
|
-
LEN=$(echo ${#GEMSET})
|
13
|
-
|
14
|
-
if [ $LEN -lt 1 ]; then
|
15
|
-
GEMSET='minkegems'
|
16
|
-
fi
|
17
|
-
|
18
|
-
GEMSETFOLDER="/usr/local/rvm/gems/ruby-2.3.1@${GEMSET}"
|
19
|
-
RVM_COMMAND="source /usr/local/rvm/scripts/rvm && rvm gemset use ${GEMSET} --create"
|
20
|
-
DOCKER_IMAGE="nicholasjackson/minke:${MINKE_VERSION}"
|
21
|
-
COMMAND=""
|
22
|
-
|
23
|
-
|
24
|
-
if [ "$1" == '' ]; then
|
25
|
-
echo $ERROR;
|
26
|
-
exit 1;
|
27
|
-
fi
|
7
|
+
DOCKER_IMAGE="minketester"
|
28
8
|
|
29
9
|
COMMAND=$*
|
30
10
|
|
11
|
+
GEM_VOLUMES=""
|
12
|
+
|
31
13
|
# Test if interactive terminal and set the flag
|
32
14
|
[[ -t 1 ]] && IT="-it" || IT=""
|
33
15
|
|
34
|
-
if [[ $1 == \generate* ]]; then
|
35
|
-
echo "Generating new template"
|
36
|
-
DIR=${PWD}
|
37
|
-
DOCKER_RUN="docker run --rm -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -v ${DIR}/_build/vendor/gems:${GEMSETFOLDER} -e DOCKER_NETWORK=minke_${NEW_UUID} -w ${DIR} ${DOCKER_IMAGE} /bin/bash -c '${RVM_COMMAND} && bundle install && minke ${COMMAND}'"
|
38
|
-
|
39
|
-
eval "${DOCKER_RUN}"
|
40
|
-
fi
|
41
|
-
|
42
16
|
if [[ $1 != \generate* ]]; then
|
17
|
+
|
18
|
+
echo "Generate"
|
19
|
+
|
20
|
+
# Test if we need to mount any special volumes for paths specified in the Gemfile
|
21
|
+
while read -r line; do
|
22
|
+
l=$(echo $line | sed "s/.*:path *=> *//" | sed "s/['|\"]\(.*\)['|\"]/\1/")
|
23
|
+
GEM_VOLUMES="${GEM_VOLUMES} -v $l:$l"
|
24
|
+
done < <(grep :path Gemfile)
|
25
|
+
|
43
26
|
DIR=$(dirname `pwd`)
|
44
|
-
DOCKER_RUN="docker run --rm ${IT} --net=minke_${NEW_UUID} -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -v ${DIR}/_build/vendor/
|
27
|
+
DOCKER_RUN="docker run --rm ${IT} --net=minke_${NEW_UUID} ${GEM_VOLUMES} -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -v ${DIR}/_build/vendor:/usr/local/bundle -e DOCKER_NETWORK=minke_${NEW_UUID} -w ${DIR}/_build ${DOCKER_IMAGE} ${COMMAND}"
|
45
28
|
|
46
|
-
echo "Running command: ${COMMAND}"
|
29
|
+
echo "Running command: minke ${COMMAND}"
|
47
30
|
|
48
|
-
|
31
|
+
id=$(docker network create minke_${NEW_UUID})
|
32
|
+
#echo "${DOCKER_RUN}"
|
49
33
|
eval "${DOCKER_RUN}"
|
50
|
-
|
51
|
-
fi
|
34
|
+
id=$(docker network rm minke_${NEW_UUID})
|
35
|
+
fi
|
36
|
+
|
37
|
+
if [[ $1 = \generate* ]]; then
|
38
|
+
DIR=$(pwd)
|
39
|
+
DOCKER_RUN="docker run --rm ${IT} -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -w ${DIR}/${DIR} ${DOCKER_IMAGE} ${COMMAND}"
|
40
|
+
echo $DOCKER_RUN
|
41
|
+
eval "$DOCKER_RUN"
|
42
|
+
fi
|
data/lib/minke/tasks/bundle.rb
CHANGED
@@ -9,20 +9,9 @@ module Minke
|
|
9
9
|
|
10
10
|
def run args = nil
|
11
11
|
@logger.info '### Install gems'
|
12
|
-
rvm = "#{ENV['HOME']}/.rvm/scripts/rvm"
|
13
|
-
rvm_root = '/usr/local/rvm/scripts/rvm'
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
gemset = @shell_helper.read_file '.ruby-gemset'
|
19
|
-
|
20
|
-
@logger.info "Using gemset #{gemset}"
|
21
|
-
|
22
|
-
rvm_command = "source #{rvm} && rvm gemset use #{gemset} --create && " if rvm_installed
|
23
|
-
rvm_command = "source #{rvm_root} && rvm gemset use #{gemset} --create && " if rvm_root_installed
|
24
|
-
|
25
|
-
@shell_helper.execute("/bin/bash -c '#{rvm_command}bundle install -j3 && bundle update'")
|
13
|
+
@shell_helper.execute('bundle install -j3')
|
14
|
+
@shell_helper.execute('bundle update')
|
26
15
|
end
|
27
16
|
|
28
17
|
end
|
data/lib/minke/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nic Jackson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- docker/.bashrc
|
233
233
|
- docker/Dockerfile
|
234
234
|
- docker/Gemfile
|
235
|
+
- docker/entrypoint.sh
|
235
236
|
- examples/config_go.yml
|
236
237
|
- examples/config_swift.yml
|
237
238
|
- lib/minke.rb
|
@@ -255,6 +256,7 @@ files:
|
|
255
256
|
- lib/minke/helpers/copy.rb
|
256
257
|
- lib/minke/helpers/rake.rb
|
257
258
|
- lib/minke/helpers/shell.rb
|
259
|
+
- lib/minke/logger.rb
|
258
260
|
- lib/minke/scripts/minke
|
259
261
|
- lib/minke/tasks/build.rb
|
260
262
|
- lib/minke/tasks/build_image.rb
|