octopress-ink 1.0.0.alpha.36 → 1.0.0.alpha.37

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: ba0cc24dea9dd480491670843df791c946c80b03
4
- data.tar.gz: 1ee711e4557cbb1b1fd2189f3a6865a099bd02b1
3
+ metadata.gz: 1226eebcf70464a6a5f11e81f3ccb35d12c388c7
4
+ data.tar.gz: 63696eb04d509a4c58f151efc79367d18f43285e
5
5
  SHA512:
6
- metadata.gz: 47b839782bcf26f6582d72a49ba29ef59c510f0a625aa633e71ec802246b8f3ac8f954cd3b7b035e88b3cec5aa5e5234dfb0dc703eceabbe719af184455de6c0
7
- data.tar.gz: a69ece94caf2e6eb8deabc429256e36f0bd7f4c13bfe00d086f2d154e829751e45928b96e65c0f578f80bdbfae896f6d2ba9b068f7bbecbb8162e14ee7bc30ec
6
+ metadata.gz: a5f58e9e24ae5e56927fc74d5a5fb3201445647d84c680a615a673ac423477983977f83f5b66f696822e0905222dbef20899417a7ba106a0f8ae9beffff97071
7
+ data.tar.gz: 9bc459fc294e66fad9c5d9ed07d779c3e84c24c08b9566085938bf6b6a3e434fb63213096562c8e8d87b7fd366a03297eeff838e225c94dac7463fe2112ac2c0
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ tmp
18
18
  .DS_Store
19
19
  .sass-cache
20
20
  test/site
21
+ .code-highlighter-cache
data/lib/octopress-ink.rb CHANGED
@@ -27,8 +27,8 @@ module Octopress
27
27
  require 'octopress-ink/commands'
28
28
  end
29
29
 
30
- def self.register_plugin(plugin, name, type='plugin', local=nil)
31
- Plugins.register_plugin(plugin, name, type, local)
30
+ def self.register_plugin(plugin)
31
+ Plugins.register_plugin(plugin)
32
32
  end
33
33
 
34
34
  def self.version
@@ -62,7 +62,7 @@ module Octopress
62
62
  return false
63
63
  end
64
64
  end
65
-
65
+
66
66
  # Prints a list of plugins and details
67
67
  #
68
68
  # options - a Hash of options from the Info command
@@ -156,6 +156,6 @@ Liquid::Template.register_tag('_', Octopress::Ink::Tags::LineCommentTag)
156
156
  require 'octopress-ink/plugins/ink'
157
157
  require 'octopress-ink/plugins/asset_pipeline'
158
158
 
159
- Octopress::Ink.register_plugin(Ink, 'ink', 'plugin')
160
- Octopress::Ink.register_plugin(Octopress::Ink::AssetPipelinePlugin, 'asset-pipeline', 'plugin', true)
159
+ Octopress::Ink.register_plugin(Ink)
160
+ Octopress::Ink.register_plugin(Octopress::Ink::AssetPipelinePlugin)
161
161
 
@@ -38,8 +38,11 @@ module Octopress
38
38
  return @page if @page
39
39
  @page = Page.new(Plugins.site, source_dir, page_dir, file, {'path'=>plugin.docs_base_path})
40
40
  @page.data['layout'] = 'docs'
41
- @page.data['plugin'] = @plugin.slug
42
- @page.data['docs_pages'] = @plugin.doc_pages
41
+ @page.data['plugin'] = {
42
+ 'name' => @plugin.name,
43
+ 'slug' => @plugin.slug
44
+ }
45
+ @page.data['doc_pages'] = @plugin.doc_pages
43
46
  @page
44
47
  end
45
48
 
@@ -1,7 +1,6 @@
1
1
  module Octopress
2
2
  module Ink
3
3
  module Filters
4
-
5
4
 
6
5
  # Returns the site's config root or '/' if the config isn't set
7
6
  #
@@ -115,6 +114,8 @@ module Octopress
115
114
  input.gsub(/ /,'-').gsub(/[^\w-]/,'').downcase
116
115
  end
117
116
 
117
+ alias_method :sluggify, :classify
118
+
118
119
  # Remove empty lines
119
120
  def compact_newlines(input)
120
121
  input.gsub(/\n{2,}/, "\n").gsub(/^ +\n/,"")
@@ -125,8 +126,8 @@ module Octopress
125
126
  compact_newlines(input).strip.gsub(/\s*\n\s*/, separator)
126
127
  end
127
128
 
128
- module_function :root, :expand_url, :expand_urls, :full_url, :full_urls, :excerpt, :cdata_escape, :titlecase, :classify, :join_lines, :compact_newlines, :unorphan
129
- public :expand_url, :expand_urls, :full_url, :full_urls, :excerpt, :cdata_escape, :titlecase, :classify, :join_lines, :compact_newlines, :unorphan
129
+ module_function :root, :expand_url, :expand_urls, :full_url, :full_urls, :excerpt, :cdata_escape, :titlecase, :classify, :sluggify, :join_lines, :compact_newlines, :unorphan
130
+ public :expand_url, :expand_urls, :full_url, :full_urls, :excerpt, :cdata_escape, :titlecase, :classify, :sluggify, :join_lines, :compact_newlines, :unorphan
130
131
  end
131
132
  end
132
133
  end
@@ -3,12 +3,18 @@ require 'find'
3
3
  module Octopress
4
4
  module Ink
5
5
  class Plugin
6
- attr_reader :name, :type, :assets_path,
6
+
7
+ DEFAULT_CONFIG = {
8
+ type: 'plugin'
9
+ }
10
+
11
+ attr_reader :name, :type, :assets_path, :local, :website, :description, :version,
7
12
  :layouts_dir, :css_dir, :javascripts_dir, :files_dir, :includes_dir, :images_dir,
8
- :layouts, :includes, :images, :fonts, :files, :pages, :docs,
9
- :website, :description, :version, :config
13
+ :layouts, :includes, :images, :fonts, :files, :pages, :docs
14
+
15
+ def initialize
16
+ DEFAULT_CONFIG.merge(configuration).each { |k,v| set_config(k,v) }
10
17
 
11
- def initialize(slug, type)
12
18
  @layouts_dir = 'layouts'
13
19
  @files_dir = 'files'
14
20
  @pages_dir = 'pages'
@@ -30,17 +36,22 @@ module Octopress
30
36
  @fonts = []
31
37
  @files = []
32
38
  @pages = []
33
- @type = type
34
- @slug = slug
35
- @name ||= slug
36
- @version ||= false
37
- @description ||= false
38
- @website ||= false
39
+ @slug ||= @name
40
+ end
41
+
42
+ def configuration; {}; end
43
+
44
+ def set_config(name,value)
45
+ instance_variable_set("@#{name}", value)
46
+ instance_eval(<<-EOS, __FILE__, __LINE__ + 1)
47
+ def #{name}
48
+ @#{name}
49
+ end
50
+ EOS
39
51
  end
40
52
 
41
53
  def register
42
54
  unless @assets_path.nil?
43
- add_config
44
55
  disable_assets
45
56
  add_assets
46
57
  add_layouts
@@ -60,14 +71,14 @@ module Octopress
60
71
  css.clone.concat sass
61
72
  end
62
73
 
63
- def add_config
64
- @config = Assets::Config.new(self, @config_file).read
74
+ def config
75
+ @config ||= Assets::Config.new(self, @config_file).read
65
76
  end
66
77
 
67
78
  def disable_assets
68
79
  disabled = []
69
- @config['disable'] ||= {}
70
- @config['disable'].each do |key,val|
80
+ config['disable'] ||= {}
81
+ config['disable'].each do |key,val|
71
82
  next unless can_disable.include? key
72
83
  if !!val == val
73
84
  disabled << key if val
@@ -77,15 +88,15 @@ module Octopress
77
88
  disabled << File.join(key, val)
78
89
  end
79
90
  end
80
- @config['disable'] = disabled
91
+ config['disable'] = disabled
81
92
  end
82
93
 
83
94
  def disabled?(dir, file)
84
- @config['disable'].include?(dir) || @config['disable'].include?(File.join(dir, file))
95
+ config['disable'].include?(dir) || config['disable'].include?(File.join(dir, file))
85
96
  end
86
97
 
87
98
  def slug
88
- @type == 'theme' ? @type : @slug
99
+ Filters.sluggify @type == 'theme' ? @type : @slug
89
100
  end
90
101
 
91
102
  def docs_base_path
@@ -103,11 +114,11 @@ module Octopress
103
114
  page_data = d.page.data
104
115
  title = page_data['link_title'] || page_data['title']
105
116
  title ||= File.basename(d.file, '.*')
106
- path = File.join(docs_base_path, d.file)
117
+ url = File.join(docs_base_path, d.file)
107
118
 
108
119
  {
109
120
  'title' => title,
110
- 'path' => path
121
+ 'url' => url
111
122
  }
112
123
  end
113
124
  end
@@ -44,7 +44,7 @@ module Octopress
44
44
 
45
45
  def self.add_files
46
46
  add_assets(%w{images pages files fonts docs})
47
- plugin('asset-pipeline').register_assets
47
+ plugin('octopress-asset-pipeline').register_assets
48
48
  add_stylesheets
49
49
  add_javascripts
50
50
  end
@@ -59,14 +59,14 @@ module Octopress
59
59
  @site
60
60
  end
61
61
 
62
- def self.register_plugin(plugin, name, type='plugin', local=nil)
63
- new_plugin = plugin.new(name, type)
62
+ def self.register_plugin(plugin)
63
+ new_plugin = plugin.new
64
64
 
65
- case type
65
+ case new_plugin.type
66
66
  when 'theme'
67
67
  @theme = new_plugin
68
68
  else
69
- if local
69
+ if new_plugin.local
70
70
  @user_plugins << new_plugin
71
71
  else
72
72
  @plugins << new_plugin
@@ -4,10 +4,16 @@
4
4
  module Octopress
5
5
  module Ink
6
6
  class AssetPipelinePlugin < Plugin
7
+ def configuration
8
+ {
9
+ name: "Octopress Asset Pipeline",
10
+ description: "Add your CSS and JS to the asset pipeline.",
11
+ local: true
12
+ }
13
+ end
7
14
 
8
- def initialize(slug, type)
9
- @name = "Octopress Assset Pipeline"
10
- super
15
+ def config
16
+ @config ||= Ink.config
11
17
  end
12
18
 
13
19
  def register_assets
@@ -17,11 +23,11 @@ module Octopress
17
23
 
18
24
  remove_jekyll_assets @sass if @sass
19
25
 
20
- if Ink.config['concat_js']
26
+ if config['concat_js']
21
27
  remove_jekyll_assets @javascripts if @javascripts
22
28
  end
23
29
 
24
- if Ink.config['concat_css']
30
+ if config['concat_css']
25
31
  remove_jekyll_assets @css if @css
26
32
  end
27
33
  end
@@ -29,9 +35,9 @@ module Octopress
29
35
  def disabled?(dir, file)
30
36
  case dir
31
37
  when stylesheets_dir
32
- Ink.config['disable'].include?('site_stylesheets')
38
+ config['disable'].include?('site_stylesheets')
33
39
  when javascripts_dir
34
- Ink.config['disable'].include?('site_javascripts')
40
+ config['disable'].include?('site_javascripts')
35
41
  end
36
42
  end
37
43
 
@@ -61,11 +67,11 @@ module Octopress
61
67
  end
62
68
 
63
69
  def javascripts_dir
64
- Ink.config['javascripts_dir']
70
+ config['javascripts_dir']
65
71
  end
66
72
 
67
73
  def stylesheets_dir
68
- Ink.config['stylesheets_dir']
74
+ config['stylesheets_dir']
69
75
  end
70
76
 
71
77
  def local_stylesheets
@@ -79,7 +85,6 @@ module Octopress
79
85
  end
80
86
 
81
87
  def local_files(type, dir)
82
- config = Ink.config
83
88
  source = Plugins.site.source
84
89
 
85
90
  # If they manually specify files
@@ -1,11 +1,13 @@
1
1
  class Ink < Octopress::Ink::Plugin
2
-
3
- def initialize(name, type)
4
- @assets_path = File.expand_path(File.join(File.dirname(__FILE__), '../../../assets'))
5
- @version = Octopress::Ink::VERSION
6
- @description = "Octopress Ink is a plugin framework for Jekyll"
7
- @website = "http://octopress.org/ink"
8
- super
2
+ def configuration
3
+ {
4
+ name: "Octopress Ink",
5
+ slug: "ink",
6
+ assets_path: File.expand_path(File.join(File.dirname(__FILE__), '../../../assets')),
7
+ version: Octopress::Ink::VERSION,
8
+ description: "Octopress Ink is a plugin framework for Jekyll",
9
+ website: "http://octopress.org/ink"
10
+ }
9
11
  end
10
12
 
11
13
  def docs_base_path
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Ink
3
- VERSION = "1.0.0.alpha.36"
3
+ VERSION = "1.0.0.alpha.37"
4
4
  end
5
5
  end
@@ -21,9 +21,8 @@ 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", "~> 1.0.0.alpha.8"
24
+ spec.add_development_dependency "octopress", "~> 3.0.0.alpha8"
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake"
27
27
  spec.add_development_dependency "pry-debugger"
28
28
  end
29
-
@@ -1,8 +1,13 @@
1
+ require 'octopress-ink'
2
+
1
3
  class TestPlugin < Octopress::Ink::Plugin
2
- def initialize(name, type)
3
- @assets_path = File.expand_path(File.join(File.dirname(__FILE__)))
4
- @description = "Test some plugins y'all"
5
- super
4
+ def configuration
5
+ {
6
+ name: 'Awesome Sauce',
7
+ slug: 'awesome-sauce',
8
+ assets_path: File.expand_path(File.dirname(__FILE__)),
9
+ description: "Test some plugins y'all"
10
+ }
6
11
  end
7
12
 
8
13
  def add_assets
@@ -12,5 +17,5 @@ class TestPlugin < Octopress::Ink::Plugin
12
17
  end
13
18
  end
14
19
 
15
- Octopress::Ink.register_plugin(TestPlugin, 'awesome-sauce')
20
+ Octopress::Ink.register_plugin(TestPlugin)
16
21
 
@@ -1,12 +1,15 @@
1
1
  require 'octopress-ink'
2
2
 
3
3
  class TestTheme < Octopress::Ink::Plugin
4
- def initialize(name, type)
5
- @assets_path = File.expand_path(File.join(File.dirname(__FILE__)))
6
- @description = "Test theme y'all"
7
- @name = "Classic Theme"
8
- super
4
+ def configuration
5
+ {
6
+ type: "theme",
7
+ description: "Test theme y'all",
8
+ name: "Classic Theme",
9
+ assets_path: File.expand_path(File.dirname(__FILE__))
10
+ }
9
11
  end
12
+
10
13
  def add_assets
11
14
  add_css_files ['theme-test.css', 'theme-test2.css']
12
15
  add_css 'theme-media-test@print.css'
@@ -15,4 +18,4 @@ class TestTheme < Octopress::Ink::Plugin
15
18
  end
16
19
  end
17
20
 
18
- Octopress::Ink.register_plugin(TestTheme, 'classic', 'theme')
21
+ 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.36
4
+ version: 1.0.0.alpha.37
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-09 00:00:00.000000000 Z
11
+ date: 2014-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0.alpha.8
47
+ version: 3.0.0.alpha8
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: 1.0.0.alpha.8
54
+ version: 3.0.0.alpha8
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement