dropbox-deployment 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dropbox-deployment.rb +11 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53966b92c5af10d6d5c3033c13cee7a0120187ce
|
4
|
+
data.tar.gz: dcf6ad8fea3fd0a4193a17c0edcce593be27df73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11ac70d8088fb06506b2297b0645f0efd555c7236c4c0a1edfb32f2b95f3355eef702c813cb272e8e1f0fa6d0f20d9e56cb66e928c3703ce9fd70c72ef0e5f71
|
7
|
+
data.tar.gz: c31f9b75e10e23cb79bf3801d6d42d9efa1b10ba9ddde9310fcad4b8bdb02fc382c66a96e96e4b583f7dd20b37eb0af27b717d8c4de177e3dad6b649f542b9b7
|
data/lib/dropbox-deployment.rb
CHANGED
@@ -6,8 +6,10 @@ require 'find'
|
|
6
6
|
module DropboxDeployment
|
7
7
|
class Deployer
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
def initialize
|
10
|
+
@@logger = Logger.new(STDOUT)
|
11
|
+
@@logger.level = Logger::WARN
|
12
|
+
end
|
11
13
|
|
12
14
|
def uploadFile(dropboxClient, file, dropboxPath)
|
13
15
|
fileName = File.basename(file)
|
@@ -33,7 +35,7 @@ module DropboxDeployment
|
|
33
35
|
end
|
34
36
|
config = YAML.load_file("dropbox-deployment.yml")
|
35
37
|
testing = false
|
36
|
-
if !config
|
38
|
+
if !config.has_key?("deploy")
|
37
39
|
puts "\nError in config file! Build file must contain a `deploy` object.\n\n"
|
38
40
|
exit(1)
|
39
41
|
end
|
@@ -53,24 +55,24 @@ module DropboxDeployment
|
|
53
55
|
end
|
54
56
|
|
55
57
|
if config["deploy"]["debug"]
|
56
|
-
logger.level = Logger::DEBUG
|
57
|
-
logger.debug("We are in debug mode")
|
58
|
+
@@logger.level = Logger::DEBUG
|
59
|
+
@@logger.debug("We are in debug mode")
|
58
60
|
end
|
59
61
|
|
60
62
|
dropboxClient = DropboxApi::Client.new
|
61
63
|
|
62
64
|
# Upload all files
|
63
|
-
logger.debug("Artifact Path: " + artifactPath)
|
64
|
-
logger.debug("Dropbox Path: " + dropboxPath)
|
65
|
+
@@logger.debug("Artifact Path: " + artifactPath)
|
66
|
+
@@logger.debug("Dropbox Path: " + dropboxPath)
|
65
67
|
isDirectory = File.directory?(artifactPath)
|
66
|
-
logger.debug("Is directory: " + "#{isDirectory}")
|
68
|
+
@@logger.debug("Is directory: " + "#{isDirectory}")
|
67
69
|
if isDirectory
|
68
70
|
uploadDirectory(dropboxClient, artifactPath, dropboxPath)
|
69
71
|
else
|
70
72
|
artifactFile = File.open(artifactPath)
|
71
73
|
uploadFile(dropboxClient, artifactFile, dropboxPath)
|
72
74
|
end
|
73
|
-
logger.debug("Uploading complete")
|
75
|
+
@@logger.debug("Uploading complete")
|
74
76
|
end
|
75
77
|
end
|
76
78
|
end
|