bricky 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDIwZmI1NWIzZWI4NGEyZWEwZmM2ZjlmNDA0YWFkZjhhNjBmODQ5Nw==
4
+ MzlmNTdkMGM2N2ViMmEzNzE1ZjQ5NjUxYjE1ODU3ODNmYjc1MWI4Yg==
5
5
  data.tar.gz: !binary |-
6
- ZWQ0ODMzODljMWMxNzFkYTA5NmQzZjVkNGIwZjkwNjNlNGU2NWM4Nw==
6
+ MjMxYTA1MzU0NWU4ZmM2ZWJjZDZmYzJhZTVkNTRmNzIwZWEzYjcwOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzQzNDM3MDkwODBhNDQyYjJlZmQ4OTk0MGI0ZTM5MWY2OTI2NmQ5MTc3ODE4
10
- NDZlYmU1MmU3NTY3ODZiZmY4NmRmZjk2ZDA1ZmZhZDFlZDVhMDJiMzk2MWI1
11
- OWVmMWY2N2E0MGZmNzhjODhlNmNmNzUxYzQ3NWYxNGI5YjkzZTg=
9
+ MGUwNTc4MmM5N2NmNGNhZGEyZmUxMDI3ZWRkNmVjOWUxZGJkYzBmYjE2ODc0
10
+ ZTI2Yjk0NTQ4ZmYzOGQyMDRiZDJiNzI5NGRjY2IwMGQ4MjI4MWU3NDhmMTg0
11
+ MTZkNDY0Yzg0NGY3ZjQ1MTRlYzM4OWIwNWE1M2UzNGM5N2I0MzI=
12
12
  data.tar.gz: !binary |-
13
- YjcwODg2OGMxODNhYWExZTgzZjMwNGYzYmNhMzUxNzNiNzllNTQ3NDA1OWZk
14
- ZDcwYzljNDMzMDA0MjBjMGI1MDhmMzZkYzYzNjc2ZjZhOGZkYzMxOWY4ZWU1
15
- N2MwNDllODQ2NTFjZTQzZGY4MWQ5ODMxYjdiNDcyMGIzYzA1ODY=
13
+ MTIyYzlmYjNhMGM5OTViNGRiYWRiNDA3YTVkZmMyYzg5NTI4NTlmZGIyNmZh
14
+ ZGVlZDc4YzI3YjQyM2ExM2EzMzM4ZGE5MTUzNmQwYWZlNDllN2VjNzQ3Y2Y0
15
+ MmJiNGVhMjlhMjNiNjMyZTBmNzIwNWMxZDUzOTk3ZDc5Y2IyMTA=
@@ -1,4 +1,4 @@
1
- #!/bin/bash -le
1
+ #!/bin/bash -e
2
2
 
3
3
  . $BRICKS_HOME/suexec
4
4
 
@@ -8,7 +8,7 @@ bundler() {
8
8
  info 'Vendor project with Bundler'
9
9
  pushd /opt/workspace/source
10
10
  command -v bundle > /dev/null 2>&1 || gem install --no-ri --no-rdoc bundler
11
- bundle install --deployment --jobs 5 --without=$BRICKS_BUNDLE_WITHOUT
11
+ bundle install --deployment --without=$BRICKS_BUNDLE_WITHOUT
12
12
  popd
13
13
  }
14
14
 
@@ -1,4 +1,4 @@
1
- #!/bin/bash -le
1
+ #!/bin/bash -e
2
2
 
3
3
  . $BRICKS_HOME/builder
4
4
 
@@ -1,4 +1,4 @@
1
- #!/bin/bash -le
1
+ #!/bin/bash -e
2
2
 
3
3
  . $BRICKS_HOME/builder
4
4
  . $BRICKS_HOME/execute
@@ -19,9 +19,17 @@ module Bricky
19
19
 
20
20
  desc :builder, "build project"
21
21
  method_option :shell, :type => :boolean, :aliases => "-s"
22
+ method_option :debugger, :type => :boolean, :aliases => "-d"
23
+ method_option :"just-image", :type => :boolean, :aliases => "-i"
22
24
  def builder
25
+ Bricky.logger.level = Logger::DEBUG if options['debugger']
26
+
23
27
  requirements.check_and_execute do
24
- dispatch(:bootstrap) && dispatch(:builder)
28
+ if options['just-image']
29
+ dispatch(:bootstrap)
30
+ else
31
+ dispatch(:bootstrap) && dispatch(:builder)
32
+ end
25
33
  end
26
34
  end
27
35
 
@@ -6,12 +6,7 @@ module Bricky
6
6
  class Bootstrap < Base
7
7
  def execute
8
8
  logger.important "Boostraping images"
9
-
10
- if need_rebuild?
11
- build(image)
12
- else
13
- logger.message "Skipping bootstrap process"
14
- end
9
+ build(image)
15
10
  end
16
11
 
17
12
  private
@@ -28,7 +23,6 @@ module Bricky
28
23
  end
29
24
  end
30
25
 
31
- make_cache!
32
26
  true
33
27
  end
34
28
 
@@ -62,21 +56,6 @@ module Bricky
62
56
  def cache_file
63
57
  "#{Bricky.config.cache_path}/builder"
64
58
  end
65
-
66
- def need_rebuild?
67
- cache_digest = open(cache_file).read rescue "dummy"
68
- image_digest = Digest::MD5.file(image.full_path).hexdigest
69
-
70
- return false if cache_digest.eql?(image_digest)
71
- true
72
- end
73
-
74
- def make_cache!
75
- FileUtils::mkdir_p(Bricky.config.cache_path)
76
- open(cache_file, 'w') do |file|
77
- file.write Digest::MD5.file(image.full_path).hexdigest
78
- end
79
- end
80
59
  end
81
60
  end
82
61
  end
@@ -14,9 +14,8 @@ module Bricky
14
14
  attach_shims
15
15
  code = command(images)
16
16
  logger.debug format(code)
17
-
18
- # TODO: remove nil from executor popen
19
- unless Bricky::Executor.popen(nil, code)
17
+
18
+ unless Bricky::Executor.system(code)
20
19
  logger.failure '~~~~~~~~~~~ Problems building image ~~~~~~~~~~~'
21
20
  return false
22
21
  end
@@ -25,7 +24,8 @@ module Bricky
25
24
  end
26
25
 
27
26
  def command(image)
28
- "docker run #{envs} #{arguments} -i -t #{image.name} /bricks/helper/start"
27
+ iteractive_hacks = options['shell'] ? "-i -t" : ""
28
+ "docker run --rm #{envs} #{arguments} #{iteractive_hacks} #{image.name} /bricks/helper/start"
29
29
  end
30
30
 
31
31
  def format(command)
@@ -54,9 +54,9 @@ module Bricky
54
54
  end
55
55
 
56
56
  def attach_shims
57
- if not File.exist? Bricky.config.shim_path
58
- FileUtils.symlink(Bricky.config.bricks_path, Bricky.config.shim_path)
59
- end
57
+ shim = Bricky.config.shim_path
58
+ FileUtils.safe_unlink(shim) if File.exist?(shim)
59
+ FileUtils.symlink(Bricky.config.bricks_path, shim)
60
60
  end
61
61
  end
62
62
  end
@@ -1,27 +1,14 @@
1
- require "pty"
1
+ require "open3"
2
2
 
3
3
  module Bricky
4
4
  module Executor
5
5
  extend self
6
6
 
7
7
  def popen(label, command)
8
- PTY.spawn(command) do |input, output, wait|
9
- begin
10
- # TODO: Refactory
11
- input.each do |line|
12
- if label.nil?
13
- logger.info line.chomp
14
- else
15
- logger.normal label, ": #{line.chomp}"
16
- end
17
- end
18
- rescue Errno::EIO
19
- ensure
20
- Process.wait wait
21
- end
22
- end
23
-
24
- $?.exitstatus.to_i.eql?(0)
8
+ Open3.popen2e(command) do |input, output, wait|
9
+ output.each { |line| logger.normal label, ": #{line.chomp}" }
10
+ wait.value.to_i.eql?(0)
11
+ end
25
12
  end
26
13
 
27
14
  def system(command)
@@ -30,7 +17,7 @@ module Bricky
30
17
 
31
18
  private
32
19
  def logger
33
- @logger ||= Bricky::Logger.new
20
+ Bricky.logger
34
21
  end
35
22
  end
36
23
  end
@@ -1,3 +1,3 @@
1
1
  module Bricky
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bricky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - andrerocker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-09 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler