dsm-portfolio-plugin 0.0.23 → 0.1.0
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/dsm-portfolio-plugin.rb +14 -10
- 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: 4ebff37fe1013c2e503587f6c6d3187d6240ddcf
|
4
|
+
data.tar.gz: aa39ab0051a8bee4225e4f50ab974499b00d680c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab41647481ac871085868dc17795fe9ed65fb95a6918f3ff8b2e8178eb86267fcf720a3e078d6693b0955e1adf852905c28495b50fed0711ef6fe5c123f0b0ac
|
7
|
+
data.tar.gz: b0a27f295cdf1817ec26d676c2e07f1b6c20792b91cf9f10c06773bebc4b5507809093ecdc2b2688934520d79d4425e88675945902fe4fe036aa5bd40d168e07
|
data/lib/dsm-portfolio-plugin.rb
CHANGED
@@ -32,12 +32,14 @@ module Jekyll
|
|
32
32
|
name = title.gsub(' ', '-').downcase
|
33
33
|
|
34
34
|
# Fill task from data file.
|
35
|
-
post_types_data_file = "post-types"
|
35
|
+
post_types_data_file = "project-post-types"
|
36
36
|
|
37
37
|
# Initialise the site object from configuration (to access data files)
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
config_options = configuration_from_options({})
|
39
|
+
site = Jekyll::Site.new(config_options)
|
40
|
+
site.read
|
41
|
+
|
42
|
+
post_types = site.site_data[post_types_data_file]
|
41
43
|
|
42
44
|
if post_types.size > 0
|
43
45
|
# Make subdirectory.
|
@@ -49,15 +51,17 @@ module Jekyll
|
|
49
51
|
# For every post-type in subfolder...
|
50
52
|
post_types.each do |post_type|
|
51
53
|
# Format file path.
|
52
|
-
post_path = file_name(name, post_type
|
53
|
-
|
54
|
+
post_path = file_name(name, post_type['post_type'], ext, date)
|
55
|
+
|
54
56
|
raise ArgumentError.new("A post already exists at ./#{post_path}") if File.exist?(post_path) and !options["force"]
|
55
57
|
|
56
58
|
# Create file.
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
IO.copy_stream("_layouts/examples/#{post_type['template_file']}", post_path)
|
60
|
+
|
61
|
+
# File.open(post_path, "w") do |f|
|
62
|
+
# # Fill it with appropriate front-matter.
|
63
|
+
# f.puts(front_matter(post_type[:post_type], title))
|
64
|
+
# end
|
61
65
|
end
|
62
66
|
|
63
67
|
puts "New posts created at ./_posts/#{date.strftime('%Y-%m-%d')}-#{name}.\n"
|