ghpages_deploy 1.3.0.pre.beta9 → 1.3.0.pre.beta10
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/lib/ghpages_deploy/rake/json.rb +27 -18
- data/lib/ghpages_deploy/version.rb +1 -1
- 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: 76b62663928a7492bfead7d860086c0e94a539fd
|
4
|
+
data.tar.gz: 235a81fe5fa0511a8f4e6c84ca58112824eb4169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 911d1e3e13a38c23cae3c35a58522e4f3c93064c241a79180c318ddb22704095480b62e040e0e3bbc9bdef2aa3e2f16dc8ef510bd952582ece7570cd220cc515
|
7
|
+
data.tar.gz: 9e5b37e9c640ab1a750ce75e122d2410937fa1411718f4ddd5d2edcb7f1be881cd4503d059d3bbd581aa009a2dd9306a1d92974b726779892c8bbaa204ddd3ee
|
@@ -26,34 +26,43 @@ module GithubPages
|
|
26
26
|
# ...
|
27
27
|
#
|
28
28
|
|
29
|
-
|
29
|
+
# if update_sitemap is being called, excluded directories should be relative to './'
|
30
|
+
|
31
|
+
def self.update_sitemap(excluded)
|
32
|
+
mapping = directory_sitemap('.', excluded).last
|
33
|
+
|
30
34
|
File.open('sitemap.json', 'w+') do |file|
|
31
|
-
file.write
|
35
|
+
file.write mapping.to_json
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
35
|
-
def self.directory_sitemap(dir)
|
36
|
-
|
37
|
-
|
38
|
-
File.
|
39
|
-
|
39
|
+
def self.directory_sitemap(dir, excluded)
|
40
|
+
mapping =
|
41
|
+
Dir.foreach(dir).flat_map do |file|
|
42
|
+
file_dir = File.join(dir, file)
|
43
|
+
next [] if excluded.include?(file_dir)
|
44
|
+
next [] if %w(.git . ..).include?(file)
|
45
|
+
next [] unless Dir.exist?(file_dir)
|
40
46
|
|
41
|
-
|
47
|
+
index =
|
48
|
+
%w(index.html _index.html).find do |html|
|
49
|
+
File.exist?(File.join(file_dir, html))
|
50
|
+
end
|
42
51
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
52
|
+
next [File.basename(file_dir), index] if index
|
53
|
+
|
54
|
+
map = directory_sitemap(file_dir, excluded)
|
55
|
+
next [] if !map || map.empty?
|
56
|
+
map
|
57
|
+
end
|
47
58
|
|
48
|
-
|
49
|
-
|
50
|
-
[file, map]
|
51
|
-
end]
|
59
|
+
return nil if mapping.empty?
|
60
|
+
[File.basename(dir), Hash[*mapping]]
|
52
61
|
end
|
53
62
|
|
54
|
-
def json_sitemap
|
63
|
+
def json_sitemap(excluded = [])
|
55
64
|
handler.handle_deploy do
|
56
|
-
JsonRakeExt.update_sitemap
|
65
|
+
JsonRakeExt.update_sitemap(excluded)
|
57
66
|
['sitemap.json']
|
58
67
|
end
|
59
68
|
end
|