minke 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzY3ZDEwYjE1YjU5NjA0YmU3ZmIzNDAzMzNmYTQxMGYzZTU4M2M1ZA==
4
+ N2NlNTg2Mjc1ZWZjNjA2NzNhM2ZhZDEyN2E4MmZiMDQxOTNkZjI4OQ==
5
5
  data.tar.gz: !binary |-
6
- NGNmZjY2ZmM4MDM1ZGU0ZDUwZTJmMzE5OGM3ZjdjZTA1MjE0ZDdiOA==
6
+ OWQzYzc5NGQ5MzNkOTljZWM2NWY3MGYyNWQ1ZTZkM2ViY2M4ZjQ2YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGY2NDA2Mzg1NjhhMDZjYmUxYmNhNWUwMjVkNjg5OWIyZGE3ODFlMTI3MzE5
10
- OTQ1YTMzNjkxN2I2NjFmODZkMjczZTY2YmM3NjQwYzZiNzVlZDYzYzA1YmU2
11
- OGRkYWQyMDVhMmYyMmQ4YzFlODZhODdkYWViYTAxMzQzZGU3ZDU=
9
+ ZDUzODA5MjUyODQ3OGI5OTA3NzJlMzk0ZmFkYjEzZDk0MzEwZGNlMDk4Yjhh
10
+ ZGQ2OTlhNWNiY2FjODM5MDNjOGJkZjdmMDdmNzNjZDI4OGQ3OTE1NmZmZTUz
11
+ M2E2MzQ4MjZkNDQxZDNmOWJlZjY0MzZjZTM1YTNjMDFhYmMzODE=
12
12
  data.tar.gz: !binary |-
13
- NDEwOWUwZTJkMzYwYzIyOWE0Mzc5MjQzODQ4NDQ5ZDRhZGMwYjJiZDEzOWNi
14
- MGQzYzM4NjY0NTdhZWVhNWM1ZDYxNjA3YzZlMTY3OTQ5NGNmZmEyYjA0ZTky
15
- N2QyMzFkOWFhOTJkZWNjY2M3ZmUzMzBlMDBhOGUyZDRkMjcwMmQ=
13
+ NmZkMDczNmJlNGNhNTQ1MzI3MTg1ZjFmM2FhYTlmZmI1NGFjMjAwN2ZmMmIx
14
+ NmZlMTdmM2JkMmU1ZGZkNjM3NDk0MzM0NzcyN2IwMjBhNjMwMzM3YTM3N2Qy
15
+ ZWIwMjM1ZDc1NmUwNjE4OThmZjdhNjBkZGVkNWVmZjZlNzAzMTk=
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Minke
2
- [![Build Status](https://travis-ci.org/nicholasjackson/go_builder.svg?branch=master)](https://travis-ci.org/nicholasjackson/go_builder)
2
+ [![Build Status](https://travis-ci.org/nicholasjackson/minke.svg?branch=master)](https://travis-ci.org/nicholasjackson/minke)
3
3
 
4
4
  Minke is an opinionated build system for Microservices and Docker, like a little envelope of quality it scaffolds the build, run and test (unit test and functional tests) phases of your microservice project allowing you to simply run and test your images using Docker Compose. Currently supporting Google's Go, extensions are planned for Node.js or HTML / Javascript sites with Grunt or Gulp based builds.
5
5
 
@@ -66,6 +66,36 @@ module Minke
66
66
  return container
67
67
  end
68
68
 
69
+ def self.create_and_run_container args, cmd
70
+ # update the timeout for the Excon Http Client
71
+ # set the chunk size to enable streaming of log files
72
+ Docker.options = {:chunk_size => 1, :read_timeout => 3600}
73
+ container = Docker::Container.create(
74
+ 'Image' => args['build_args']['image'],
75
+ 'Cmd' => cmd,
76
+ "Binds" => ["#{ENV['GOPATH']}/src:/go/src"],
77
+ "Env" => args['build_args']['env'],
78
+ 'WorkingDir' => args['build_args']['working_directory'])
79
+
80
+ return_code = 0
81
+
82
+ thread = Thread.new {
83
+ container.attach { |stream, chunk|
84
+ puts "#{chunk}"
85
+
86
+ if stream.to_s == "stdout"
87
+ return_code = 0
88
+ else
89
+ return_code = 1
90
+ end
91
+ }
92
+ }
93
+ container.start
94
+ thread.join
95
+
96
+ return container, return_code
97
+ end
98
+
69
99
  def self.tag_and_push args
70
100
  image = self.find_image "#{args['go']['application_name']}:latest"
71
101
  image.tag('repo' => "#{args['docker_registry']['namespace']}/#{args['go']['application_name']}", 'force' => true) unless image.info["RepoTags"].include? "#{args['docker_registry']['namespace']}/#{args['go']['application_name']}:latest"
@@ -4,21 +4,23 @@ namespace :app do
4
4
  p "Test application"
5
5
 
6
6
  config = Minke::Helpers.config
7
- container = Minke::GoDocker.get_container config['docker']
8
7
 
9
8
  begin
10
9
  # Get go packages
11
- ret = container.exec(['go','get','-t','-v','./...']) { |stream, chunk| puts "#{stream}: #{chunk}" }
12
- raise Exception, 'Error running command' unless ret[2] == 0
10
+ puts "Go get"
11
+ container, ret = Minke::GoDocker.create_and_run_container config['docker'], ['go','get','-t','-v','./...']
12
+ ensure
13
+ container.delete()
14
+ end
13
15
 
16
+ begin
14
17
  # Test application
15
- ret = container.exec(['go','test','./...']) do |stream, chunk|
16
- puts "#{stream}: #{chunk}"
17
- end
18
+ puts "Go test"
19
+ container, ret = Minke::GoDocker.create_and_run_container config['docker'], ['go','test','./...']
18
20
 
19
- raise Exception, 'Error running command' unless ret[2] == 0
20
- ensure
21
- container.delete(:force => true)
21
+ raise Exception, 'Error running command' unless ret == 0
22
+ ensure
23
+ container.delete()
22
24
  end
23
25
  end
24
26
 
@@ -27,19 +29,14 @@ namespace :app do
27
29
  p "Build for Linux"
28
30
 
29
31
  config = Minke::Helpers.config
30
- container = Minke::GoDocker.get_container config['docker']
31
32
 
32
33
  begin
33
34
  # Build go server
34
- ret = container.exec(
35
- ['go','build','-a','-installsuffix','cgo','-ldflags','\'-s\'','-o', config['go']['application_name']]
36
- ) do |stream, chunk|
37
- puts "#{stream}: #{chunk}"
38
- end
35
+ container, ret = Minke::GoDocker.create_and_run_container config['docker'], ['go','build','-a','-installsuffix','cgo','-ldflags','\'-s\'','-o', config['go']['application_name']]
39
36
 
40
- raise Exception, 'Error running command' unless ret[2] == 0
41
- ensure
42
- container.delete(:force => true)
37
+ raise Exception, 'Error running command' unless ret == 0
38
+ ensure
39
+ container.delete()
43
40
  end
44
41
  end
45
42
 
data/lib/minke/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Minke
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
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: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Jackson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-27 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler