pave 0.14.2 → 0.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d60f70f1adf00c1beb42f8dc21af9bc5ddd3b79c
4
- data.tar.gz: f2d481a72dd18d023e4e58543c8661c2b1a93441
3
+ metadata.gz: 4ff4bfda4339f7822940b422dceacff496933bae
4
+ data.tar.gz: a33593d9f7d0f64036223e79a303f077786e0d35
5
5
  SHA512:
6
- metadata.gz: ee88e9997af98597f67ede70617a9e016032ce5f1b31039631da37009c0caef425794ab1341a830cf6dd3724f34221fdf054f7ff0197ae694704989e9ea61ec0
7
- data.tar.gz: 375fcde0a4ab513c7e09fdff2c4bde5c465c434cbaf369214a6272e5553391eb293fb0a2bf06d14a7d74ac547e905a49c57a4af46d7fcd116170a39a242c4085
6
+ metadata.gz: 726112c791f2752da003130870ef703c6d93d3ad6e950650636f758d176676fb65ab6a7a921784b41d2b774844c9df7d0d1975400a51ace5d85fb5b957f8ee9b
7
+ data.tar.gz: 4ad862c750b2477af78ff2fe28a62d0dbeb6d96ceb5d302d9a9286bf21eef627e823e59cd2a15b8e57067d4aa5a1d6bb2915493d3d174477a3055038f562c551
data/bin/pave CHANGED
@@ -225,20 +225,24 @@ end
225
225
  alias_command :"cache:clear", :"files:cache:clear"
226
226
 
227
227
  command :"files:pull" do |c|
228
- c.syntax = "pave files:pull"
228
+ c.syntax = "pave files:pull [options]"
229
229
  c.description = "Download the project's live files directory."
230
- c.action do |args|
230
+ c.option '-m', '--method METHOD', String, 'Specify a method: zip or rsync'
231
+ c.action do |args, options|
232
+ method = options.method || "zip"
231
233
  remote = args.first || "live"
232
- Pave::Files.pull(remote)
234
+ Pave::Files.pull(remote, method)
233
235
  end
234
236
  end
235
237
 
236
238
  command :"files:push" do |c|
237
- c.syntax = "pave files:push"
239
+ c.syntax = "pave files:push [options]"
238
240
  c.description = "Upload the project's local files directory."
239
- c.action do |args|
241
+ c.option '-m', '--method METHOD', String, 'Specify a method: zip or rsync'
242
+ c.action do |args, options|
243
+ method = options.method || "zip"
240
244
  remote = args.first || "live"
241
- Pave::Files.push(remote)
245
+ Pave::Files.push(remote, method)
242
246
  end
243
247
  end
244
248
 
@@ -11,25 +11,85 @@ module Pave
11
11
  end
12
12
 
13
13
  def self.clear_cache
14
- sh "rm -rf ./files/tmp/*; rm -rf ./files/cache/*;"
14
+ say "Clearing Cache"
15
+ sh "sudo rm -rf ./files/tmp; sudo rm -rf ./files/cache;"
15
16
  end
16
17
 
17
- def self.push(remote="live")
18
+ def self.push(remote="live", method="zip")
18
19
  server = Pave::Remote.server(remote)
19
20
  directory = Pave::Remote.directory(remote)
20
- sh "rsync #{flags} #{exclusions} ./files/* #{server}:#{directory}/files/*"
21
+ clear_cache
22
+ if method == "rsync"
23
+ sh "rsync #{flags} #{exclusions} ./files/* #{server}:#{directory}/files/*"
24
+ else
25
+ zip_files('local')
26
+ say "Pushing zip to remote server"
27
+ sh "scp ./tmp_files_zip_local.zip #{remote_url}"
28
+ if backup_files('remote', remote)
29
+ if unzip_files('remote', remote)
30
+ remove_zipped_files
31
+ end
32
+ end
33
+ say "Done"
34
+ end
21
35
  end
22
36
 
23
- def self.pull(remote="live")
37
+ def self.pull(remote="live", method="zip")
24
38
  server = Pave::Remote.server(remote)
25
39
  directory = Pave::Remote.directory(remote)
26
- sh "rsync #{flags} #{exclusions} #{server}:#{directory}/files/* ./files/*"
27
40
  clear_cache
41
+ if method == "rsync"
42
+ sh "rsync #{flags} #{exclusions} #{server}:#{directory}/files/* ./files/*"
43
+ else
44
+ if backup_files('local')
45
+ if backup_files('remote', remote)
46
+ say "Downloading zip from remote server"
47
+ sh "scp #{remote_url}/tmp_files_zip_remote.zip ./"
48
+ if unzip_files('local')
49
+ remove_zipped_files
50
+ end
51
+ end
52
+ end
53
+ end
28
54
  end
29
55
 
30
56
  def self.sync(remote="live")
31
57
  pull(remote)
32
58
  push(remote)
33
59
  end
60
+
61
+ def self.zip_files(location="local")
62
+ say "Zipping local files"
63
+ sh "zip -9 -r tmp_files_zip_#{location}.zip ./files"
64
+ end
65
+
66
+ def self.backup_files(location="local", remote)
67
+ if location == "local"
68
+ zip_files('local')
69
+ else
70
+ server = Pave::Remote.server(remote)
71
+ directory = Pave::Remote.directory(remote)
72
+ sh "ssh #{server} \"cd #{directory}; zip -9 -r tmp_files_zip_remote.zip ./files\""
73
+ end
74
+ end
75
+
76
+ def self.unzip_files(location="local", remote)
77
+ if location == "local"
78
+ sh "rm -rf ./files; unzip tmp_files_zip_remote.zip"
79
+ else
80
+ server = Pave::Remote.server(remote)
81
+ directory = Pave::Remote.directory(remote)
82
+ sh "ssh #{server} \"cd #{directory}; rm -rf files/; unzip tmp_files_zip_local.zip\""
83
+ end
84
+ end
85
+
86
+ def self.remove_zipped_files
87
+ say "Cleaning up"
88
+ sh "rm -rf tmp_files_zip_local.zip; rm -rf tmp_files_zip_remote.zip"
89
+ end
90
+
91
+ def self.remote_url(remote="live")
92
+ "#{Pave::Remote.server(remote)}:#{Pave::Remote.directory(remote)}"
93
+ end
34
94
  end
35
95
  end
@@ -1,3 +1,3 @@
1
1
  module Pave
2
- VERSION = "0.14.2"
2
+ VERSION = "0.15.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamon Holmgren
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-24 00:00:00.000000000 Z
12
+ date: 2014-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler