octopress 3.0.0.rc.17 → 3.0.0.rc.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f479839dc1695278cc9852771af311ab70f6b1e2
4
- data.tar.gz: 061cf5d2b7860efdd16f9eb5370864afe67d9356
3
+ metadata.gz: e06beb1aacea443d9b080887b53f8b9b7a705a47
4
+ data.tar.gz: 236b3fbb3766813875bf93391bcfd62603a88430
5
5
  SHA512:
6
- metadata.gz: 6164d99a472f778e2fdcdcca93b8fb519bdc70cc340b9c65e09a73d36b4b19bcc825d110660da6be6e50695a8514381c9a8431ded5dad55199159120a3292194
7
- data.tar.gz: 5f0460bec58ca35bd67aa0f9e259a5f22ea70613acc7645bca58336db66b9f38412283140077b4c04953735ace781892c01ed2e42c0e7325b8bd35eb5ab5d944
6
+ metadata.gz: b6f281eb30ffe7a95d4226474f5dc34d0ac36f7d06210a31f2303f083f78921c9b5402ca567d2bbb785e1f3ef6cc7251053cacda7741850f0e34d2d4c4a833a6
7
+ data.tar.gz: 73ca967e81a63cc7ae0eea83c8a916269be385f6d8d8f57750df4df18df46623164df3220b72dedbdfac65bb7c7e6fb45d4a942c4d033007702bd6a5be4ed444
@@ -1,5 +1,9 @@
1
1
  # Octopress Changelog
2
2
 
3
+ ### 3.0.0 RC18 - 2014-12-08
4
+
5
+ - Loads site plugins before creating new pages, posts and drafts, allowing liquid tag processing in _template files.
6
+
3
7
  ### 3.0.0 RC17 - 2014-12-08
4
8
 
5
9
  - Added a configuration tip when adding a new collection page.
@@ -1,32 +1,22 @@
1
1
  module Octopress
2
2
  module CommandHelpers
3
- def self.add_build_options(c)
4
- c.option 'config', '--config <CONFIG_FILE>[,CONFIG_FILE2,...]', Array, 'Custom Jekyll configuration file'
5
- c.option 'octopress-config', '--octopress-config <CONFIG_FILE>', 'Custom Octopress configuration file'
6
- c.option 'future', '--future', 'Publishes posts with a future date'
7
- c.option 'limit_posts', '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
8
- c.option 'watch', '--watch', 'Watch for changes and rebuild'
9
- c.option 'list', '--lsi', 'Use LSI for improved related posts'
10
- c.option 'drafts','-D', '--drafts', 'Render posts in the _drafts folder'
11
- c.option 'verbose', '--verbose', 'Print verbose output.'
12
- end
13
-
14
- def self.normalize_options(options)
15
- if drafts_state = options.delete('drafts')
16
- options['show_drafts'] = drafts_state
17
- end
18
- options
19
- end
20
-
21
3
  def self.add_page_options(c)
22
4
  c.option 'template', '--template PATH', "New #{c.name.to_s} from a template."
23
- c.option 'date', '--date DATE', "Use 'now' or a String that is parseable by Time#parse."
24
- c.option 'force', '--force', 'Overwrite file if it already exists'
5
+ c.option 'date', '--date DATE', "Use 'now' or a String that is parseable by Time#parse."
6
+ c.option 'force', '--force', 'Overwrite file if it already exists'
25
7
  end
26
8
 
27
9
  def self.add_common_options(c)
28
- c.option 'config', '--config <CONFIG_FILE>[,CONFIG_FILE2,...]', Array, 'Custom Jekyll configuration file'
10
+ c.option 'config', '--config <CONFIG_FILE>[,CONFIG_FILE2,...]', Array, 'Custom Jekyll configuration file'
29
11
  c.option 'octopress-config', '--octopress-config <CONFIG_FILE>', 'Custom Octopress configuration file'
30
12
  end
13
+
14
+ def self.site(options)
15
+ options = {'config' => options['config']}
16
+ Jekyll.logger.log_level = :error
17
+ site = Jekyll::Site.new(Jekyll.configuration(options))
18
+ Jekyll.logger.log_level = :info
19
+ site
20
+ end
31
21
  end
32
22
  end
@@ -25,7 +25,7 @@ module Octopress
25
25
 
26
26
  c.action do |args, options|
27
27
  options['path'] = args.first
28
- Page.new(options).write
28
+ Page.new(CommandHelpers.site(options), options).write
29
29
  end
30
30
  end
31
31
 
@@ -39,7 +39,7 @@ module Octopress
39
39
 
40
40
  c.action do |args, options|
41
41
  options['title'] = args.first
42
- Post.new(options).write
42
+ Post.new(CommandHelpers.site(options), options).write
43
43
  end
44
44
  end
45
45
 
@@ -52,7 +52,7 @@ module Octopress
52
52
 
53
53
  c.action do |args, options|
54
54
  options['title'] = args.first
55
- Draft.new(options).write
55
+ Draft.new(CommandHelpers.site(options), options).write
56
56
  end
57
57
  end
58
58
  end
@@ -13,7 +13,7 @@ module Octopress
13
13
  abort "You must specify a path." if args.empty?
14
14
  options['path'] = args.first
15
15
  options['type'] = 'post from draft'
16
- Draft.new(options).publish
16
+ Draft.new(CommandHelpers.site(options), options).publish
17
17
  end
18
18
  end
19
19
  end
@@ -15,7 +15,7 @@ module Octopress
15
15
 
16
16
  def path
17
17
  name = "#{title_slug}.#{extension}"
18
- File.join(source, '_drafts', name)
18
+ File.join(site.source, '_drafts', name)
19
19
  end
20
20
 
21
21
  # -----
@@ -41,7 +41,7 @@ module Octopress
41
41
 
42
42
  # Create a new post file
43
43
  #
44
- Post.new(post_options).write
44
+ Post.new(site, post_options).write
45
45
 
46
46
  # Remove the old draft file
47
47
  #
@@ -1,8 +1,20 @@
1
1
  module Octopress
2
2
  class Page
3
3
 
4
- def initialize(options)
5
- @config = Octopress.config(options)
4
+ DEFAULT_OPTIONS = {
5
+ 'post_ext' => 'markdown',
6
+ 'page_ext' => 'html',
7
+ 'post_layout' => 'post',
8
+ 'page_layout' => 'page',
9
+ 'titlecase' => true
10
+ }
11
+
12
+ attr_accessor :site
13
+
14
+ def initialize(site, options)
15
+ @site = site
16
+ @site.plugin_manager.conscientious_require
17
+ @config = DEFAULT_OPTIONS.merge(site.config)
6
18
  @options = options
7
19
  set_default_options
8
20
 
@@ -31,7 +43,9 @@ module Octopress
31
43
 
32
44
  # If path begins with an underscore the page is probably being added to a collection
33
45
  #
34
- print_collection_tip($1) if dir =~ /#{source}\/_([^\/]+)/
46
+ if @options['type'] == 'page'
47
+ print_collection_tip($1) if dir =~ /#{site.source}\/_([^\/]+)/
48
+ end
35
49
  else
36
50
  puts path
37
51
  end
@@ -42,7 +56,7 @@ module Octopress
42
56
  def print_collection_tip(collection)
43
57
  # If Jekyll is not already configurated for this collection, print instructions
44
58
  #
45
- if !jekyll_config['collections'] || !jekyll_config['collections'][collection]
59
+ if !@config['collections'] || !@config['collections'][collection]
46
60
  msg = "\nTIP: To create a new '#{collection}' collection, add this to your Jekyll configuration\n"
47
61
  msg += "----------------\n"
48
62
  msg += "collections:\n #{collection}:\n output: true"
@@ -56,12 +70,8 @@ module Octopress
56
70
  path.sub(local, '')
57
71
  end
58
72
 
59
- def jekyll_config
60
- Configuration.jekyll_config(@options)
61
- end
62
-
63
- def source
64
- jekyll_config['source']
73
+ def site
74
+ @site
65
75
  end
66
76
 
67
77
  def path
@@ -77,7 +87,7 @@ module Octopress
77
87
  #
78
88
  file += ".#{extension}" unless file =~ /\.\w+$/
79
89
 
80
- @path = File.join(source, file)
90
+ @path = File.join(site.source, file)
81
91
  end
82
92
 
83
93
  def extension
@@ -118,7 +128,7 @@ module Octopress
118
128
 
119
129
  if file
120
130
  file.sub(/^_templates\//, '')
121
- file = File.join(source, '_templates', file) if file
131
+ file = File.join(site.source, '_templates', file) if file
122
132
  if File.exist? file
123
133
  parse_template File.open(file).read
124
134
  elsif @options['template']
@@ -181,6 +191,5 @@ module Octopress
181
191
  front_matter %w{layout title}
182
192
  end
183
193
  end
184
-
185
194
  end
186
195
  end
@@ -12,7 +12,7 @@ module Octopress
12
12
 
13
13
  def path
14
14
  name = "#{date_slug}-#{title_slug}.#{extension}"
15
- dir = File.join(source, '_posts', @options['dir'])
15
+ dir = File.join(site.source, '_posts', @options['dir'])
16
16
  FileUtils.mkdir_p dir
17
17
  File.join(dir, name)
18
18
  end
@@ -1,3 +1,3 @@
1
1
  module Octopress
2
- VERSION = "3.0.0.rc.17"
2
+ VERSION = "3.0.0.rc.18"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc.17
4
+ version: 3.0.0.rc.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-08 00:00:00.000000000 Z
12
+ date: 2014-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mercenary