ghp 0.0.5 → 0.0.7

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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/bin/ghp +26 -6
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.7
data/bin/ghp CHANGED
@@ -35,18 +35,38 @@ end
35
35
 
36
36
  module Nanoc::DataSources
37
37
  module Filesystem
38
+ def get_ghp_config
39
+ Dir.chdir(File.expand_path('../..', __FILE__).strip) {
40
+ Nanoc::Site.new('.').config
41
+ }
42
+ end
43
+
44
+ def pathfind_file(in_dir = ".")
45
+ (["./lib"] + $:).collect {|x| File.join(File.expand_path("..", x), in_dir) }.select {|x| File.directory? x }.each do |found_dir|
46
+ yield found_dir
47
+ end
48
+ end
49
+
38
50
  def items
39
- ghp_config = Nanoc::Site.new('.').config
51
+ ghp_config = get_ghp_config
40
52
  alt_content = ghp_config[:alt_content] || "content"
41
- alt_dir = (["./lib"] + $:).collect {|x| File.join(File.expand_path("..", x), alt_content) }.select {|x| File.directory? x }[0]
42
- load_objects(alt_dir, 'item', Nanoc::Item)
53
+
54
+ acc = [ ]
55
+ pathfind_file(alt_content) do |alt_dir|
56
+ acc += load_objects(alt_dir, 'item', Nanoc::Item)
57
+ end
58
+ acc
43
59
  end
44
60
 
45
61
  def layouts
46
- ghp_config = Nanoc::Site.new('.').config
62
+ ghp_config = get_ghp_config
47
63
  alt_layouts = ghp_config[:alt_layouts] || "layouts"
48
- alt_dir = (["./lib"] + $:).collect {|x| File.join(File.expand_path("..", x), alt_layouts) }.select {|x| File.directory? x }[0]
49
- load_objects(alt_dir, 'layout', Nanoc::Layout)
64
+
65
+ acc = []
66
+ pathfind_file(alt_layouts) do |alt_dir|
67
+ acc += load_objects(alt_dir, 'layout', Nanoc::Layout)
68
+ end
69
+ acc
50
70
  end
51
71
  end
52
72
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Nghiem