octopress-ink 1.0.0.alpha.40 → 1.0.0.alpha.41

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84fb3edc066bb60dd8d87bb25cd335d0b0d0c996
4
- data.tar.gz: 36a986d15251fca1611d23c576321a17fabc4032
3
+ metadata.gz: 7cafd4614b86a0c2ee67bd091d9603518488deb2
4
+ data.tar.gz: 89ed549eaa1b6fd06225f005229ac923ac6cc73e
5
5
  SHA512:
6
- metadata.gz: bc9393404392e1537419199a97a1395aa148abeff3bb27cd984e395f68d39e6e017c93631906074909ecced339c9848e66ccbce21fbe4d0ab4df549d3ccfeed4
7
- data.tar.gz: d45fc65a409dc90a5b32962a24e7eca7ea6313ee06043f2ff51372359d3019cd2508d5b9bcf6771ec90b16d275cc70199397e908168ab462170e871acb6f5d21
6
+ metadata.gz: c89bec5e91f8579d7a0daf2f218cc920dc4f0f0c3ce416207c00635c3b94bb833d0f39ec7ae65c2a79189c5609a72028cbdfc8b4b8da658fdcf7736be3d0c1cb
7
+ data.tar.gz: 917bcefdc14014139f9eb56125f38bf64b94d5c18cf8524c46aae20d10898858b3572c1954ff2770ae59ea5789164a92ecf27415c9624bc37978f5746c1676dd
data/lib/octopress-ink.rb CHANGED
@@ -45,7 +45,7 @@ module Octopress
45
45
 
46
46
  def self.site(options={})
47
47
  log_level = Jekyll.logger.log_level
48
- Jekyll.logger.log_level = Jekyll::Stevenson::WARN
48
+ Jekyll.logger.log_level = Jekyll::Stevenson::ERROR
49
49
  @site ||= Jekyll::Site.new(Jekyll.configuration(options))
50
50
  Jekyll.logger.log_level = log_level
51
51
  @site
@@ -134,6 +134,10 @@ module Octopress
134
134
  end
135
135
  end
136
136
 
137
+ def self.gem_dir(*subdirs)
138
+ File.expand_path(File.join(File.dirname(__FILE__), '../..', *subdirs))
139
+ end
140
+
137
141
  def self.copy_doc(source, dest)
138
142
  contents = File.open(source).read
139
143
  contents.sub!(/^# (.*)$/, "#{doc_title('\1').strip}")
@@ -168,6 +172,7 @@ Liquid::Template.register_tag('yield', Octopress::Ink::Tags::YieldTag)
168
172
  Liquid::Template.register_tag('wrap', Octopress::Ink::Tags::WrapTag)
169
173
  Liquid::Template.register_tag('abort', Octopress::Ink::Tags::AbortTag)
170
174
  Liquid::Template.register_tag('_', Octopress::Ink::Tags::LineCommentTag)
175
+ Liquid::Template.register_tag('doc_url', Octopress::Ink::Tags::DocUrlTag)
171
176
 
172
177
  require 'octopress-ink/plugins/ink'
173
178
  require 'octopress-ink/plugins/asset_pipeline'
@@ -23,7 +23,7 @@ module Octopress
23
23
  end
24
24
 
25
25
  def plugin_path
26
- File.join(plugin_dir, dir, file)
26
+ File.join(plugin_dir, page_dir, file)
27
27
  end
28
28
 
29
29
  def source_dir
@@ -40,7 +40,8 @@ module Octopress
40
40
  @page.data['layout'] = 'docs'
41
41
  @page.data['plugin'] = {
42
42
  'name' => @plugin.name,
43
- 'slug' => @plugin.slug
43
+ 'slug' => @plugin.slug,
44
+ 'docs_base_path' => plugin.docs_base_path
44
45
  }
45
46
  @page.data['doc_pages'] = @plugin.doc_pages
46
47
  @page
@@ -2,7 +2,7 @@ module Octopress
2
2
  module Ink
3
3
  module Assets
4
4
  class Sass < Stylesheet
5
- def initialize(plugin, base, file, media)
5
+ def initialize(plugin, base, file)
6
6
  @plugin = plugin
7
7
  @base = base
8
8
  @file = file
@@ -3,7 +3,7 @@ module Octopress
3
3
  module Assets
4
4
  class Stylesheet < Asset
5
5
 
6
- def initialize(plugin, base, file, media)
6
+ def initialize(plugin, base, file)
7
7
  @plugin = plugin
8
8
  @file = file
9
9
  @base = base
@@ -1,7 +1,7 @@
1
1
  module Octopress
2
2
  module Ink
3
3
  module Commands
4
- require 'octopress-ink/commands/info'
4
+ require 'octopress-ink/commands/list'
5
5
  require 'octopress-ink/commands/copy'
6
6
 
7
7
  class Ink < Octopress::Command
@@ -9,10 +9,14 @@ module Octopress
9
9
  def self.init_with_program(p)
10
10
  p.command(:ink) do |c|
11
11
  c.version Octopress::Ink::VERSION
12
- c.description "Get informationa about and work with Octopress Ink plugins."
12
+ c.description "Work with your Octopress Ink plugins."
13
13
  c.syntax "ink <subcommand>"
14
14
 
15
- Info.process_command(c)
15
+ c.action do |args, options|
16
+ puts c if args.empty?
17
+ end
18
+
19
+ List.process_command(c)
16
20
  Copy.process_command(c)
17
21
  end
18
22
  end
@@ -6,7 +6,8 @@ module Octopress
6
6
  c.option "layouts", "--layouts", "#{action} only layouts"
7
7
  c.option "includes", "--includes", "#{action} only includes"
8
8
  c.option "pages", "--pages", "#{action} only pages"
9
- c.option "stylesheets", "--stylesheets", "#{action} only Stylesheets"
9
+ c.option "stylesheets", "--stylesheets", "#{action} only Stylesheets (CSS and Sass)"
10
+ c.option "css", "--css", "#{action} only CSS files"
10
11
  c.option "sass", "--sass", "#{action} only Sass files"
11
12
  c.option "javascripts", "--javascripts", "#{action} only Javascripts"
12
13
  c.option "images", "--images", "#{action} only images"
@@ -1,10 +1,10 @@
1
1
  module Octopress
2
2
  module Ink
3
3
  module Commands
4
- class Info
4
+ class List
5
5
  def self.process_command(p)
6
- p.command(:info) do |c|
7
- c.syntax "octopress ink info [plugin] [options]"
6
+ p.command(:list) do |c|
7
+ c.syntax "list [plugin] [options]"
8
8
  c.description "Get info about octopress ink plugins"
9
9
  c.option "all", "--all", "List all plugins and their assets"
10
10
  CommandHelpers.add_asset_options(c, 'List')
@@ -9,7 +9,7 @@ module Octopress
9
9
  }
10
10
 
11
11
  attr_reader :name, :type, :assets_path, :local, :website, :description, :version,
12
- :layouts_dir, :css_dir, :javascripts_dir, :files_dir, :includes_dir, :images_dir,
12
+ :layouts_dir, :stylesheets_dir, :javascripts_dir, :files_dir, :includes_dir, :images_dir,
13
13
  :layouts, :includes, :images, :fonts, :files, :pages, :docs
14
14
 
15
15
  def initialize
@@ -23,8 +23,7 @@ module Octopress
23
23
  @images_dir = 'images'
24
24
  @includes_dir = 'includes'
25
25
  @javascripts_dir = 'javascripts'
26
- @css_dir = 'stylesheets'
27
- @sass_dir = 'stylesheets'
26
+ @stylesheets_dir = 'stylesheets'
28
27
  @config_file = 'config.yml'
29
28
  @layouts = []
30
29
  @includes = []
@@ -62,13 +61,14 @@ module Octopress
62
61
  add_docs
63
62
  add_files
64
63
  add_pages
64
+ add_stylesheets
65
65
  end
66
66
  end
67
67
 
68
68
  def add_assets; end
69
69
 
70
70
  def stylesheets
71
- css.clone.concat sass
71
+ css.clone.concat sass_without_partials
72
72
  end
73
73
 
74
74
  def config
@@ -110,17 +110,19 @@ module Octopress
110
110
  #
111
111
  def doc_pages
112
112
  if !@docs.empty?
113
- @docs.clone.map do |d|
114
- page_data = d.page.data
115
- title = page_data['link_title'] || page_data['title']
116
- title ||= File.basename(d.file, '.*')
117
- url = File.join(docs_base_path, d.file)
113
+ @docs.clone.map { |d|
114
+ page = d.page
115
+ title = page.data['link_title'] || page.data['title'] || page.basename
116
+ url = File.join('/', docs_base_path, page.url.sub('index.html', ''))
118
117
 
119
118
  {
120
119
  'title' => title,
121
120
  'url' => url
122
121
  }
123
- end
122
+ }.sort_by { |i|
123
+ # Sort by depth of url
124
+ i['url'].split('/').size
125
+ }
124
126
  end
125
127
  end
126
128
 
@@ -194,6 +196,12 @@ module Octopress
194
196
  message = ''
195
197
  no_assets = []
196
198
 
199
+ if options['stylesheets']
200
+ options['css'] = true
201
+ options['sass'] = true
202
+ options.delete('stylesheets')
203
+ end
204
+
197
205
  select_assets(options).each do |name, assets|
198
206
  next if assets.size == 0
199
207
  if name == 'docs'
@@ -243,46 +251,59 @@ module Octopress
243
251
  end
244
252
  end
245
253
 
254
+ def add_stylesheets
255
+ find_assets(@stylesheets_dir).each do |asset|
256
+ if File.extname(asset) =~ /s[ca]ss/
257
+ @sass << Assets::Sass.new(self, @stylesheets_dir, asset)
258
+ else
259
+ @css << Assets::Stylesheet.new(self, @stylesheets_dir, asset)
260
+ end
261
+ end
262
+ end
263
+
246
264
  def add_layouts
247
- @layouts = find_assets(@layouts_dir, Assets::Layout)
265
+ @layouts = add_new_assets(@layouts_dir, Assets::Layout)
248
266
  end
249
267
 
250
268
  def add_includes
251
- @includes = find_assets(@includes_dir, Assets::Asset)
269
+ @includes = add_new_assets(@includes_dir, Assets::Asset)
252
270
  end
253
271
 
254
272
  def add_pages
255
- @pages = find_assets(@pages_dir, Assets::PageAsset)
273
+ @pages = add_new_assets(@pages_dir, Assets::PageAsset)
256
274
  end
257
275
 
258
276
  def add_docs
259
- @docs = find_assets(@docs_dir, Assets::DocPageAsset)
277
+ @docs = add_new_assets(@docs_dir, Assets::DocPageAsset)
260
278
  end
261
279
 
262
280
  def add_files
263
- @files = find_assets(@files_dir, Assets::FileAsset)
281
+ @files = add_new_assets(@files_dir, Assets::FileAsset)
264
282
  end
265
283
 
266
284
  def add_javascripts
267
- @javascripts = find_assets(@javascripts_dir, Assets::Javascript)
285
+ @javascripts = add_new_assets(@javascripts_dir, Assets::Javascript)
268
286
  end
269
287
 
270
288
  def add_fonts
271
- @fonts = find_assets(@fonts_dir, Assets::Asset)
289
+ @fonts = add_new_assets(@fonts_dir, Assets::Asset)
272
290
  end
273
291
 
274
292
  def add_images
275
- @images = find_assets(@images_dir, Assets::Asset)
293
+ @images = add_new_assets(@images_dir, Assets::Asset)
294
+ end
295
+
296
+ def add_new_assets(dir, asset_type)
297
+ find_assets(dir).map do |asset|
298
+ asset_type.new(self, dir, asset)
299
+ end
276
300
  end
277
301
 
278
- def find_assets(dir, asset_type)
279
- found = []
302
+ def find_assets(dir)
280
303
  full_dir = File.join(@assets_path, dir)
281
- glob_assets(full_dir).each do |file|
282
- asset = file.sub(full_dir+'/', '')
283
- found << asset_type.new(self, dir, asset)
304
+ glob_assets(full_dir).map do |file|
305
+ file.sub(full_dir+'/', '')
284
306
  end
285
- found
286
307
  end
287
308
 
288
309
  def glob_assets(dir)
@@ -290,21 +311,21 @@ module Octopress
290
311
  Find.find(dir).to_a.reject {|f| File.directory? f }
291
312
  end
292
313
 
293
- def add_css(file, media=nil)
294
- @css << Assets::Stylesheet.new(self, @css_dir, file, media)
295
- end
314
+ #def add_css(file, media=nil)
315
+ #@css << Assets::Stylesheet.new(self, @stylesheets_dir, file, media)
316
+ #end
296
317
 
297
- def add_sass(file, media=nil)
298
- @sass << Assets::Sass.new(self, @sass_dir, file, media)
299
- end
318
+ #def add_sass(file, media=nil)
319
+ #@sass << Assets::Sass.new(self, @sass_dir, file, media)
320
+ #end
300
321
 
301
- def add_css_files(files, media=nil)
302
- files.each { |f| add_css(f, media) }
303
- end
322
+ #def add_css_files(files, media=nil)
323
+ #files.each { |f| add_css(f, media) }
324
+ #end
304
325
 
305
- def add_sass_files(files, media=nil)
306
- files.each { |f| add_sass(f, media) }
307
- end
326
+ #def add_sass_files(files, media=nil)
327
+ #files.each { |f| add_sass(f, media) }
328
+ #end
308
329
 
309
330
  def remove_jekyll_assets(files)
310
331
  files.each {|f| f.remove_jekyll_asset }
@@ -318,6 +339,13 @@ module Octopress
318
339
 
319
340
  def copy_asset_files(path, options)
320
341
  copied = []
342
+
343
+ if options['stylesheets']
344
+ options['css'] = true
345
+ options['sass'] = true
346
+ options.delete('stylesheets')
347
+ end
348
+
321
349
  select_assets(options).each do |name, assets|
322
350
  next if name == 'docs'
323
351
  assets.each { |a| copied << a.copy(path) }
@@ -345,6 +373,10 @@ module Octopress
345
373
  @sass.reject{|f| f.disabled? }
346
374
  end
347
375
 
376
+ def sass_without_partials
377
+ sass.reject{|f| f.file =~ /^_/ }
378
+ end
379
+
348
380
  def javascripts
349
381
  @javascripts.reject{|f| f.disabled? }
350
382
  end
@@ -3,7 +3,7 @@ class Ink < Octopress::Ink::Plugin
3
3
  {
4
4
  name: "Octopress Ink",
5
5
  slug: "ink",
6
- assets_path: File.expand_path(File.join(File.dirname(__FILE__), '../../../assets')),
6
+ assets_path: Octopress::Ink.gem_dir('assets'),
7
7
  version: Octopress::Ink::VERSION,
8
8
  description: "Octopress Ink is a plugin framework for Jekyll",
9
9
  website: "http://octopress.org/docs/ink"
@@ -13,5 +13,13 @@ class Ink < Octopress::Ink::Plugin
13
13
  def docs_base_path
14
14
  'docs/ink'
15
15
  end
16
+
17
+ def info(options)
18
+ if options['docs']
19
+ super
20
+ else
21
+ ''
22
+ end
23
+ end
16
24
  end
17
25
 
@@ -14,6 +14,7 @@ module Octopress
14
14
  autoload :WrapTag, 'octopress-ink/tags/wrap'
15
15
  autoload :AbortTag, 'octopress-ink/tags/abort'
16
16
  autoload :LineCommentTag, 'octopress-ink/tags/line_comment'
17
+ autoload :DocUrlTag, 'octopress-ink/tags/doc_url'
17
18
  end
18
19
  end
19
20
  end
@@ -0,0 +1,18 @@
1
+ # For plugin authors who need to generate urls pointing to ther doc pages.
2
+
3
+ module Octopress
4
+ module Ink
5
+ module Tags
6
+ class DocUrlTag < Liquid::Tag
7
+ def initialize(tag_name, markup, tokens)
8
+ super
9
+ @url = markup.strip
10
+ end
11
+
12
+ def render(context)
13
+ '/' + File.join(context['page']['plugin']['docs_base_path'], @url)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Ink
3
- VERSION = "1.0.0.alpha.40"
3
+ VERSION = "1.0.0.alpha.41"
4
4
  end
5
5
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency "jekyll", "~> 1.4.3"
22
22
  spec.add_runtime_dependency "sass", "~> 3.3.0"
23
23
 
24
- spec.add_development_dependency "octopress", "~> 3.0.0.alpha8"
24
+ spec.add_development_dependency "octopress"
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake"
27
27
  spec.add_development_dependency "pry-debugger"
data/test/Gemfile CHANGED
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem "octopress-ink", path: "../"
4
4
  gem "pry-debugger"
5
- #gem "octopress", path: "../../cli"
5
+ gem "octopress", path: "../../cli"
@@ -9,12 +9,6 @@ class TestPlugin < Octopress::Ink::Plugin
9
9
  description: "Test some plugins y'all"
10
10
  }
11
11
  end
12
-
13
- def add_assets
14
- add_css 'plugin-test.css'
15
- add_css 'plugin-media-test.css', 'print'
16
- super
17
- end
18
12
  end
19
13
 
20
14
  Octopress::Ink.register_plugin(TestPlugin)
@@ -9,13 +9,6 @@ class TestTheme < Octopress::Ink::Plugin
9
9
  assets_path: File.expand_path(File.dirname(__FILE__))
10
10
  }
11
11
  end
12
-
13
- def add_assets
14
- add_css_files ['theme-test.css', 'theme-test2.css']
15
- add_css 'theme-media-test@print.css'
16
- add_css 'disable-this.css'
17
- add_sass_files ['main.scss', 'disable.sass']
18
- end
19
12
  end
20
13
 
21
14
  Octopress::Ink.register_plugin(TestTheme)
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.40
4
+ version: 1.0.0.alpha.41
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-22 00:00:00.000000000 Z
11
+ date: 2014-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: octopress
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
- version: 3.0.0.alpha8
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 3.0.0.alpha8
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -126,7 +126,7 @@ files:
126
126
  - lib/octopress-ink/commands.rb
127
127
  - lib/octopress-ink/commands/copy.rb
128
128
  - lib/octopress-ink/commands/helpers.rb
129
- - lib/octopress-ink/commands/info.rb
129
+ - lib/octopress-ink/commands/list.rb
130
130
  - lib/octopress-ink/configuration.rb
131
131
  - lib/octopress-ink/filters.rb
132
132
  - lib/octopress-ink/generators/plugin_assets.rb
@@ -149,6 +149,7 @@ files:
149
149
  - lib/octopress-ink/tags/assign.rb
150
150
  - lib/octopress-ink/tags/capture.rb
151
151
  - lib/octopress-ink/tags/content_for.rb
152
+ - lib/octopress-ink/tags/doc_url.rb
152
153
  - lib/octopress-ink/tags/filter.rb
153
154
  - lib/octopress-ink/tags/include.rb
154
155
  - lib/octopress-ink/tags/javascript.rb
@@ -238,7 +239,7 @@ files:
238
239
  - test/plugins/awesome-sauce/pages/test_pages/one.html
239
240
  - test/plugins/awesome-sauce/pages/test_pages/two.html
240
241
  - test/plugins/awesome-sauce/plugin.rb
241
- - test/plugins/awesome-sauce/stylesheets/plugin-media-test.css
242
+ - test/plugins/awesome-sauce/stylesheets/plugin-media-test@print.css
242
243
  - test/plugins/awesome-sauce/stylesheets/plugin-test.css
243
244
  - test/plugins/test-theme/config.yml
244
245
  - test/plugins/test-theme/files/disabled-file.txt
@@ -415,7 +416,7 @@ test_files:
415
416
  - test/plugins/awesome-sauce/pages/test_pages/one.html
416
417
  - test/plugins/awesome-sauce/pages/test_pages/two.html
417
418
  - test/plugins/awesome-sauce/plugin.rb
418
- - test/plugins/awesome-sauce/stylesheets/plugin-media-test.css
419
+ - test/plugins/awesome-sauce/stylesheets/plugin-media-test@print.css
419
420
  - test/plugins/awesome-sauce/stylesheets/plugin-test.css
420
421
  - test/plugins/test-theme/config.yml
421
422
  - test/plugins/test-theme/files/disabled-file.txt