dpl 2.0.0.alpha.2 → 2.0.0.alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -1
  3. data/Gemfile.lock +13 -8
  4. data/NOTES.md +1 -74
  5. data/README.md +464 -193
  6. data/lib/dpl/assets/convox/install +11 -0
  7. data/lib/dpl/assets/dpl/README.erb.md +4 -0
  8. data/lib/dpl/cli.rb +54 -18
  9. data/lib/dpl/ctx/test.rb +7 -3
  10. data/lib/dpl/helper/env.rb +67 -18
  11. data/lib/dpl/helper/wrap.rb +9 -0
  12. data/lib/dpl/provider.rb +11 -9
  13. data/lib/dpl/provider/dsl.rb +3 -1
  14. data/lib/dpl/provider/status.rb +6 -6
  15. data/lib/dpl/providers.rb +3 -1
  16. data/lib/dpl/providers/anynines.rb +5 -3
  17. data/lib/dpl/providers/azure_web_apps.rb +1 -1
  18. data/lib/dpl/providers/bintray.rb +2 -0
  19. data/lib/dpl/providers/bluemixcloudfoundry.rb +5 -3
  20. data/lib/dpl/providers/boxfuse.rb +1 -1
  21. data/lib/dpl/providers/cargo.rb +10 -1
  22. data/lib/dpl/providers/chef_supermarket.rb +3 -1
  23. data/lib/dpl/providers/cloud66.rb +2 -0
  24. data/lib/dpl/providers/cloudfiles.rb +2 -0
  25. data/lib/dpl/providers/cloudformation.rb +278 -0
  26. data/lib/dpl/providers/cloudfoundry.rb +6 -4
  27. data/lib/dpl/providers/codedeploy.rb +5 -5
  28. data/lib/dpl/providers/convox.rb +121 -0
  29. data/lib/dpl/providers/datica.rb +1 -1
  30. data/lib/dpl/providers/engineyard.rb +2 -0
  31. data/lib/dpl/providers/gae.rb +6 -7
  32. data/lib/dpl/providers/gcs.rb +5 -3
  33. data/lib/dpl/providers/gleis.rb +70 -0
  34. data/lib/dpl/providers/hackage.rb +2 -0
  35. data/lib/dpl/providers/hephy.rb +3 -1
  36. data/lib/dpl/providers/heroku.rb +4 -8
  37. data/lib/dpl/providers/heroku/api.rb +4 -2
  38. data/lib/dpl/providers/heroku/git.rb +3 -1
  39. data/lib/dpl/providers/lambda.rb +4 -4
  40. data/lib/dpl/providers/launchpad.rb +3 -1
  41. data/lib/dpl/providers/netlify.rb +2 -0
  42. data/lib/dpl/providers/npm.rb +2 -0
  43. data/lib/dpl/providers/openshift.rb +2 -0
  44. data/lib/dpl/providers/opsworks.rb +1 -1
  45. data/lib/dpl/providers/packagecloud.rb +2 -0
  46. data/lib/dpl/providers/pages.rb +4 -7
  47. data/lib/dpl/providers/pages/api.rb +16 -12
  48. data/lib/dpl/providers/pages/git.rb +16 -12
  49. data/lib/dpl/providers/puppetforge.rb +2 -0
  50. data/lib/dpl/providers/pypi.rb +2 -0
  51. data/lib/dpl/providers/releases.rb +8 -6
  52. data/lib/dpl/providers/rubygems.rb +3 -1
  53. data/lib/dpl/providers/s3.rb +7 -7
  54. data/lib/dpl/providers/scalingo.rb +2 -0
  55. data/lib/dpl/providers/testfairy.rb +2 -0
  56. data/lib/dpl/providers/transifex.rb +2 -0
  57. data/lib/dpl/version.rb +1 -1
  58. metadata +7 -3
  59. data/lib/dpl/providers/atlas.rb +0 -49
@@ -25,7 +25,7 @@ module Dpl
25
25
  push: 'Deploying to Datica: %{target}'
26
26
 
27
27
  def setup
28
- commit unless cleanup?
28
+ commit if git_dirty? && !cleanup?
29
29
  end
30
30
 
31
31
  def deploy
@@ -11,6 +11,8 @@ module Dpl
11
11
 
12
12
  required :api_key, [:email, :password]
13
13
 
14
+ env :engineyard, :ey
15
+
14
16
  opt '--api_key KEY', 'Engine Yard API key', secret: true
15
17
  opt '--email EMAIL', 'Engine Yard account email'
16
18
  opt '--password PASS', 'Engine Yard password', secret: true
@@ -11,7 +11,7 @@ module Dpl
11
11
 
12
12
  python '>= 2.7.9'
13
13
 
14
- env :googlecloud, :cloudsdk_core, allow_skip_underscore: true
14
+ env :gae, :googlecloud, :cloudsdk_core, allow_skip_underscore: true
15
15
 
16
16
  opt '--project ID', 'Project ID used to identify the project on Google Cloud', required: true
17
17
  opt '--keyfile FILE', 'Path to the JSON file containing your Service Account credentials in JSON Web Token format. To be obtained via the Google Developers Console. Should be handled with care as it contains authorization keys.', default: 'service-account.json'
@@ -19,18 +19,18 @@ module Dpl
19
19
  opt '--version VER', 'The version of the app that will be created or replaced by this deployment. If you do not specify a version, one will be generated for you'
20
20
  opt '--verbosity LEVEL', 'Adjust the log verbosity', default: 'warning'
21
21
  opt '--promote', 'Do not promote the deployed version', default: true
22
- opt '--stop_previous_version', 'Prevent your deployment from stopping the previously promoted version. This is from the future, so might not work (yet).', default: true
22
+ opt '--stop_previous_version', 'Prevent the deployment from stopping a previously promoted version', default: true
23
23
  opt '--install_sdk', 'Do not install the Google Cloud SDK', default: true
24
24
 
25
- cmds install: 'curl -L https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz | gzip -d | tar -x -C ~',
26
- bootstrap: '~/google-cloud-sdk/bin/bootstrapping/install.py --usage-reporting=false --command-completion=false --path-update=false',
25
+ URL = 'https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz'
26
+
27
+ cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --path-update false --usage-reporting false --command-completion false',
27
28
  login: 'gcloud -q auth activate-service-account --key-file %{keyfile}',
28
29
  deploy: 'gcloud -q app deploy %{config} %{deploy_opts}',
29
30
  cat_logs: 'find $HOME/.config/gcloud/logs -type f -print -exec cat {} \;'
30
31
 
31
32
  errs install: 'Failed to download Google Cloud SDK.',
32
- login: 'Failed to authenticate.',
33
- bootstrap: 'Failed bootstrap Google Cloud SDK.'
33
+ login: 'Failed to authenticate.'
34
34
 
35
35
  msgs failed: 'Deployment failed.'
36
36
 
@@ -39,7 +39,6 @@ module Dpl
39
39
  def install
40
40
  return unless install_sdk?
41
41
  shell :install
42
- shell :bootstrap
43
42
  end
44
43
 
45
44
  def login
@@ -15,15 +15,17 @@ module Dpl
15
15
 
16
16
  python '>= 2.7.9'
17
17
 
18
+ env :gcs
19
+
18
20
  opt '--access_key_id ID', 'GCS Interoperable Access Key ID', required: true, secret: true
19
21
  opt '--secret_access_key KEY', 'GCS Interoperable Access Secret', required: true, secret: true
20
22
  opt '--bucket BUCKET', 'GCS Bucket', required: true
21
23
  opt '--local_dir DIR', 'Local directory to upload from', default: '.'
22
24
  opt '--upload_dir DIR', 'GCS directory to upload to'
23
25
  opt '--dot_match', 'Upload hidden files starting with a dot'
24
- opt '--acl ACL', 'Access control to set for uploaded objects'
26
+ 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'
25
27
  opt '--detect_encoding', 'HTTP header Content-Encoding to set for files compressed with gzip and compress utilities.'
26
- opt '--cache_control HEADER', 'HTTP header Cache-Control to suggest that the browser cache the file.'
28
+ 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'
27
29
 
28
30
  cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --path-update false --usage-reporting false --command-completion false',
29
31
  copy: 'gsutil %{gs_opts}cp %{copy_opts}-r %{source} %{target}'
@@ -32,7 +34,7 @@ module Dpl
32
34
 
33
35
  errs copy: 'Failed uploading files.'
34
36
 
35
- URL = 'https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-252.0.0-linux-x86_64.tar.gz'
37
+ URL = 'https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz'
36
38
 
37
39
  BOTO = sq(<<-str)
38
40
  [Credentials]
@@ -0,0 +1,70 @@
1
+ module Dpl
2
+ module Providers
3
+ class Gleis < Provider
4
+ status :alpha
5
+
6
+ description sq(<<-str)
7
+ tbd
8
+ str
9
+
10
+ gem 'gleis', '~> 0.6.0'
11
+
12
+ env :gleis
13
+
14
+ opt '--app APP', 'Gleis application to upload to', default: :repo_name
15
+ opt '--username NAME', 'Gleis username', required: true
16
+ opt '--password PASS', 'Gleis password', required: true, secret: true
17
+ opt '--key_name NAME', 'Name of the SSH deploy key pushed to Gleis', default: 'dpl_deploy_key'
18
+ opt '--verbose'
19
+
20
+ needs :ssh_key
21
+
22
+ cmds login: 'gleis auth login %{username} %{password} --skip-keygen',
23
+ logout: 'gleis auth logout',
24
+ validate: 'gleis app status -a %{app}',
25
+ add_key: 'gleis auth key add %{file} %{key_name}',
26
+ remove_key: 'gleis auth key remove %{key_name}',
27
+ git_url: 'gleis app git -a %{app} -q',
28
+ deploy: 'git push %{push_opts} -f %{git_url} HEAD:refs/heads/master'
29
+
30
+ errs login: 'Login failed',
31
+ validate: 'Application not found',
32
+ add_key: 'Adding SSH key failed',
33
+ remove_key: 'Removing key failed',
34
+ git_url: 'Failed to retrieve Git URL',
35
+ deploy: 'Deploying application failed'
36
+
37
+ attr_reader :git_url
38
+
39
+ def login
40
+ shell :login
41
+ end
42
+
43
+ def setup
44
+ @git_url = shell :git_url, capture: true
45
+ end
46
+
47
+ def validate
48
+ shell :validate
49
+ end
50
+
51
+ def add_key(file)
52
+ shell :add_key, file: file
53
+ end
54
+
55
+ def deploy
56
+ shell :deploy
57
+ end
58
+
59
+ def remove_key
60
+ shell :remove_key
61
+ end
62
+
63
+ private
64
+
65
+ def push_opts
66
+ '-v' if verbose?
67
+ end
68
+ end
69
+ end
70
+ end
@@ -7,6 +7,8 @@ module Dpl
7
7
  tbd
8
8
  str
9
9
 
10
+ env :hackage
11
+
10
12
  opt '--username USER', 'Hackage username', required: true
11
13
  opt '--password USER', 'Hackage password', required: true, secret: true
12
14
  opt '--publish', 'Whether or not to publish the package'
@@ -7,11 +7,13 @@ module Dpl
7
7
  tbd
8
8
  str
9
9
 
10
+ env :hephy
11
+
10
12
  opt '--controller NAME', 'Hephy controller', required: true, example: 'hephy.hephyapps.com'
11
13
  opt '--username USER', 'Hephy username', required: true
12
14
  opt '--password PASS', 'Hephy password', required: true, secret: true
13
15
  opt '--app APP', 'Deis app', required: true
14
- opt '--cli_version VER', 'Install a specific hephy cli version', default: 'stable'
16
+ opt '--cli_version VER', 'Install a specific Hephy CLI version', default: 'stable'
15
17
  opt '--verbose', 'Verbose log output'
16
18
 
17
19
  needs :git, :ssh_key
@@ -1,20 +1,16 @@
1
1
  module Dpl
2
2
  module Providers
3
3
  class Heroku < Provider
4
- def self.new(ctx, args)
5
- # can this be a generic dispatch feature in Cl?
6
- return super unless registry_key.to_sym == :heroku
7
- arg = args.detect { |arg| arg.include?('--strategy') }
8
- strategy = arg ? arg.split('=').last : 'api'
9
- Provider[:"heroku:#{strategy}"].new(ctx, args)
10
- end
4
+ abstract
11
5
 
12
6
  gem 'faraday', '~> 0.9.2'
13
7
  gem 'json'
14
8
  gem 'netrc', '~> 0.11.0'
15
9
  gem 'rendezvous', '~> 0.1.3'
16
10
 
17
- opt '--strategy NAME', 'Heroku deployment strategy', default: 'api', enum: %w(api git), internal: true
11
+ env :heroku
12
+
13
+ opt '--strategy NAME', 'Heroku deployment strategy', default: 'api', enum: %w(api git)
18
14
  opt '--app APP', 'Heroku app name', default: :repo_name
19
15
  opt '--log_level LEVEL', internal: true
20
16
 
@@ -2,6 +2,8 @@ module Dpl
2
2
  module Providers
3
3
  class Heroku
4
4
  class Api < Heroku
5
+ register 'heroku:api'
6
+
5
7
  status :alpha
6
8
 
7
9
  full_name 'Heroku API'
@@ -40,7 +42,7 @@ module Dpl
40
42
  end
41
43
 
42
44
  def upload
43
- shell :upload
45
+ shell :upload, echo: false
44
46
  end
45
47
 
46
48
  def build
@@ -54,7 +56,7 @@ module Dpl
54
56
  end
55
57
 
56
58
  def log
57
- shell :log
59
+ shell :log, echo: false
58
60
  end
59
61
 
60
62
  def verify
@@ -2,6 +2,8 @@ module Dpl
2
2
  module Providers
3
3
  class Heroku
4
4
  class Git < Heroku
5
+ register 'heroku:git'
6
+
5
7
  status :alpha
6
8
 
7
9
  full_name 'Heroku Git'
@@ -15,7 +17,7 @@ module Dpl
15
17
  opt '--api_key KEY', 'Heroku API key', secret: true
16
18
  opt '--username USER', 'Heroku username', alias: :user
17
19
  opt '--password PASS', 'Heroku password', secret: true
18
- opt '--git URL'
20
+ opt '--git URL', 'Heroku Git remote URL'
19
21
 
20
22
  needs :git, :git_http_user_agent
21
23
 
@@ -14,15 +14,15 @@ module Dpl
14
14
  gem 'aws-sdk-lambda', '~> 1.0'
15
15
  gem 'rubyzip', '~> 1.2.2', require: 'zip'
16
16
 
17
- env :aws
17
+ env :aws, :lambda
18
18
  config '~/.aws/credentials', '~/.aws/config', prefix: 'aws'
19
19
 
20
20
  opt '--access_key_id ID', 'AWS access key id', required: true, secret: true
21
21
  opt '--secret_access_key KEY', 'AWS secret key', required: true, secret: true
22
22
  opt '--region REGION', 'AWS region the Lambda function is running in', default: 'us-east-1'
23
23
  opt '--function_name FUNC', 'Name of the Lambda being created or updated', required: true
24
- opt '--role ROLE', 'ARN of the IAM role to assign to the Lambda function', note: 'required for creating a new function'
25
- opt '--handler_name NAME', 'Function the Lambda calls to begin execution.', note: 'required for creating a new function'
24
+ opt '--role ROLE', 'ARN of the IAM role to assign to the Lambda function', note: 'required when creating a new function'
25
+ opt '--handler_name NAME', 'Function the Lambda calls to begin execution.', note: 'required when creating a new function'
26
26
  opt '--module_name NAME', 'Name of the module that exports the handler', default: 'index', requires: :handler_name
27
27
  opt '--description DESCR', 'Description of the Lambda being created or updated'
28
28
  opt '--timeout SECS', 'Function execution time (in seconds) at which Lambda should terminate the function', default: 3
@@ -30,7 +30,7 @@ module Dpl
30
30
  opt '--subnet_ids IDS', 'List of subnet IDs to be added to the function', type: :array, note: 'Needs the ec2:DescribeSubnets and ec2:DescribeVpcs permission for the user of the access/secret key to work'
31
31
  opt '--security_group_ids IDS', 'List of security group IDs to be added to the function', type: :array, note: 'Needs the ec2:DescribeSecurityGroups and ec2:DescribeVpcs permission for the user of the access/secret key to work'
32
32
  opt '--environment VARS', 'List of Environment Variables to add to the function', type: :array, format: /[\w\-]+=.+/, note: 'Can be encrypted for added security', alias: :environment_variables
33
- opt '--runtime NAME', 'Lambda runtime to use', default: 'nodejs8.10', enum: %w(java8 nodejs8.10 nodejs10.x python2.7 python3.6 python3.7 dotnetcore2.1 go1.x ruby2.5)
33
+ opt '--runtime NAME', 'Lambda runtime to use', note: 'required when creating a new function', default: 'nodejs8.10', enum: %w(java8 nodejs8.10 nodejs10.x python2.7 python3.6 python3.7 dotnetcore2.1 go1.x ruby2.5)
34
34
  opt '--dead_letter_arn ARN', 'ARN to an SNS or SQS resource used for the dead letter queue.'
35
35
  opt '--kms_key_arn ARN', 'KMS key ARN to use to encrypt environment_variables.'
36
36
  opt '--tracing_mode MODE', 'Tracing mode', default: 'PassThrough', enum: %w(Active PassThrough), note: 'Needs xray:PutTraceSegments xray:PutTelemetryRecords on the role'
@@ -7,9 +7,11 @@ module Dpl
7
7
  tbd
8
8
  str
9
9
 
10
- opt '--slug SLUG', 'Launchpad project slug', format: /^~[^\/]+\/[^\/]+\/[^\/]+$/, example: '~user-name/project-name/branch-name'
10
+ env :launchpad
11
+
11
12
  opt '--oauth_token TOKEN', 'Launchpad OAuth token', secret: true
12
13
  opt '--oauth_token_secret SECRET', 'Launchpad OAuth token secret', secret: true
14
+ opt '--slug SLUG', 'Launchpad project slug', format: /^~[^\/]+\/[^\/]+\/[^\/]+$/, example: '~user-name/project-name/branch-name'
13
15
 
14
16
  msgs invalid_credentials: 'Invalid credentials (%s)',
15
17
  unknown_error: 'Error: %s (%s)'
@@ -9,6 +9,8 @@ module Dpl
9
9
 
10
10
  npm 'netlify-cli', 'netlify'
11
11
 
12
+ env :netlify
13
+
12
14
  opt '--site ID', 'A site ID to deploy to', required: true
13
15
  opt '--auth TOKEN', 'An auth token to log in with', required: true, secret: true
14
16
  opt '--dir DIR', 'Specify a folder to deploy'
@@ -11,6 +11,8 @@ module Dpl
11
11
 
12
12
  gem 'json'
13
13
 
14
+ env :npm
15
+
14
16
  opt '--email EMAIL', 'npm account email'
15
17
  opt '--api_token TOKEN', 'npm api token', alias: :api_key, required: true, secret: true, note: 'can be retrieved from your local ~/.npmrc file', see: 'https://docs.npmjs.com/creating-and-viewing-authentication-tokens'
16
18
  opt '--access ACCESS', 'Access level', enum: %w(public private)
@@ -9,6 +9,8 @@ module Dpl
9
9
  tbd
10
10
  str
11
11
 
12
+ env :openshift
13
+
12
14
  opt '--server SERVER', 'OpenShift server', required: true
13
15
  opt '--token TOKEN', 'OpenShift token', required: true, secret: true
14
16
  opt '--project PROJECT', 'OpenShift project', required: true
@@ -11,7 +11,7 @@ module Dpl
11
11
 
12
12
  gem 'aws-sdk-opsworks', '~> 1.0'
13
13
 
14
- env :aws
14
+ env :aws, :opsworks
15
15
  config '~/.aws/credentials', '~/.aws/config', prefix: 'aws'
16
16
 
17
17
  opt '--access_key_id ID', 'AWS access key id', required: true, secret: true
@@ -13,6 +13,8 @@ module Dpl
13
13
 
14
14
  gem 'packagecloud-ruby', '~> 1.0.8', require: 'packagecloud'
15
15
 
16
+ env :packagecloud
17
+
16
18
  opt '--username USER', 'The packagecloud.io username.', required: true
17
19
  opt '--token TOKEN', 'The packagecloud.io api token.', required: true, secret: true
18
20
  opt '--repository REPO', 'The repository to push to.', required: true
@@ -1,14 +1,11 @@
1
1
  module Dpl
2
2
  module Providers
3
3
  class Pages < Provider
4
- def self.new(ctx, args)
5
- return super unless registry_key.to_sym == :pages
6
- arg = args.detect { |arg| arg.include? '--strategy' }
7
- strategy = arg ? arg.split('=', 2).last : 'git'
8
- Provider[:"pages:#{strategy}"].new(ctx, args)
9
- end
4
+ abstract
10
5
 
11
- opt '--strategy NAME', 'GitHub Pages deployment strategy', default: 'git', enum: %w(api git), internal: true
6
+ env :github, :pages
7
+
8
+ opt '--strategy NAME', 'GitHub Pages deployment strategy', default: 'git', enum: %w(api git)
12
9
  end
13
10
  end
14
11
  end
@@ -4,6 +4,10 @@ module Dpl
4
4
  module Providers
5
5
  class Pages
6
6
  class Api < Pages
7
+ register 'pages:api'
8
+
9
+ status :dev
10
+
7
11
  PAGES_PREVIEW_MEDIA_TYPE = 'application/vnd.github.mister-fantastic-preview+json'
8
12
 
9
13
  # suppress warnings about preview API
@@ -16,8 +20,6 @@ module Dpl
16
20
 
17
21
  gem 'octokit', '~> 4.14.0'
18
22
 
19
- status :alpha
20
-
21
23
  full_name 'GitHub Pages (API)'
22
24
 
23
25
  description sq(<<-str)
@@ -32,20 +34,22 @@ module Dpl
32
34
  str
33
35
 
34
36
  opt '--repo SLUG', 'GitHub repo slug', default: :repo_slug
35
- opt '--github_token TOKEN', 'GitHub oauth token with repo permission', required: true, secret: true
37
+ opt '--token TOKEN', 'GitHub oauth token with repo permission', required: true, secret: true, alias: :github_token
36
38
 
37
- msgs pages_not_found: 'GitHub Pages not found for %{slug}. ' \
38
- 'Given token has insufficient scope (\'repo\' or \'public_repo\'), ' \
39
- 'or GitHub Pages is not enabled for this repo (see https://github.com/%{slug}/settings)',
40
- build_pages_request_timeout: 'GitHub Pages build request timed out',
41
- deploy_start: 'Requesting GitHub Pages build using API'
39
+ msgs not_found: sq(<<-msg),
40
+ GitHub Pages not found for %{slug}.
41
+ Either the given token has insufficient scope (repo or public_repo), or
42
+ GitHub Pages is not enabled for this repo (see https://github.com/%{slug}/settings)'
43
+ msg
44
+ timeout: 'GitHub Pages build request timed out',
45
+ deploy: 'Requesting GitHub Pages build using API'
42
46
 
43
47
  def validate
44
- error :pages_not_found unless pages_enabled?
48
+ error :not_found unless pages_enabled?
45
49
  end
46
50
 
47
51
  def deploy
48
- info :deploy_start
52
+ info :deploy
49
53
 
50
54
  api.request_page_build slug
51
55
 
@@ -71,7 +75,7 @@ module Dpl
71
75
  rescue Octokit::Forbidden => fb
72
76
  error fb.message
73
77
  rescue Timeout::Error => to
74
- error :build_pages_request_timeout
78
+ error :timeout
75
79
  end
76
80
 
77
81
  private
@@ -87,7 +91,7 @@ module Dpl
87
91
  end
88
92
 
89
93
  def creds
90
- { access_token: github_token }
94
+ { access_token: token }
91
95
  end
92
96
 
93
97
  def pages_enabled?
@@ -2,6 +2,8 @@ module Dpl
2
2
  module Providers
3
3
  class Pages
4
4
  class Git < Pages
5
+ register 'pages:git'
6
+
5
7
  status :alpha
6
8
 
7
9
  full_name 'GitHub Pages'
@@ -13,10 +15,10 @@ module Dpl
13
15
  gem 'octokit', '~> 4.14.0'
14
16
  gem 'public_suffix', '~> 3.0.3'
15
17
 
16
- required :github_token, :deploy_key
18
+ required :token, :deploy_key
17
19
 
18
20
  opt '--repo SLUG', 'Repo slug', default: :repo_slug
19
- opt '--github_token TOKEN', 'GitHub oauth token with repo permission', secret: true
21
+ opt '--token TOKEN', 'GitHub oauth token with repo permission', secret: true, alias: :github_token
20
22
  opt '--deploy_key PATH', 'Path to a file containing a private deploy key with write access to the repository', see: 'https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys'
21
23
  opt '--target_branch BRANCH', 'Branch to push force to', default: 'gh-pages'
22
24
  opt '--keep_history', 'Create incremental commit instead of doing push force', default: true
@@ -30,7 +32,7 @@ module Dpl
30
32
  opt '--email EMAIL', 'Committer email', note: 'defaults to the current git commit author email'
31
33
  opt '--committer_from_gh', 'Use the token\'s owner name and email for the commit', requires: :github_token
32
34
  opt '--deployment_file', 'Enable creation of a deployment-info file'
33
- opt '--github_url URL', default: 'github.com'
35
+ opt '--url URL', default: 'github.com', alias: :github_url
34
36
 
35
37
  needs :git
36
38
 
@@ -39,7 +41,7 @@ module Dpl
39
41
  insufficient_scopes: 'Dpl does not have permission to access %{url} using the provided GitHub token. Please make sure the token have the repo or public_repo scope.',
40
42
  setup_deploy_key: 'Moving deploy key %{deploy_key} to %{path}',
41
43
  check_deploy_key: 'Checking deploy key',
42
- deploy: 'Deploying branch %{target_branch} to %{github_url}',
44
+ deploy: 'Deploying branch %{target_branch} to %{url}',
43
45
  keep_history: 'The deployment is configured to preserve the target branch if it exists on remote.',
44
46
  work_dir: 'Using temporary work directory %{work_dir}',
45
47
  committer_from_gh: 'The repo is configured to use committer user and email.',
@@ -50,7 +52,8 @@ module Dpl
50
52
  copy_files: 'Copying %{src_dir} contents to %{work_dir}',
51
53
  git_config: 'Configuring git committer to be %{name} <%{email}>',
52
54
  prepare: 'Preparing to deploy %{target_branch} branch to gh-pages',
53
- git_push: 'Pushing to %{url}'
55
+ git_push: 'Pushing to %{url}',
56
+ stop: 'There are no changes to commit, stopping.'
54
57
 
55
58
  cmds git_clone: 'git clone --quiet --branch="%{target_branch}" --depth=1 "%{remote_url}" . > /dev/null 2>&1',
56
59
  git_init: 'git init .',
@@ -74,7 +77,7 @@ module Dpl
74
77
  git_push: 'Failed to push the build to %{url}:%{target_branch}'
75
78
 
76
79
  def login
77
- github_token? ? login_token : setup_deploy_key
80
+ token? ? login_token : setup_deploy_key
78
81
  end
79
82
 
80
83
  def setup
@@ -93,6 +96,7 @@ module Dpl
93
96
  def deploy
94
97
  git_clone? ? git_clone : git_init
95
98
  copy_files
99
+ return info :stop unless git_dirty?
96
100
  git_config
97
101
  git_commit
98
102
  git_push
@@ -199,19 +203,19 @@ module Dpl
199
203
  end
200
204
 
201
205
  def remote_url
202
- github_token? ? https_url_with_token : git_url
206
+ token? ? https_url_with_token : git_url
203
207
  end
204
208
 
205
209
  def https_url_with_token
206
- "https://#{github_token}@#{url}"
210
+ "https://#{token}@#{url}"
207
211
  end
208
212
 
209
213
  def git_url
210
- "git@#{github_url}:#{slug}.git"
214
+ "git@#{opts[:url]}:#{slug}.git"
211
215
  end
212
216
 
213
217
  def url
214
- "#{github_url}/#{slug}.git"
218
+ "#{opts[:url]}/#{slug}.git"
215
219
  end
216
220
 
217
221
  def slug
@@ -231,11 +235,11 @@ module Dpl
231
235
  end
232
236
 
233
237
  def api
234
- @api ||= Octokit::Client.new(access_token: github_token, api_endpoint: api_endpoint)
238
+ @api ||= Octokit::Client.new(access_token: token, api_endpoint: api_endpoint)
235
239
  end
236
240
 
237
241
  def api_endpoint
238
- github_url == 'github.com' ? 'https://api.github.com/' : "https://#{github_url}/api/v3/"
242
+ opts[:url] == 'github.com' ? 'https://api.github.com/' : "https://#{opts[:url]}/api/v3/"
239
243
  end
240
244
 
241
245
  def now