dapp 0.7.33 → 0.7.34

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c5095ab59dcafa96d266fe6621054d73650f810
4
- data.tar.gz: da9b7fc76f67b249253fa444519ff8d9d12656d8
3
+ metadata.gz: 057467ea87a01a2cf762174c86784e2cca072266
4
+ data.tar.gz: def7d534f9f24fbc1a58c6f9b6220f61f662745d
5
5
  SHA512:
6
- metadata.gz: 93b35c7c59d78b784ef7cc17ca7ad5962fefec63843e1f818070432bba7f359a06af80c7131e6ed620a63c4a2f19bd7d685691a8b8653959ccdff932bebb1315
7
- data.tar.gz: 5e2b182eb2a0c84f5276765b5745cbc5969a811b6d9c3f5ea68b5862cf9493a449361af53ac53afb7eeb29b1605f9d535f03860ae038744e16b280b90f3e2384
6
+ metadata.gz: 74efa859ec62149c1547250934b024d102909e274269993ae4f94d02bc1a24756e9d85a3ff9f5a994c055fcaef37f4d903e8be985c9687d3cc8b2b1314d42017
7
+ data.tar.gz: 29db42cab0de1664a24bf1561b0b9118c7fcad4285aeb26217bdf87ad1af7e471200c254dd810d3cd839c9e546f004217604cfa6fc97273550bad4f98b9ccf2f
@@ -54,7 +54,7 @@ en:
54
54
  chef:
55
55
  stage_path_overlap: "Cannot install `%{cookbook}` cookbook's path %{from} into %{to}: already exists"
56
56
  mdapp_dependency_in_metadata_forbidden: "Using mdapp as dependency in metadata.rb forbidden: detected `%{dependency}`"
57
- cookbook_path_not_found: "Dapp cookbook directory not found at %{path}"
57
+ local_cookbook_path_not_found: "Dapp cookbook directory not found at %{path}"
58
58
  cookbook_berksfile_not_found: "Dapp cookbook Berksfile not found at %{path}"
59
59
  cookbook_metadata_not_found: "Dapp cookbook metadata.rb file not found at %{path}"
60
60
  cookbook_not_specified_in_berksfile: "Dapp cookbook `%{name}` not specified in Berksfile at %{path}"
@@ -21,6 +21,7 @@ require 'net_status'
21
21
 
22
22
  require 'dapp/version'
23
23
  require 'dapp/core_ext/hash'
24
+ require 'dapp/core_ext/pathname'
24
25
  require 'dapp/helper/cli'
25
26
  require 'dapp/helper/trivia'
26
27
  require 'dapp/helper/sha256'
@@ -123,7 +124,9 @@ require 'dapp/build/stage/ga_artifact_patch'
123
124
  require 'dapp/build/stage/build_artifact'
124
125
  require 'dapp/project/lock'
125
126
  require 'dapp/project/ssh_agent'
127
+ require 'dapp/project/git_artifact'
126
128
  require 'dapp/project/dappfile'
129
+ require 'dapp/project/chef'
127
130
  require 'dapp/project/command/common'
128
131
  require 'dapp/project/command/build'
129
132
  require 'dapp/project/command/bp'
@@ -97,21 +97,21 @@ module Dapp
97
97
  cookbook_metadata.name
98
98
  end
99
99
 
100
- def cookbook_path(*path)
101
- dimg.cookbook_path.tap do |cookbook_path|
102
- unless cookbook_path.exist?
103
- raise Error, code: :cookbook_path_not_found,
104
- data: { path: cookbook_path }
100
+ def local_cookbook_path(*path)
101
+ dimg.local_cookbook_path.tap do |local_cookbook_path|
102
+ unless local_cookbook_path.exist?
103
+ raise Error, code: :local_cookbook_path_not_found,
104
+ data: { path: local_cookbook_path }
105
105
  end
106
106
  end.join(*path)
107
107
  end
108
108
 
109
109
  def berksfile_path
110
- cookbook_path('Berksfile')
110
+ local_cookbook_path('Berksfile')
111
111
  end
112
112
 
113
113
  def berksfile_lock_path
114
- cookbook_path('Berksfile.lock')
114
+ local_cookbook_path('Berksfile.lock')
115
115
  end
116
116
 
117
117
  def berksfile
@@ -121,7 +121,7 @@ module Dapp
121
121
  data: { path: berksfile_path.to_s }
122
122
  end
123
123
 
124
- Berksfile.new(cookbook_path, berksfile_path).tap do |berksfile|
124
+ Berksfile.new(local_cookbook_path, berksfile_path).tap do |berksfile|
125
125
  unless berksfile.local_cookbook? project_name
126
126
  raise Error, code: :cookbook_not_specified_in_berksfile,
127
127
  data: { name: project_name, path: berksfile_path.to_s }
@@ -131,7 +131,7 @@ module Dapp
131
131
  end
132
132
 
133
133
  def cookbook_metadata_path
134
- cookbook_path('metadata.rb')
134
+ local_cookbook_path('metadata.rb')
135
135
  end
136
136
 
137
137
  def check_cookbook_metadata_path_exist!
@@ -0,0 +1,25 @@
1
+ module Dapp
2
+ # CoreExt
3
+ module CoreExt
4
+ # Pathname
5
+ module Pathname
6
+ def subpath_of?(another_path)
7
+ another_path_descends = []
8
+ ::Pathname.new(another_path).cleanpath.descend {|d| another_path_descends << d}
9
+
10
+ path_descends = []
11
+ cleanpath.descend {|d| path_descends << d}
12
+
13
+ (path_descends & another_path_descends) == another_path_descends and
14
+ (path_descends - another_path_descends).any?
15
+ end
16
+
17
+ def subpath_of(another_path)
18
+ return unless subpath_of? another_path
19
+ cleanpath.to_s.partition(::Pathname.new(another_path).cleanpath.to_s + '/').last
20
+ end
21
+ end # Pathname
22
+ end # CoreExt
23
+ end # Dapp
24
+
25
+ ::Pathname.send(:include, ::Dapp::CoreExt::Pathname)
@@ -7,8 +7,8 @@ module Dapp
7
7
  make_path(project.path, *path).expand_path
8
8
  end
9
9
 
10
- def cookbook_path(*path)
11
- make_path(project.cookbook_path, *path)
10
+ def local_cookbook_path(*path)
11
+ make_path(project.local_cookbook_path, *path)
12
12
  end
13
13
 
14
14
  def tmp_path(*path)
@@ -30,7 +30,7 @@ module Dapp
30
30
  commands << "#{repo.dimg.project.install_bin} #{credentials.join(' ')} -d #{to}"
31
31
 
32
32
  if include_paths_or_cwd.empty? || include_paths_or_cwd.any? { |path| file_exist_in_repo?(stage.layer_commit(self), path) }
33
- commands << ["#{repo.dimg.project.git_bin} --git-dir=#{repo.container_path} archive #{stage.layer_commit(self)}:#{cwd} #{include_paths.join(' ')}",
33
+ commands << ["#{repo.dimg.project.git_bin} --git-dir=#{repo.container_path} archive #{stage.layer_commit(self)}:#{cwd} --prefix=/ #{include_paths.join(' ')}",
34
34
  "#{sudo}#{repo.dimg.project.tar_bin} -x -C #{to} #{archive_command_excludes.join(' ')}"].join(' | ')
35
35
  end
36
36
  end
@@ -49,7 +49,7 @@ module Dapp
49
49
  end
50
50
 
51
51
  def archive_command_excludes
52
- exclude_paths.map { |path| %(--exclude=#{path}) }
52
+ exclude_paths.map { |path| %(--exclude=#{File.join('/', path)}) }
53
53
  end
54
54
 
55
55
  def patch_command_excludes
@@ -89,7 +89,7 @@ module Dapp
89
89
  end
90
90
 
91
91
  def exclude_paths(with_cwd = false)
92
- base_paths(repo.dimg.project.system_files.concat(@exclude_paths), with_cwd)
92
+ base_paths(repo.exclude_paths + @exclude_paths, with_cwd)
93
93
  end
94
94
 
95
95
  def include_paths(with_cwd = false)
@@ -10,6 +10,10 @@ module Dapp
10
10
  @name = name
11
11
  end
12
12
 
13
+ def exclude_paths
14
+ []
15
+ end
16
+
13
17
  def container_path
14
18
  raise
15
19
  end
@@ -6,6 +6,10 @@ module Dapp
6
6
  super(dimg, 'own')
7
7
  end
8
8
 
9
+ def exclude_paths
10
+ dimg.project.local_git_artifact_exclude_paths
11
+ end
12
+
9
13
  def container_path
10
14
  dimg.container_dapp_path('git_repo_own', "#{name}.git")
11
15
  end
@@ -2,7 +2,9 @@ module Dapp
2
2
  # Project
3
3
  class Project
4
4
  include Lock
5
+ include GitArtifact
5
6
  include Dappfile
7
+ include Chef
6
8
 
7
9
  include Command::Common
8
10
  include Command::Run
@@ -83,10 +85,6 @@ module Dapp
83
85
  @path ||= expand_path(dappfile_path)
84
86
  end
85
87
 
86
- def cookbook_path
87
- File.join(path, '.dapp_chef')
88
- end
89
-
90
88
  def build_path
91
89
  @build_path ||= begin
92
90
  if cli_options[:build_dir]
@@ -97,8 +95,13 @@ module Dapp
97
95
  end
98
96
  end
99
97
 
100
- def system_files
101
- [dappfile_path, cookbook_path, build_path].map { |p| File.basename(p) }
98
+ def local_git_artifact_exclude_paths(&blk)
99
+ super do |exclude_paths|
100
+ build_path_relpath = Pathname.new(build_path).subpath_of(path)
101
+ exclude_paths << build_path_relpath.to_s if build_path_relpath
102
+
103
+ yield exclude_paths if block_given?
104
+ end
102
105
  end
103
106
 
104
107
  def stage_cache
@@ -0,0 +1,24 @@
1
+ module Dapp
2
+ # Project
3
+ class Project
4
+ # Chef
5
+ module Chef
6
+ def local_git_artifact_exclude_paths(&blk)
7
+ super do |exclude_paths|
8
+ exclude_paths << '.dapp_chef'
9
+ exclude_paths << '.chefinit'
10
+
11
+ yield exclude_paths if block_given?
12
+ end
13
+ end
14
+
15
+ def local_cookbook_path
16
+ File.join(path, '.dapp_chef')
17
+ end
18
+
19
+ def chefinit_cookbook_path
20
+ File.join(path, '.chefinit')
21
+ end
22
+ end # Chef
23
+ end # Project
24
+ end # Dapp
@@ -3,6 +3,14 @@ module Dapp
3
3
  class Project
4
4
  # Dappfile
5
5
  module Dappfile
6
+ def local_git_artifact_exclude_paths(&blk)
7
+ super do |exclude_paths|
8
+ exclude_paths << 'Dappfile'
9
+
10
+ yield exclude_paths if block_given?
11
+ end
12
+ end
13
+
6
14
  def build_configs
7
15
  @configs ||= begin
8
16
  dimgs(dappfile_path).flatten.tap do |dimgs|
@@ -0,0 +1,13 @@
1
+ module Dapp
2
+ # Project
3
+ class Project
4
+ # GitArtifact
5
+ module GitArtifact
6
+ def local_git_artifact_exclude_paths(&blk)
7
+ @local_git_artifact_exclude_paths ||= [].tap do |exclude_paths|
8
+ yield exclude_paths if block_given?
9
+ end
10
+ end
11
+ end # GitArtifact
12
+ end # Project
13
+ end # Dapp
@@ -1,5 +1,5 @@
1
1
  # Version
2
2
  module Dapp
3
- VERSION = '0.7.33'.freeze
4
- BUILD_CACHE_VERSION = '6.2'
3
+ VERSION = '0.7.34'.freeze
4
+ BUILD_CACHE_VERSION = '6.3'
5
5
  end
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.7.33
4
+ version: 0.7.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-24 00:00:00.000000000 Z
11
+ date: 2017-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -455,6 +455,7 @@ files:
455
455
  - lib/dapp/config/directive/shell/artifact.rb
456
456
  - lib/dapp/config/directive/shell/dimg.rb
457
457
  - lib/dapp/core_ext/hash.rb
458
+ - lib/dapp/core_ext/pathname.rb
458
459
  - lib/dapp/dimg.rb
459
460
  - lib/dapp/dimg/git_artifact.rb
460
461
  - lib/dapp/dimg/path.rb
@@ -496,6 +497,7 @@ files:
496
497
  - lib/dapp/lock/file.rb
497
498
  - lib/dapp/prctl.rb
498
499
  - lib/dapp/project.rb
500
+ - lib/dapp/project/chef.rb
499
501
  - lib/dapp/project/command/bp.rb
500
502
  - lib/dapp/project/command/build.rb
501
503
  - lib/dapp/project/command/cleanup.rb
@@ -517,6 +519,7 @@ files:
517
519
  - lib/dapp/project/dappfile.rb
518
520
  - lib/dapp/project/deps/base.rb
519
521
  - lib/dapp/project/deps/gitartifact.rb
522
+ - lib/dapp/project/git_artifact.rb
520
523
  - lib/dapp/project/lock.rb
521
524
  - lib/dapp/project/logging/base.rb
522
525
  - lib/dapp/project/logging/i18n.rb