dpl 2.0.3.beta.4 → 2.0.3.beta.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +15 -3
  3. data/Gemfile.lock +444 -211
  4. data/Rakefile +36 -34
  5. data/bin/dpl +3 -1
  6. data/dpl.gemspec +25 -0
  7. data/lib/dpl/cli.rb +19 -14
  8. data/lib/dpl/ctx/bash.rb +18 -12
  9. data/lib/dpl/ctx/test.rb +21 -15
  10. data/lib/dpl/ctx.rb +2 -0
  11. data/lib/dpl/helper/assets.rb +4 -2
  12. data/lib/dpl/helper/cmd.rb +20 -18
  13. data/lib/dpl/helper/config_file.rb +5 -3
  14. data/lib/dpl/helper/cookbook_site_streaming_uploader.rb +249 -0
  15. data/lib/dpl/helper/env.rb +26 -22
  16. data/lib/dpl/helper/github.rb +2 -0
  17. data/lib/dpl/helper/interpolate.rb +8 -4
  18. data/lib/dpl/helper/memoize.rb +4 -1
  19. data/lib/dpl/helper/squiggle.rb +3 -1
  20. data/lib/dpl/helper/transliterate.rb +3 -1
  21. data/lib/dpl/helper/wrap.rb +3 -1
  22. data/lib/dpl/helper/zip.rb +3 -1
  23. data/lib/dpl/provider/dsl.rb +18 -4
  24. data/lib/dpl/provider/examples.rb +6 -2
  25. data/lib/dpl/provider/status.rb +26 -24
  26. data/lib/dpl/providers/anynines.rb +22 -20
  27. data/lib/dpl/providers/azure_web_apps.rb +21 -19
  28. data/lib/dpl/providers/bintray.rb +44 -37
  29. data/lib/dpl/providers/bluemixcloudfoundry.rb +38 -36
  30. data/lib/dpl/providers/boxfuse.rb +12 -10
  31. data/lib/dpl/providers/cargo.rb +7 -5
  32. data/lib/dpl/providers/chef_supermarket.rb +82 -80
  33. data/lib/dpl/providers/cloud66.rb +17 -15
  34. data/lib/dpl/providers/cloudfiles.rb +8 -6
  35. data/lib/dpl/providers/cloudformation.rb +191 -187
  36. data/lib/dpl/providers/cloudfoundry.rb +32 -30
  37. data/lib/dpl/providers/codedeploy.rb +35 -33
  38. data/lib/dpl/providers/convox.rb +32 -25
  39. data/lib/dpl/providers/datica.rb +30 -28
  40. data/lib/dpl/providers/ecr.rb +66 -64
  41. data/lib/dpl/providers/elasticbeanstalk.rb +14 -12
  42. data/lib/dpl/providers/engineyard.rb +60 -58
  43. data/lib/dpl/providers/firebase.rb +6 -4
  44. data/lib/dpl/providers/flynn.rb +8 -6
  45. data/lib/dpl/providers/gae.rb +28 -25
  46. data/lib/dpl/providers/gcs.rb +59 -57
  47. data/lib/dpl/providers/git_push.rb +199 -195
  48. data/lib/dpl/providers/gleis.rb +19 -17
  49. data/lib/dpl/providers/hackage.rb +15 -13
  50. data/lib/dpl/providers/hephy.rb +18 -16
  51. data/lib/dpl/providers/heroku/api.rb +72 -70
  52. data/lib/dpl/providers/heroku/git.rb +15 -13
  53. data/lib/dpl/providers/heroku.rb +40 -38
  54. data/lib/dpl/providers/lambda.rb +134 -134
  55. data/lib/dpl/providers/launchpad.rb +45 -43
  56. data/lib/dpl/providers/netlify.rb +7 -5
  57. data/lib/dpl/providers/npm.rb +61 -58
  58. data/lib/dpl/providers/nuget.rb +8 -6
  59. data/lib/dpl/providers/openshift.rb +8 -6
  60. data/lib/dpl/providers/opsworks.rb +23 -21
  61. data/lib/dpl/providers/pages/api.rb +14 -14
  62. data/lib/dpl/providers/pages/git.rb +53 -47
  63. data/lib/dpl/providers/pages.rb +3 -1
  64. data/lib/dpl/providers/puppetforge.rb +6 -4
  65. data/lib/dpl/providers/pypi.rb +55 -54
  66. data/lib/dpl/providers/releases.rb +30 -23
  67. data/lib/dpl/providers/rubygems.rb +35 -31
  68. data/lib/dpl/providers/s3.rb +148 -142
  69. data/lib/dpl/providers/scalingo.rb +18 -16
  70. data/lib/dpl/providers/script.rb +4 -2
  71. data/lib/dpl/providers/snap.rb +12 -9
  72. data/lib/dpl/providers/surge.rb +7 -5
  73. data/lib/dpl/providers/testfairy.rb +47 -43
  74. data/lib/dpl/providers/transifex.rb +20 -18
  75. data/lib/dpl/providers.rb +3 -1
  76. data/lib/dpl/string_ext.rb +3 -1
  77. data/lib/dpl/support/aws_sdk_patch.rb +4 -1
  78. data/lib/dpl/support/gems.rb +7 -3
  79. data/lib/dpl/support/gstore_patch.rb +3 -1
  80. data/lib/dpl/support/version.rb +13 -12
  81. data/lib/dpl/version.rb +3 -1
  82. data/lib/dpl.rb +2 -0
  83. data/status.json +237 -0
  84. metadata +32 -15
  85. /data/lib/dpl/providers/{packagecloud.rb → packagecloud.rb_} +0 -0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Engineyard < Provider
@@ -5,13 +7,13 @@ module Dpl
5
7
 
6
8
  status :alpha
7
9
 
8
- description sq(<<-str)
10
+ description sq(<<-STR)
9
11
  tbd
10
- str
12
+ STR
11
13
 
12
- gem 'ey-core', '~> 3.5'
14
+ gem 'ey-core', '~> 3.6'
13
15
 
14
- required :api_key, [:email, :password]
16
+ required :api_key, %i[email password]
15
17
 
16
18
  env :engineyard, :ey
17
19
 
@@ -23,19 +25,19 @@ module Dpl
23
25
  opt '--migrate CMD', 'Engine Yard migration commands'
24
26
  opt '--account NAME', 'Engine Yard account name'
25
27
 
26
- msgs deploy: 'Deploying ...',
27
- login: 'Authenticating via email and password ...',
28
- write_rc: 'Authenticating via api token ...',
29
- authenticated: 'Authenticated as %{name}',
30
- invalid_migrate: 'Invalid migration command, try --migrate="rake db:migrate"',
31
- envs: 'Checking environment ...',
32
- no_env: 'No matching environment found',
33
- too_many_envs: 'Multiple environments match, please be more specific: %s',
34
- env_entry: 'environment=%s account=%s'
35
-
36
- cmds login: "ey-core login << str\n%{email}\n%{password}\nstr",
28
+ msgs deploy: 'Deploying ...',
29
+ login: 'Authenticating via email and password ...',
30
+ write_rc: 'Authenticating via api token ...',
31
+ authenticated: 'Authenticated as %{name}',
32
+ invalid_migrate: 'Invalid migration command, try --migrate="rake db:migrate"',
33
+ envs: 'Checking environment ...',
34
+ no_env: 'No matching environment found',
35
+ too_many_envs: 'Multiple environments match, please be more specific: %s',
36
+ env_entry: 'environment=%s account=%s'
37
+
38
+ cmds login: "ey-core login << str\n%{email}\n%{password}\nstr",
37
39
  whoami: 'ey-core whoami',
38
- envs: 'ey-core environments',
40
+ envs: 'ey-core environments',
39
41
  deploy: 'ey-core deploy %{deploy_opts}'
40
42
 
41
43
  def login
@@ -54,58 +56,58 @@ module Dpl
54
56
 
55
57
  private
56
58
 
57
- def authenticate
58
- shell :login, echo: false, capture: true
59
- end
59
+ def authenticate
60
+ shell :login, echo: false, capture: true
61
+ end
60
62
 
61
- def whoami
62
- shell(:whoami, echo: false, capture: true) =~ /email\s*:\s*"(.+)"/ && $1
63
- end
63
+ def whoami
64
+ shell(:whoami, echo: false, capture: true) =~ /email\s*:\s*"(.+)"/ && ::Regexp.last_match(1)
65
+ end
64
66
 
65
- def write_rc
66
- info :write_rc
67
- write_file '~/.ey-core', "https://api.engineyard.com/: #{api_key}"
68
- end
67
+ def write_rc
68
+ info :write_rc
69
+ write_file '~/.ey-core', "https://api.engineyard.com/: #{api_key}"
70
+ end
69
71
 
70
- def invalid_migrate?
71
- migrate.is_a?(TrueClass) || migrate == 'true'
72
- end
72
+ def invalid_migrate?
73
+ migrate.is_a?(TrueClass) || migrate == 'true'
74
+ end
73
75
 
74
- def deploy_opts
75
- opts = [%(--ref="#{git_sha}" --environment="#{env}")]
76
- opts << opts_for(%i(app account))
77
- opts << migrate_opt
78
- opts.join(' ')
79
- end
76
+ def deploy_opts
77
+ opts = [%(--ref="#{git_sha}" --environment="#{env}")]
78
+ opts << opts_for(%i[app account])
79
+ opts << migrate_opt
80
+ opts.join(' ')
81
+ end
80
82
 
81
- def migrate_opt
82
- migrate? ? opts_for(%i(migrate)) : '--no-migrate'
83
- end
83
+ def migrate_opt
84
+ migrate? ? opts_for(%i[migrate]) : '--no-migrate'
85
+ end
84
86
 
85
- def env
86
- @env ||= super || detect_env(envs)
87
- end
87
+ def env
88
+ @env ||= super || detect_env(envs)
89
+ end
88
90
 
89
- def detect_env(envs)
90
- case envs.size
91
- when 1 then envs.first[:name]
92
- when 0 then error :no_env
93
- else too_many_envs(envs)
94
- end
91
+ def detect_env(envs)
92
+ case envs.size
93
+ when 1 then envs.first[:name]
94
+ when 0 then error :no_env
95
+ else too_many_envs(envs)
95
96
  end
97
+ end
96
98
 
97
- def envs
98
- lines = shell(:envs, echo: false, capture: true).split("\n")[2..-1] || []
99
- envs = lines.map { |line| line.split('|')[1..-1].map(&:strip) }
100
- envs = envs.map { |pair| %i(name account).zip(pair).to_h }
101
- envs.select { |env| env[:name] == opts[:env] } if env?
102
- envs
103
- end
99
+ def envs
100
+ lines = shell(:envs, echo: false, capture: true).split("\n")[2..] || []
101
+ envs = lines.map { |line| line.split('|')[1..].map(&:strip) }
102
+ envs = envs.map { |pair| %i[name account].zip(pair).to_h }
103
+ envs.select { |env| env[:name] == opts[:env] } if env?
104
+ envs
105
+ end
104
106
 
105
- def too_many_envs(envs)
106
- envs = envs.map { |env| msg(:env_entry) % env.values_at(:name, :account) }
107
- error msg(:too_many_envs) % envs.join(', ')
108
- end
107
+ def too_many_envs(envs)
108
+ envs = envs.map { |env| msg(:env_entry) % env.values_at(:name, :account) }
109
+ error msg(:too_many_envs) % envs.join(', ')
110
+ end
109
111
  end
110
112
  end
111
113
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Firebase < Provider
@@ -5,9 +7,9 @@ module Dpl
5
7
 
6
8
  status :stable
7
9
 
8
- description sq(<<-str)
10
+ description sq(<<-STR)
9
11
  tbd
10
- str
12
+ STR
11
13
 
12
14
  node_js '>= 8.0.0'
13
15
 
@@ -28,7 +30,7 @@ module Dpl
28
30
  msgs missing_config: 'Missing firebase.json'
29
31
 
30
32
  def validate
31
- error :missing_config unless File.exists?('firebase.json')
33
+ error :missing_config unless File.exist?('firebase.json')
32
34
  end
33
35
 
34
36
  def deploy
@@ -36,7 +38,7 @@ module Dpl
36
38
  end
37
39
 
38
40
  def deploy_opts
39
- opts_for(%i(project message token only force))
41
+ opts_for(%i[project message token only force])
40
42
  end
41
43
  end
42
44
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Flynn < Provider
@@ -7,16 +9,16 @@ module Dpl
7
9
 
8
10
  full_name 'Flynn'
9
11
 
10
- description sq(<<-str)
12
+ description sq(<<-STR)
11
13
  Flynn provider for Dpl
12
- str
14
+ STR
13
15
 
14
16
  opt '--git URL', 'Flynn Git remote URL', required: true
15
17
 
16
18
  needs :git, :git_http_user_agent
17
19
 
18
20
  cmds fetch: 'git fetch origin $TRAVIS_BRANCH --unshallow',
19
- push: 'git push %{remote} HEAD:refs/heads/master -f'
21
+ push: 'git push %{remote} HEAD:refs/heads/master -f'
20
22
 
21
23
  def deploy
22
24
  shell :fetch, assert: false
@@ -25,9 +27,9 @@ module Dpl
25
27
 
26
28
  private
27
29
 
28
- def remote
29
- git
30
- end
30
+ def remote
31
+ git
32
+ end
31
33
  end
32
34
  end
33
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Gae < Provider
@@ -7,9 +9,9 @@ module Dpl
7
9
 
8
10
  full_name 'Google App Engine'
9
11
 
10
- description sq(<<-str)
12
+ description sq(<<-STR)
11
13
  tbd
12
- str
14
+ STR
13
15
 
14
16
  python '>= 2.7.9'
15
17
 
@@ -26,20 +28,21 @@ module Dpl
26
28
 
27
29
  URL = 'https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz'
28
30
 
29
- cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --path-update false --usage-reporting false --command-completion false',
30
- login: 'gcloud -q auth activate-service-account --key-file %{keyfile}',
31
- deploy: 'gcloud -q app deploy %{config} %{deploy_opts}',
32
- cat_logs: 'find $HOME/.config/gcloud/logs -type f -print -exec cat {} \;'
31
+ cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --path-update false --usage-reporting false --command-completion false',
32
+ login: 'gcloud -q auth activate-service-account --key-file %{keyfile}',
33
+ deploy: 'gcloud -q app deploy %{config} %{deploy_opts}',
34
+ cat_logs: 'find $HOME/.config/gcloud/logs -type f -print -exec cat {} \;'
33
35
 
34
- errs install: 'Failed to download Google Cloud SDK.',
35
- login: 'Failed to authenticate.'
36
+ errs install: 'Failed to download Google Cloud SDK.',
37
+ login: 'Failed to authenticate.'
36
38
 
37
- msgs failed: 'Deployment failed.'
39
+ msgs failed: 'Deployment failed.'
38
40
 
39
41
  path '~/google-cloud-sdk/bin'
40
42
 
41
43
  def install
42
44
  return unless install_sdk?
45
+
43
46
  shell :install
44
47
  end
45
48
 
@@ -54,22 +57,22 @@ module Dpl
54
57
 
55
58
  private
56
59
 
57
- def deploy_opts
58
- opts = [*opts_for(%i(project verbosity version))]
59
- opts << '--no-promote' unless promote?
60
- opts << '--no-stop-previous-version' unless stop_previous_version?
61
- opts.join(' ')
62
- end
63
-
64
- def failed
65
- warn :failed
66
- shell :cat_logs
67
- error ''
68
- end
69
-
70
- def project
71
- super || File.dirname(build_dir)
72
- end
60
+ def deploy_opts
61
+ opts = [*opts_for(%i[project verbosity version])]
62
+ opts << '--no-promote' unless promote?
63
+ opts << '--no-stop-previous-version' unless stop_previous_version?
64
+ opts.join(' ')
65
+ end
66
+
67
+ def failed
68
+ warn :failed
69
+ shell :cat_logs
70
+ error ''
71
+ end
72
+
73
+ def project
74
+ super || File.dirname(build_dir)
75
+ end
73
76
  end
74
77
  end
75
78
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'kconv'
2
4
 
3
5
  module Dpl
@@ -9,17 +11,17 @@ module Dpl
9
11
 
10
12
  full_name 'Google Cloud Store'
11
13
 
12
- description sq(<<-str)
14
+ description sq(<<-STR)
13
15
  tbd
14
- str
16
+ STR
15
17
 
16
- gem 'mime-types', '~> 3.2.2'
18
+ gem 'mime-types', '~> 3.4.1'
17
19
 
18
20
  python '>= 2.7.9'
19
21
 
20
22
  env :gcs
21
23
 
22
- required :key_file, [:access_key_id, :secret_access_key]
24
+ required :key_file, %i[access_key_id secret_access_key]
23
25
 
24
26
  opt '--key_file FILE', 'Path to a GCS service account key JSON file'
25
27
  opt '--access_key_id ID', 'GCS Interoperable Access Key ID', secret: true
@@ -28,28 +30,28 @@ module Dpl
28
30
  opt '--local_dir DIR', 'Local directory to upload from', default: '.'
29
31
  opt '--upload_dir DIR', 'GCS directory to upload to'
30
32
  opt '--dot_match', 'Upload hidden files starting with a dot'
31
- opt '--acl ACL', 'Access control to set for uploaded objects', default: 'private', enum: %w(private public-read public-read-write authenticated-read bucket-owner-read bucket-owner-full-control), see: 'https://cloud.google.com/storage/docs/reference-headers#xgoogacl'
33
+ opt '--acl ACL', 'Access control to set for uploaded objects', default: 'private', enum: %w[private public-read public-read-write authenticated-read bucket-owner-read bucket-owner-full-control], see: 'https://cloud.google.com/storage/docs/reference-headers#xgoogacl'
32
34
  opt '--detect_encoding', 'HTTP header Content-Encoding to set for files compressed with gzip and compress utilities.'
33
35
  opt '--cache_control HEADER', 'HTTP header Cache-Control to suggest that the browser cache the file.', see: 'https://cloud.google.com/storage/docs/xml-api/reference-headers#cachecontrol'
34
36
  opt '--glob GLOB', default: '**/*'
35
37
 
36
- cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --quiet --path-update false --usage-reporting false --command-completion false',
38
+ cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --quiet --path-update false --usage-reporting false --command-completion false',
37
39
  login_key: 'gcloud auth activate-service-account --key-file=%{key_file}',
38
- rsync: 'gsutil %{gs_opts} rsync %{rsync_opts} %{glob} %{target}',
39
- copy: 'gsutil %{gs_opts} cp %{copy_opts} -r %{source} %{target}'
40
+ rsync: 'gsutil %{gs_opts} rsync %{rsync_opts} %{glob} %{target}',
41
+ copy: 'gsutil %{gs_opts} cp %{copy_opts} -r %{source} %{target}'
40
42
 
41
- msgs login_key: 'Authenticating with service account key file %{key_file}',
43
+ msgs login_key: 'Authenticating with service account key file %{key_file}',
42
44
  login_creds: 'Authenticating with access key: %{access_key_id}'
43
45
 
44
- errs copy: 'Failed uploading files.'
46
+ errs copy: 'Failed uploading files.'
45
47
 
46
48
  URL = 'https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz'
47
49
 
48
- BOTO = sq(<<-str)
50
+ BOTO = sq(<<-STR)
49
51
  [Credentials]
50
52
  gs_access_key_id = %{access_key_id}
51
53
  gs_secret_access_key = %{secret_access_key}
52
- str
54
+ STR
53
55
 
54
56
  path '~/google-cloud-sdk'
55
57
  move '/etc/boto.cfg'
@@ -70,61 +72,61 @@ module Dpl
70
72
 
71
73
  private
72
74
 
73
- def login_key
74
- shell :login_key
75
- end
75
+ def login_key
76
+ shell :login_key
77
+ end
76
78
 
77
- def login_creds
78
- info :login_creds
79
- write_boto
80
- end
79
+ def login_creds
80
+ info :login_creds
81
+ write_boto
82
+ end
81
83
 
82
- def write_boto
83
- write_file '~/.boto', interpolate(BOTO, opts, secure: true), 0600
84
- end
84
+ def write_boto
85
+ write_file '~/.boto', interpolate(BOTO, opts, secure: true), 0600
86
+ end
85
87
 
86
- def files
87
- Dir.glob(*glob_args).select { |path| File.file?(path) }
88
- end
88
+ def files
89
+ Dir.glob(*glob_args).select { |path| File.file?(path) }
90
+ end
89
91
 
90
- def copy(source)
91
- to = [target.sub(%r(/$), ''), source].join('/')
92
- shell :copy, gs_opts: gs_opts(source), source: source, target: to
93
- end
92
+ def copy(source)
93
+ to = [target.sub(%r{/$}, ''), source].join('/')
94
+ shell :copy, gs_opts: gs_opts(source), source:, target: to
95
+ end
94
96
 
95
- def dirname(path)
96
- dir = File.dirname(path)
97
- dir unless dir.empty? || dir == '.'
98
- end
97
+ def dirname(path)
98
+ dir = File.dirname(path)
99
+ dir unless dir.empty? || dir == '.'
100
+ end
99
101
 
100
- def gs_opts(path)
101
- opts = []
102
- opts << %(-h "Cache-Control:#{cache_control}") if cache_control?
103
- opts << %(-h "Content-Encoding:#{encoding(path)}") if detect_encoding?
104
- opts << %(-h "Content-type:#{mime_type(path)}") if mime_type(path)
105
- opts.join(' ') + ' ' if opts.any?
106
- end
102
+ def gs_opts(path)
103
+ opts = []
104
+ opts << %(-h "Cache-Control:#{cache_control}") if cache_control?
105
+ opts << %(-h "Content-Encoding:#{encoding(path)}") if detect_encoding?
106
+ opts << %(-h "Content-type:#{mime_type(path)}") if mime_type(path)
107
+ "#{opts.join(' ')} " if opts.any?
108
+ end
107
109
 
108
- def copy_opts
109
- opts = []
110
- opts << %(-a "#{acl}") if acl?
111
- opts.join(' ') + ' ' if opts.any?
112
- end
110
+ def copy_opts
111
+ opts = []
112
+ opts << %(-a "#{acl}") if acl?
113
+ "#{opts.join(' ')} " if opts.any?
114
+ end
113
115
 
114
- def target
115
- "gs://#{bucket}/#{upload_dir}"
116
- end
116
+ def target
117
+ "gs://#{bucket}/#{upload_dir}"
118
+ end
117
119
 
118
- def mime_type(path)
119
- type = MIME::Types.type_for(path).first
120
- type.to_s if type
121
- end
120
+ def mime_type(path)
121
+ type = MIME::Types.type_for(path).first
122
+ type&.to_s
123
+ end
122
124
 
123
- def glob_args
124
- args = [glob]
125
- args << File::FNM_DOTMATCH if dot_match?
126
- args
127
- end
125
+ def glob_args
126
+ args = [glob]
127
+ args << File::FNM_DOTMATCH if dot_match?
128
+ args
129
+ end
128
130
  end
129
131
  end
130
132
  end