bricky 0.0.11 → 0.0.12
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 +8 -8
- data/etc/bricks/debian/builder +0 -3
- data/etc/bricks/helper/suexec +16 -0
- data/etc/templates/bricky/bricky.yml +1 -1
- data/lib/bricky.rb +5 -0
- data/lib/bricky/bricks.rb +4 -6
- data/lib/bricky/bricks/base.rb +3 -0
- data/lib/bricky/bricks/bundle.rb +1 -1
- data/lib/bricky/bricks/helper.rb +7 -1
- data/lib/bricky/command.rb +2 -10
- data/lib/bricky/commands/base.rb +4 -0
- data/lib/bricky/commands/bootstrap.rb +31 -6
- data/lib/bricky/commands/builder.rb +6 -6
- data/lib/bricky/commands/install.rb +7 -4
- data/lib/bricky/config.rb +4 -0
- data/lib/bricky/image.rb +4 -0
- data/lib/bricky/logger.rb +30 -0
- data/lib/bricky/requirements.rb +9 -7
- data/lib/bricky/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzY4ZjIwODYzODQ0OGIyN2JlMGJmOTdkYTdhYjliMzgzMmM4N2U1OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmIyN2U4ODdkYmExMTJiZTFkZDNjMWM1MjhiMDczMzQ3OTE2OGI0MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzZjNjRiZDk1OTUxMGNiYWQzZGJlODY4ZGU0Yjg4YmIyMmQ1YjZlMDBmM2Mz
|
10
|
+
MmMyMTY2MTQ1ZjQ0MWYxZmY2ZjM2OTQzZmM4YzA4M2ZmOTFhMTMyMGJmYTdi
|
11
|
+
MmMwZDE1YTg1NTU1MGFjN2VhYjhkOTE3N2Y4ZjM0OTQ4ZDU1NTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWVhNzkyODFmOTIxM2M1MzE5OWRhZjNmMmZiYTQ2NThmNzRhMjEwZGI1ZTE3
|
14
|
+
OTE3NjhlMDA4ZTMyNTI1Y2ViMjhiMmY0MzBjYTFmYjYzODk4NTdjNDAzNmFh
|
15
|
+
NTNkZWIxMGI3NzAwMDhiODM5Y2RmNDYyNzk3YTUwYzliMThhMjc=
|
data/etc/bricks/debian/builder
CHANGED
data/etc/bricks/helper/suexec
CHANGED
@@ -5,5 +5,21 @@
|
|
5
5
|
suexec() {
|
6
6
|
name=$1
|
7
7
|
export -f $name
|
8
|
+
|
9
|
+
if [[ $BRICKS_LINUX == "true" ]]
|
10
|
+
then
|
11
|
+
execute_linux $name
|
12
|
+
else
|
13
|
+
execute_other $name
|
14
|
+
fi
|
15
|
+
}
|
16
|
+
|
17
|
+
execute_other() {
|
18
|
+
name=$1
|
19
|
+
execute $name
|
20
|
+
}
|
21
|
+
|
22
|
+
execute_linux() {
|
23
|
+
name=$1
|
8
24
|
su builder -m -c "bash -ec 'execute $name'"
|
9
25
|
}
|
data/lib/bricky.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "bricky/config"
|
2
|
+
require "bricky/logger"
|
2
3
|
require "bricky/command"
|
3
4
|
require "bricky/version"
|
4
5
|
|
@@ -12,4 +13,8 @@ module Bricky
|
|
12
13
|
def config
|
13
14
|
@config ||= Bricky::Config.new
|
14
15
|
end
|
16
|
+
|
17
|
+
def logger
|
18
|
+
@logger ||= Bricky::Logger.new
|
19
|
+
end
|
15
20
|
end
|
data/lib/bricky/bricks.rb
CHANGED
@@ -16,15 +16,13 @@ module Bricky
|
|
16
16
|
end.uniq
|
17
17
|
end
|
18
18
|
|
19
|
-
def resolve_and_initialize(name, config)
|
20
|
-
return Bricky::Bricks::Bundle.new(config) if name.eql? "bundle"
|
21
|
-
return Bricky::Bricks::Debian.new(config) if name.eql? "debian"
|
22
|
-
return Bricky::Bricks::Mounts.new(config) if name.eql? "mounts"
|
23
|
-
end
|
24
|
-
|
25
19
|
private
|
26
20
|
def default_bricks
|
27
21
|
[Bricky::Bricks::Helper.new({})]
|
28
22
|
end
|
23
|
+
|
24
|
+
def resolve_and_initialize(name, config)
|
25
|
+
Bricky::Bricks.const_get("#{name.to_s.capitalize}").new(config)
|
26
|
+
end
|
29
27
|
end
|
30
28
|
end
|
data/lib/bricky/bricks/base.rb
CHANGED
data/lib/bricky/bricks/bundle.rb
CHANGED
data/lib/bricky/bricks/helper.rb
CHANGED
data/lib/bricky/command.rb
CHANGED
@@ -16,18 +16,11 @@ module Bricky
|
|
16
16
|
dispatch(:install)
|
17
17
|
end
|
18
18
|
|
19
|
-
desc :bootstrap, "bootstrap builder images"
|
20
|
-
def bootstrap
|
21
|
-
requirements.check_and_execute do
|
22
|
-
dispatch(:bootstrap)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
19
|
desc :builder, "build project"
|
27
20
|
method_option :shell, :type => :boolean, :aliases => "-s"
|
28
21
|
def builder
|
29
22
|
requirements.check_and_execute do
|
30
|
-
dispatch(:builder)
|
23
|
+
dispatch(:bootstrap) && dispatch(:builder)
|
31
24
|
end
|
32
25
|
end
|
33
26
|
|
@@ -38,8 +31,7 @@ module Bricky
|
|
38
31
|
|
39
32
|
def dispatch(name)
|
40
33
|
clazz = Bricky::Commands.const_get("#{name.to_s.capitalize}")
|
41
|
-
|
42
|
-
command.execute
|
34
|
+
clazz.new(options).execute
|
43
35
|
end
|
44
36
|
end
|
45
37
|
end
|
data/lib/bricky/commands/base.rb
CHANGED
@@ -5,8 +5,13 @@ module Bricky
|
|
5
5
|
module Commands
|
6
6
|
class Bootstrap < Base
|
7
7
|
def execute
|
8
|
-
|
9
|
-
|
8
|
+
logger.important "Boostraping images"
|
9
|
+
|
10
|
+
if need_rebuild?
|
11
|
+
build(image)
|
12
|
+
else
|
13
|
+
logger.message "Skipping bootstrap process"
|
14
|
+
end
|
10
15
|
end
|
11
16
|
|
12
17
|
private
|
@@ -15,14 +20,15 @@ module Bricky
|
|
15
20
|
hack = command(image.name, create_hack_image(image))
|
16
21
|
|
17
22
|
[base, hack].each do |code|
|
18
|
-
|
23
|
+
logger.message "Processing '#{image.name}' image: ", code
|
19
24
|
|
20
25
|
unless system(code)
|
21
|
-
|
26
|
+
logger.failure "~~~~~~~~~~~ Problems building image ~~~~~~~~~~~"
|
22
27
|
return false
|
23
28
|
end
|
24
29
|
end
|
25
30
|
|
31
|
+
make_cache!
|
26
32
|
true
|
27
33
|
end
|
28
34
|
|
@@ -30,8 +36,8 @@ module Bricky
|
|
30
36
|
"docker build -t #{template_name} #{image_path}"
|
31
37
|
end
|
32
38
|
|
33
|
-
def
|
34
|
-
|
39
|
+
def image
|
40
|
+
@image ||= Bricky::Image.new("builder")
|
35
41
|
end
|
36
42
|
|
37
43
|
def create_hack_image(image)
|
@@ -52,6 +58,25 @@ module Bricky
|
|
52
58
|
|
53
59
|
parser.result(variables.get_binding)
|
54
60
|
end
|
61
|
+
|
62
|
+
def cache_file
|
63
|
+
"#{Bricky.config.cache_path}/builder"
|
64
|
+
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
|
55
80
|
end
|
56
81
|
end
|
57
82
|
end
|
@@ -4,17 +4,17 @@ module Bricky
|
|
4
4
|
module Commands
|
5
5
|
class Builder < Base
|
6
6
|
def execute
|
7
|
-
|
7
|
+
logger.important 'Building Project'
|
8
8
|
build(Bricky::Image.new("builder"))
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
12
12
|
def build(images)
|
13
13
|
code = command(images)
|
14
|
-
|
14
|
+
logger.debug format(code)
|
15
15
|
|
16
16
|
unless system(code)
|
17
|
-
|
17
|
+
logger.failure '~~~~~~~~~~~ Problems building image ~~~~~~~~~~~'
|
18
18
|
return false
|
19
19
|
end
|
20
20
|
|
@@ -26,7 +26,7 @@ module Bricky
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def format(command)
|
29
|
-
[
|
29
|
+
['-v ', '-i ', '-e '].inject(command) do |result, param|
|
30
30
|
result.split(param).join("\n\t #{param}")
|
31
31
|
end
|
32
32
|
end
|
@@ -43,11 +43,11 @@ module Bricky
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def arguments
|
46
|
-
args = bricks.collect(&:arguments).uniq.join(
|
46
|
+
args = bricks.collect(&:arguments).uniq.join(' ')
|
47
47
|
end
|
48
48
|
|
49
49
|
def entrypoints
|
50
|
-
bricks.collect(&:entrypoint).compact.uniq.join(
|
50
|
+
bricks.collect(&:entrypoint).compact.uniq.join(' && ')
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -1,7 +1,11 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "thor/group"
|
3
|
+
|
1
4
|
module Bricky
|
2
5
|
module Commands
|
3
6
|
class Install < Base
|
4
7
|
def execute
|
8
|
+
logger.important 'Setup bricky configuration files'
|
5
9
|
installer = InstallThor.new
|
6
10
|
installer.execute
|
7
11
|
end
|
@@ -11,13 +15,12 @@ module Bricky
|
|
11
15
|
include Thor::Actions
|
12
16
|
|
13
17
|
def execute
|
14
|
-
|
15
|
-
|
16
|
-
copy_file "Brickyfile"
|
18
|
+
directory 'bricky'
|
19
|
+
copy_file 'Brickyfile'
|
17
20
|
end
|
18
21
|
|
19
22
|
def self.source_root
|
20
|
-
File.expand_path(
|
23
|
+
File.expand_path('../../../../etc/templates', __FILE__)
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
data/lib/bricky/config.rb
CHANGED
data/lib/bricky/image.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "logger"
|
2
|
+
|
3
|
+
module Bricky
|
4
|
+
class Logger < ::Logger
|
5
|
+
def initialize
|
6
|
+
super(STDOUT)
|
7
|
+
self.level = INFO
|
8
|
+
self.formatter = proc do |severity, datetime, progname, msg|
|
9
|
+
"#{msg}\n"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def message(*args)
|
14
|
+
info colorize_first(args, :blue)
|
15
|
+
end
|
16
|
+
|
17
|
+
def failure(*args)
|
18
|
+
error colorize_first(args, :white).on_red
|
19
|
+
end
|
20
|
+
|
21
|
+
def important(*args)
|
22
|
+
info colorize_first(args, :light_blue)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def colorize_first(args, color)
|
27
|
+
[args.first.colorize(color), args[1..-1]].join
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/bricky/requirements.rb
CHANGED
@@ -1,23 +1,25 @@
|
|
1
1
|
module Bricky
|
2
2
|
class Requirements
|
3
3
|
def check_and_execute
|
4
|
-
if
|
4
|
+
if pending?
|
5
5
|
print "Make sure you have the following requirements: "
|
6
|
-
puts requirements.join(',').colorize(:red)
|
6
|
+
puts requirements.join(', ').colorize(:red)
|
7
7
|
else
|
8
8
|
yield
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
13
|
-
def
|
14
|
-
["docker"]
|
15
|
-
end
|
16
|
-
|
17
|
-
def pending_requirements
|
13
|
+
def pending?
|
18
14
|
requirements.detect do |command|
|
19
15
|
not system("which #{command} > /dev/null 2>&1")
|
20
16
|
end
|
21
17
|
end
|
18
|
+
|
19
|
+
def requirements
|
20
|
+
requirements = ["docker"]
|
21
|
+
requirements << "boot2docker" unless RUBY_PLATFORM.include?("linux")
|
22
|
+
requirements
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
data/lib/bricky/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andrerocker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/bricky/commands/install.rb
|
116
116
|
- lib/bricky/config.rb
|
117
117
|
- lib/bricky/image.rb
|
118
|
+
- lib/bricky/logger.rb
|
118
119
|
- lib/bricky/requirements.rb
|
119
120
|
- lib/bricky/setup.rb
|
120
121
|
- lib/bricky/version.rb
|
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
version: '0'
|
139
140
|
requirements: []
|
140
141
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.4.
|
142
|
+
rubygems_version: 2.4.4
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: a smart way to build software packages
|