jeremylightsmith-actionsite 0.6 → 0.6.1
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.
- data/lib/action_site.rb +1 -1
- data/lib/action_site/site.rb +17 -12
- metadata +1 -1
data/lib/action_site.rb
CHANGED
data/lib/action_site/site.rb
CHANGED
@@ -38,12 +38,9 @@ module ActionSite
|
|
38
38
|
@generators ||= DEFAULT_GENERATORS.dup
|
39
39
|
end
|
40
40
|
|
41
|
-
def generate
|
42
|
-
Dir.
|
43
|
-
|
44
|
-
refresh_page path
|
45
|
-
end
|
46
|
-
end
|
41
|
+
def generate
|
42
|
+
Dir[@in_dir + "/**/*"].map {|path| path.sub(@in_dir, '') }.
|
43
|
+
each {|path| refresh_page(path) }
|
47
44
|
end
|
48
45
|
|
49
46
|
def refresh_page(path)
|
@@ -58,19 +55,18 @@ module ActionSite
|
|
58
55
|
# nothing
|
59
56
|
|
60
57
|
elsif File.symlink?(in_file)
|
61
|
-
|
58
|
+
ensure_directory_exists(out_file)
|
62
59
|
cp in_file, out_file rescue nil # maybe the links don't exist here
|
63
60
|
|
64
61
|
elsif File.directory?(in_file)
|
65
|
-
|
66
|
-
generate in_file, out_file
|
62
|
+
ensure_directory_exists(out_file)
|
67
63
|
|
68
64
|
elsif resource?(in_file)
|
69
|
-
|
65
|
+
ensure_directory_exists(out_file)
|
70
66
|
ln_sf File.expand_path(in_file), File.expand_path(out_file)
|
71
67
|
|
72
68
|
else
|
73
|
-
|
69
|
+
ensure_directory_exists(out_file)
|
74
70
|
out_file = out_file.gsub(/\..+$/, '.html')
|
75
71
|
generate_page(in_file, out_file)
|
76
72
|
puts " #{in_file} => #{out_file}"
|
@@ -78,7 +74,11 @@ module ActionSite
|
|
78
74
|
end
|
79
75
|
|
80
76
|
def excluded?(file)
|
81
|
-
File.directory?(file)
|
77
|
+
if File.directory?(file)
|
78
|
+
EXCLUDED_DIRECTORIES.include?(File.basename(file))
|
79
|
+
elsif File.file?(file)
|
80
|
+
EXCLUDED_DIRECTORIES.include?(File.basename(File.dirname(file)))
|
81
|
+
end
|
82
82
|
end
|
83
83
|
|
84
84
|
def resource?(file)
|
@@ -110,6 +110,11 @@ module ActionSite
|
|
110
110
|
|
111
111
|
private
|
112
112
|
|
113
|
+
def ensure_directory_exists(file)
|
114
|
+
dir = File.dirname(file)
|
115
|
+
mkdir_p(dir) unless File.directory?(dir)
|
116
|
+
end
|
117
|
+
|
113
118
|
def generate_page(in_file, out_file)
|
114
119
|
File.open(out_file, "w") do |f|
|
115
120
|
f << @generator.process_file(in_file)
|