Skip to content

Commit 358af5b

Browse files
cdce8pballoob
authored andcommitted
Expanded rake isolate to cover components (home-assistant#5349)
1 parent 0a23a4b commit 358af5b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Rakefile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ deploy_branch = "master"
1616

1717
## -- Misc Configs -- ##
1818

19-
public_dir = "public/" # compiled site directory
19+
public_dir = "public/" # compiled site directory
2020
source_dir = "source" # source file directory
2121
blog_index_dir = 'source/blog' # directory for your blog's index page (if you put your index in source/blog/index.html, set this to 'source/blog')
2222
deploy_dir = "_deploy" # deploy directory (for Github pages deployment)
2323
stash_dir = "_stash" # directory to stash posts for speedy generation
24+
components_dir = "_components" # directory for component files
2425
posts_dir = "_posts" # directory for blog files
2526
themes_dir = ".themes" # directory for blog files
2627
new_post_ext = "markdown" # default new post file extension when using the new_post task
@@ -169,18 +170,26 @@ task :new_page, :filename do |t, args|
169170
end
170171

171172
# usage rake isolate[my-post]
172-
desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much more quickly."
173+
desc "Move all other components and posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much more quickly."
173174
task :isolate, :filename do |t, args|
174175
stash_dir = "#{source_dir}/#{stash_dir}"
176+
s_posts_dir = "#{stash_dir}/#{posts_dir}"
177+
s_components_dir = "#{stash_dir}/#{components_dir}"
175178
FileUtils.mkdir(stash_dir) unless File.exist?(stash_dir)
179+
FileUtils.mkdir(s_posts_dir) unless File.exist?(s_posts_dir)
180+
FileUtils.mkdir(s_components_dir) unless File.exist?(s_components_dir)
176181
Dir.glob("#{source_dir}/#{posts_dir}/*.*") do |post|
177-
FileUtils.mv post, stash_dir unless post.include?(args.filename)
182+
FileUtils.mv post, s_posts_dir unless post.include?(args.filename)
183+
end
184+
Dir.glob("#{source_dir}/#{components_dir}/*.*") do |component|
185+
FileUtils.mv component, s_components_dir unless component.include?(args.filename)
178186
end
179187
end
180188

181189
desc "Move all stashed posts back into the posts directory, ready for site generation."
182190
task :integrate do
183-
FileUtils.mv Dir.glob("#{source_dir}/#{stash_dir}/*.*"), "#{source_dir}/#{posts_dir}/"
191+
FileUtils.mv Dir.glob("#{source_dir}/#{stash_dir}/#{posts_dir}/*.*"), "#{source_dir}/#{posts_dir}/"
192+
FileUtils.mv Dir.glob("#{source_dir}/#{stash_dir}/#{components_dir}/*.*"), "#{source_dir}/#{components_dir}/"
184193
end
185194

186195
desc "Clean out caches: .pygments-cache, .gist-cache, .sass-cache"

0 commit comments

Comments
 (0)