dapp 0.5.7 → 0.5.8
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 +4 -4
- data/lib/dapp/application/path.rb +16 -0
- data/lib/dapp/build/stage/mod/artifact.rb +1 -1
- data/lib/dapp/build/stage/source_1_archive_dependencies.rb +4 -0
- data/lib/dapp/build/stage/source_base.rb +4 -2
- data/lib/dapp/build/stage/source_dependencies_base.rb +2 -1
- data/lib/dapp/builder/chef.rb +14 -7
- data/lib/dapp/git_artifact.rb +5 -4
- data/lib/dapp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8a9ec9afc7917a8ecf1ba8d47e65defef16df8f
|
4
|
+
data.tar.gz: 50c22e22781a24115fc79514ad9c71410784a75e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 919231c2f8a6f6bf78780bcf969921472ddd416dee45fc46404cb9ff84f22848c780e8a76b342aa34d1024986fa651dd19e38d496328caa8610b297ac56d4c80
|
7
|
+
data.tar.gz: 929a790d85767cc510136ed9283b6ec86cb473e18cdee69fec205b0277dba81a11952930edf0e6ac28e0d725359156c76a7fea3d390e8b61a51bf02c550575aa
|
@@ -15,6 +15,16 @@ module Dapp
|
|
15
15
|
make_path(@build_path, home_path.basename, *path).expand_path.tap { |p| p.parent.mkpath }
|
16
16
|
end
|
17
17
|
|
18
|
+
def project_path
|
19
|
+
@project_path ||= begin
|
20
|
+
if File.basename(expand_path(home_path, 1)) == '.dapps'
|
21
|
+
expand_path(home_path, 2)
|
22
|
+
else
|
23
|
+
home_path
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
18
28
|
def container_dapp_path(*path)
|
19
29
|
make_path('/.dapp', *path)
|
20
30
|
end
|
@@ -28,6 +38,12 @@ module Dapp
|
|
28
38
|
def make_path(base, *path)
|
29
39
|
path.compact.map(&:to_s).inject(Pathname.new(base), &:+)
|
30
40
|
end
|
41
|
+
|
42
|
+
def expand_path(path, number = 1)
|
43
|
+
path = File.expand_path(path)
|
44
|
+
number.times.each { path = File.dirname(path) }
|
45
|
+
path
|
46
|
+
end
|
31
47
|
end # Path
|
32
48
|
end # Application
|
33
49
|
end # Dapp
|
@@ -68,7 +68,7 @@ module Dapp
|
|
68
68
|
credentials += "-o #{owner} " if owner
|
69
69
|
credentials += "-g #{group} " if group
|
70
70
|
|
71
|
-
copy_files =
|
71
|
+
copy_files = proc do |from_, cwd_, path_ = ''|
|
72
72
|
cwd_ = File.expand_path(File.join('/', cwd_))
|
73
73
|
"find #{File.join(from_, cwd_, path_)} -type f -exec bash -ec 'install -D #{credentials} {} " \
|
74
74
|
"#{File.join(to, "$(echo {} | sed -e \"s/#{File.join(from_, cwd_).gsub('/', '\\/')}//g\")")}' \\;"
|
@@ -22,8 +22,6 @@ module Dapp
|
|
22
22
|
def image
|
23
23
|
super do |image|
|
24
24
|
image.add_volumes_from gitartifact_container
|
25
|
-
image.add_command 'export PATH=/.dapp/deps/gitartifact/bin:$PATH'
|
26
|
-
|
27
25
|
application.git_artifacts.each do |git_artifact|
|
28
26
|
image.add_volume "#{git_artifact.repo.path}:#{git_artifact.repo.container_path}:ro"
|
29
27
|
image.add_command git_artifact.send(apply_command_method, self)
|
@@ -46,6 +44,10 @@ module Dapp
|
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
47
|
+
def git_dappdeps_path
|
48
|
+
'/.dapp/deps/gitartifact/bin/git'
|
49
|
+
end
|
50
|
+
|
49
51
|
protected
|
50
52
|
|
51
53
|
def gitartifact_container_name # FIXME: hashsum(image) or dockersafe()
|
@@ -18,7 +18,8 @@ module Dapp
|
|
18
18
|
protected
|
19
19
|
|
20
20
|
def dependencies_files_checksum(regs)
|
21
|
-
|
21
|
+
regs.map! { |reg| File.directory?(File.join(application.project_path, reg)) ? File.join(reg, '**', '*') : reg }
|
22
|
+
unless (files = regs.map { |reg| Dir[File.join(application.project_path, reg)].map { |f| File.read(f) if File.file?(f) } }).empty?
|
22
23
|
hashsum files
|
23
24
|
end
|
24
25
|
end
|
data/lib/dapp/builder/chef.rb
CHANGED
@@ -19,11 +19,10 @@ module Dapp
|
|
19
19
|
define_method("#{stage}") do |image|
|
20
20
|
unless stage_empty?(stage)
|
21
21
|
image.add_volumes_from(chefdk_container)
|
22
|
-
image.add_command
|
23
|
-
"export DAPP_BUILD_STAGE=#{stage}"
|
22
|
+
image.add_command "export DAPP_BUILD_STAGE=#{stage}"
|
24
23
|
|
25
24
|
image.add_volume "#{stage_build_path(stage)}:#{container_stage_build_path(stage)}:ro"
|
26
|
-
image.add_command [
|
25
|
+
image.add_command [chef_solo_dappdeps_path,
|
27
26
|
'--legacy-mode',
|
28
27
|
"-c #{container_stage_config_path(stage)}",
|
29
28
|
"-o #{stage_cookbooks_runlist(stage).join(',')}"].join(' ')
|
@@ -167,7 +166,7 @@ module Dapp
|
|
167
166
|
'echo " StrictHostKeyChecking no" >> ~/.ssh/config',
|
168
167
|
'if [ ! -f Berksfile.lock ] ; then echo "Berksfile.lock not found" 1>&2 ; exit 1 ; fi',
|
169
168
|
'cp -a Berksfile.lock /tmp/Berksfile.lock.orig',
|
170
|
-
|
169
|
+
"#{berks_dappdeps_path} vendor /tmp/vendored_cookbooks",
|
171
170
|
'export LOCKDIFF=$(diff -u0 Berksfile.lock /tmp/Berksfile.lock.orig)',
|
172
171
|
['if [ "$LOCKDIFF" != "" ] ; then ',
|
173
172
|
'cp -a /tmp/Berksfile.lock.orig Berksfile.lock ; ',
|
@@ -209,7 +208,7 @@ module Dapp
|
|
209
208
|
|
210
209
|
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
211
210
|
def install_stage_cookbooks(stage)
|
212
|
-
select_existing_paths =
|
211
|
+
select_existing_paths = proc do |cookbook_path, paths|
|
213
212
|
paths.select { |from, _| cookbook_path.join(from).exist? }
|
214
213
|
end
|
215
214
|
|
@@ -305,11 +304,11 @@ module Dapp
|
|
305
304
|
@stage_cookbooks_runlist[stage] ||= begin
|
306
305
|
res = []
|
307
306
|
|
308
|
-
does_entry_exist =
|
307
|
+
does_entry_exist = proc do |cookbook, entrypoint|
|
309
308
|
stage_cookbooks_path(stage, cookbook, 'recipes', "#{entrypoint}.rb").exist?
|
310
309
|
end
|
311
310
|
|
312
|
-
format_entry =
|
311
|
+
format_entry = proc do |cookbook, entrypoint|
|
313
312
|
entrypoint = 'void' if entrypoint.nil?
|
314
313
|
"#{cookbook}::#{entrypoint}"
|
315
314
|
end
|
@@ -382,6 +381,14 @@ module Dapp
|
|
382
381
|
def container_stage_build_path(_stage, *path)
|
383
382
|
path.compact.map(&:to_s).inject(Pathname.new('/.dapp/chef/build'), &:+)
|
384
383
|
end
|
384
|
+
|
385
|
+
def chef_solo_dappdeps_path
|
386
|
+
'/.dapp/deps/chefdk/bin/chef-solo'
|
387
|
+
end
|
388
|
+
|
389
|
+
def berks_dappdeps_path
|
390
|
+
'/.dapp/deps/chefdk/bin/berks'
|
391
|
+
end
|
385
392
|
end
|
386
393
|
end
|
387
394
|
end
|
data/lib/dapp/git_artifact.rb
CHANGED
@@ -15,6 +15,7 @@ module Dapp
|
|
15
15
|
@branch = branch || repo.application.cli_options[:git_artifact_branch] || repo.branch
|
16
16
|
@commit = commit
|
17
17
|
|
18
|
+
cwd = File.expand_path(File.join('/', cwd))[1..-1] unless cwd.nil? || cwd.empty?
|
18
19
|
@cwd = cwd
|
19
20
|
@paths = paths
|
20
21
|
@owner = owner
|
@@ -26,7 +27,7 @@ module Dapp
|
|
26
27
|
credentials = [:owner, :group].map { |attr| "--#{attr}=#{send(attr)}" unless send(attr).nil? }.compact
|
27
28
|
|
28
29
|
["install #{credentials.join(' ')} -d #{where_to_add}",
|
29
|
-
["
|
30
|
+
["#{stage.git_dappdeps_path} --git-dir=#{repo.container_path} archive #{stage.layer_commit(self)}:#{cwd} #{paths}",
|
30
31
|
"#{sudo}tar -x -C #{where_to_add}"].join(' | ')]
|
31
32
|
end
|
32
33
|
|
@@ -35,8 +36,8 @@ module Dapp
|
|
35
36
|
prev_commit = stage.prev_source_stage.layer_commit(self)
|
36
37
|
|
37
38
|
if prev_commit != current_commit || any_changes?(prev_commit, current_commit)
|
38
|
-
[["
|
39
|
-
"#{sudo}
|
39
|
+
[["#{stage.git_dappdeps_path} --git-dir=#{repo.container_path} #{diff_command(prev_commit, current_commit)}",
|
40
|
+
"#{sudo}#{stage.git_dappdeps_path} apply --whitespace=nowarn --directory=#{where_to_add} --unsafe-paths"].join(' | ')]
|
40
41
|
else
|
41
42
|
[]
|
42
43
|
end
|
@@ -55,7 +56,7 @@ module Dapp
|
|
55
56
|
end
|
56
57
|
|
57
58
|
def paramshash
|
58
|
-
Digest::SHA256.hexdigest [cwd, paths, owner, group].map(&:to_s).join(':::')
|
59
|
+
Digest::SHA256.hexdigest [where_to_add, cwd, paths, owner, group].map(&:to_s).join(':::')
|
59
60
|
end
|
60
61
|
|
61
62
|
def paths(with_cwd = false)
|
data/lib/dapp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|