dropbox-deployment 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53966b92c5af10d6d5c3033c13cee7a0120187ce
4
- data.tar.gz: dcf6ad8fea3fd0a4193a17c0edcce593be27df73
3
+ metadata.gz: 73b2fe55c7ac8b63490b72f9edad059392cce68d
4
+ data.tar.gz: 2c7c5fcc20519dceab71e883e5e23dd7864e87c4
5
5
  SHA512:
6
- metadata.gz: 11ac70d8088fb06506b2297b0645f0efd555c7236c4c0a1edfb32f2b95f3355eef702c813cb272e8e1f0fa6d0f20d9e56cb66e928c3703ce9fd70c72ef0e5f71
7
- data.tar.gz: c31f9b75e10e23cb79bf3801d6d42d9efa1b10ba9ddde9310fcad4b8bdb02fc382c66a96e96e4b583f7dd20b37eb0af27b717d8c4de177e3dad6b649f542b9b7
6
+ metadata.gz: 2747aaa4bd06a05afd1562dd3cfabfdf6e434766e6aa3594ba87903515bdb8f29d87d58f5643b19c92bc3c665727544b8d660d133d87e0e8922001fa3fdbabd8
7
+ data.tar.gz: 0df1c98307f984e82a4966250bfa1db7ae389a6dd6d5e6ee95107b80c1577c0578d78536eee56e3d550cb59fc6fe5e3d00c88f740c3a2824ba71d6ac7484c0fe
@@ -1,6 +1,6 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'dropbox-deployment'
4
-
5
- deployer = DropboxDeployment::Deployer.new
6
- deployer.deploy
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'dropbox-deployment'
4
+
5
+ deployer = DropboxDeployment::Deployer.new
6
+ deployer.deploy
@@ -1,78 +1,73 @@
1
- require 'dropbox_api'
2
- require 'yaml'
3
- require 'logger'
4
- require 'find'
5
-
6
- module DropboxDeployment
7
- class Deployer
8
-
9
- def initialize
10
- @@logger = Logger.new(STDOUT)
11
- @@logger.level = Logger::WARN
12
- end
13
-
14
- def uploadFile(dropboxClient, file, dropboxPath)
15
- fileName = File.basename(file)
16
- content = IO.read(file)
17
- dropboxClient.upload dropboxPath + "/" + fileName, content
18
- end
19
-
20
- def uploadDirectory(dropboxClient, directoryPath, dropboxPath)
21
- Find.find(directoryPath) do |file|
22
- # TODO need to have the path of the parent as part of the dropbox path
23
- # so that we keep the hierarchy we want
24
- if !File.directory?(file)
25
- uploadFile(dropboxClient, file, dropboxPath)
26
- end
27
- end
28
- end
29
-
30
- def deploy()
31
- # Validation
32
- if !File.file?("dropbox-deployment.yml")
33
- puts "\nNo config file found. You need a file called `dropbox-deployment.yml` with the configuration. See the README for details\n\n"
34
- exit(1)
35
- end
36
- config = YAML.load_file("dropbox-deployment.yml")
37
- testing = false
38
- if !config.has_key?("deploy")
39
- puts "\nError in config file! Build file must contain a `deploy` object.\n\n"
40
- exit(1)
41
- end
42
- artifactPath = config["deploy"]["artifacts_path"]
43
- dropboxPath = config["deploy"]["dropbox_path"]
44
-
45
- # Just for testing, load the local oauth token from the file
46
- if File.file?("testconfig")
47
- oauth = IO.read "testconfig"
48
- ENV["DROPBOX_OAUTH_BEARER"] = oauth
49
- testing = true
50
- end
51
-
52
- if ENV["DROPBOX_OAUTH_BEARER"].nil?
53
- puts "\nYou must have an environment variable of `DROPBOX_OAUTH_BEARER` in order to deploy to Dropbox\n\n"
54
- exit(1)
55
- end
56
-
57
- if config["deploy"]["debug"]
58
- @@logger.level = Logger::DEBUG
59
- @@logger.debug("We are in debug mode")
60
- end
61
-
62
- dropboxClient = DropboxApi::Client.new
63
-
64
- # Upload all files
65
- @@logger.debug("Artifact Path: " + artifactPath)
66
- @@logger.debug("Dropbox Path: " + dropboxPath)
67
- isDirectory = File.directory?(artifactPath)
68
- @@logger.debug("Is directory: " + "#{isDirectory}")
69
- if isDirectory
70
- uploadDirectory(dropboxClient, artifactPath, dropboxPath)
71
- else
72
- artifactFile = File.open(artifactPath)
73
- uploadFile(dropboxClient, artifactFile, dropboxPath)
74
- end
75
- @@logger.debug("Uploading complete")
76
- end
77
- end
78
- end
1
+ require 'dropbox_api'
2
+ require 'yaml'
3
+ require 'logger'
4
+ require 'find'
5
+ require 'dotenv'
6
+ Dotenv.load
7
+
8
+ module DropboxDeployment
9
+ class Deployer
10
+
11
+ def initialize
12
+ @@logger = Logger.new(STDOUT)
13
+ @@logger.level = Logger::WARN
14
+ end
15
+
16
+ def uploadFile(dropboxClient, file, dropboxPath)
17
+ fileName = File.basename(file)
18
+ content = IO.read(file)
19
+ dropboxClient.upload dropboxPath + "/" + fileName, content, :mode => :overwrite
20
+ end
21
+
22
+ def uploadDirectory(dropboxClient, directoryPath, dropboxPath)
23
+ Find.find(directoryPath) do |file|
24
+ # TODO need to have the path of the parent as part of the dropbox path
25
+ # so that we keep the hierarchy we want
26
+ if !File.directory?(file)
27
+ uploadFile(dropboxClient, file, dropboxPath)
28
+ end
29
+ end
30
+ end
31
+
32
+ def deploy()
33
+ # Validation
34
+ if !File.file?("dropbox-deployment.yml")
35
+ puts "\nNo config file found. You need a file called `dropbox-deployment.yml` with the configuration. See the README for details\n\n"
36
+ exit(1)
37
+ end
38
+ config = YAML.load_file("dropbox-deployment.yml")
39
+ testing = false
40
+ if !config.has_key?("deploy")
41
+ puts "\nError in config file! Build file must contain a `deploy` object.\n\n"
42
+ exit(1)
43
+ end
44
+ artifactPath = config["deploy"]["artifacts_path"]
45
+ dropboxPath = config["deploy"]["dropbox_path"]
46
+
47
+ if ENV["DROPBOX_OAUTH_BEARER"].nil?
48
+ puts "\nYou must have an environment variable of `DROPBOX_OAUTH_BEARER` in order to deploy to Dropbox\n\n"
49
+ exit(1)
50
+ end
51
+
52
+ if config["deploy"]["debug"]
53
+ @@logger.level = Logger::DEBUG
54
+ @@logger.debug("We are in debug mode")
55
+ end
56
+
57
+ dropboxClient = DropboxApi::Client.new
58
+
59
+ # Upload all files
60
+ @@logger.debug("Artifact Path: " + artifactPath)
61
+ @@logger.debug("Dropbox Path: " + dropboxPath)
62
+ isDirectory = File.directory?(artifactPath)
63
+ @@logger.debug("Is directory: " + "#{isDirectory}")
64
+ if isDirectory
65
+ uploadDirectory(dropboxClient, artifactPath, dropboxPath)
66
+ else
67
+ artifactFile = File.open(artifactPath)
68
+ uploadFile(dropboxClient, artifactFile, dropboxPath)
69
+ end
70
+ @@logger.debug("Uploading complete")
71
+ end
72
+ end
73
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropbox-deployment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Carlson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-20 00:00:00.000000000 Z
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dropbox_api
@@ -24,6 +24,26 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.1.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: dotenv
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.2'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 2.2.0
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.2'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.2.0
27
47
  description:
28
48
  email:
29
49
  - jawnnypoo@gmail.com
@@ -42,11 +62,12 @@ post_install_message:
42
62
  rdoc_options: []
43
63
  require_paths:
44
64
  - lib
65
+ - lib
45
66
  required_ruby_version: !ruby/object:Gem::Requirement
46
67
  requirements:
47
68
  - - ">="
48
69
  - !ruby/object:Gem::Version
49
- version: '0'
70
+ version: 2.0.0
50
71
  required_rubygems_version: !ruby/object:Gem::Requirement
51
72
  requirements:
52
73
  - - ">="
@@ -54,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
75
  version: '0'
55
76
  requirements: []
56
77
  rubyforge_project:
57
- rubygems_version: 2.6.11
78
+ rubygems_version: 2.6.8
58
79
  signing_key:
59
80
  specification_version: 4
60
81
  summary: Deploy your CI artifacts to Dropbox