octopress 3.0.0.alpha7 → 3.0.0.alpha8

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: 1652fdb31e927325dd2d90571f8dab99be6dfe7d
4
- data.tar.gz: a214422e3a4c98cd014c57cc91bc036b93778a23
3
+ metadata.gz: 4f9b1847085d24d5bdfcfc8c587c68d416bd9d95
4
+ data.tar.gz: f4dde30b1c537623df72a4d3bca0f99f308292e0
5
5
  SHA512:
6
- metadata.gz: b699385d7fc6d6473c78ce88e8f0c759994eb32e6f8fe130cdfd25fcaa518b43b3e4543b86e34e4ae6a8522c361a4af89abcd01145b2eceaac2c7ca195af0568
7
- data.tar.gz: 35219bf6f8ebbddfeaf2ce04906ed20c1978c698bf979f768959cab9a49a987772a31ee9fb4d3db87d3dafb1deb06a47445bc5eeb32d80ae08a4c1ba115e8cf1
6
+ metadata.gz: 439892300f2b23d9c19547ab05dbd409388db470f78069d2ae53339fea3079f1b0db1f3086a66adc304e4ed86dc45554d6f74b5987c58d5ac4966ec6c07a78e3
7
+ data.tar.gz: 67f5ca769098c7f138dc24791a8b36c50dc837591095e772bb9fb4570997c03a797649b2f119be9a384b83eb599ba33bcb324b2d7f3ad7600058af418d53e49c
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ _site
@@ -0,0 +1 @@
1
+ docs_mode: true
data/docs/index.html ADDED
@@ -0,0 +1 @@
1
+ OMG DOCS
data/lib/octopress.rb CHANGED
@@ -28,7 +28,7 @@ module Octopress
28
28
  end
29
29
 
30
30
  def self.config(options={})
31
- Configuration.config(options)
31
+ @config ||= Configuration.config(options)
32
32
  end
33
33
 
34
34
  def self.require_blessed_gems
@@ -40,3 +40,4 @@ module Octopress
40
40
  end
41
41
  end
42
42
  end
43
+
@@ -10,6 +10,7 @@ module Octopress
10
10
  CommandHelpers.add_build_options(c)
11
11
 
12
12
  c.action do |args, options|
13
+ Octopress.config(options)
13
14
  options = CommandHelpers.normalize_options(options)
14
15
  options = ::Jekyll.configuration(options.to_symbol_keys)
15
16
  ::Jekyll::Commands::Build.process(options)
@@ -1,4 +1,5 @@
1
1
  require 'jekyll'
2
+ require 'yaml'
2
3
  require File.expand_path('helpers', File.dirname(__FILE__))
3
4
 
4
5
  module Octopress
@@ -6,35 +7,66 @@ module Octopress
6
7
  def self.init_with_program(p)
7
8
  p.command(:docs) do |c|
8
9
  c.syntax 'octopress docs'
9
- c.description "Soon: Launch local server with docs for Octopress v#{Octopress::VERSION}"
10
+ c.description "Launch local server with docs for Octopress v#{Octopress::VERSION} and Octopress Ink plugins."
10
11
 
11
12
  c.option 'port', '-P', '--port [PORT]', 'Port to listen on'
12
13
  c.option 'host', '-H', '--host [HOST]', 'Host to bind to'
14
+ if ENV['OCTODEV']
15
+ c.option 'watch', '--watch', 'Watch docs site for changes and rebuild. (For docs development)'
16
+ end
13
17
  c.option 'jekyll', '--jekyll', "Launch local server with docs for Jekyll v#{Jekyll::VERSION}"
14
18
 
15
19
  c.action do |args, options|
16
-
17
- # Only show jekyll docs if the jekyll flag was used
18
- #
19
- if options['jekyll']
20
- options.delete('jekyll')
21
-
22
- # Find local Jekyll gem path
23
- #
24
- spec = Gem::Specification.find_by_name("jekyll")
25
- gem_path = spec.gem_dir
26
-
27
- options = CommandHelpers.normalize_options(options)
28
- options = ::Jekyll.configuration(options.to_symbol_keys.merge!({
29
- 'source' => "#{gem_path}/site",
30
- 'destination' => "#{gem_path}/site/_site"
31
- }))
32
-
33
- ::Jekyll::Commands::Build.process(options)
34
- ::Jekyll::Commands::Serve.process(options)
35
- else
36
- puts "Sorry, not yet. View Octopress docs on http://octopress.org or view Jekyll docs locally by running `octopress docs --jekyll`"
37
- end
20
+ serve_docs(options)
21
+ end
22
+ end
23
+ end
24
+
25
+ def self.serve_docs(options)
26
+ if options['jekyll']
27
+ options = init_jekyll_docs(options)
28
+ else
29
+ options = init_octopress_docs(options)
30
+ end
31
+ options["serving"] = true
32
+ options = CommandHelpers.normalize_options(options)
33
+ options = ::Jekyll.configuration(options.to_symbol_keys)
34
+ ::Jekyll::Commands::Build.process(options)
35
+ ::Jekyll::Commands::Serve.process(options)
36
+ end
37
+
38
+ def self.init_octopress_docs(options)
39
+ Octopress.config({'octopress-config'=>File.join(site_dir, '_octopress.yml')})
40
+ require_gems
41
+ options['source'] = site_dir
42
+ options['destination'] = File.join(site_dir, '_site')
43
+ options
44
+ end
45
+
46
+ def self.init_jekyll_docs(options)
47
+ options.delete('jekyll')
48
+
49
+ # Find local Jekyll gem path
50
+ #
51
+ spec = Gem::Specification.find_by_name("jekyll")
52
+ gem_path = spec.gem_dir
53
+
54
+ options['source'] = "#{gem_path}/site",
55
+ options['destination'] = "#{gem_path}/site/_site"
56
+ options
57
+ end
58
+
59
+ def self.site_dir
60
+ File.expand_path('docs', File.join(File.dirname(__FILE__), '../../../', ))
61
+ end
62
+
63
+ def self.require_gems
64
+ file = File.join(Dir.pwd, '_config.yml')
65
+ if File.exist? file
66
+ config = YAML.safe_load(File.open(file))
67
+ gems = config['gems']
68
+ if gems && gems.is_a?(Array)
69
+ gems.each {|g| require g }
38
70
  end
39
71
  end
40
72
  end
@@ -1,7 +1,8 @@
1
1
  module Octopress
2
2
  module CommandHelpers
3
3
  def self.add_build_options(c)
4
- c.option 'config', '--config <CONFIG_FILE>[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
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'
5
6
  c.option 'future', '--future', 'Publishes posts with a future date'
6
7
  c.option 'limit_posts', '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
7
8
  c.option 'watch', '--watch', 'Watch for changes and rebuild'
@@ -4,7 +4,7 @@ module Octopress
4
4
  class New < Command
5
5
  def self.init_with_program(p)
6
6
  p.command(:new) do |c|
7
- c.syntax 'new <path>'
7
+ c.syntax 'new <PATH>'
8
8
  c.description 'Creates a new Jekyll site scaffold in path'
9
9
  c.option 'force', '--force', 'Force creation even if path already exists'
10
10
  c.option 'blank', '--blank', 'Creates scaffolding but with empty files'
@@ -18,6 +18,8 @@ module Octopress
18
18
  c.option 'baseurl', '--baseurl URL', 'Base URL'
19
19
 
20
20
  c.action do |args, options|
21
+ Octopress.config(options)
22
+
21
23
  options.default :serving => true
22
24
  options = CommandHelpers.normalize_options(options)
23
25
  options = ::Jekyll.configuration(options.to_symbol_keys)
@@ -12,7 +12,7 @@ module Octopress
12
12
  def self.config(options={})
13
13
  return @config if @config
14
14
 
15
- file = '_octopress.yml'
15
+ file = options['octopress-config'] || '_octopress.yml'
16
16
  config = {}
17
17
  if File.exist? file
18
18
  config = YAML.safe_load(File.open(file))
@@ -1,3 +1,3 @@
1
1
  module Octopress
2
- VERSION = "3.0.0.alpha7"
2
+ VERSION = "3.0.0.alpha8"
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.alpha7
4
+ version: 3.0.0.alpha8
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-02-27 00:00:00.000000000 Z
12
+ date: 2014-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mercenary
@@ -97,6 +97,9 @@ files:
97
97
  - README.md
98
98
  - Rakefile
99
99
  - bin/octopress
100
+ - docs/_octopress.yml
101
+ - docs/_site/index.html
102
+ - docs/index.html
100
103
  - lib/octopress.rb
101
104
  - lib/octopress/command.rb
102
105
  - lib/octopress/commands/build.rb