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 +4 -4
- data/bin/pave +10 -6
- data/lib/pave/files.rb +65 -5
- data/lib/pave/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ff4bfda4339f7822940b422dceacff496933bae
|
4
|
+
data.tar.gz: a33593d9f7d0f64036223e79a303f077786e0d35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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
|
|
data/lib/pave/files.rb
CHANGED
@@ -11,25 +11,85 @@ module Pave
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.clear_cache
|
14
|
-
|
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
|
-
|
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
|
data/lib/pave/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|