octopress-ink 1.0.0.alpha.33 → 1.0.0.alpha.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/assets/docs/food.html +0 -0
- data/assets/docs/index.html +0 -0
- data/lib/octopress-ink.rb +80 -27
- data/lib/octopress-ink/assets.rb +6 -1
- data/lib/octopress-ink/assets/asset.rb +54 -36
- data/lib/octopress-ink/assets/config.rb +10 -11
- data/lib/octopress-ink/assets/doc_page.rb +53 -0
- data/lib/octopress-ink/assets/file.rb +37 -0
- data/lib/octopress-ink/assets/javascript.rb +5 -1
- data/lib/octopress-ink/assets/layout.rb +8 -5
- data/lib/octopress-ink/assets/local_asset.rb +47 -0
- data/lib/octopress-ink/assets/local_javascript.rb +12 -0
- data/lib/octopress-ink/assets/local_sass.rb +30 -0
- data/lib/octopress-ink/assets/local_stylesheet.rb +33 -0
- data/lib/octopress-ink/assets/page.rb +19 -9
- data/lib/octopress-ink/assets/sass.rb +24 -19
- data/lib/octopress-ink/assets/stylesheet.rb +12 -6
- data/lib/octopress-ink/commands.rb +5 -2
- data/lib/octopress-ink/commands/copy.rb +29 -0
- data/lib/octopress-ink/commands/helpers.rb +12 -10
- data/lib/octopress-ink/commands/info.rb +5 -3
- data/lib/octopress-ink/configuration.rb +21 -0
- data/lib/octopress-ink/filters.rb +1 -1
- data/lib/octopress-ink/generators/plugin_assets.rb +2 -3
- data/lib/octopress-ink/jekyll/page.rb +15 -11
- data/lib/octopress-ink/plugin.rb +214 -109
- data/lib/octopress-ink/plugins.rb +74 -113
- data/lib/octopress-ink/plugins/asset_pipeline.rb +93 -0
- data/lib/octopress-ink/plugins/ink.rb +15 -0
- data/lib/octopress-ink/version.rb +1 -1
- data/octopress-ink.gemspec +1 -0
- data/test/Gemfile +0 -2
- data/test/_concat_false.yml +2 -0
- data/test/_sass_compact.yml +2 -3
- data/test/_sass_expanded.yml +2 -3
- data/test/concat_css_false/{awesome-sauce/stylesheets → stylesheets/awesome-sauce}/plugin-media-test.css +0 -0
- data/test/concat_css_false/{awesome-sauce/stylesheets → stylesheets/awesome-sauce}/plugin-test.css +0 -0
- data/test/concat_css_false/{theme/stylesheets → stylesheets/theme}/theme-media-test.css +0 -0
- data/test/concat_css_false/{theme/stylesheets → stylesheets/theme}/theme-test.css +0 -0
- data/test/concat_css_false/{theme/stylesheets → stylesheets/theme}/theme-test2.css +0 -0
- data/test/concat_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js +3 -0
- data/test/concat_js_false/javascripts/site.js +1 -0
- data/test/concat_js_false/javascripts/theme/bar.js +1 -0
- data/test/concat_js_false/javascripts/theme/foo.js +1 -0
- data/test/copy_layouts_pages/_copy/layouts/default.html +12 -0
- data/test/copy_layouts_pages/_copy/layouts/test.html +4 -0
- data/test/copy_layouts_pages/_copy/pages/disable-test.html +3 -0
- data/test/copy_layouts_pages/_copy/pages/one.xml +4 -0
- data/test/copy_layouts_pages/_copy/pages/three.md +5 -0
- data/test/copy_layouts_pages/_copy/pages/two.md +6 -0
- data/test/copy_test/_copy/files/disabled-file.txt +2 -0
- data/test/copy_test/_copy/files/favicon.ico +1 -0
- data/test/copy_test/_copy/files/favicon.png +1 -0
- data/test/copy_test/_copy/fonts/font-one.otf +1 -0
- data/test/copy_test/_copy/fonts/font-two.ttf +1 -0
- data/test/copy_test/_copy/includes/bar.html +2 -0
- data/test/copy_test/_copy/includes/greet.html +1 -0
- data/test/copy_test/_copy/javascripts/bar.js +1 -0
- data/test/copy_test/_copy/javascripts/disable-this.js +1 -0
- data/test/copy_test/_copy/javascripts/foo.js +1 -0
- data/test/copy_test/_copy/layouts/default.html +12 -0
- data/test/copy_test/_copy/layouts/test.html +4 -0
- data/test/copy_test/_copy/pages/disable-test.html +3 -0
- data/test/copy_test/_copy/pages/one.xml +4 -0
- data/test/copy_test/_copy/pages/three.md +5 -0
- data/test/copy_test/_copy/pages/two.md +6 -0
- data/test/copy_test/_copy/stylesheets/disable-this.css +1 -0
- data/test/copy_test/_copy/stylesheets/disable.sass +1 -0
- data/test/copy_test/_copy/stylesheets/main.scss +2 -0
- data/test/copy_test/_copy/stylesheets/theme-media-test@print.css +1 -0
- data/test/copy_test/_copy/stylesheets/theme-test.css +4 -0
- data/test/copy_test/_copy/stylesheets/theme-test2.css +3 -0
- data/test/plugins/awesome-sauce/docs/index.html +0 -0
- data/test/plugins/awesome-sauce/pages/test_pages/one.html +1 -1
- data/test/plugins/awesome-sauce/pages/test_pages/two.html +1 -1
- data/test/plugins/awesome-sauce/plugin.rb +2 -3
- data/test/plugins/test-theme/config.yml +1 -1
- data/test/plugins/test-theme/files/disabled-file.txt +2 -0
- data/test/plugins/test-theme/fonts/font-one.otf +1 -0
- data/test/plugins/test-theme/fonts/font-two.ttf +1 -0
- data/test/plugins/test-theme/javascripts/disable-this.js +1 -0
- data/test/plugins/test-theme/pages/disable-test.html +3 -0
- data/test/plugins/test-theme/pages/test_pages/disable-test.html +3 -0
- data/test/plugins/test-theme/pages/test_pages/two.md +1 -1
- data/test/plugins/test-theme/plugin.rb +4 -4
- data/test/plugins/test-theme/stylesheets/disable-this.css +1 -0
- data/test/plugins/test-theme/stylesheets/disable.sass +1 -0
- data/test/sass_compact/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +1 -1
- data/test/sass_expanded/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +1 -1
- data/test/source/_javascripts/site.js +1 -0
- data/test/source/_plugins/awesome-sauce/config.yml +5 -1
- data/test/source/_plugins/theme/config.yml +11 -1
- data/test/source/{stylesheets → _stylesheets}/_foo.scss +0 -0
- data/test/source/{stylesheets → _stylesheets}/site.sass +0 -0
- data/test/source/{stylesheets → _stylesheets}/test.css +0 -0
- data/test/test.rb +87 -37
- metadata +130 -23
- data/lib/octopress-ink/assets/include.rb +0 -18
- data/lib/octopress-ink/assets/root.rb +0 -29
- data/lib/octopress-ink/plugins/stylesheets.rb +0 -56
- data/test/_concat_css_false.yml +0 -3
@@ -0,0 +1,37 @@
|
|
1
|
+
# These are files which need to be in added to the root of the site directory
|
2
|
+
# Use root assets for files like robots.text or favicon.ico
|
3
|
+
|
4
|
+
module Octopress
|
5
|
+
module Ink
|
6
|
+
module Assets
|
7
|
+
class FileAsset < Asset
|
8
|
+
|
9
|
+
def initialize(plugin, base, file)
|
10
|
+
@root = plugin.assets_path
|
11
|
+
@plugin = plugin
|
12
|
+
@base = base
|
13
|
+
@filename = file
|
14
|
+
@dir = File.dirname(file)
|
15
|
+
@file = File.basename(file)
|
16
|
+
@exists = {}
|
17
|
+
file_check
|
18
|
+
end
|
19
|
+
|
20
|
+
def filename
|
21
|
+
@filename
|
22
|
+
end
|
23
|
+
|
24
|
+
def user_dir
|
25
|
+
File.join Plugins.site.source, Plugins.custom_dir, plugin.slug, base
|
26
|
+
end
|
27
|
+
|
28
|
+
def add
|
29
|
+
if !exists?(local_plugin_path) && !Ink.config['docs_mode']
|
30
|
+
Plugins.site.static_files << StaticFile.new(File.join(source_dir, file), destination)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -3,7 +3,11 @@ module Octopress
|
|
3
3
|
module Assets
|
4
4
|
class Javascript < Asset
|
5
5
|
def tag
|
6
|
-
"<script src='#{Filters.expand_url(File.join(
|
6
|
+
"<script src='#{Filters.expand_url(File.join(dir, file))}'></script>"
|
7
|
+
end
|
8
|
+
|
9
|
+
def destination
|
10
|
+
File.join(base, plugin.slug, file)
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -3,19 +3,22 @@ module Octopress
|
|
3
3
|
module Assets
|
4
4
|
class Layout < Asset
|
5
5
|
|
6
|
+
def initialize(plugin, base, file)
|
7
|
+
super
|
8
|
+
register
|
9
|
+
end
|
10
|
+
|
6
11
|
def register
|
7
|
-
file = user_path
|
8
12
|
dir = user_dir
|
9
|
-
if !exists?(file)
|
10
|
-
file = plugin_path
|
13
|
+
if !exists?(File.join(dir, file))
|
11
14
|
dir = plugin_dir
|
12
15
|
end
|
13
16
|
|
14
|
-
Plugins.site.layouts[name] = Jekyll::Layout.new(Plugins.site, dir,
|
17
|
+
Plugins.site.layouts[name] = Jekyll::Layout.new(Plugins.site, dir, file)
|
15
18
|
end
|
16
19
|
|
17
20
|
def name
|
18
|
-
name = "#{
|
21
|
+
name = "#{plugin.slug}:#{file}"
|
19
22
|
# remove extension
|
20
23
|
name = name.split(".")[0..-2].join(".")
|
21
24
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Octopress
|
2
|
+
module Ink
|
3
|
+
module Assets
|
4
|
+
class LocalAsset < Asset
|
5
|
+
def initialize(plugin, base, file)
|
6
|
+
@plugin = plugin
|
7
|
+
@file = file
|
8
|
+
@base = base
|
9
|
+
@dir = base.sub(/^_/,'')
|
10
|
+
@root = Plugins.site.source
|
11
|
+
end
|
12
|
+
|
13
|
+
def info
|
14
|
+
message = filename.ljust(35)
|
15
|
+
message += "from: #{base}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def path
|
19
|
+
Pathname.new File.join(root, base, file)
|
20
|
+
end
|
21
|
+
|
22
|
+
def destination
|
23
|
+
File.join(dir, file)
|
24
|
+
end
|
25
|
+
|
26
|
+
def add
|
27
|
+
Plugins.site.static_files << StaticFile.new(path, destination)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Copy is unncessary with local assets
|
31
|
+
#
|
32
|
+
def copy(target_dir); end
|
33
|
+
|
34
|
+
# Remove files from Jekyll's static_files array so it doesn't end up in the
|
35
|
+
# compiled site directory.
|
36
|
+
#
|
37
|
+
def remove_jekyll_asset
|
38
|
+
Plugins.site.static_files.clone.each do |sf|
|
39
|
+
if sf.kind_of?(Jekyll::StaticFile) && sf.path == path.to_s
|
40
|
+
Plugins.site.static_files.delete(sf)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Octopress
|
2
|
+
module Ink
|
3
|
+
module Assets
|
4
|
+
class LocalSass < LocalStylesheet
|
5
|
+
def initialize(plugin, base, file, media=nil)
|
6
|
+
@plugin = plugin
|
7
|
+
@file = file
|
8
|
+
@base = base
|
9
|
+
@root = Plugins.site.source
|
10
|
+
@dir = base.sub(/^_/,'')
|
11
|
+
@media = media || 'all'
|
12
|
+
end
|
13
|
+
|
14
|
+
def destination
|
15
|
+
File.join(dir, file.sub(/@(.+?)\./,'.').sub(/s.ss/, 'css'))
|
16
|
+
end
|
17
|
+
|
18
|
+
def compile
|
19
|
+
options = Plugins.sass_options
|
20
|
+
compiled = Plugins.compile_sass_file(path.to_s, options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def add
|
24
|
+
Plugins.site.static_files << StaticFileContent.new(compile, destination)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Octopress
|
2
|
+
module Ink
|
3
|
+
module Assets
|
4
|
+
class LocalStylesheet < LocalAsset
|
5
|
+
def initialize(plugin, base, file, media=nil)
|
6
|
+
@plugin = plugin
|
7
|
+
@file = file
|
8
|
+
@base = base
|
9
|
+
@root = Plugins.site.source
|
10
|
+
@dir = base.sub(/^_/,'')
|
11
|
+
@media = media || 'all'
|
12
|
+
end
|
13
|
+
|
14
|
+
def media
|
15
|
+
m = @media
|
16
|
+
if file =~ /@(.+?)\./
|
17
|
+
m = $1
|
18
|
+
end
|
19
|
+
m
|
20
|
+
end
|
21
|
+
|
22
|
+
def destination
|
23
|
+
File.join(dir, file.sub(/@(.+?)\./,'.'))
|
24
|
+
end
|
25
|
+
|
26
|
+
def tag
|
27
|
+
"<link href='#{Filters.expand_url(File.join(dir, file))}' media='#{media}' rel='stylesheet' type='text/css'>"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -5,11 +5,13 @@ module Octopress
|
|
5
5
|
module Ink
|
6
6
|
module Assets
|
7
7
|
class PageAsset < Asset
|
8
|
+
attr_reader :filename
|
8
9
|
|
9
|
-
def initialize(plugin,
|
10
|
+
def initialize(plugin, base, file)
|
10
11
|
@root = plugin.assets_path
|
11
12
|
@plugin = plugin
|
12
|
-
@
|
13
|
+
@base = base
|
14
|
+
@filename = file
|
13
15
|
@dir = File.dirname(file)
|
14
16
|
@file = File.basename(file)
|
15
17
|
@exists = {}
|
@@ -17,24 +19,32 @@ module Octopress
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def page_dir
|
20
|
-
|
22
|
+
dir == '.' ? '' : dir
|
21
23
|
end
|
22
24
|
|
23
25
|
def plugin_path
|
24
|
-
File.join(plugin_dir,
|
26
|
+
File.join(plugin_dir, dir, file)
|
27
|
+
end
|
28
|
+
|
29
|
+
def url_info
|
30
|
+
"path: #{page.url.sub(/^\//,'')}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def user_dir
|
34
|
+
File.join Plugins.site.source, Plugins.custom_dir, plugin.slug, base
|
25
35
|
end
|
26
36
|
|
27
37
|
def page
|
28
|
-
@page ||= Page.new(Plugins.site,
|
38
|
+
@page ||= Page.new(Plugins.site, source_dir, page_dir, file, plugin.config)
|
29
39
|
end
|
30
40
|
|
31
41
|
# Add page to Jekyll pages if no other page has a conflicting destination
|
32
42
|
#
|
33
|
-
def
|
34
|
-
|
35
|
-
|
43
|
+
def add
|
44
|
+
if page.url && !Ink.config['docs_mode']
|
45
|
+
Plugins.site.pages << page unless Helpers::Path.find_page(page)
|
46
|
+
end
|
36
47
|
end
|
37
|
-
|
38
48
|
end
|
39
49
|
end
|
40
50
|
end
|
@@ -2,59 +2,64 @@ module Octopress
|
|
2
2
|
module Ink
|
3
3
|
module Assets
|
4
4
|
class Sass < Stylesheet
|
5
|
-
def initialize(plugin,
|
5
|
+
def initialize(plugin, base, file, media)
|
6
6
|
@plugin = plugin
|
7
|
-
@
|
7
|
+
@base = base
|
8
8
|
@file = file
|
9
9
|
@media = media || 'all'
|
10
10
|
@root = plugin.assets_path
|
11
|
-
@dir = File.join(plugin.slug,
|
11
|
+
@dir = File.join(plugin.slug, base)
|
12
12
|
@exists = {}
|
13
13
|
file_check
|
14
14
|
end
|
15
15
|
|
16
16
|
def tag
|
17
|
-
"<link href='#{Filters.expand_url(File.join(
|
17
|
+
"<link href='#{Filters.expand_url(File.join(dir, file))}' media='#{@media}' rel='stylesheet' type='text/css'>"
|
18
18
|
end
|
19
19
|
|
20
20
|
# TODO: see if this is done TODO: choose user path before local path.
|
21
21
|
def user_load_path
|
22
|
-
File.join(Plugins.site.source, Plugins.custom_dir,
|
22
|
+
File.join(Plugins.site.source, Plugins.custom_dir, dir, File.dirname(file)).sub /\/\.$/, ''
|
23
23
|
end
|
24
24
|
|
25
25
|
def theme_load_path
|
26
|
-
File.expand_path(File.join(
|
26
|
+
File.expand_path(File.join(root, base))
|
27
|
+
end
|
28
|
+
|
29
|
+
def disabled?
|
30
|
+
plugin.disabled?('sass', filename) ||
|
31
|
+
plugin.disabled?('stylesheets', filename)
|
27
32
|
end
|
28
33
|
|
29
34
|
def compile
|
30
35
|
unless @compiled
|
31
36
|
options = Plugins.sass_options
|
32
|
-
|
33
|
-
|
34
|
-
else
|
35
|
-
# If the plugin isn't a local plugin, add source paths to allow overrieds on @imports.
|
36
|
-
#
|
37
|
-
options[:load_paths] = [user_load_path, theme_load_path]
|
38
|
-
@compiled = Plugins.compile_sass(path.read, options)
|
39
|
-
end
|
37
|
+
options[:load_paths] = [user_load_path, theme_load_path]
|
38
|
+
@compiled = Plugins.compile_sass(path.read, options)
|
40
39
|
end
|
41
40
|
@compiled
|
42
41
|
end
|
43
42
|
|
44
43
|
def user_override_path
|
45
44
|
# Allow Sass overrides to use either syntax
|
46
|
-
if
|
47
|
-
[File.join(user_dir,
|
45
|
+
if file =~ /s[ac]ss$/
|
46
|
+
[File.join(user_dir, file), File.join(user_dir, alt_syntax_file)]
|
48
47
|
else
|
49
|
-
File.join user_dir,
|
48
|
+
File.join user_dir, file
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
52
|
+
def alt_syntax_file
|
53
|
+
ext = File.extname(file)
|
54
|
+
alt_ext = (ext == '.scss' ? '.sass' : '.scss')
|
55
|
+
file.sub(ext, alt_ext)
|
56
|
+
end
|
57
|
+
|
53
58
|
def destination
|
54
|
-
File.join(
|
59
|
+
File.join(base, plugin.slug, file.sub(/@(.+?)\./,'.').sub(/s.ss/, 'css'))
|
55
60
|
end
|
56
61
|
|
57
|
-
def
|
62
|
+
def add
|
58
63
|
Plugins.site.static_files << StaticFileContent.new(compile, destination)
|
59
64
|
end
|
60
65
|
end
|
@@ -2,31 +2,37 @@ module Octopress
|
|
2
2
|
module Ink
|
3
3
|
module Assets
|
4
4
|
class Stylesheet < Asset
|
5
|
-
|
5
|
+
|
6
|
+
def initialize(plugin, base, file, media)
|
6
7
|
@plugin = plugin
|
7
8
|
@file = file
|
8
|
-
@
|
9
|
+
@base = base
|
9
10
|
@media = media || 'all'
|
10
11
|
@root = plugin.assets_path
|
11
|
-
@dir = File.join(plugin.slug,
|
12
|
+
@dir = File.join(plugin.slug, 'stylesheets')
|
12
13
|
@exists = {}
|
13
14
|
file_check
|
14
15
|
end
|
15
16
|
|
16
17
|
def media
|
17
18
|
m = @media
|
18
|
-
if
|
19
|
+
if file =~ /@(.+?)\./
|
19
20
|
m = $1
|
20
21
|
end
|
21
22
|
m
|
22
23
|
end
|
23
24
|
|
25
|
+
def disabled?
|
26
|
+
plugin.disabled?('css', filename) ||
|
27
|
+
plugin.disabled?('stylesheets', filename)
|
28
|
+
end
|
29
|
+
|
24
30
|
def destination
|
25
|
-
File.join(
|
31
|
+
File.join(base, plugin.slug, file.sub(/@(.+?)\./,'.'))
|
26
32
|
end
|
27
33
|
|
28
34
|
def tag
|
29
|
-
"<link href='#{Filters.expand_url(File.join(
|
35
|
+
"<link href='#{Filters.expand_url(File.join(dir, file))}' media='#{media}' rel='stylesheet' type='text/css'>"
|
30
36
|
end
|
31
37
|
end
|
32
38
|
end
|
@@ -2,15 +2,18 @@ module Octopress
|
|
2
2
|
module Ink
|
3
3
|
module Commands
|
4
4
|
require 'octopress-ink/commands/info'
|
5
|
+
require 'octopress-ink/commands/copy'
|
5
6
|
|
6
7
|
class Ink < Octopress::Command
|
7
8
|
|
8
9
|
def self.init_with_program(p)
|
9
10
|
p.command(:ink) do |c|
|
10
|
-
c.
|
11
|
-
c.description "Get about
|
11
|
+
c.version Octopress::Ink::VERSION
|
12
|
+
c.description "Get informationa about and work with Octopress Ink plugins."
|
13
|
+
c.syntax "ink <subcommand>"
|
12
14
|
|
13
15
|
Info.process_command(c)
|
16
|
+
Copy.process_command(c)
|
14
17
|
end
|
15
18
|
end
|
16
19
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Octopress
|
2
|
+
module Ink
|
3
|
+
module Commands
|
4
|
+
class Copy
|
5
|
+
def self.process_command(p)
|
6
|
+
p.command(:copy) do |c|
|
7
|
+
c.syntax "copy <PLUGIN> [PATH] [options]"
|
8
|
+
c.description "Copy plugin assets to PATH (PATH defaults to _plugins/[plugin_name]/)"
|
9
|
+
c.option "all", "--all", "Copy all plugin assets"
|
10
|
+
c.option "force", "--force", "Overwrite files"
|
11
|
+
CommandHelpers.add_asset_options(c, 'Copy')
|
12
|
+
|
13
|
+
c.action do |args, options|
|
14
|
+
if args.empty?
|
15
|
+
puts "Error: Please pass a plugin to install assets from."
|
16
|
+
Octopress::Ink.list_plugins
|
17
|
+
else
|
18
|
+
name = args[0]
|
19
|
+
path = args[1]
|
20
|
+
Octopress::Ink.copy_plugin_assets(name, path, options)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|