octopress-ink 1.0.0.alpha.44 → 1.0.0.alpha.45
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -6
- data/assets/docs/_plugin-template.markdown +9 -21
- data/assets/docs/creating-a-plugin.markdown +90 -12
- data/lib/octopress-ink/assets/asset.rb +55 -26
- data/lib/octopress-ink/assets/coffeescript.rb +22 -0
- data/lib/octopress-ink/assets/config.rb +12 -8
- data/lib/octopress-ink/assets/doc_page.rb +21 -18
- data/lib/octopress-ink/assets/file.rb +9 -7
- data/lib/octopress-ink/assets/javascript.rb +7 -0
- data/lib/octopress-ink/assets/layout.rb +3 -1
- data/lib/octopress-ink/assets/page.rb +12 -10
- data/lib/octopress-ink/assets/sass.rb +24 -17
- data/lib/octopress-ink/assets/stylesheet.rb +12 -6
- data/lib/octopress-ink/assets.rb +1 -4
- data/lib/octopress-ink/commands/helpers.rb +7 -4
- data/lib/octopress-ink/commands/init.rb +48 -0
- data/lib/octopress-ink/commands/list.rb +1 -1
- data/lib/octopress-ink/commands/new.rb +126 -49
- data/lib/octopress-ink/commands.rb +2 -0
- data/lib/octopress-ink/configuration.rb +18 -10
- data/lib/octopress-ink/filters.rb +4 -4
- data/lib/octopress-ink/generators/plugin_assets.rb +3 -2
- data/lib/octopress-ink/helpers/path.rb +4 -4
- data/lib/octopress-ink/jekyll/hooks.rb +123 -7
- data/lib/octopress-ink/jekyll/page.rb +3 -1
- data/lib/octopress-ink/plugin.rb +198 -165
- data/lib/octopress-ink/plugin_asset_pipeline.rb +172 -0
- data/lib/octopress-ink/plugins.rb +44 -168
- data/lib/octopress-ink/tags/javascript.rb +1 -1
- data/lib/octopress-ink/tags/render.rb +4 -2
- data/lib/octopress-ink/tags/stylesheet.rb +1 -1
- data/lib/octopress-ink/utils.rb +42 -0
- data/lib/octopress-ink/version.rb +1 -1
- data/lib/octopress-ink.rb +70 -34
- data/octopress-ink.gemspec +2 -2
- data/test/_combine_false.yml +4 -0
- data/test/_config.yml +1 -1
- data/test/combine_css/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +15 -0
- data/test/{sass_expanded → combine_css}/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css +2 -4
- data/test/{concat_css_false → combine_css_false}/stylesheets/awesome-sauce/plugin-media-test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/awesome-sauce/plugin-test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/site.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/theme/theme-media-test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/theme/theme-test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/theme/theme-test2.css +0 -0
- data/test/combine_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js +7 -0
- data/test/{concat_js_false → combine_js_false}/javascripts/site.js +0 -0
- data/test/combine_js_false/javascripts/test.js +10 -0
- data/test/{concat_js_false → combine_js_false}/javascripts/theme/bar.js +0 -0
- data/test/{concat_js_false → combine_js_false}/javascripts/theme/foo.js +0 -0
- data/test/copy_layouts_pages/_copy/pages/two.md +0 -1
- data/test/copy_test/_copy/pages/two.md +0 -1
- data/test/copy_test/_copy/stylesheets/main.scss +4 -1
- data/test/expected/index.html +2 -2
- data/test/plugins/awesome-sauce/pages/b.html +0 -1
- data/test/plugins/awesome-sauce/plugin.rb +1 -1
- data/test/plugins/test-theme/javascripts/blah.coffee +1 -0
- data/test/plugins/test-theme/plugin.rb +1 -1
- data/test/plugins/test-theme/stylesheets/main.scss +4 -1
- data/test/source/_plugins/awesome-sauce/config.yml +1 -1
- data/test/source/_plugins/theme/config.yml +1 -1
- data/test/source/_posts/2014-02-01-test-post.md +1 -0
- data/test/source/index.md +2 -2
- data/test/test.rb +15 -27
- metadata +66 -84
- data/lib/octopress-ink/assets/local_asset.rb +0 -47
- data/lib/octopress-ink/assets/local_javascript.rb +0 -12
- data/lib/octopress-ink/assets/local_sass.rb +0 -30
- data/lib/octopress-ink/assets/local_stylesheet.rb +0 -33
- data/lib/octopress-ink/helpers/titlecase.rb +0 -37
- data/lib/octopress-ink/plugins/asset_pipeline.rb +0 -103
- data/test/_concat_false.yml +0 -2
- data/test/_sass_compact.yml +0 -4
- data/test/_sass_expanded.yml +0 -4
- data/test/concat_css/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +0 -1
- data/test/concat_css/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css +0 -1
- data/test/concat_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js +0 -3
- data/test/sass_compact/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +0 -18
- data/test/sass_compact/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css +0 -5
- data/test/sass_expanded/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +0 -36
- data/test/source/_javascripts/site.js +0 -1
- data/test/source/_stylesheets/_foo.scss +0 -1
- data/test/source/_stylesheets/site.sass +0 -7
- data/test/source/_stylesheets/test.css +0 -1
@@ -1,9 +1,12 @@
|
|
1
1
|
module Octopress
|
2
2
|
module Ink
|
3
3
|
module Plugins
|
4
|
+
|
5
|
+
@static_files = []
|
4
6
|
@plugins = []
|
5
7
|
@user_plugins = []
|
6
|
-
@
|
8
|
+
@css_tags = []
|
9
|
+
@js_tags = []
|
7
10
|
|
8
11
|
def self.theme
|
9
12
|
@theme
|
@@ -13,6 +16,12 @@ module Octopress
|
|
13
16
|
plugins.each(&block)
|
14
17
|
end
|
15
18
|
|
19
|
+
# Store static files to be written
|
20
|
+
#
|
21
|
+
def self.static_files
|
22
|
+
@static_files
|
23
|
+
end
|
24
|
+
|
16
25
|
def self.size
|
17
26
|
plugins.size
|
18
27
|
end
|
@@ -33,18 +42,14 @@ module Octopress
|
|
33
42
|
[@theme].concat(@plugins).concat(@user_plugins).compact
|
34
43
|
end
|
35
44
|
|
36
|
-
def self.register
|
37
|
-
|
38
|
-
|
39
|
-
plugins.each do |p|
|
40
|
-
p.register
|
41
|
-
end
|
45
|
+
def self.register
|
46
|
+
plugins.each do |p|
|
47
|
+
p.register
|
42
48
|
end
|
43
49
|
end
|
44
50
|
|
45
51
|
def self.add_files
|
46
52
|
add_assets(%w{images pages files fonts docs})
|
47
|
-
plugin('octopress-asset-pipeline').register_assets
|
48
53
|
add_stylesheets
|
49
54
|
add_javascripts
|
50
55
|
end
|
@@ -55,8 +60,12 @@ module Octopress
|
|
55
60
|
end
|
56
61
|
end
|
57
62
|
|
58
|
-
def self.
|
59
|
-
@
|
63
|
+
def self.add_css_tag(tag)
|
64
|
+
@css_tags << tag
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.add_js_tag(tag)
|
68
|
+
@js_tags << tag
|
60
69
|
end
|
61
70
|
|
62
71
|
def self.register_plugin(plugin, options=nil)
|
@@ -109,187 +118,54 @@ module Octopress
|
|
109
118
|
plugin_docs
|
110
119
|
end
|
111
120
|
|
121
|
+
# Inclue partials from plugins
|
122
|
+
#
|
112
123
|
def self.include(name, file)
|
113
124
|
p = plugin(name)
|
114
125
|
p.include(file)
|
115
126
|
end
|
116
127
|
|
128
|
+
# Read plugin dir from site configs
|
129
|
+
#
|
117
130
|
def self.custom_dir
|
118
|
-
site.config['plugins']
|
119
|
-
end
|
120
|
-
|
121
|
-
def self.fingerprint(paths)
|
122
|
-
paths = [paths] unless paths.is_a? Array
|
123
|
-
Digest::MD5.hexdigest(paths.clone.map! { |path| "#{File.mtime(path).to_i}" }.join)
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.combined_stylesheet_path(media)
|
127
|
-
File.join('stylesheets', "#{media}-#{@combined_stylesheets[media][:fingerprint]}.css")
|
128
|
-
end
|
129
|
-
|
130
|
-
def self.combined_javascript_path
|
131
|
-
print = ''
|
132
|
-
|
133
|
-
if @js_fingerprint
|
134
|
-
print = "-" + @js_fingerprint
|
135
|
-
end
|
136
|
-
|
137
|
-
File.join('javascripts', "all#{print}.js")
|
138
|
-
end
|
139
|
-
|
140
|
-
def self.write_files(source, dest)
|
141
|
-
@site.static_files << StaticFileContent.new(source, dest)
|
142
|
-
end
|
143
|
-
|
144
|
-
def self.compile_sass_file(path, options)
|
145
|
-
::Sass.compile_file(path, options)
|
146
|
-
end
|
147
|
-
|
148
|
-
def self.compile_sass(contents, options)
|
149
|
-
::Sass.compile(contents, options)
|
150
|
-
end
|
151
|
-
|
152
|
-
def self.sass_options
|
153
|
-
config = @site.config
|
154
|
-
|
155
|
-
defaults = {
|
156
|
-
'style' => :compressed,
|
157
|
-
'trace' => false,
|
158
|
-
'line_numbers' => false
|
159
|
-
}
|
160
|
-
|
161
|
-
options = defaults.deep_merge(config['sass'] || {}).symbolize_keys
|
162
|
-
options = options.each{ |k,v| options[k] = v.to_sym if v.is_a? String }
|
163
|
-
options
|
164
|
-
end
|
165
|
-
|
166
|
-
def self.write_combined_stylesheet
|
167
|
-
css = combine_stylesheets
|
168
|
-
css.keys.each do |media|
|
169
|
-
contents = compile_sass(css[media][:contents], sass_options)
|
170
|
-
write_files(contents, combined_stylesheet_path(media))
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
def self.write_combined_javascript
|
175
|
-
js = combine_javascripts
|
176
|
-
write_files(js, combined_javascript_path) unless js == ''
|
177
|
-
end
|
178
|
-
|
179
|
-
def self.combine_stylesheets
|
180
|
-
unless @combined_stylesheets
|
181
|
-
css = {}
|
182
|
-
paths = {}
|
183
|
-
plugins.each do |plugin|
|
184
|
-
if plugin.type == 'theme'
|
185
|
-
plugin_header = "/* Theme: #{plugin.name} */\n"
|
186
|
-
else
|
187
|
-
plugin_header = "/* Plugin: #{plugin.name} */\n"
|
188
|
-
end
|
189
|
-
stylesheets = plugin.stylesheets
|
190
|
-
stylesheets.each do |file|
|
191
|
-
css[file.media] ||= {}
|
192
|
-
css[file.media][:contents] ||= ''
|
193
|
-
css[file.media][:contents] << plugin_header
|
194
|
-
css[file.media][:paths] ||= []
|
195
|
-
|
196
|
-
# Add Sass files
|
197
|
-
if file.respond_to? :compile
|
198
|
-
css[file.media][:contents].concat file.compile
|
199
|
-
else
|
200
|
-
css[file.media][:contents].concat file.path.read.strip
|
201
|
-
end
|
202
|
-
css[file.media][:paths] << file.path
|
203
|
-
plugin_header = ''
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
css.keys.each do |media|
|
208
|
-
css[media][:fingerprint] = fingerprint(css[media][:paths])
|
209
|
-
end
|
210
|
-
@combined_stylesheets = css
|
211
|
-
end
|
212
|
-
@combined_stylesheets
|
213
|
-
end
|
214
|
-
|
215
|
-
def self.combine_javascripts
|
216
|
-
unless @combined_javascripts
|
217
|
-
js = ''
|
218
|
-
plugins.each do |plugin|
|
219
|
-
paths = plugin.javascript_paths
|
220
|
-
@js_fingerprint = fingerprint(paths)
|
221
|
-
paths.each do |file|
|
222
|
-
js.concat Pathname.new(file).read
|
223
|
-
end
|
224
|
-
end
|
225
|
-
@combined_javascripts = js
|
226
|
-
end
|
227
|
-
@combined_javascripts
|
228
|
-
end
|
229
|
-
|
230
|
-
def self.combined_stylesheet_tag
|
231
|
-
tags = ''
|
232
|
-
combine_stylesheets.keys.each do |media|
|
233
|
-
tags.concat "<link href='#{Filters.expand_url(combined_stylesheet_path(media))}' media='#{media}' rel='stylesheet' type='text/css'>"
|
234
|
-
end
|
235
|
-
tags
|
236
|
-
end
|
237
|
-
|
238
|
-
def self.combined_javascript_tag
|
239
|
-
unless combine_javascripts == ''
|
240
|
-
"<script src='#{Filters.expand_url(combined_javascript_path)}'></script>"
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
def self.stylesheet_tags
|
245
|
-
if Ink.config['concat_css']
|
246
|
-
combined_stylesheet_tag
|
247
|
-
else
|
248
|
-
css = []
|
249
|
-
plugins.each do |plugin|
|
250
|
-
css.concat plugin.stylesheet_tags
|
251
|
-
css.concat plugin.sass_tags
|
252
|
-
end
|
253
|
-
css
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
|
-
def self.javascript_tags
|
258
|
-
if Ink.config['concat_js']
|
259
|
-
combined_javascript_tag
|
260
|
-
else
|
261
|
-
js = []
|
262
|
-
plugins.each do |plugin|
|
263
|
-
js.concat plugin.javascript_tags
|
264
|
-
end
|
265
|
-
js
|
266
|
-
end
|
131
|
+
Ink.site.config['plugins']
|
267
132
|
end
|
268
133
|
|
269
134
|
# Copy/Generate Stylesheets
|
270
135
|
#
|
271
136
|
def self.add_stylesheets
|
272
|
-
|
273
|
-
|
274
|
-
write_combined_stylesheet
|
137
|
+
if Ink.config['combine_css']
|
138
|
+
PluginAssetPipeline.write_combined_stylesheet
|
275
139
|
else
|
276
140
|
add_assets(%w{css sass})
|
277
141
|
end
|
278
142
|
end
|
279
|
-
|
143
|
+
|
280
144
|
# Copy/Generate Javascripts
|
281
145
|
#
|
282
146
|
def self.add_javascripts
|
283
|
-
|
284
|
-
|
285
|
-
write_combined_javascript
|
147
|
+
if Ink.config['combine_js']
|
148
|
+
PluginAssetPipeline.write_combined_javascript
|
286
149
|
else
|
287
|
-
add_assets(
|
150
|
+
add_assets(%w{js coffee})
|
288
151
|
end
|
152
|
+
end
|
289
153
|
|
154
|
+
def self.css_tags
|
155
|
+
if Ink.config['combine_css']
|
156
|
+
PluginAssetPipeline.combined_stylesheet_tag
|
157
|
+
else
|
158
|
+
@css_tags.join('')
|
159
|
+
end
|
290
160
|
end
|
291
161
|
|
162
|
+
def self.js_tags
|
163
|
+
if Ink.config['combine_js']
|
164
|
+
PluginAssetPipeline.combined_javascript_tag
|
165
|
+
else
|
166
|
+
@js_tags.join('')
|
167
|
+
end
|
168
|
+
end
|
292
169
|
end
|
293
170
|
end
|
294
171
|
end
|
295
|
-
|
@@ -25,7 +25,7 @@ module Octopress
|
|
25
25
|
content = read(markup, context)
|
26
26
|
|
27
27
|
if content =~ /\A-{3}(.+[^\A])-{3}\n(.+)/m
|
28
|
-
local_vars =
|
28
|
+
local_vars = SafeYAML.load($1.strip)
|
29
29
|
content = $2.strip
|
30
30
|
end
|
31
31
|
|
@@ -36,7 +36,9 @@ module Octopress
|
|
36
36
|
partial = Liquid::Template.parse(content)
|
37
37
|
content = context.stack {
|
38
38
|
context['include'] = include_tag.parse_params(context)
|
39
|
-
|
39
|
+
if local_vars
|
40
|
+
context['page'] = Jekyll::Utils.deep_merge_hashes(context['page'], local_vars)
|
41
|
+
end
|
40
42
|
partial.render!(context)
|
41
43
|
}.strip
|
42
44
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Octopress
|
2
|
+
module Utils
|
3
|
+
|
4
|
+
# Smart capitalization for titles
|
5
|
+
#
|
6
|
+
def self.titlecase(input)
|
7
|
+
small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs.)
|
8
|
+
|
9
|
+
x = input.split(" ").map do |word|
|
10
|
+
# note: word could contain non-word characters!
|
11
|
+
# downcase all small_words, capitalize the rest
|
12
|
+
small_words.include?(word.gsub(/\W/, "").downcase) ? word.downcase! : smart_capitalize!(word)
|
13
|
+
word
|
14
|
+
end
|
15
|
+
# capitalize first and last words
|
16
|
+
smart_capitalize!(x.first)
|
17
|
+
smart_capitalize!(x.last)
|
18
|
+
# small words are capitalized after colon, period, exclamation mark, question mark
|
19
|
+
x.join(" ").gsub(/(:|\.|!|\?)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{smart_capitalize($2)} " }
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.titlecase!(input)
|
23
|
+
input.replace(titlecase(input))
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.smart_capitalize(input)
|
27
|
+
target = input.dup
|
28
|
+
# ignore any leading crazy characters and capitalize the first real character
|
29
|
+
if target =~ /^['"\(\[']*([a-z])/
|
30
|
+
i = input.index($1)
|
31
|
+
x = target[i,target.length]
|
32
|
+
# word with capitals and periods mid-word are left alone
|
33
|
+
target[i,1] = target[i,1].upcase unless x =~ /[A-Z]/ or x =~ /\.\w+/
|
34
|
+
end
|
35
|
+
target
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.smart_capitalize!(input)
|
39
|
+
input.replace(smart_capitalize(input))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/octopress-ink.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'jekyll'
|
2
2
|
require 'sass'
|
3
|
+
require 'autoprefixer-rails'
|
3
4
|
require 'digest/md5'
|
4
5
|
|
5
6
|
require 'octopress-ink/version'
|
7
|
+
|
8
|
+
require 'octopress-ink/utils'
|
6
9
|
require 'octopress-ink/generators/plugin_assets'
|
7
10
|
require 'octopress-ink/jekyll/hooks'
|
8
11
|
require 'octopress-ink/version'
|
9
|
-
require 'octopress-ink/helpers/titlecase'
|
10
12
|
|
11
13
|
module Octopress
|
12
14
|
module Ink
|
@@ -20,6 +22,7 @@ module Octopress
|
|
20
22
|
autoload :StaticFileContent, 'octopress-ink/jekyll/static_file_content'
|
21
23
|
autoload :Plugins, 'octopress-ink/plugins'
|
22
24
|
autoload :Plugin, 'octopress-ink/plugin'
|
25
|
+
autoload :PluginAssetPipeline, 'octopress-ink/plugin_asset_pipeline'
|
23
26
|
autoload :Tags, 'octopress-ink/tags'
|
24
27
|
|
25
28
|
if defined? Octopress::Command
|
@@ -27,6 +30,14 @@ module Octopress
|
|
27
30
|
require 'octopress-ink/commands'
|
28
31
|
end
|
29
32
|
|
33
|
+
def self.version
|
34
|
+
version = "Jekyll v#{Jekyll::VERSION}, "
|
35
|
+
if defined? Octopress::VERSION
|
36
|
+
version << "Octopress v#{Octopress::VERSION} "
|
37
|
+
end
|
38
|
+
version << "Octopress Ink v#{Octopress::Ink::VERSION}"
|
39
|
+
end
|
40
|
+
|
30
41
|
# Register a new plugin
|
31
42
|
#
|
32
43
|
# plugin - A subclass of Plugin
|
@@ -39,28 +50,41 @@ module Octopress
|
|
39
50
|
#
|
40
51
|
# options - A hash of configuration options.
|
41
52
|
#
|
42
|
-
def self.
|
53
|
+
def self.add_plugin(options={})
|
43
54
|
Plugins.register_plugin Plugin, options
|
44
55
|
end
|
45
56
|
|
46
|
-
def self.version
|
47
|
-
version = "Jekyll v#{Jekyll::VERSION}, "
|
48
|
-
if defined? Octopress::VERSION
|
49
|
-
version << "Octopress v#{Octopress::VERSION} "
|
50
|
-
end
|
51
|
-
version << "Octopress Ink v#{Octopress::Ink::VERSION}"
|
52
|
-
end
|
53
|
-
|
54
57
|
def self.config
|
55
|
-
Configuration.config
|
58
|
+
@config ||= Configuration.config
|
56
59
|
end
|
57
60
|
|
58
61
|
def self.site(options={})
|
62
|
+
@site ||= init_site(options)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.site=(site)
|
66
|
+
@site = site
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.payload(payload={})
|
70
|
+
config = Octopress::Ink::Plugins.config
|
71
|
+
payload['plugins'] = config['plugins']
|
72
|
+
payload['theme'] = config['theme']
|
73
|
+
payload['octopress'] = {}
|
74
|
+
payload['octopress']['version'] = Octopress::Ink.version
|
75
|
+
if Octopress::Ink.config['docs_mode']
|
76
|
+
payload['doc_pages'] = Octopress::Ink::Plugins.doc_pages
|
77
|
+
end
|
78
|
+
|
79
|
+
payload
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.init_site(options)
|
59
83
|
log_level = Jekyll.logger.log_level
|
60
|
-
Jekyll.logger.log_level =
|
61
|
-
|
84
|
+
Jekyll.logger.log_level = :error
|
85
|
+
site = Jekyll::Site.new(Jekyll.configuration(options))
|
62
86
|
Jekyll.logger.log_level = log_level
|
63
|
-
|
87
|
+
site
|
64
88
|
end
|
65
89
|
|
66
90
|
def self.plugins
|
@@ -85,13 +109,14 @@ module Octopress
|
|
85
109
|
#
|
86
110
|
#
|
87
111
|
def self.list(options={})
|
88
|
-
|
112
|
+
site(options)
|
113
|
+
Plugins.register
|
89
114
|
options = {'minimal'=>true} if options.empty?
|
90
115
|
message = "Octopress Ink - v#{VERSION}\n"
|
91
116
|
|
92
117
|
if plugins.size > 0
|
93
118
|
plugins.each do |plugin|
|
94
|
-
message += plugin.
|
119
|
+
message += plugin.list(options)
|
95
120
|
end
|
96
121
|
else
|
97
122
|
message += "You have no plugins installed."
|
@@ -99,25 +124,27 @@ module Octopress
|
|
99
124
|
puts message
|
100
125
|
end
|
101
126
|
|
102
|
-
def self.
|
103
|
-
|
127
|
+
def self.plugin_list(name, options)
|
128
|
+
site(options)
|
129
|
+
Plugins.register
|
104
130
|
options.delete('config')
|
105
131
|
if p = plugin(name)
|
106
|
-
puts p.
|
132
|
+
puts p.list(options)
|
107
133
|
else
|
108
134
|
not_found(name)
|
109
135
|
end
|
110
136
|
end
|
111
137
|
|
112
138
|
def self.copy_plugin_assets(name, options)
|
113
|
-
|
139
|
+
site(options)
|
140
|
+
Plugins.register
|
114
141
|
if path = options.delete('path')
|
115
|
-
full_path = File.join(
|
142
|
+
full_path = File.join(Ink.site.source, path)
|
116
143
|
if !Dir["#{full_path}/*"].empty? && options['force'].nil?
|
117
144
|
abort "Error: directory #{path} is not empty. Use --force to overwrite files."
|
118
145
|
end
|
119
146
|
else
|
120
|
-
full_path = File.join(
|
147
|
+
full_path = File.join(Ink.site.source, Plugins.custom_dir, name)
|
121
148
|
end
|
122
149
|
if p = plugin(name)
|
123
150
|
copied = p.copy_asset_files(full_path, options)
|
@@ -131,13 +158,9 @@ module Octopress
|
|
131
158
|
end
|
132
159
|
end
|
133
160
|
|
134
|
-
def self.not_found(plugin)
|
135
|
-
puts "Plugin '#{plugin}' not found."
|
136
|
-
list_plugins
|
137
|
-
end
|
138
|
-
|
139
161
|
def self.list_plugins(options={})
|
140
|
-
|
162
|
+
site(options)
|
163
|
+
Plugins.register
|
141
164
|
puts "\nCurrently installed plugins:"
|
142
165
|
if plugins.size > 0
|
143
166
|
plugins.each { |plugin| puts plugin.name }
|
@@ -150,14 +173,31 @@ module Octopress
|
|
150
173
|
File.expand_path(File.join(File.dirname(__FILE__), '../', *subdirs))
|
151
174
|
end
|
152
175
|
|
176
|
+
# Makes it easy for Ink plugins to copy README and CHANGELOG
|
177
|
+
# files to doc folder to be used as a documentation asset file
|
178
|
+
#
|
179
|
+
# Usage: In rakefile require 'octopress-ink'
|
180
|
+
# then add task calling Octopress::Ink.copy_doc for each file
|
181
|
+
#
|
153
182
|
def self.copy_doc(source, dest, permalink=nil)
|
154
183
|
contents = File.open(source).read
|
184
|
+
|
185
|
+
# Convert H1 to title and add permalink in YAML front-matter
|
186
|
+
#
|
155
187
|
contents.sub!(/^# (.*)$/, "#{doc_yaml('\1', permalink).strip}")
|
188
|
+
|
156
189
|
FileUtils.mkdir_p File.dirname(dest)
|
157
190
|
File.open(dest, 'w') {|f| f.write(contents) }
|
158
191
|
puts "Updated #{dest} from #{source}"
|
159
192
|
end
|
160
193
|
|
194
|
+
private
|
195
|
+
|
196
|
+
def self.not_found(plugin)
|
197
|
+
puts "Plugin '#{plugin}' not found."
|
198
|
+
list_plugins
|
199
|
+
end
|
200
|
+
|
161
201
|
def self.doc_yaml(title, permalink)
|
162
202
|
yaml = "---\n"
|
163
203
|
yaml += "title: \"#{title.strip}\"\n"
|
@@ -169,15 +209,14 @@ end
|
|
169
209
|
|
170
210
|
Liquid::Template.register_filter Octopress::Ink::Filters
|
171
211
|
|
172
|
-
|
173
212
|
Liquid::Template.register_tag('include', Octopress::Ink::Tags::IncludeTag)
|
174
213
|
Liquid::Template.register_tag('assign', Octopress::Ink::Tags::AssignTag)
|
175
214
|
Liquid::Template.register_tag('capture', Octopress::Ink::Tags::CaptureTag)
|
176
215
|
Liquid::Template.register_tag('return', Octopress::Ink::Tags::ReturnTag)
|
177
216
|
Liquid::Template.register_tag('filter', Octopress::Ink::Tags::FilterTag)
|
178
217
|
Liquid::Template.register_tag('render', Octopress::Ink::Tags::RenderTag)
|
179
|
-
Liquid::Template.register_tag('
|
180
|
-
Liquid::Template.register_tag('
|
218
|
+
Liquid::Template.register_tag('css_asset_tag', Octopress::Ink::Tags::JavascriptTag)
|
219
|
+
Liquid::Template.register_tag('js_asset_tag', Octopress::Ink::Tags::StylesheetTag)
|
181
220
|
Liquid::Template.register_tag('content_for', Octopress::Ink::Tags::ContentForTag)
|
182
221
|
Liquid::Template.register_tag('yield', Octopress::Ink::Tags::YieldTag)
|
183
222
|
Liquid::Template.register_tag('wrap', Octopress::Ink::Tags::WrapTag)
|
@@ -186,8 +225,5 @@ Liquid::Template.register_tag('_', Octopress::Ink::Tags::LineCommentTag)
|
|
186
225
|
Liquid::Template.register_tag('doc_url', Octopress::Ink::Tags::DocUrlTag)
|
187
226
|
|
188
227
|
require 'octopress-ink/plugins/ink'
|
189
|
-
require 'octopress-ink/plugins/asset_pipeline'
|
190
228
|
|
191
229
|
Octopress::Ink.register_plugin(Octopress::Ink::InkPlugin)
|
192
|
-
Octopress::Ink.register_plugin(Octopress::Ink::AssetPipelinePlugin)
|
193
|
-
|
data/octopress-ink.gemspec
CHANGED
@@ -18,8 +18,8 @@ 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", "~>
|
22
|
-
spec.add_runtime_dependency "
|
21
|
+
spec.add_runtime_dependency "jekyll", "~> 2.0"
|
22
|
+
spec.add_runtime_dependency "autoprefixer-rails", "~> 1.1", ">= 1.1.20140403"
|
23
23
|
|
24
24
|
spec.add_development_dependency "octopress"
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
data/test/_config.yml
CHANGED
data/test/{concat_css_false → combine_css_false}/stylesheets/awesome-sauce/plugin-media-test.css
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|