octopress-ink 1.0.0.alpha.42 → 1.0.0.alpha.43

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: 9ea8a006600a51e0bfc3c4816f20da55e849d52a
4
- data.tar.gz: 5a4e760a5f58d4225bced80fd31d57f80c904683
3
+ metadata.gz: db0b53411b0e6748e5281e9db9fa6ef247296b9e
4
+ data.tar.gz: 8ff58d71d3cd6c9b75ba143e072fca4ce169b906
5
5
  SHA512:
6
- metadata.gz: 188cec7106b750e62cd193bb5c54fea9965c3733b5854ab02a30562ea00ae3cb1867eccaf78ba9814f4f8156ef4e7d1c273adbb21b130cefa3152a77c1b9aadc
7
- data.tar.gz: 84967eb34ce31062e3699c6f9a4009cbbc8146db0da74d9be6d1372773a0fe7b371017eddbe7b0f19e4b060e10358c764da078b1ddf11d4552f75496719d431e
6
+ metadata.gz: 1c455972095fe4418cfaf5ec2e70c3a6cb1785cf8d0cd29989d433425240532aa3f62b92098c02d9316844bfbe62ee963ae05758fd74d21cfa799303d169eb56
7
+ data.tar.gz: f9e610a3b80b20731db06b95f43931988167fd2b9b58190703f6d029bc58bb600250085f96497e0e1459f65af08d7d38f313ef6829a106a4659ef21e58d3c8eb
@@ -0,0 +1,9 @@
1
+ | Configuration | Description |
2
+ |:--------------|:------------|
3
+ | name | The display name for your plugin, e.g. "My Plugin" |
4
+ | assets_path | Path to your plugin's assets directory |
5
+ | slug | Optional: The slug is how users will reference your plugin, (Default: sluggified name) |
6
+ | type | Optional: "plugin" or "theme" (Default: "plugin") |
7
+ | version | Optional: Version will be displayed with plugin info |
8
+ | description | Optional: Description will be displayed with plugin info |
9
+ | website | Optional: Website will be displayed with plugin info |
@@ -0,0 +1,25 @@
1
+ ```ruby
2
+ require "octopress-ink"
3
+
4
+ module MyPlugin
5
+ class InkPlugin < Octopress::Ink::Plugin
6
+
7
+ # Define the configuration for your plugin
8
+ #
9
+ def configuration
10
+ {
11
+ name: "My plugin",
12
+ slug: "my-plugin",
13
+ assets_path: File.expand_path(File.join(File.dirname(__FILE__), '../assets')),
14
+ type: "plugin",
15
+ version: MyPlugin::VERSION,
16
+ description: "",
17
+ website: ""
18
+ }
19
+ end
20
+ end
21
+ end
22
+
23
+ # Register the plugin with Octopress Ink
24
+ Octopress::Ink.register_plugin(SomePlugin::InkPlugin)
25
+ ```
@@ -0,0 +1,69 @@
1
+ ---
2
+ title: "Creating a Gem"
3
+ permalink: /guides/creating-a-gem/
4
+ ---
5
+
6
+ *This guide assumes you have already installed Git, and Ruby 1.9.3 or greater.*
7
+
8
+ Octopress Ink plugins are distributed as ruby gems so you'll probably need to create an acconut at [RubyGems.org](https://rubygems.org/sign_up) if you haven't yet. Also, be sure you have [bundler](http://bundler.io) installed.
9
+
10
+ ### How to Create a Gem
11
+
12
+ The [bundler gem](http://bundler.io/) is a great way to manage gems and provides some terrific utilites for gem creators. Go ahead and
13
+ install it if you haven't yet.
14
+
15
+ ```sh
16
+ gem install bundler
17
+ ```
18
+
19
+ Now we'll use Bundler to create a gem project for our new plugin.
20
+
21
+ ```sh
22
+ bundle gem baconnaise
23
+ ```
24
+
25
+ That's right, this plugin will be called `baconnaise`. That command will generate a bunch of files into the new `baconnaise` directory. Take a peek inside and you'll see somethig like this:
26
+
27
+ ```
28
+ lib/
29
+ baconnaise/
30
+ version.rb
31
+ baconnaise.rb
32
+ baconnaise.gemspec
33
+ Gemfile
34
+ LICENSE.txt
35
+ Rakefile
36
+ README.md
37
+ ```
38
+
39
+ First, you'll want to edit your `baconnaise.gemspec` to be sure the information in that is right. Be sure to change the default description and summary. The gem won't build if you have a *TODO* in either of those. Here's what we're gonig to go with.
40
+
41
+ ```ruby
42
+ spec.description = %q{Baconnaise, because mistakes have never been this spreadable.}
43
+ spec.summary = %q{Baconnaise, because #YOLO.}
44
+ ```
45
+
46
+ Next you'll want to add Octopress Ink as a runtime dependency. Here's what that looks like.
47
+
48
+ ```ruby
49
+ spec.add_runtime_dependency 'octopress-ink', '~> 1.0'
50
+ ```
51
+
52
+ #### A note on Version Numbering
53
+
54
+ By default the `bundle gem` command starts you off at version `0.0.1`. If you take a look at `lib/baconnaise/version.rb` you'll see this.
55
+
56
+ ```
57
+ module Baconnaise
58
+ VERSION = "0.0.1"
59
+ end
60
+ ```
61
+
62
+ I'd encourage you to change your version number to `1.0.0` as soon as you release your plugin for production use. For a sensible guide on version numbers, refer to [semver.org](http://semver.org/).
63
+
64
+ ---
65
+
66
+ For the next part we'll take a look at creating an Octopress Ink plugin.
67
+
68
+ [Creating a Plugin &rarr;]({% doc_url /guides/creating-a-plugin/ %})
69
+
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: "Create an Octopress Ink Plugin"
3
+ permalink: /guides/creating-a-plugin/
4
+ ---
5
+
6
+ If you haven't created a ruby gem for your plugin, check out [Creating a Gem]({% doc_url /guides/creating-a-gem/ %}).
7
+
8
+ In this section we'll create an Octopress Ink plugin. Take a look at `lib/baconnaise.rb`. You should see
9
+ something like this:
10
+
11
+ ```ruby
12
+ require "baconnaise/version"
13
+
14
+ module Baconnaise
15
+ # Your code goes here...
16
+ end
17
+ ```
18
+
19
+ We'll require octopress-ink add a configuration method, and register the plugin with Octopress Ink plugin. Here's what `lib/baconnaise.rb` after we've done that.
20
+
21
+ ```ruby
22
+ require "baconnaise/version"
23
+ require "octopress-ink"
24
+
25
+ module Baconnaise
26
+ class InkPlugin < Octopress::Ink::Plugin
27
+ def configuration
28
+ {
29
+ # your configuration goes here.
30
+ }
31
+ end
32
+ end
33
+ end
34
+
35
+ # Register the plugin with Octopress Ink
36
+ Octopress::Ink.register_plugin(Baconnaise::InkPlugin)
37
+ ```
38
+
39
+ Now when Jekyll requires your plugin, it will register with Octopress Ink. The configuration options are as follows:
40
+
41
+ {% render ./_configuration.markdown %}
42
+
43
+ For Baconnaise, our configuration medthod will look like this:
44
+
45
+ ```ruby
46
+ def configuration
47
+ {
48
+ name: "Baconnaise",
49
+ slug: "baconnaise",
50
+ assets_path: File.expand_path(File.join(File.dirname(__FILE__), '../assets')),
51
+ type: "plugin",
52
+ version: Baconnaise::VERSION,
53
+ description: "Baconnaise, because mistakes have never been this spreadable.",
54
+ website: "http://baconnaise-craze.info/or/something/"
55
+ }
56
+ end
57
+ ```
@@ -0,0 +1,63 @@
1
+ ---
2
+ title: Octopress Ink
3
+ ---
4
+
5
+ Octopress Ink helps developers create plugins and themes which integrate seamlessly into any Jekyll site.
6
+
7
+ #### Benefits For users
8
+
9
+ - Go from vanilla Jekyll to a fully featured site in minutes.
10
+ - Plugins are easy to install and uninstall.
11
+ - Customization is simple and consistent.
12
+ - Easily view documentation for your unique setup, even offline.
13
+
14
+ [Using Octopress Ink plugins &rarr;]({% doc_url for-users %})
15
+
16
+ #### Benefits For Developers
17
+
18
+ - Automatically integrate with the asset pipeline.
19
+ - Easily convert plugins you've already written.
20
+ - Plugins automatically integrate with the Octopress CLI.
21
+
22
+ [Developing with Octopress Ink &rarr;]({% doc_url for-developers %})
23
+
24
+ #### Shipping assets
25
+ - Asset pipeline
26
+ - Automatic namespacing
27
+ - Easy customization
28
+ - Versioned release
29
+ - Dependencies (build on others)
30
+
31
+ #### Shipping themes
32
+ - Layouts
33
+ - Includes
34
+ - Pages
35
+ - Files
36
+ - Easy override
37
+ - Installable
38
+
39
+ #### Customization
40
+
41
+ assets/
42
+ docs/
43
+ index.markdown
44
+ stylesheets/
45
+ plugin.scss
46
+ javascripts/
47
+ plugin.js
48
+
49
+ lib/
50
+ furbysaurus/
51
+ version.rb
52
+ furbysaurus.rb
53
+
54
+ CHANGELOG.md
55
+ Gemfile
56
+ LICENSE.txt
57
+ furbysaurus.gemspec
58
+ Rakefile
59
+ README.md
60
+ ```
61
+
62
+ ## Creating a theme
63
+
@@ -0,0 +1,22 @@
1
+ ---
2
+ title: "Octopress Ink Plugin Reference"
3
+ permalink: /plugin-reference/
4
+ ---
5
+
6
+ Octopress Ink plugins should be distributed as ruby gems. If you don't know how to create a ruby gem, [follow this walkthrough]({% doc_url /guides/create-a-gem/ %}).
7
+
8
+ ### Plugin Template
9
+
10
+ This is the basic template for creating an Octopress Ink plugin.
11
+
12
+ {% render ./_plugin-template.markdown %}
13
+
14
+ ### Configuration Reference
15
+
16
+ The configuration options are as follows:
17
+
18
+ {% render ./_configuration.markdown %}
19
+
20
+ ### Plugin Assets
21
+
22
+ You can set `assets_path` to point wherever you like insde your gem file, but in this case we have it pointing to the `assets` directiory in root of the gem. There isn't a directory there yet, so we'll need to add one, and while were at it, add any assets that this plugin will need.
data/lib/octopress-ink.rb CHANGED
@@ -135,23 +135,22 @@ module Octopress
135
135
  end
136
136
 
137
137
  def self.gem_dir(*subdirs)
138
- File.expand_path(File.join(File.dirname(__FILE__), '../..', *subdirs))
138
+ File.expand_path(File.join(File.dirname(__FILE__), '../', *subdirs))
139
139
  end
140
140
 
141
- def self.copy_doc(source, dest)
141
+ def self.copy_doc(source, dest, permalink=nil)
142
142
  contents = File.open(source).read
143
- contents.sub!(/^# (.*)$/, "#{doc_title('\1').strip}")
143
+ contents.sub!(/^# (.*)$/, "#{doc_yaml('\1', permalink).strip}")
144
144
  FileUtils.mkdir_p File.dirname(dest)
145
145
  File.open(dest, 'w') {|f| f.write(contents) }
146
146
  puts "Updated #{dest} from #{source}"
147
147
  end
148
148
 
149
- def self.doc_title(input)
150
- <<-YAML
151
- ---
152
- title: "#{input.strip}"
153
- ---
154
- YAML
149
+ def self.doc_yaml(title, permalink)
150
+ yaml = "---\n"
151
+ yaml += "title: \"#{title.strip}\"\n"
152
+ yaml += "permalink: #{permalink.strip}\n" if permalink
153
+ yaml += "---"
155
154
  end
156
155
  end
157
156
  end
@@ -177,6 +176,6 @@ Liquid::Template.register_tag('doc_url', Octopress::Ink::Tags::DocUrlTag)
177
176
  require 'octopress-ink/plugins/ink'
178
177
  require 'octopress-ink/plugins/asset_pipeline'
179
178
 
180
- Octopress::Ink.register_plugin(Ink)
179
+ Octopress::Ink.register_plugin(Octopress::Ink::InkPlugin)
181
180
  Octopress::Ink.register_plugin(Octopress::Ink::AssetPipelinePlugin)
182
181
 
@@ -44,7 +44,6 @@ module Octopress
44
44
  'docs_base_path' => plugin.docs_base_path,
45
45
  }
46
46
  @page.data['dir'] = File.dirname(plugin_path)
47
- @page.data['doc_pages'] = @plugin.doc_pages
48
47
  @page
49
48
  end
50
49
 
@@ -35,6 +35,8 @@ module Octopress
35
35
  end
36
36
  rescue; end
37
37
 
38
+ super
39
+
38
40
  if @url && @url =~ /\/$/
39
41
  if self.ext == '.xml'
40
42
  @url = File.join(@url, "index.xml")
@@ -43,10 +45,9 @@ module Octopress
43
45
  end
44
46
  end
45
47
 
46
- super
48
+ @url
47
49
  end
48
50
  end
49
51
  end
50
52
  end
51
53
  end
52
-
@@ -110,7 +110,7 @@ module Octopress
110
110
  #
111
111
  def doc_pages
112
112
  if !@docs.empty?
113
- @docs.clone.map { |d|
113
+ @doc_pages ||= @docs.clone.map { |d|
114
114
  page = d.page
115
115
  title = page.data['link_title'] || page.data['title'] || page.basename
116
116
  url = File.join('/', docs_base_path, page.url.sub('index.html', ''))
@@ -97,16 +97,16 @@ module Octopress
97
97
  # returns: Array of plugin doc pages
98
98
  #
99
99
  def self.doc_pages
100
- plugins.clone.map { |p|
100
+ plugin_docs = {}
101
+ plugins.clone.map do |p|
101
102
  if pages = p.doc_pages
102
- {
103
+ plugin_docs[p.slug] = {
103
104
  "name" => p.name,
104
105
  "pages" => pages
105
106
  }
106
- else
107
- nil
108
107
  end
109
- }.compact
108
+ end
109
+ plugin_docs
110
110
  end
111
111
 
112
112
  def self.include(name, file)
@@ -1,25 +1,28 @@
1
- class Ink < Octopress::Ink::Plugin
2
- def configuration
3
- {
4
- name: "Octopress Ink",
5
- slug: "ink",
6
- assets_path: Octopress::Ink.gem_dir('assets'),
7
- version: Octopress::Ink::VERSION,
8
- description: "Octopress Ink is a plugin framework for Jekyll",
9
- website: "http://octopress.org/docs/ink"
10
- }
11
- end
1
+ module Octopress
2
+ module Ink
3
+ class InkPlugin < Octopress::Ink::Plugin
4
+ def configuration
5
+ {
6
+ name: "Octopress Ink",
7
+ slug: "ink",
8
+ assets_path: Octopress::Ink.gem_dir('assets'),
9
+ version: Octopress::Ink::VERSION,
10
+ description: "Octopress Ink is a plugin framework for Jekyll",
11
+ website: "http://octopress.org/docs/ink"
12
+ }
13
+ end
12
14
 
13
- def docs_base_path
14
- 'docs/ink'
15
- end
15
+ def docs_base_path
16
+ 'docs/ink'
17
+ end
16
18
 
17
- def info(options)
18
- if options['docs']
19
- super
20
- else
21
- ''
19
+ def info(options)
20
+ if options['docs']
21
+ super
22
+ else
23
+ ''
24
+ end
25
+ end
22
26
  end
23
27
  end
24
28
  end
25
-
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Ink
3
- VERSION = "1.0.0.alpha.42"
3
+ VERSION = "1.0.0.alpha.43"
4
4
  end
5
5
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "jekyll", "~> 1.4.3"
21
+ spec.add_runtime_dependency "jekyll", "~> 1.5", ">= 1.5.0"
22
22
  spec.add_runtime_dependency "sass", "~> 3.3.0"
23
23
 
24
24
  spec.add_development_dependency "octopress"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-ink
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha.42
4
+ version: 1.0.0.alpha.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-24 00:00:00.000000000 Z
11
+ date: 2014-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.3
19
+ version: '1.5'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 1.5.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
26
- version: 1.4.3
29
+ version: '1.5'
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 1.5.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: sass
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +114,12 @@ files:
108
114
  - LICENSE.txt
109
115
  - README.md
110
116
  - Rakefile
117
+ - assets/docs/_configuration.markdown
118
+ - assets/docs/_plugin-template.markdown
119
+ - assets/docs/creating-a-gem.markdown
120
+ - assets/docs/creating-a-plugin.markdown
121
+ - assets/docs/index.markdown
122
+ - assets/docs/plugin-reference.markdown
111
123
  - lib/octopress-ink.rb
112
124
  - lib/octopress-ink/assets.rb
113
125
  - lib/octopress-ink/assets/asset.rb