Module: Postwave::BlogUtilities

Included in:
BlogBuilder, BlogCreator, Post, PostCreator
Defined in:
lib/postwave/blog_utilities.rb

Constant Summary collapse

CONFIG_FILE_NAME =
"postwave.yaml"
INDEX_FILE_NAME =
"index.csv"
SUMMARY_FILE_NAME =
"summary.yaml"
POSTS_DIR =
"_posts"
META_DIR =
"meta"
TAGS_DIR =
"tags"

Instance Method Summary collapse

Instance Method Details

#directory_pathsObject



23
24
25
26
27
28
29
# File 'lib/postwave/blog_utilities.rb', line 23

def directory_paths
  [
    File.join(Dir.pwd, POSTS_DIR),
    File.join(Dir.pwd, POSTS_DIR, META_DIR),
    File.join(Dir.pwd, POSTS_DIR, META_DIR, TAGS_DIR),
  ]
end

#file_pathsObject



15
16
17
18
19
20
21
# File 'lib/postwave/blog_utilities.rb', line 15

def file_paths
  [
    File.join(Dir.pwd, CONFIG_FILE_NAME),
    File.join(Dir.pwd, POSTS_DIR, META_DIR, INDEX_FILE_NAME),
    File.join(Dir.pwd, POSTS_DIR, META_DIR, SUMMARY_FILE_NAME),
  ]
end

#find_missing_pathsObject



31
32
33
34
35
36
37
38
# File 'lib/postwave/blog_utilities.rb', line 31

def find_missing_paths
  paths_to_check = directory_paths + file_paths
  missing_paths = []
  paths_to_check.each do |path|
    missing_paths << path if !FileTest.exists?(path)
  end
  missing_paths
end

#is_set_up?Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/postwave/blog_utilities.rb', line 10

def is_set_up?
  missing_paths = find_missing_paths
  missing_paths.empty?
end