dropbox-deployment 0.0.0
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 +7 -0
- data/lib/dropbox-deployment.rb +65 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2ef874c2394fd9704241353d1357ee07937e61af
|
4
|
+
data.tar.gz: 491e92a1f8d099131b9b2e697b9714678c5587ba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 478bc08b00a7fab82fa3b4459e9adbd1fd5023f92a80d1254c3876f373c3b9f1643a1c5476c12dc26b72844ae1091e3262441e735ccdc25a7fd0e63222bce4a6
|
7
|
+
data.tar.gz: 928b667885284cddd132e0ae42d4b97f40f5677d1a7e85d0f2a9dd14cf75b31241dab7a58b4a54f8a83eeebbb3ecdf3d68ebcc727e3e11e0f3a20a99d96c5f3c
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'dropbox_api'
|
3
|
+
require 'yaml'
|
4
|
+
require 'logger'
|
5
|
+
require 'find'
|
6
|
+
|
7
|
+
logger = Logger.new(STDOUT)
|
8
|
+
logger.level = Logger::WARN
|
9
|
+
|
10
|
+
def uploadFile(dropboxClient, file, dropboxPath)
|
11
|
+
fileName = File.basename(file)
|
12
|
+
content = IO.read(file)
|
13
|
+
dropboxClient.upload dropboxPath + "/" + fileName, content
|
14
|
+
end
|
15
|
+
|
16
|
+
def uploadDirectory(dropboxClient, directoryPath, dropboxPath)
|
17
|
+
Find.find(directoryPath) do |file|
|
18
|
+
# TODO need to have the path of the parent as part of the dropbox path
|
19
|
+
# so that we keep the hierarchy we want
|
20
|
+
if !File.directory?(file)
|
21
|
+
uploadFile(dropboxClient, file, dropboxPath)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
# Validation
|
26
|
+
config = YAML.load_file("upload-to-dropbox.yml")
|
27
|
+
testing = false
|
28
|
+
if !config["deploy"]
|
29
|
+
puts "\nError in config file! Build file must contain a `deploy` object.\n\n"
|
30
|
+
exit(1)
|
31
|
+
end
|
32
|
+
artifactPath = config["deploy"]["artifacts_path"]
|
33
|
+
dropboxPath = config["deploy"]["dropbox_path"]
|
34
|
+
|
35
|
+
# Just for testing, load the local oauth token from the file
|
36
|
+
if File.file?("testconfig")
|
37
|
+
oauth = IO.read "testconfig"
|
38
|
+
ENV["DROPBOX_OAUTH_BEARER"] = oauth
|
39
|
+
testing = true
|
40
|
+
end
|
41
|
+
|
42
|
+
if ENV["DROPBOX_OAUTH_BEARER"].nil?
|
43
|
+
puts "\nYou must have an environment variable of `DROPBOX_OAUTH_BEARER` in order to deploy to Dropbox\n\n"
|
44
|
+
exit(1)
|
45
|
+
end
|
46
|
+
|
47
|
+
if config["deploy"]["debug"]
|
48
|
+
logger.level = Logger::DEBUG
|
49
|
+
logger.debug("We are in debug mode")
|
50
|
+
end
|
51
|
+
|
52
|
+
dropboxClient = DropboxApi::Client.new
|
53
|
+
|
54
|
+
# Upload all files
|
55
|
+
logger.debug("Artifact Path: " + artifactPath)
|
56
|
+
logger.debug("Dropbox Path: " + dropboxPath)
|
57
|
+
isDirectory = File.directory?(artifactPath)
|
58
|
+
logger.debug("Is directory: " + "#{isDirectory}")
|
59
|
+
if isDirectory
|
60
|
+
uploadDirectory(dropboxClient, artifactPath, dropboxPath)
|
61
|
+
else
|
62
|
+
artifactFile = File.open(artifactPath)
|
63
|
+
uploadFile(dropboxClient, artifactFile, dropboxPath)
|
64
|
+
end
|
65
|
+
logger.debug("Uploading complete")
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dropbox-deployment
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Carlson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dropbox_api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.5
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- jawnnypoo@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/dropbox-deployment.rb
|
35
|
+
homepage: https://github.com/Jawnnypoo/dropbox-deployment
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 2.6.11
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: Deploy your CI artifacts to Dropbox
|
59
|
+
test_files: []
|