dpl 1.8.48.travis.2486.5 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.travis.yml +42 -21
  4. data/Gemfile +3 -98
  5. data/README.md +5 -16
  6. data/Rakefile +160 -1
  7. data/dpl-anynines.gemspec +3 -0
  8. data/dpl-atlas.gemspec +3 -0
  9. data/dpl-azure_webapps.gemspec +3 -0
  10. data/dpl-bintray.gemspec +3 -0
  11. data/dpl-bitballoon.gemspec +3 -0
  12. data/dpl-bluemix_cloud_foundry.gemspec +3 -0
  13. data/dpl-boxfuse.gemspec +3 -0
  14. data/dpl-catalyze.gemspec +3 -0
  15. data/dpl-chef_supermarket.gemspec +8 -0
  16. data/dpl-cloud66.gemspec +3 -0
  17. data/dpl-cloud_files.gemspec +3 -0
  18. data/dpl-cloud_foundry.gemspec +3 -0
  19. data/dpl-code_deploy.gemspec +3 -0
  20. data/dpl-deis.gemspec +3 -0
  21. data/dpl-divshot.gemspec +3 -0
  22. data/dpl-elastic_beanstalk.gemspec +3 -0
  23. data/dpl-engine_yard.gemspec +3 -0
  24. data/dpl-firebase.gemspec +3 -0
  25. data/dpl-gae.gemspec +3 -0
  26. data/dpl-gcs.gemspec +3 -0
  27. data/dpl-hackage.gemspec +3 -0
  28. data/dpl-heroku.gemspec +3 -0
  29. data/dpl-lambda.gemspec +3 -0
  30. data/dpl-launchpad.gemspec +3 -0
  31. data/dpl-modulus.gemspec +3 -0
  32. data/dpl-npm.gemspec +3 -0
  33. data/dpl-openshift.gemspec +3 -0
  34. data/dpl-ops_works.gemspec +3 -0
  35. data/dpl-packagecloud.gemspec +3 -0
  36. data/dpl-pages.gemspec +3 -0
  37. data/dpl-puppet_forge.gemspec +3 -0
  38. data/dpl-pypi.gemspec +3 -0
  39. data/dpl-releases.gemspec +3 -0
  40. data/dpl-rubygems.gemspec +3 -0
  41. data/dpl-s3.gemspec +3 -0
  42. data/dpl-scalingo.gemspec +3 -0
  43. data/dpl-script.gemspec +3 -0
  44. data/dpl-surge.gemspec +3 -0
  45. data/dpl-testfairy.gemspec +3 -0
  46. data/dpl-transifex.gemspec +3 -0
  47. data/dpl.gemspec +2 -31
  48. data/gemspec_helper.rb +49 -0
  49. data/lib/dpl/provider.rb +101 -58
  50. data/lib/dpl/version.rb +1 -1
  51. data/spec/provider_spec.rb +15 -34
  52. metadata +76 -107
  53. data/lib/dpl/provider/anynines.rb +0 -13
  54. data/lib/dpl/provider/appfog.rb +0 -21
  55. data/lib/dpl/provider/atlas.rb +0 -108
  56. data/lib/dpl/provider/azure_webapps.rb +0 -48
  57. data/lib/dpl/provider/bintray.rb +0 -509
  58. data/lib/dpl/provider/bitballoon.rb +0 -22
  59. data/lib/dpl/provider/bluemix_cloud_foundry.rb +0 -23
  60. data/lib/dpl/provider/boxfuse.rb +0 -57
  61. data/lib/dpl/provider/catalyze.rb +0 -49
  62. data/lib/dpl/provider/chef_supermarket.rb +0 -85
  63. data/lib/dpl/provider/cloud66.rb +0 -38
  64. data/lib/dpl/provider/cloud_files.rb +0 -38
  65. data/lib/dpl/provider/cloud_foundry.rb +0 -43
  66. data/lib/dpl/provider/code_deploy.rb +0 -154
  67. data/lib/dpl/provider/deis.rb +0 -128
  68. data/lib/dpl/provider/divshot.rb +0 -23
  69. data/lib/dpl/provider/elastic_beanstalk.rb +0 -195
  70. data/lib/dpl/provider/engine_yard.rb +0 -90
  71. data/lib/dpl/provider/firebase.rb +0 -27
  72. data/lib/dpl/provider/gae.rb +0 -97
  73. data/lib/dpl/provider/gcs.rb +0 -59
  74. data/lib/dpl/provider/hackage.rb +0 -29
  75. data/lib/dpl/provider/heroku.rb +0 -18
  76. data/lib/dpl/provider/heroku/api.rb +0 -98
  77. data/lib/dpl/provider/heroku/generic.rb +0 -94
  78. data/lib/dpl/provider/heroku/git.rb +0 -28
  79. data/lib/dpl/provider/lambda.rb +0 -236
  80. data/lib/dpl/provider/launchpad.rb +0 -48
  81. data/lib/dpl/provider/modulus.rb +0 -23
  82. data/lib/dpl/provider/npm.rb +0 -64
  83. data/lib/dpl/provider/openshift.rb +0 -59
  84. data/lib/dpl/provider/ops_works.rb +0 -132
  85. data/lib/dpl/provider/packagecloud.rb +0 -144
  86. data/lib/dpl/provider/pages.rb +0 -212
  87. data/lib/dpl/provider/puppet_forge.rb +0 -43
  88. data/lib/dpl/provider/pypi.rb +0 -103
  89. data/lib/dpl/provider/releases.rb +0 -139
  90. data/lib/dpl/provider/rubygems.rb +0 -51
  91. data/lib/dpl/provider/s3.rb +0 -123
  92. data/lib/dpl/provider/scalingo.rb +0 -97
  93. data/lib/dpl/provider/script.rb +0 -29
  94. data/lib/dpl/provider/surge.rb +0 -33
  95. data/lib/dpl/provider/testfairy.rb +0 -111
  96. data/lib/dpl/provider/transifex.rb +0 -45
  97. data/spec/provider/anynines_spec.rb +0 -20
  98. data/spec/provider/appfog_spec.rb +0 -35
  99. data/spec/provider/atlas_spec.rb +0 -99
  100. data/spec/provider/azure_webapps_spec.rb +0 -95
  101. data/spec/provider/bintray_spec.rb +0 -259
  102. data/spec/provider/bitballoon_spec.rb +0 -32
  103. data/spec/provider/bluemixcloudfoundry_spec.rb +0 -23
  104. data/spec/provider/boxfuse_spec.rb +0 -16
  105. data/spec/provider/catalyze_spec.rb +0 -39
  106. data/spec/provider/chef_supermarket_spec.rb +0 -51
  107. data/spec/provider/cloud66_spec.rb +0 -44
  108. data/spec/provider/cloud_files_spec.rb +0 -88
  109. data/spec/provider/cloudfoundry_spec.rb +0 -71
  110. data/spec/provider/code_deploy_spec.rb +0 -366
  111. data/spec/provider/deis_spec.rb +0 -116
  112. data/spec/provider/divshot_spec.rb +0 -28
  113. data/spec/provider/elastic_beanstalk_spec.rb +0 -209
  114. data/spec/provider/firebase_spec.rb +0 -40
  115. data/spec/provider/gae_spec.rb +0 -26
  116. data/spec/provider/gcs_spec.rb +0 -115
  117. data/spec/provider/hackage_spec.rb +0 -47
  118. data/spec/provider/heroku_spec.rb +0 -357
  119. data/spec/provider/lambda_spec.rb +0 -432
  120. data/spec/provider/launchpad_spec.rb +0 -33
  121. data/spec/provider/modulus_spec.rb +0 -29
  122. data/spec/provider/npm_spec.rb +0 -95
  123. data/spec/provider/openshift_spec.rb +0 -91
  124. data/spec/provider/ops_works_spec.rb +0 -127
  125. data/spec/provider/packagecloud_spec.rb +0 -56
  126. data/spec/provider/puppet_forge_spec.rb +0 -60
  127. data/spec/provider/pypi_spec.rb +0 -105
  128. data/spec/provider/releases_spec.rb +0 -303
  129. data/spec/provider/rubygems_spec.rb +0 -106
  130. data/spec/provider/s3_spec.rb +0 -174
  131. data/spec/provider/scalingo_spec.rb +0 -64
  132. data/spec/provider/script_spec.rb +0 -26
  133. data/spec/provider/surge_spec.rb +0 -15
  134. data/spec/provider/testfairy_spec.rb +0 -65
  135. data/spec/provider/transifex_spec.rb +0 -110
@@ -1,212 +0,0 @@
1
- module DPL
2
- class Provider
3
- class Pages < Provider
4
- """Implements Github Pages deployment
5
-
6
- Options:
7
- - repo [optional, for pushed to other repos]
8
- - github-token [required]
9
- - github-url [optional, defaults to github.com]
10
- - target-branch [optional, defaults to gh-pages]
11
- - keep-history [optional, defaults to false]
12
- - allow-empty-commit [optional, defaults to false]
13
- - committer-from-gh [optional, defaults to false]
14
- - verbose [optional, defaults to false]
15
- - local-dir [optional, defaults to `pwd`]
16
- - fqdn [optional]
17
- - project-name [optional, defaults to fqdn or repo slug]
18
- - email [optional, defaults to deploy@travis-ci.org]
19
- - name [optional, defaults to Deployment Bot]
20
- - deployment-file [optional, defaults to false]
21
- """
22
-
23
- require 'tmpdir'
24
-
25
- if RUBY_VERSION >= "2.0.0"
26
- requires 'octokit', version: '~> 4.6.2'
27
- else
28
- requires 'octokit', version: '~> 4.3.0'
29
- end
30
-
31
- experimental 'GitHub Pages'
32
-
33
- def initialize(context, options)
34
- super
35
-
36
- @build_dir = File.join(src_dir, options[:local_dir] || '.')
37
- print_step "The target dir for deployment is '#{@build_dir}'."
38
-
39
- @project_name = options[:project_name] || fqdn || slug
40
- @target_branch = options[:target_branch] || 'gh-pages'
41
-
42
- @gh_fqdn = fqdn
43
- @gh_url = options[:github_url] || 'github.com'
44
- @gh_token = option(:github_token)
45
- @keep_history = !!keep_history
46
- @allow_empty_commit = !!allow_empty_commit
47
- @committer_from_gh = !!committer_from_gh
48
- @verbose = !!verbose
49
-
50
- @gh_email = options[:email] || 'deploy@travis-ci.org'
51
- @gh_name = "#{options[:name] || 'Deployment Bot'} (from Travis CI)"
52
-
53
- @deployment_file = !!options[:deployment_file]
54
-
55
- @gh_ref = "#{@gh_url}/#{slug}.git"
56
- @gh_remote_url = "https://#{@gh_token}@#{@gh_ref}"
57
- @git_push_opts = @keep_history ? '' : ' --force'
58
- @git_commit_opts = (@allow_empty_commit and @keep_history) ? ' --allow-empty' : ''
59
-
60
- print_step "The repo is configured to use committer user and email." if @committer_from_gh
61
- end
62
-
63
- def fqdn
64
- options.fetch(:fqdn) { nil }
65
- end
66
-
67
- def slug
68
- options.fetch(:repo) { context.env['TRAVIS_REPO_SLUG'] }
69
- end
70
-
71
- def src_dir
72
- context.env['TRAVIS_BUILD_DIR'] or Dir.pwd
73
- end
74
-
75
- def keep_history
76
- options.fetch(:keep_history, false)
77
- end
78
-
79
- def committer_from_gh
80
- options.fetch(:committer_from_gh, false)
81
- end
82
-
83
- def allow_empty_commit
84
- options.fetch(:allow_empty_commit, false)
85
- end
86
-
87
- def verbose
88
- # Achtung! Never verbosify git, since it may expose user's token.
89
- options.fetch(:verbose, false)
90
- end
91
-
92
- def api # Borrowed from Releases provider
93
- error 'gh-token must be provided for Pages provider to work.' unless @gh_token
94
-
95
- return @api if @api
96
-
97
- api_opts = { :access_token => @gh_token }
98
- api_opts[:api_endpoint] = @gh_url == 'github.com' ? "https://api.github.com/" : "https://#{@gh_url}/api/v3/"
99
-
100
- @api = Octokit::Client.new(api_opts)
101
- end
102
-
103
- def user
104
- @user ||= api.user
105
- end
106
-
107
- def setup_auth
108
- user.login
109
- end
110
-
111
- def check_auth
112
- setup_auth
113
-
114
- unless api.scopes.include? 'public_repo' or api.scopes.include? 'repo'
115
- error "Dpl does not have permission to access #{@gh_url} using it. Make sure your token contains the repo or public_repo scope."
116
- end
117
-
118
- log "Logged in as @#{user.login} (#{user.name})"
119
- rescue Octokit::Unauthorized => exc
120
- error "gh-token is invalid. Details: #{exc}"
121
- end
122
-
123
- def needs_key?
124
- false
125
- end
126
-
127
- def print_step(msg)
128
- log msg if @verbose
129
- end
130
-
131
- def github_pull_or_init(target_dir)
132
- unless @keep_history
133
- github_init(target_dir)
134
- return
135
- end
136
-
137
- print_step "Trying to clone a single branch #{@target_branch} from existing repo..."
138
- unless context.shell "git clone --quiet --branch='#{@target_branch}' --depth=1 '#{@gh_remote_url}' '#{target_dir}' > /dev/null 2>&1"
139
- # if such branch doesn't exist at remote, init it from scratch
140
- print_step "Cloning #{@target_branch} branch failed"
141
- Dir.mkdir(target_dir) # Restore dir destroyed by failed `git clone`
142
- github_init(target_dir)
143
- end
144
- end
145
-
146
- def github_init(target_dir)
147
- FileUtils.cd(target_dir, :verbose => true) do
148
- print_step "Creating a brand new local repo from scratch in dir #{Dir.pwd}..."
149
- context.shell "git init" or raise 'Could not create new git repo'
150
- print_step 'Repo created successfully'
151
- context.shell "git checkout --orphan '#{@target_branch}'" or raise 'Could not create an orphan git branch'
152
- print_step "An orphan branch #{@target_branch} created successfully"
153
- end
154
- end
155
-
156
- def identify_preferred_committer
157
- if @committer_from_gh and @gh_token
158
- return (user.name or @gh_name), (user.email or @gh_email)
159
- end
160
- return @gh_name, @gh_email
161
- end
162
-
163
- def github_configure
164
- committer_name, committer_email = identify_preferred_committer
165
- print_step "Configuring git committer to be #{committer_name} <#{committer_email}> (workdir: #{Dir.pwd})"
166
- context.shell "git config user.email '#{committer_email}'"
167
- context.shell "git config user.name '#{committer_name}'"
168
- end
169
-
170
- def github_commit
171
- committer_name, _ = identify_preferred_committer
172
- print_step "Preparing to deploy #{@target_branch} branch to gh-pages (workdir: #{Dir.pwd})"
173
- context.shell "touch \"deployed at `date` by #{committer_name}\"" if @deployment_file
174
- context.shell "echo '#{@gh_fqdn}' > CNAME" if @gh_fqdn
175
- context.shell 'git add -A .'
176
- context.shell "git commit#{@git_commit_opts} -qm 'Deploy #{@project_name} to #{@gh_ref}:#{@target_branch}'"
177
- context.shell 'git show --stat-count=10 HEAD'
178
- end
179
-
180
- def github_deploy
181
- print_step "Doing the git push (workdir: #{Dir.pwd})..."
182
- unless context.shell "git push#{@git_push_opts} --quiet '#{@gh_remote_url}' '#{@target_branch}':'#{@target_branch}' > /dev/null 2>&1"
183
- error "Couldn't push the build to #{@gh_ref}:#{@target_branch}"
184
- end
185
- end
186
-
187
- def push_app
188
- print_step "Starting deployment of #{@target_branch} branch to GitHub Pages..."
189
- print_step "The deployment is configured to preserve the target branch if it exists on remote" if @keep_history
190
- Dir.mktmpdir do |tmpdir|
191
- workdir = "#{tmpdir}/work"
192
- Dir.mkdir(workdir)
193
- print_step "Created a temporary work directory #{workdir}"
194
-
195
- github_pull_or_init(workdir)
196
-
197
- FileUtils.cd(workdir, :verbose => true) do
198
- print_step "Copying #{@build_dir} contents to #{workdir} (workdir: #{Dir.pwd})..."
199
- context.shell "rsync -r --exclude .git --delete '#{@build_dir}/' '#{workdir}'" or error "Could not copy #{@build_dir}."
200
-
201
- github_configure
202
- github_commit
203
- github_deploy
204
- context.shell "git status" if @verbose
205
- end
206
- end
207
- print_step "App has been pushed"
208
- end
209
-
210
- end
211
- end
212
- end
@@ -1,43 +0,0 @@
1
- module DPL
2
- class Provider
3
- class PuppetForge < Provider
4
- require 'pathname'
5
-
6
- requires 'json_pure', :version => '< 2.0', :load => 'json/pure'
7
- requires 'puppet', :load => 'puppet/face'
8
- requires 'puppet-blacksmith', :load => 'puppet_blacksmith'
9
-
10
- def modulefile
11
- @modulefile ||= Blacksmith::Modulefile.new
12
- end
13
-
14
- def forge
15
- @forge ||= Blacksmith::Forge.new(options[:user], options[:password], options[:url])
16
- end
17
-
18
- def build
19
- pmod = Puppet::Face['module', :current]
20
- pmod.build('./')
21
- end
22
-
23
- def needs_key?
24
- false
25
- end
26
-
27
- def check_app
28
- modulefile.metadata
29
- end
30
-
31
- def check_auth
32
- raise Error, "must supply a user" unless option(:user)
33
- raise Error, "must supply a password" unless option(:password)
34
- end
35
-
36
- def push_app
37
- build
38
- log "Uploading to Puppet Forge #{forge.username}/#{modulefile.name}"
39
- forge.push!(modulefile.name)
40
- end
41
- end
42
- end
43
- end
@@ -1,103 +0,0 @@
1
- module DPL
2
- class Provider
3
- class PyPI < Provider
4
- DEFAULT_SERVER = 'https://upload.pypi.org/legacy/'
5
- PYPIRC_FILE = '~/.pypirc'
6
-
7
- def pypi_user
8
- option(:username, :user) || context.env['PYPI_USER'] || context.env['PYPI_USERNAME']
9
- end
10
-
11
- def pypi_password
12
- options[:password] || context.env['PYPI_PASSWORD']
13
- end
14
-
15
- def pypi_server
16
- options[:server] || context.env['PYPI_SERVER'] || DEFAULT_SERVER
17
- end
18
-
19
- def pypi_distributions
20
- options[:distributions] || context.env['PYPI_DISTRIBUTIONS'] || 'sdist'
21
- end
22
-
23
- def pypi_docs_dir_option
24
- docs_dir = options[:docs_dir] || context.env['PYPI_DOCS_DIR'] || ''
25
- if !docs_dir.empty?
26
- '--upload-dir ' + docs_dir
27
- end
28
- end
29
-
30
- def skip_upload_docs?
31
- ! options.has_key?(:skip_upload_docs) ||
32
- (options.has_key?(:skip_upload_docs) && options[:skip_upload_docs])
33
- end
34
-
35
- def install_deploy_dependencies
36
- unless context.shell "wget -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel && " \
37
- "pip install --upgrade setuptools twine wheel"
38
- error "Couldn't install pip, setuptools, twine or wheel."
39
- end
40
- end
41
-
42
- def config
43
- {
44
- :header => '[distutils]',
45
- :servers_line => 'index-servers = pypi',
46
- :servers => {
47
- 'pypi' => [
48
- "repository: #{pypi_server}",
49
- "username: #{pypi_user}",
50
- "password: #{pypi_password}",
51
- ]
52
- }
53
- }
54
- end
55
-
56
- def write_servers(f)
57
- config[:servers].each do |key, val|
58
- f.puts " " * 4 + key
59
- end
60
-
61
- config[:servers].each do |key, val|
62
- f.puts "[#{key}]"
63
- f.puts val
64
- end
65
- end
66
-
67
- def write_config
68
- File.open(File.expand_path(PYPIRC_FILE), 'w') do |f|
69
- config.each do |key, val|
70
- f.puts(val) if val.is_a? String or val.is_a? Array
71
- end
72
- write_servers(f)
73
- end
74
- end
75
-
76
- def check_auth
77
- error "missing PyPI username" unless pypi_user
78
- error "missing PyPI password" unless pypi_password
79
- write_config
80
- log "Authenticated as #{pypi_user}"
81
- end
82
-
83
- def check_app
84
- end
85
-
86
- def needs_key?
87
- false
88
- end
89
-
90
- def push_app
91
- context.shell "python setup.py #{pypi_distributions}"
92
- unless context.shell "twine upload -r pypi dist/*"
93
- error 'PyPI upload failed.'
94
- end
95
- context.shell "rm -rf dist/*"
96
- unless skip_upload_docs?
97
- log "Uploading documentation (skip with \"skip_upload_docs: true\")"
98
- context.shell "python setup.py upload_docs #{pypi_docs_dir_option} -r #{pypi_server}"
99
- end
100
- end
101
- end
102
- end
103
- end
@@ -1,139 +0,0 @@
1
- module DPL
2
- class Provider
3
- class Releases < Provider
4
- require 'pathname'
5
-
6
- if RUBY_VERSION >= "2.0.0"
7
- requires 'octokit', version: '~> 4.6.2'
8
- else
9
- requires 'octokit', version: '~> 4.3.0'
10
- end
11
-
12
- requires 'mime-types', version: '~> 2.0'
13
-
14
- def travis_tag
15
- # Check if $TRAVIS_TAG is unset or set but empty
16
- if context.env.fetch('TRAVIS_TAG','') == ''
17
- nil
18
- else
19
- context.env['TRAVIS_TAG']
20
- end
21
- end
22
-
23
- def get_tag
24
- if travis_tag.nil?
25
- @tag ||= `git describe --tags --exact-match 2>/dev/null`.chomp
26
- else
27
- @tag ||= travis_tag
28
- end
29
- end
30
-
31
- def api
32
- if options[:user] and options[:password]
33
- @api ||= Octokit::Client.new(:login => options[:user], :password => options[:password])
34
- else
35
- @api ||= Octokit::Client.new(:access_token => option(:api_key))
36
- end
37
- end
38
-
39
- def slug
40
- options.fetch(:repo) { context.env['TRAVIS_REPO_SLUG'] }
41
- end
42
-
43
- def releases
44
- @releases ||= api.releases(slug)
45
- end
46
-
47
- def user
48
- @user ||= api.user
49
- end
50
-
51
- def files
52
- if options[:file_glob]
53
- Array(options[:file]).map do |glob|
54
- Dir.glob(glob)
55
- end.flatten
56
- else
57
- Array(options[:file])
58
- end
59
- end
60
-
61
- def needs_key?
62
- false
63
- end
64
-
65
- def check_app
66
- log "Deploying to repo: #{slug}"
67
-
68
- context.shell 'git fetch --tags' if travis_tag.nil?
69
- log "Current tag is: #{get_tag}"
70
- end
71
-
72
- def setup_auth
73
- user.login
74
- end
75
-
76
- def check_auth
77
- setup_auth
78
-
79
- unless api.scopes.include? 'public_repo' or api.scopes.include? 'repo'
80
- raise Error, "Dpl does not have permission to upload assets. Make sure your token contains the repo or public_repo scope."
81
- end
82
-
83
- log "Logged in as #{user.name}"
84
- end
85
-
86
- def push_app
87
- tag_matched = false
88
- release_url = nil
89
-
90
- if options[:release_number]
91
- tag_matched = true
92
- release_url = "https://api.github.com/repos/" + slug + "/releases/" + options[:release_number]
93
- else
94
- releases.each do |release|
95
- if release.tag_name == get_tag
96
- release_url = release.rels[:self].href
97
- tag_matched = true
98
- end
99
- end
100
- end
101
-
102
- #If for some reason GitHub hasn't already created a release for the tag, create one
103
- if tag_matched == false
104
- release_url = api.create_release(slug, get_tag, options.merge({:draft => true})).rels[:self].href
105
- end
106
-
107
- files.each do |file|
108
- existing_url = nil
109
- filename = Pathname.new(file).basename.to_s
110
- api.release(release_url).rels[:assets].get.data.each do |existing_file|
111
- if existing_file.name == filename
112
- existing_url = existing_file.url
113
- end
114
- end
115
- if !existing_url
116
- upload_file(file, filename, release_url)
117
- elsif existing_url && options[:overwrite]
118
- log "#{filename} already exists, overwriting."
119
- api.delete_release_asset(existing_url)
120
- upload_file(file, filename, release_url)
121
- else
122
- log "#{filename} already exists, skipping."
123
- end
124
- end
125
-
126
- api.update_release(release_url, {:draft => false}.merge(options))
127
- end
128
-
129
- def upload_file(file, filename, release_url)
130
- content_type = MIME::Types.type_for(file).first.to_s
131
- if content_type.empty?
132
- # Specify the default content type, as it is required by GitHub
133
- content_type = "application/octet-stream"
134
- end
135
- api.upload_asset(release_url, file, {:name => filename, :content_type => content_type})
136
- end
137
- end
138
- end
139
- end