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
data/test/concat_css_false/{awesome-sauce/stylesheets → stylesheets/awesome-sauce}/plugin-test.css
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('local js')
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('bar')
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('omg')
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
6
|
+
<title>{{ page.title }}</title>
|
7
|
+
<meta name="viewport" content="width=device-width">
|
8
|
+
</head>
|
9
|
+
<body class="{{ page.body_class }} {{ site.body_class }}">
|
10
|
+
{{ content }}
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
default favicon
|
@@ -0,0 +1 @@
|
|
1
|
+
some favicon
|
@@ -0,0 +1 @@
|
|
1
|
+
not a font
|
@@ -0,0 +1 @@
|
|
1
|
+
such font. very kern.
|
@@ -0,0 +1 @@
|
|
1
|
+
{{ include.greeting }}, I heard you like includes.
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('bar')
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('omgwtfbbq!!!11one')
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('omg')
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
6
|
+
<title>{{ page.title }}</title>
|
7
|
+
<meta name="viewport" content="width=device-width">
|
8
|
+
</head>
|
9
|
+
<body class="{{ page.body_class }} {{ site.body_class }}">
|
10
|
+
{{ content }}
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
.do-not-exist { background: black; }
|
@@ -0,0 +1 @@
|
|
1
|
+
.do-not-exist { background: #f00; }
|
@@ -0,0 +1 @@
|
|
1
|
+
* { background: none; color: #000; }
|
File without changes
|
@@ -6,9 +6,8 @@ class TestPlugin < Octopress::Ink::Plugin
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def add_assets
|
9
|
-
|
10
|
-
|
11
|
-
add_root_file 'robots.txt'
|
9
|
+
add_css 'plugin-test.css'
|
10
|
+
add_css 'plugin-media-test.css', 'print'
|
12
11
|
super
|
13
12
|
end
|
14
13
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
not a font
|
@@ -0,0 +1 @@
|
|
1
|
+
such font. very kern.
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('omgwtfbbq!!!11one')
|
@@ -7,10 +7,10 @@ class TestTheme < Octopress::Ink::Plugin
|
|
7
7
|
super
|
8
8
|
end
|
9
9
|
def add_assets
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
add_css_files ['theme-test.css', 'theme-test2.css']
|
11
|
+
add_css 'theme-media-test@print.css'
|
12
|
+
add_css 'disable-this.css'
|
13
|
+
add_sass_files ['main.scss', 'disable.sass']
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -0,0 +1 @@
|
|
1
|
+
.do-not-exist { background: black; }
|
@@ -0,0 +1 @@
|
|
1
|
+
.do-not-exist { background: #f00; }
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('local js')
|
@@ -1,5 +1,15 @@
|
|
1
1
|
test_override: config from theme override
|
2
|
-
|
2
|
+
page_urls:
|
3
3
|
test: test_pages/theme_page.html
|
4
4
|
feed:
|
5
5
|
url: test_pages/feed/
|
6
|
+
|
7
|
+
disable:
|
8
|
+
fonts: true
|
9
|
+
stylesheets: disable-this.css
|
10
|
+
sass: disable.sass
|
11
|
+
pages:
|
12
|
+
- disable-test.html
|
13
|
+
- test_pages/disable-test.html
|
14
|
+
files: disabled-file.txt
|
15
|
+
javascripts: disable-this.js
|
File without changes
|
File without changes
|
File without changes
|
data/test/test.rb
CHANGED
@@ -1,26 +1,34 @@
|
|
1
1
|
require 'colorator'
|
2
|
+
require 'find'
|
3
|
+
require '../lib/octopress-ink.rb'
|
2
4
|
|
3
5
|
@has_failed = false
|
4
|
-
@failures =
|
6
|
+
@failures = []
|
5
7
|
|
6
8
|
def pout(str)
|
7
9
|
print str
|
8
10
|
$stdout.flush
|
9
11
|
end
|
10
12
|
|
11
|
-
def test(file,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
def test(file, target_dir, source_dir="site")
|
14
|
+
site_file = Dir.glob("#{source_dir}/#{file}").first
|
15
|
+
if site_file && File.exist?(site_file)
|
16
|
+
if diff_file(file, target_dir, source_dir)
|
17
|
+
pout "F".red
|
18
|
+
@has_failed = true
|
19
|
+
else
|
20
|
+
pout ".".green
|
21
|
+
end
|
16
22
|
else
|
17
|
-
|
23
|
+
@failures << "File: #{source_dir}/#{file}: No such file or directory."
|
24
|
+
@has_failed = true
|
25
|
+
pout "F".red
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
21
29
|
def test_missing(file, dir)
|
22
30
|
if File.exist? File.join dir, file
|
23
|
-
@failures
|
31
|
+
@failures << "File #{file} should not exist".red
|
24
32
|
pout "F".red
|
25
33
|
@has_failed = true
|
26
34
|
else
|
@@ -28,32 +36,33 @@ def test_missing(file, dir)
|
|
28
36
|
end
|
29
37
|
end
|
30
38
|
|
31
|
-
def build(
|
32
|
-
config = ['_config.yml'] << config
|
33
|
-
|
39
|
+
def build(options={})
|
40
|
+
config = ['_config.yml'] << options[:config]
|
41
|
+
cmd = "rm -rf site && bundle exec octopress build --config #{config.join(',')}"
|
42
|
+
cmd += " --octopress-config #{options[:octopress_config]}" if options[:octopress_config]
|
43
|
+
`#{cmd}`
|
34
44
|
end
|
35
45
|
|
36
|
-
def diff_file(file,
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
46
|
+
def diff_file(file, target_dir='expected', source_dir='site')
|
47
|
+
diff = `diff #{target_dir}/#{file} #{source_dir}/#{file}`
|
48
|
+
if diff =~ /(<.+?\n)?(---\n)?(>.+)/
|
49
|
+
@failures << <<-DIFF
|
50
|
+
Failure in #{file}
|
51
|
+
---------
|
52
|
+
#{($1||'').red + $3.green}
|
53
|
+
---------
|
54
|
+
DIFF
|
44
55
|
else
|
45
|
-
|
56
|
+
false
|
46
57
|
end
|
47
58
|
end
|
48
59
|
|
49
|
-
build
|
50
|
-
|
51
60
|
def test_tags(dir)
|
52
61
|
tags = %w{content_for abort_false include assign capture wrap render filter}
|
53
62
|
tags.each { |file| test("test_tags/#{file}.html", dir) }
|
54
63
|
|
55
64
|
tags = %w{abort_true, abort_posts}
|
56
|
-
tags.each { |file| test_missing("test_tags/#{file}.html",
|
65
|
+
tags.each { |file| test_missing("test_tags/#{file}.html", 'site') }
|
57
66
|
end
|
58
67
|
|
59
68
|
def test_pages(dir)
|
@@ -76,8 +85,8 @@ def test_configs(dir)
|
|
76
85
|
configs.each { |file| test("test_config/#{file}.html", dir) }
|
77
86
|
end
|
78
87
|
|
79
|
-
def test_stylesheets(dir,
|
80
|
-
if
|
88
|
+
def test_stylesheets(dir, concat=true)
|
89
|
+
if concat
|
81
90
|
stylesheets = %w{all-* print-*}
|
82
91
|
stylesheets.each { |file| test("stylesheets/#{file}.css", dir) }
|
83
92
|
else
|
@@ -85,10 +94,21 @@ def test_stylesheets(dir, concat_css=true)
|
|
85
94
|
local_stylesheets.each { |file| test("stylesheets/#{file}.css", dir) }
|
86
95
|
|
87
96
|
plugin_stylesheets = %w{plugin-media-test plugin-test}
|
88
|
-
plugin_stylesheets.each { |file| test("awesome-sauce
|
97
|
+
plugin_stylesheets.each { |file| test("stylesheets/awesome-sauce/#{file}.css", dir) }
|
89
98
|
|
90
99
|
theme_stylesheets = %w{theme-media-test theme-test theme-test2}
|
91
|
-
theme_stylesheets.each { |file| test("theme
|
100
|
+
theme_stylesheets.each { |file| test("stylesheets/theme/#{file}.css", dir) }
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_javascripts(dir, concat=true)
|
105
|
+
if concat
|
106
|
+
javascripts = %w{all-*}
|
107
|
+
javascripts.each { |file| test("javascripts/#{file}.js", dir) }
|
108
|
+
else
|
109
|
+
javascripts = %w{bar foo}
|
110
|
+
javascripts.each { |file| test("javascripts/theme/#{file}.js", dir) }
|
111
|
+
test("javascripts/site.js", dir)
|
92
112
|
end
|
93
113
|
end
|
94
114
|
|
@@ -97,14 +117,33 @@ def test_root_assets(dir)
|
|
97
117
|
root_assets.each { |file| test(file, dir) }
|
98
118
|
end
|
99
119
|
|
120
|
+
def test_copy_assets(dir)
|
121
|
+
Find.find("#{dir}/_copy") do |file|
|
122
|
+
unless File.directory? file
|
123
|
+
test(file.sub("#{dir}"+"/", ''), dir, 'source')
|
124
|
+
end
|
125
|
+
end
|
126
|
+
`rm -rf source/_copy`
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_disabled(dir)
|
130
|
+
files = %w{
|
131
|
+
stylesheets/theme/disable-this.css
|
132
|
+
stylesheets/theme/disable.css
|
133
|
+
disable-test.html
|
134
|
+
test_pages/disable-test.html
|
135
|
+
javascripts/disable-this.js
|
136
|
+
fonts/font-one.otf
|
137
|
+
fonts/font-two.ttf
|
138
|
+
}
|
139
|
+
files.each { |file| test_missing(file, dir) }
|
140
|
+
end
|
141
|
+
|
100
142
|
def print_failures
|
101
143
|
puts "\n"
|
102
144
|
if @has_failed
|
103
|
-
@failures.each do |
|
104
|
-
puts
|
105
|
-
puts "---------"
|
106
|
-
puts diff
|
107
|
-
puts "---------"
|
145
|
+
@failures.each do |failure|
|
146
|
+
puts failure
|
108
147
|
end
|
109
148
|
abort
|
110
149
|
else
|
@@ -112,22 +151,33 @@ def print_failures
|
|
112
151
|
end
|
113
152
|
end
|
114
153
|
|
154
|
+
build
|
155
|
+
|
115
156
|
test_post('expected')
|
116
157
|
test_tags('expected')
|
117
158
|
test_pages('expected')
|
118
159
|
test_layouts('expected')
|
119
160
|
test_stylesheets('concat_css')
|
161
|
+
test_javascripts('concat_js')
|
120
162
|
test_configs('expected')
|
121
163
|
test_root_assets('expected')
|
122
164
|
|
123
|
-
|
165
|
+
Octopress::Ink.copy_plugin_assets('theme', '_copy', {'force'=> true})
|
166
|
+
test_copy_assets('copy_test')
|
167
|
+
|
168
|
+
Octopress::Ink.copy_plugin_assets('theme', '_copy', {'force'=> true, 'layouts' => true, 'pages' => true})
|
169
|
+
test_copy_assets('copy_layouts_pages')
|
170
|
+
|
171
|
+
build octopress_config: '_concat_false.yml'
|
124
172
|
test_stylesheets('concat_css_false', false)
|
173
|
+
test_javascripts('concat_js_false', false)
|
174
|
+
#test_disabled('site')
|
125
175
|
|
126
|
-
build '_sass_compact.yml'
|
127
|
-
test_stylesheets('sass_compact')
|
176
|
+
#build config: '_sass_compact.yml'
|
177
|
+
#test_stylesheets('sass_compact')
|
128
178
|
|
129
|
-
build '_sass_expanded.yml'
|
130
|
-
test_stylesheets('sass_expanded')
|
179
|
+
#build config: '_sass_expanded.yml'
|
180
|
+
#test_stylesheets('sass_expanded')
|
131
181
|
|
132
182
|
print_failures
|
133
183
|
|