dapp 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36e8983506fe61c327ea8fda9cd52cab355b65cd
4
- data.tar.gz: 8f19a707066d6e0be1613c5260d2539d69979c4f
3
+ metadata.gz: 47d4ca61c72282976ce1a025dbc00af3ce9ae5dd
4
+ data.tar.gz: 7ba0e4bb0f8aba250d4df9b9e16101883ca46ef2
5
5
  SHA512:
6
- metadata.gz: dc2b15d20bfc7a5e34c3138c8552c06a1b43a4d16a5882adc7f46f771455230fb0456689a0eae7556784ab0eb4397a4be57c0978fa0eeb78320896db46ee704e
7
- data.tar.gz: 1691cd707bc1ab86d32465d287a08b26efc2a8198bebf7dc0074d3b797b01ebaf17beb3ddf5cbd998a802c77703ab3840e551cdb3a9dcb3c7497ec9607524182
6
+ metadata.gz: a923babf8d0a05ee8e5772408e2cbf115c203df9305a2bff11ccba6e367d9d973d02fe29296dd9d1d799d0091ff96a60384d84ce6bbb497d29608d6bb22acda4
7
+ data.tar.gz: 2aed90c824516ad48148ef8b6e6af4b8c1b697a1f06c8a1102467eeda6452afc0b507c372459e06927d9794e7831d039c3c1a461a0df89e95841f8b1d5222e96
@@ -3,12 +3,13 @@ en:
3
3
  missing_translation: "Missing translation for code: '%{code}'!"
4
4
  shellout:
5
5
  shell_command_failed: ">>> START STREAM\n%{stream}\n>>> END STREAM"
6
+ system_shell_command_failed: ">>> START STREAM\n%{stream}\n>>> END STREAM%{backtrace}"
6
7
  application:
7
8
  application_not_built: "Application hasn't been built yet!"
8
9
  application_not_run: "Application run failed!"
9
10
  git_branch_without_name: "Application has specific revision that isn't associated with a branch name!"
10
11
  ci_environment_required: 'CI environment required (Travis or GitLab CI)!'
11
- cookbooks_stage_checksum_not_calculated: "Cookbooks checksum not calculated for stage '%{stage}', run build first"
12
+ chef_stage_checksum_not_calculated: "Chef stage '%{stage}' checksum is not calculated yet, run build first"
12
13
  dappfile:
13
14
  incorrect: "Dappfile with '%{error}':\n%{message}"
14
15
  build:
@@ -40,7 +40,7 @@ module Dapp
40
40
  cwd_ = File.expand_path(File.join('/', cwd_))
41
41
  "#{application.project.find_path} #{File.join(from_, cwd_, path_)} #{excludes} -type f -exec " \
42
42
  "#{application.project.bash_path} -ec '#{application.project.install_path} -D #{credentials} {} " \
43
- "#{File.join(to, "$(#{application.project.echo_path} {} | " \
43
+ "#{File.join(to, "$(echo {} | " \
44
44
  "#{application.project.sed_path} -e \"s/#{File.join(from_, cwd_).gsub('/', '\\/')}//g\")")}' \\;"
45
45
  end
46
46
 
@@ -50,8 +50,10 @@ module Dapp
50
50
  super
51
51
 
52
52
  %i(before_install install before_setup setup chef_cookbooks).each do |stage|
53
- raise ::Dapp::Error::Application, code: :cookbooks_stage_checksum_not_calculated,
54
- data: { stage: stage } unless stage_cookbooks_checksum_path(stage).exist?
53
+ unless stage_empty?(stage) or stage_cookbooks_checksum_path(stage).exist?
54
+ raise ::Dapp::Error::Application, code: :chef_stage_checksum_not_calculated,
55
+ data: { stage: stage }
56
+ end
55
57
  end
56
58
  end
57
59
 
@@ -198,7 +200,7 @@ module Dapp
198
200
  unless application.project.cli_options[:dev] || chef_cookbooks_stage
199
201
  commands.push(
200
202
  ['if [ ! -f Berksfile.lock ] ; then ',
201
- "#{application.project.echo_path} \"Berksfile.lock not found\" 1>&2 ; ",
203
+ "echo \"Berksfile.lock not found\" 1>&2 ; ",
202
204
  'exit 1 ; ',
203
205
  'fi'].join
204
206
  )
@@ -216,7 +218,7 @@ module Dapp
216
218
  commands.push(
217
219
  "export LOCKDIFF=$(#{application.project.diff_path} -u1 Berksfile.lock #{berksfile_lock_path})",
218
220
  ['if [ "$LOCKDIFF" != "" ] ; then ',
219
- "#{application.project.echo_path} -e \"Bad Berksfile.lock\n$LOCKDIFF\" 1>&2 ; ",
221
+ "echo -e \"Bad Berksfile.lock\n$LOCKDIFF\" 1>&2 ; ",
220
222
  'exit 1 ; ',
221
223
  'fi'].join
222
224
  )
@@ -225,8 +227,8 @@ module Dapp
225
227
 
226
228
  vendor_commands = [
227
229
  "#{application.project.mkdir_path} -p ~/.ssh",
228
- "#{application.project.echo_path} \"Host *\" >> ~/.ssh/config",
229
- "#{application.project.echo_path} \" StrictHostKeyChecking no\" >> ~/.ssh/config",
230
+ "echo \"Host *\" >> ~/.ssh/config",
231
+ "echo \" StrictHostKeyChecking no\" >> ~/.ssh/config",
230
232
  *berksfile.local_cookbooks
231
233
  .values
232
234
  .map { |cookbook| "#{application.project.rsync_path} --archive --relative #{cookbook[:path]} /tmp/local_cookbooks" },
@@ -236,10 +238,10 @@ module Dapp
236
238
  *after_vendor_commands,
237
239
  ["#{application.project.find_path} /tmp/cookbooks -type d -exec #{application.project.bash_path} -ec '",
238
240
  "#{application.project.install_path} -o #{Process.uid} -g #{Process.gid} --mode $(#{application.project.stat_path} -c %a {}) -d ",
239
- "#{dest_path}/$(#{application.project.echo_path} {} | #{application.project.sed_path} -e \"s/^\\/tmp\\/cookbooks//\")' \\;"].join,
241
+ "#{dest_path}/$(echo {} | #{application.project.sed_path} -e \"s/^\\/tmp\\/cookbooks//\")' \\;"].join,
240
242
  ["#{application.project.find_path} /tmp/cookbooks -type f -exec #{application.project.bash_path} -ec '",
241
243
  "#{application.project.install_path} -o #{Process.uid} -g #{Process.gid} --mode $(#{application.project.stat_path} -c %a {}) {} ",
242
- "#{dest_path}/$(#{application.project.echo_path} {} | #{application.project.sed_path} -e \"s/\\/tmp\\/cookbooks//\")' \\;"].join,
244
+ "#{dest_path}/$(echo {} | #{application.project.sed_path} -e \"s/\\/tmp\\/cookbooks//\")' \\;"].join,
243
245
  "#{application.project.install_path} -o #{Process.uid} -g #{Process.gid} --mode 0644 <(#{application.project.date_path} +%s.%N) #{dest_path.join('.created_at')}"
244
246
  ]
245
247
 
@@ -4,7 +4,7 @@ module Dapp
4
4
  # Error
5
5
  class Error < ::Dapp::Error::Base
6
6
  def initialize(**net_status)
7
- super(context: :chef, **net_status)
7
+ super(context: 'chef', **net_status)
8
8
  end
9
9
  end
10
10
  end # Chef
@@ -50,9 +50,11 @@ module Dapp
50
50
 
51
51
  def name
52
52
  @name ||= begin
53
- system_shellout!("#{git_path} -C #{path} config --get remote.origin.url").stdout.strip.split('/').last[/.*(?=.git)/]
54
- rescue Error::Shellout
55
- File.basename(path)
53
+ if File.exist? File.join(path, '.git')
54
+ system_shellout("#{git_path} -C #{path} config --get remote.origin.url").stdout.strip.split('/').last[/.*(?=.git)/] rescue File.basename(path)
55
+ else
56
+ File.basename(path)
57
+ end
56
58
  end
57
59
  end
58
60
 
@@ -36,7 +36,7 @@ module Dapp
36
36
  end
37
37
 
38
38
  def shellout_pack(command)
39
- "eval $(#{echo_path} #{Base64.strict_encode64(command)} | base64 --decode)"
39
+ "eval $(echo #{Base64.strict_encode64(command)} | base64 --decode)"
40
40
  end
41
41
 
42
42
  class << self
@@ -65,7 +65,7 @@ module Dapp
65
65
 
66
66
  yield(**kwargs)
67
67
  rescue ::Mixlib::ShellOut::ShellCommandFailed => e
68
- raise Error::Shellout, code: class_to_lowercase(e.class), data: { stream: stream.show }
68
+ raise Error::Shellout, code: class_to_lowercase(e.class), data: { stream: stream.show, backtrace: e.backtrace.join("\n") }
69
69
  end
70
70
  end
71
71
  end
@@ -39,19 +39,29 @@ module Dapp
39
39
  end
40
40
  end
41
41
 
42
- def system_shellout(command, **kwargs)
43
- shellout _to_system_shellout_command(command), **kwargs
42
+ def system_shellout(command, raise_error: false, **kwargs)
43
+ if raise_error
44
+ shellout! _to_system_shellout_command(command), **kwargs
45
+ else
46
+ shellout _to_system_shellout_command(command), **kwargs
47
+ end
48
+ rescue Error::Shellout => err
49
+ $stderr.puts "\033[1m\033[31mWARNING: System shellout container failure, " +
50
+ "try to remove if error persists: " +
51
+ "docker rm -f #{system_shellout_container_name}\033[0m"
52
+
53
+ raise Error::Shellout.new(code: :system_shell_command_failed, **err.net_status)
44
54
  end
45
55
 
46
56
  def system_shellout!(command, **kwargs)
47
- shellout! _to_system_shellout_command(command), **kwargs
57
+ system_shellout(command, raise_error: true, **kwargs)
48
58
  end
49
59
 
50
60
  private
51
61
 
52
62
  def _to_system_shellout_command(command)
53
63
  cmd = shellout_pack ["cd #{Dir.pwd}", command].join(' && ')
54
- "docker exec #{system_shellout_container} chroot /.system_shellout_root bash -ec '#{[
64
+ "docker exec #{system_shellout_container} chroot /.system_shellout_root #{bash_path} -ec '#{[
55
65
  *System.default_env_keys.map do |env_key|
56
66
  env_key = env_key.to_s.upcase
57
67
  "export #{env_key}=#{ENV[env_key]}"
@@ -1,5 +1,5 @@
1
1
  # Version
2
2
  module Dapp
3
- VERSION = '0.6.7'.freeze
3
+ VERSION = '0.6.8'.freeze
4
4
  BUILD_CACHE_VERSION = 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.6.7
4
+ version: 0.6.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-10-26 00:00:00.000000000 Z
11
+ date: 2016-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout