octopress-ink 1.0.0.alpha.45 → 1.0.0.rc.1
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 +4 -4
- data/assets/docs/plugin-reference.markdown +1 -1
- data/lib/octopress-ink.rb +1 -0
- data/lib/octopress-ink/assets/coffeescript.rb +5 -0
- data/lib/octopress-ink/assets/sass.rb +7 -0
- data/lib/octopress-ink/configuration.rb +3 -0
- data/lib/octopress-ink/plugin_asset_pipeline.rb +9 -1
- data/lib/octopress-ink/version.rb +1 -1
- data/octopress-ink.gemspec +1 -0
- data/test/_combine_false.yml +1 -1
- data/test/_compress_false.yml +2 -0
- data/test/combine_css_false/stylesheets/theme/main.css +2 -0
- data/test/combine_js_false/javascripts/theme/blah.js +4 -0
- data/test/{combine_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js → compress_false/javascripts/all-.js} +0 -0
- data/test/{combine_css/stylesheets/all-e10f647557c9d610df6df40a458bc823.css → compress_false/stylesheets/all-.css} +0 -0
- data/test/{combine_css/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css → compress_false/stylesheets/print-.css} +0 -0
- data/test/copy_test/_copy/config.yml +2 -0
- data/test/copy_test/_copy/files/test.html +1 -0
- data/test/copy_test/_copy/javascripts/blah.coffee +1 -0
- data/test/copy_test/_copy/stylesheets/_colors.scss +1 -0
- data/test/expected/index.html +2 -0
- data/test/expected/javascripts/all-.js +1 -0
- data/test/expected/stylesheets/all-.css +1 -0
- data/test/expected/stylesheets/print-.css +1 -0
- data/test/expected/test.html +1 -0
- data/test/expected/test_layouts/test_markdown.html +13 -0
- data/test/expected/test_tags/return.html +23 -0
- data/test/plugins/test-theme/files/test.html +1 -1
- data/test/test.rb +67 -170
- data/test/test_suite.rb +161 -0
- data/test/uglify_js_false/javascripts/all-.js +7 -0
- metadata +52 -16
- data/test/combine_css_false/stylesheets/site.css +0 -1
- data/test/combine_css_false/stylesheets/test.css +0 -1
- data/test/combine_js_false/javascripts/site.js +0 -1
- data/test/combine_js_false/javascripts/test.js +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7aaa5bcf89c2f4ee26fe475db4657f9abadf369
|
4
|
+
data.tar.gz: 500a1709b5f6561e18231ea43ac3a69c0c671f59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e71e8686034c36d30d288e8be98cdcee95eee9b762ac946a1dbb5679627216ddcf8626a3f6ff175fcb5df78dc120318c2e3dd02c6f0d285d7a8920e18cf92933
|
7
|
+
data.tar.gz: b4135e91764ec41e747e8b514ea22dfa92408045ee35c2c5bc5df8c12f4fbaaa93471707a499628f8443318fccd47670abaf0c76827a43c6828803352cfdbd02
|
@@ -19,4 +19,4 @@ The configuration options are as follows:
|
|
19
19
|
|
20
20
|
### Plugin Assets
|
21
21
|
|
22
|
-
You can set `assets_path` to point wherever you like
|
22
|
+
You can set `assets_path` to point wherever you like inside your gem file, but in this case we have it pointing to the `assets` directory in root of the gem. There isn't a directory there yet, so we'll need to add one, and while were at it, add any assets that this plugin will need.
|
data/lib/octopress-ink.rb
CHANGED
@@ -10,12 +10,15 @@ module Octopress
|
|
10
10
|
'compress_css' => true,
|
11
11
|
'combine_js' => true,
|
12
12
|
'compress_js' => true,
|
13
|
+
'uglifier' => {},
|
13
14
|
'disable' => [],
|
14
15
|
'date_format' => 'ordinal',
|
16
|
+
|
15
17
|
'linkpost' => {
|
16
18
|
'marker' => "→",
|
17
19
|
'marker_position' => 'after'
|
18
20
|
},
|
21
|
+
|
19
22
|
'post' => {
|
20
23
|
'marker' => false,
|
21
24
|
'marker_position' => 'before'
|
@@ -7,6 +7,7 @@ module Octopress
|
|
7
7
|
def self.compile_css(content)
|
8
8
|
configs = sass_converter.sass_configs
|
9
9
|
configs[:syntax] = :scss
|
10
|
+
configs[:style] = :compressed if Ink.config['compress_css']
|
10
11
|
|
11
12
|
Sass.compile(content, configs)
|
12
13
|
end
|
@@ -155,7 +156,13 @@ module Octopress
|
|
155
156
|
|
156
157
|
def self.write_combined_javascript
|
157
158
|
js = combine_javascripts
|
158
|
-
|
159
|
+
unless js == ''
|
160
|
+
if Ink.config['compress_js']
|
161
|
+
settings = Jekyll::Utils.symbolize_hash_keys(Ink.config['uglifier'])
|
162
|
+
js = Uglifier.new(settings).compile(js)
|
163
|
+
end
|
164
|
+
write_files(js, combined_javascript_path)
|
165
|
+
end
|
159
166
|
end
|
160
167
|
|
161
168
|
def self.write_files(source, dest)
|
@@ -163,6 +170,7 @@ module Octopress
|
|
163
170
|
end
|
164
171
|
|
165
172
|
def self.fingerprint(paths)
|
173
|
+
return '' if ENV['JEKYLL_ENV'] == 'test'
|
166
174
|
paths = [paths] unless paths.is_a? Array
|
167
175
|
Digest::MD5.hexdigest(paths.clone.map! { |path| "#{File.mtime(path).to_i}" }.join)
|
168
176
|
end
|
data/octopress-ink.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_runtime_dependency "jekyll", "~> 2.0"
|
22
|
+
spec.add_runtime_dependency "uglifier", "~> 2.5"
|
22
23
|
spec.add_runtime_dependency "autoprefixer-rails", "~> 1.1", ">= 1.1.20140403"
|
23
24
|
|
24
25
|
spec.add_development_dependency "octopress"
|
data/test/_combine_false.yml
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<strong>testing theme/files assets</strong>
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log 'dang'
|
@@ -0,0 +1 @@
|
|
1
|
+
$bg: white;
|
data/test/expected/index.html
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
console.log("bar"),console.log("omg")(function(){console.log("dang")}).call(this);
|
@@ -0,0 +1 @@
|
|
1
|
+
body{margin:2px;padding:2px}.main{color:#444}body{background:black}.plugin-widget{background:red;color:#fff}
|
@@ -0,0 +1 @@
|
|
1
|
+
*{background:none;color:#000}article a:after{content:attr(href)}
|
@@ -0,0 +1 @@
|
|
1
|
+
<strong>testing theme/files assets</strong>
|
@@ -0,0 +1,13 @@
|
|
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></title>
|
7
|
+
<meta name="viewport" content="width=device-width">
|
8
|
+
</head>
|
9
|
+
<body class=" ">
|
10
|
+
<p><strong>strong</strong> <em>emphasized</em> <a href="http://example.com">a link</a></p>
|
11
|
+
|
12
|
+
</body>
|
13
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
## Simple return
|
4
|
+
bar → bar
|
5
|
+
|
6
|
+
## Conditional return
|
7
|
+
bar → bar
|
8
|
+
'' → ''
|
9
|
+
|
10
|
+
## Ternary return
|
11
|
+
nope → nope
|
12
|
+
|
13
|
+
## Cascading return
|
14
|
+
nope → nope
|
15
|
+
bar → bar
|
16
|
+
|
17
|
+
## Test local variables
|
18
|
+
yep → yep
|
19
|
+
|
20
|
+
## Returns with filters
|
21
|
+
2013-07-21T18:59:00-05:00 → 2013-07-21T18:59:00-05:00
|
22
|
+
2013-07-21T18:59:00-05:00 → 2013-07-21T18:59:00-05:00
|
23
|
+
|
@@ -1 +1 @@
|
|
1
|
-
<strong>
|
1
|
+
<strong>testing theme/files assets</strong>
|
data/test/test.rb
CHANGED
@@ -1,175 +1,72 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
require '../lib/octopress-ink.rb'
|
1
|
+
require './test_suite'
|
2
|
+
ENV['JEKYLL_ENV'] = 'test'
|
4
3
|
|
5
|
-
@has_failed = false
|
6
4
|
@failures = []
|
7
5
|
|
8
|
-
def pout(str)
|
9
|
-
print str
|
10
|
-
$stdout.flush
|
11
|
-
end
|
12
|
-
|
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
|
22
|
-
else
|
23
|
-
@failures << "File: #{source_dir}/#{file}: No such file or directory."
|
24
|
-
@has_failed = true
|
25
|
-
pout "F".red
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_missing(file, dir)
|
30
|
-
if File.exist? File.join dir, file
|
31
|
-
@failures << "File #{file} should not exist".red
|
32
|
-
pout "F".red
|
33
|
-
@has_failed = true
|
34
|
-
else
|
35
|
-
pout ".".green
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def build(options={})
|
40
|
-
config = ['_config.yml'] << options[:config]
|
41
|
-
cmd = "rm -rf site && bundle exec jekyll build --config #{config.join(',')}"
|
42
|
-
#cmd += " --octopress-config #{options[:octopress_config]}" if options[:octopress_config]
|
43
|
-
if options[:octopress_config]
|
44
|
-
FileUtils.cp options[:octopress_config], '_octopress.yml'
|
45
|
-
end
|
46
|
-
`#{cmd}`
|
47
|
-
`rm _octopress.yml`
|
48
|
-
end
|
49
|
-
|
50
|
-
def diff_file(file, target_dir='expected', source_dir='site')
|
51
|
-
diff = `diff #{target_dir}/#{file} #{source_dir}/#{file}`
|
52
|
-
if diff.size > 0
|
53
|
-
@failures << <<-DIFF
|
54
|
-
Failure in #{file}
|
55
|
-
---------
|
56
|
-
#{diff.gsub(/\A.+?\n/,'').gsub(/^(<.+?)$/){|m| m.red}.gsub(/>.+/){|m| m.green}}
|
57
|
-
---------
|
58
|
-
DIFF
|
59
|
-
else
|
60
|
-
false
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_tags(dir)
|
65
|
-
tags = %w{content_for abort_false include assign capture wrap render filter}
|
66
|
-
tags.each { |file| test("test_tags/#{file}.html", dir) }
|
67
|
-
|
68
|
-
tags = %w{abort_true, abort_posts}
|
69
|
-
tags.each { |file| test_missing("test_tags/#{file}.html", 'site') }
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_pages(dir)
|
73
|
-
pages = %w{plugin_page plugin_page_override theme_page three}
|
74
|
-
pages.each { |file| test("test_pages/#{file}.html", dir) }
|
75
|
-
test("test_pages/feed/index.xml", dir)
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_post(dir)
|
79
|
-
test("2014/02/01/test-post.html", dir)
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_layouts(dir)
|
83
|
-
layouts = %w{local plugin_layout theme theme_override}
|
84
|
-
layouts.each { |file| test("test_layouts/#{file}.html", dir) }
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_configs(dir)
|
88
|
-
configs = %w{plugin_config theme_config}
|
89
|
-
configs.each { |file| test("test_config/#{file}.html", dir) }
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_stylesheets(dir, combine=true)
|
93
|
-
if combine
|
94
|
-
stylesheets = %w{all-* print-*}
|
95
|
-
stylesheets.each { |file| test("stylesheets/#{file}.css", dir) }
|
96
|
-
else
|
97
|
-
plugin_stylesheets = %w{plugin-media-test plugin-test}
|
98
|
-
plugin_stylesheets.each { |file| test("stylesheets/awesome-sauce/#{file}.css", dir) }
|
99
|
-
|
100
|
-
theme_stylesheets = %w{theme-media-test theme-test theme-test2}
|
101
|
-
theme_stylesheets.each { |file| test("stylesheets/theme/#{file}.css", dir) }
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_javascripts(dir, combine=true)
|
106
|
-
if combine
|
107
|
-
javascripts = %w{all-*}
|
108
|
-
javascripts.each { |file| test("javascripts/#{file}.js", dir) }
|
109
|
-
else
|
110
|
-
%w{bar foo}.each { |file| test("javascripts/theme/#{file}.js", dir) }
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def test_root_assets(dir)
|
115
|
-
root_assets = %w{favicon.ico favicon.png robots.txt}
|
116
|
-
root_assets.each { |file| test(file, dir) }
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_copy_assets(dir)
|
120
|
-
Find.find("#{dir}/_copy") do |file|
|
121
|
-
unless File.directory? file
|
122
|
-
test(file.sub("#{dir}"+"/", ''), dir, 'source')
|
123
|
-
end
|
124
|
-
end
|
125
|
-
`rm -rf source/_copy`
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_disabled(dir)
|
129
|
-
files = %w{
|
130
|
-
stylesheets/theme/disable-this.css
|
131
|
-
stylesheets/theme/disable.css
|
132
|
-
disable-test.html
|
133
|
-
test_pages/disable-test.html
|
134
|
-
javascripts/disable-this.js
|
135
|
-
fonts/font-one.otf
|
136
|
-
fonts/font-two.ttf
|
137
|
-
}
|
138
|
-
files.each { |file| test_missing(file, dir) }
|
139
|
-
end
|
140
|
-
|
141
|
-
def print_failures
|
142
|
-
puts "\n"
|
143
|
-
if @has_failed
|
144
|
-
@failures.each do |failure|
|
145
|
-
puts failure
|
146
|
-
end
|
147
|
-
abort
|
148
|
-
else
|
149
|
-
puts "All passed!".green
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
6
|
build
|
154
7
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
8
|
+
test_dirs('Site build', 'site', 'expected')
|
9
|
+
|
10
|
+
build({octopress_config: '_combine_false.yml'})
|
11
|
+
|
12
|
+
test_dirs("Don't combine CSS", 'site/stylesheets', 'combine_css_false/stylesheets')
|
13
|
+
test_dirs("Don't combine JS", 'site/javascripts', 'combine_js_false/javascripts')
|
14
|
+
|
15
|
+
build({octopress_config: '_compress_false.yml'})
|
16
|
+
|
17
|
+
test_dirs("Don't compress JS", 'site/javascripts', 'compress_false/javascripts')
|
18
|
+
test_dirs("Don't compress CSS", 'site/stylesheets', 'compress_false/stylesheets')
|
19
|
+
|
20
|
+
test_cmd({
|
21
|
+
desc: 'Copy all theme assets',
|
22
|
+
cmd: 'octopress ink copy theme --path _copy --force',
|
23
|
+
expect: 'Copied files:
|
24
|
+
+ source/_copy/layouts/default.html
|
25
|
+
+ source/_copy/layouts/test.html
|
26
|
+
+ source/_copy/includes/bar.html
|
27
|
+
+ source/_copy/includes/greet.html
|
28
|
+
+ source/_copy/pages/disable-test.html
|
29
|
+
+ source/_copy/pages/four.xml
|
30
|
+
+ source/_copy/pages/one.xml
|
31
|
+
+ source/_copy/pages/three.md
|
32
|
+
+ source/_copy/pages/two.md
|
33
|
+
+ source/_copy/stylesheets/_colors.scss
|
34
|
+
+ source/_copy/stylesheets/disable.sass
|
35
|
+
+ source/_copy/stylesheets/main.scss
|
36
|
+
+ source/_copy/stylesheets/disable-this.css
|
37
|
+
+ source/_copy/stylesheets/theme-media-test@print.css
|
38
|
+
+ source/_copy/stylesheets/theme-test.css
|
39
|
+
+ source/_copy/stylesheets/theme-test2.css
|
40
|
+
+ source/_copy/javascripts/bar.js
|
41
|
+
+ source/_copy/javascripts/disable-this.js
|
42
|
+
+ source/_copy/javascripts/foo.js
|
43
|
+
+ source/_copy/javascripts/blah.coffee
|
44
|
+
+ source/_copy/fonts/font-one.otf
|
45
|
+
+ source/_copy/fonts/font-two.ttf
|
46
|
+
+ source/_copy/files/disabled-file.txt
|
47
|
+
+ source/_copy/files/favicon.ico
|
48
|
+
+ source/_copy/files/favicon.png
|
49
|
+
+ source/_copy/files/test.html
|
50
|
+
+ source/_copy/config.yml'
|
51
|
+
})
|
52
|
+
|
53
|
+
test_dirs('Copy theme', 'source/_copy', 'copy_test/_copy')
|
54
|
+
`rm -rf source/_copy`
|
55
|
+
|
56
|
+
test_cmd({
|
57
|
+
desc: 'Copy theme layouts and pages',
|
58
|
+
cmd: 'octopress ink copy theme --layouts --pages --path _copy --force',
|
59
|
+
expect: 'Copied files:
|
60
|
+
+ source/_copy/layouts/default.html
|
61
|
+
+ source/_copy/layouts/test.html
|
62
|
+
+ source/_copy/pages/disable-test.html
|
63
|
+
+ source/_copy/pages/four.xml
|
64
|
+
+ source/_copy/pages/one.xml
|
65
|
+
+ source/_copy/pages/three.md
|
66
|
+
+ source/_copy/pages/two.md'
|
67
|
+
})
|
68
|
+
|
69
|
+
test_dirs('Copy theme', 'source/_copy', 'copy_layouts_pages/_copy')
|
70
|
+
`rm -rf source/_copy`
|
71
|
+
|
72
|
+
print_results
|
data/test/test_suite.rb
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
require 'colorator'
|
2
|
+
require 'find'
|
3
|
+
|
4
|
+
# This is a makeshift integration test-suite.
|
5
|
+
# It is unapologetically pragmatic.
|
6
|
+
|
7
|
+
|
8
|
+
# Build Jekyll
|
9
|
+
#
|
10
|
+
def build(options={})
|
11
|
+
if options[:octopress_config]
|
12
|
+
FileUtils.cp options[:octopress_config], '_octopress.yml'
|
13
|
+
end
|
14
|
+
|
15
|
+
config = ['_config.yml'] << options[:config]
|
16
|
+
cmd = "rm -rf site && bundle exec jekyll build --config #{config.join(',')}"
|
17
|
+
|
18
|
+
`#{cmd}`
|
19
|
+
`rm _octopress.yml` if options[:octopress_config]
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
# Find all files in a given directory
|
24
|
+
#
|
25
|
+
def dir_files(dir)
|
26
|
+
Find.find(dir).to_a.reject!{|f| File.directory?(f) }
|
27
|
+
end
|
28
|
+
|
29
|
+
# Recursively diff two directories
|
30
|
+
#
|
31
|
+
# This will walk through dir1 and diff matching paths in dir2
|
32
|
+
#
|
33
|
+
def test_dirs(desc, dir1, dir2)
|
34
|
+
|
35
|
+
test_missing_files(desc, dir1, dir2)
|
36
|
+
|
37
|
+
dir_files(dir1).each do |file|
|
38
|
+
file2 = file.sub(dir1, dir2)
|
39
|
+
if File.exist?(file2)
|
40
|
+
if diff = diff_file(file, file2)
|
41
|
+
@failures << {
|
42
|
+
desc: "#{desc}\nDiff of file: #{file.sub(dir1+'/', '')}\n",
|
43
|
+
result: format_diff(diff)
|
44
|
+
}
|
45
|
+
pout 'F'.red
|
46
|
+
else
|
47
|
+
pout '.'.green
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def format_diff(diff)
|
54
|
+
"#{diff.gsub(/\A.+?\n/,'').gsub(/^[^><].+/,'---').gsub(/^>.+/){|m|
|
55
|
+
m.green
|
56
|
+
}.gsub(/^(<.+?)$/){ |m|
|
57
|
+
m.red
|
58
|
+
}}"
|
59
|
+
end
|
60
|
+
|
61
|
+
# List differences between files in two directories
|
62
|
+
#
|
63
|
+
def test_missing_files(desc, dir1, dir2)
|
64
|
+
files1 = dir_files(dir1).map {|f| f.sub(dir1,'') }
|
65
|
+
files2 = dir_files(dir2).map {|f| f.sub(dir2,'') }
|
66
|
+
|
67
|
+
missing = []
|
68
|
+
|
69
|
+
(files2 - files1).each do |file|
|
70
|
+
missing << File.join(dir1, file)
|
71
|
+
end
|
72
|
+
|
73
|
+
(files1 - files2).each do |file|
|
74
|
+
missing << File.join(dir2, file)
|
75
|
+
end
|
76
|
+
|
77
|
+
if !missing.empty?
|
78
|
+
@failures << {
|
79
|
+
desc: "#{desc}\nMissing files:\n",
|
80
|
+
result: " - " + missing.join("\n - ")
|
81
|
+
}
|
82
|
+
|
83
|
+
pout 'F'.red
|
84
|
+
else
|
85
|
+
pout '.'.green
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Diff two files
|
90
|
+
#
|
91
|
+
def diff_file(file1, file2)
|
92
|
+
diff = `diff #{file1} #{file2}`
|
93
|
+
if diff.size > 0
|
94
|
+
diff
|
95
|
+
else
|
96
|
+
false
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Test command output
|
101
|
+
#
|
102
|
+
# Input: options hash, format:
|
103
|
+
# {
|
104
|
+
# desc: description of task
|
105
|
+
# cmd: system command to be run, (String or Array)
|
106
|
+
# expect: expected output from command
|
107
|
+
# }
|
108
|
+
#
|
109
|
+
def test_cmd(options)
|
110
|
+
if cmd = options[:cmd]
|
111
|
+
cmd = [cmd] unless cmd.is_a? Array
|
112
|
+
|
113
|
+
# In debug mode command output is printed
|
114
|
+
#
|
115
|
+
if options[:debug]
|
116
|
+
system cmd.join('; ')
|
117
|
+
else
|
118
|
+
output = `#{cmd.join('; ')}`.gsub(/#{Dir.pwd}\/*/,'').strip
|
119
|
+
|
120
|
+
# Remove character color codes
|
121
|
+
output = output.gsub("\e",'').gsub(/\[\d+m/,'').gsub("\[0m",'')
|
122
|
+
end
|
123
|
+
if options[:expect] && options[:expect].strip == output
|
124
|
+
pout '.'.green
|
125
|
+
else
|
126
|
+
pout 'F'.red
|
127
|
+
@failures << {
|
128
|
+
desc: options[:desc]+"\n",
|
129
|
+
result: <<-HERE
|
130
|
+
expected: #{(options[:expect] || '').strip.green}
|
131
|
+
result: #{(output || '').strip.red}
|
132
|
+
HERE
|
133
|
+
}
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
# Print a single character without a newline
|
140
|
+
#
|
141
|
+
def pout(str)
|
142
|
+
print str
|
143
|
+
$stdout.flush
|
144
|
+
end
|
145
|
+
|
146
|
+
# Ouptut nicely formatted failure messages
|
147
|
+
#
|
148
|
+
def print_results
|
149
|
+
if !@failures.empty?
|
150
|
+
@failures.each do |test|
|
151
|
+
pout "\nFailed: #{test[:desc]}"
|
152
|
+
puts test[:result]
|
153
|
+
# print a newline for easier reading
|
154
|
+
puts ""
|
155
|
+
end
|
156
|
+
abort
|
157
|
+
else
|
158
|
+
puts "All passed!".green
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
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.
|
4
|
+
version: 1.0.0.rc.1
|
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-05-
|
11
|
+
date: 2014-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: uglifier
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.5'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: autoprefixer-rails
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,21 +187,20 @@ files:
|
|
173
187
|
- octopress-ink.gemspec
|
174
188
|
- test/Gemfile
|
175
189
|
- test/_combine_false.yml
|
190
|
+
- test/_compress_false.yml
|
176
191
|
- test/_config.yml
|
177
|
-
- test/combine_css/stylesheets/all-e10f647557c9d610df6df40a458bc823.css
|
178
|
-
- test/combine_css/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css
|
179
192
|
- test/combine_css_false/stylesheets/awesome-sauce/plugin-media-test.css
|
180
193
|
- test/combine_css_false/stylesheets/awesome-sauce/plugin-test.css
|
181
|
-
- test/combine_css_false/stylesheets/
|
182
|
-
- test/combine_css_false/stylesheets/test.css
|
194
|
+
- test/combine_css_false/stylesheets/theme/main.css
|
183
195
|
- test/combine_css_false/stylesheets/theme/theme-media-test.css
|
184
196
|
- test/combine_css_false/stylesheets/theme/theme-test.css
|
185
197
|
- test/combine_css_false/stylesheets/theme/theme-test2.css
|
186
|
-
- test/combine_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js
|
187
|
-
- test/combine_js_false/javascripts/site.js
|
188
|
-
- test/combine_js_false/javascripts/test.js
|
189
198
|
- test/combine_js_false/javascripts/theme/bar.js
|
199
|
+
- test/combine_js_false/javascripts/theme/blah.js
|
190
200
|
- test/combine_js_false/javascripts/theme/foo.js
|
201
|
+
- test/compress_false/javascripts/all-.js
|
202
|
+
- test/compress_false/stylesheets/all-.css
|
203
|
+
- test/compress_false/stylesheets/print-.css
|
191
204
|
- test/copy_layouts_pages/_copy/layouts/default.html
|
192
205
|
- test/copy_layouts_pages/_copy/layouts/test.html
|
193
206
|
- test/copy_layouts_pages/_copy/pages/disable-test.html
|
@@ -195,14 +208,17 @@ files:
|
|
195
208
|
- test/copy_layouts_pages/_copy/pages/one.xml
|
196
209
|
- test/copy_layouts_pages/_copy/pages/three.md
|
197
210
|
- test/copy_layouts_pages/_copy/pages/two.md
|
211
|
+
- test/copy_test/_copy/config.yml
|
198
212
|
- test/copy_test/_copy/files/disabled-file.txt
|
199
213
|
- test/copy_test/_copy/files/favicon.ico
|
200
214
|
- test/copy_test/_copy/files/favicon.png
|
215
|
+
- test/copy_test/_copy/files/test.html
|
201
216
|
- test/copy_test/_copy/fonts/font-one.otf
|
202
217
|
- test/copy_test/_copy/fonts/font-two.ttf
|
203
218
|
- test/copy_test/_copy/includes/bar.html
|
204
219
|
- test/copy_test/_copy/includes/greet.html
|
205
220
|
- test/copy_test/_copy/javascripts/bar.js
|
221
|
+
- test/copy_test/_copy/javascripts/blah.coffee
|
206
222
|
- test/copy_test/_copy/javascripts/disable-this.js
|
207
223
|
- test/copy_test/_copy/javascripts/foo.js
|
208
224
|
- test/copy_test/_copy/layouts/default.html
|
@@ -212,6 +228,7 @@ files:
|
|
212
228
|
- test/copy_test/_copy/pages/one.xml
|
213
229
|
- test/copy_test/_copy/pages/three.md
|
214
230
|
- test/copy_test/_copy/pages/two.md
|
231
|
+
- test/copy_test/_copy/stylesheets/_colors.scss
|
215
232
|
- test/copy_test/_copy/stylesheets/disable-this.css
|
216
233
|
- test/copy_test/_copy/stylesheets/disable.sass
|
217
234
|
- test/copy_test/_copy/stylesheets/main.scss
|
@@ -223,11 +240,16 @@ files:
|
|
223
240
|
- test/expected/favicon.png
|
224
241
|
- test/expected/four/index.xml
|
225
242
|
- test/expected/index.html
|
243
|
+
- test/expected/javascripts/all-.js
|
226
244
|
- test/expected/robots.txt
|
245
|
+
- test/expected/stylesheets/all-.css
|
246
|
+
- test/expected/stylesheets/print-.css
|
247
|
+
- test/expected/test.html
|
227
248
|
- test/expected/test_config/plugin_config.html
|
228
249
|
- test/expected/test_config/theme_config.html
|
229
250
|
- test/expected/test_layouts/local.html
|
230
251
|
- test/expected/test_layouts/plugin_layout.html
|
252
|
+
- test/expected/test_layouts/test_markdown.html
|
231
253
|
- test/expected/test_layouts/theme.html
|
232
254
|
- test/expected/test_layouts/theme_override.html
|
233
255
|
- test/expected/test_pages/feed/index.xml
|
@@ -242,6 +264,7 @@ files:
|
|
242
264
|
- test/expected/test_tags/filter.html
|
243
265
|
- test/expected/test_tags/include.html
|
244
266
|
- test/expected/test_tags/render.html
|
267
|
+
- test/expected/test_tags/return.html
|
245
268
|
- test/expected/test_tags/wrap.html
|
246
269
|
- test/plugins/awesome-sauce/config.yml
|
247
270
|
- test/plugins/awesome-sauce/docs/index.html
|
@@ -318,6 +341,8 @@ files:
|
|
318
341
|
- test/source/test_tags/return.html
|
319
342
|
- test/source/test_tags/wrap.html
|
320
343
|
- test/test.rb
|
344
|
+
- test/test_suite.rb
|
345
|
+
- test/uglify_js_false/javascripts/all-.js
|
321
346
|
homepage: https://github.com/octopress/ink
|
322
347
|
licenses:
|
323
348
|
- MIT
|
@@ -345,21 +370,20 @@ summary: A starting point for creating gem-based Jekyll themes and plugins
|
|
345
370
|
test_files:
|
346
371
|
- test/Gemfile
|
347
372
|
- test/_combine_false.yml
|
373
|
+
- test/_compress_false.yml
|
348
374
|
- test/_config.yml
|
349
|
-
- test/combine_css/stylesheets/all-e10f647557c9d610df6df40a458bc823.css
|
350
|
-
- test/combine_css/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css
|
351
375
|
- test/combine_css_false/stylesheets/awesome-sauce/plugin-media-test.css
|
352
376
|
- test/combine_css_false/stylesheets/awesome-sauce/plugin-test.css
|
353
|
-
- test/combine_css_false/stylesheets/
|
354
|
-
- test/combine_css_false/stylesheets/test.css
|
377
|
+
- test/combine_css_false/stylesheets/theme/main.css
|
355
378
|
- test/combine_css_false/stylesheets/theme/theme-media-test.css
|
356
379
|
- test/combine_css_false/stylesheets/theme/theme-test.css
|
357
380
|
- test/combine_css_false/stylesheets/theme/theme-test2.css
|
358
|
-
- test/combine_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js
|
359
|
-
- test/combine_js_false/javascripts/site.js
|
360
|
-
- test/combine_js_false/javascripts/test.js
|
361
381
|
- test/combine_js_false/javascripts/theme/bar.js
|
382
|
+
- test/combine_js_false/javascripts/theme/blah.js
|
362
383
|
- test/combine_js_false/javascripts/theme/foo.js
|
384
|
+
- test/compress_false/javascripts/all-.js
|
385
|
+
- test/compress_false/stylesheets/all-.css
|
386
|
+
- test/compress_false/stylesheets/print-.css
|
363
387
|
- test/copy_layouts_pages/_copy/layouts/default.html
|
364
388
|
- test/copy_layouts_pages/_copy/layouts/test.html
|
365
389
|
- test/copy_layouts_pages/_copy/pages/disable-test.html
|
@@ -367,14 +391,17 @@ test_files:
|
|
367
391
|
- test/copy_layouts_pages/_copy/pages/one.xml
|
368
392
|
- test/copy_layouts_pages/_copy/pages/three.md
|
369
393
|
- test/copy_layouts_pages/_copy/pages/two.md
|
394
|
+
- test/copy_test/_copy/config.yml
|
370
395
|
- test/copy_test/_copy/files/disabled-file.txt
|
371
396
|
- test/copy_test/_copy/files/favicon.ico
|
372
397
|
- test/copy_test/_copy/files/favicon.png
|
398
|
+
- test/copy_test/_copy/files/test.html
|
373
399
|
- test/copy_test/_copy/fonts/font-one.otf
|
374
400
|
- test/copy_test/_copy/fonts/font-two.ttf
|
375
401
|
- test/copy_test/_copy/includes/bar.html
|
376
402
|
- test/copy_test/_copy/includes/greet.html
|
377
403
|
- test/copy_test/_copy/javascripts/bar.js
|
404
|
+
- test/copy_test/_copy/javascripts/blah.coffee
|
378
405
|
- test/copy_test/_copy/javascripts/disable-this.js
|
379
406
|
- test/copy_test/_copy/javascripts/foo.js
|
380
407
|
- test/copy_test/_copy/layouts/default.html
|
@@ -384,6 +411,7 @@ test_files:
|
|
384
411
|
- test/copy_test/_copy/pages/one.xml
|
385
412
|
- test/copy_test/_copy/pages/three.md
|
386
413
|
- test/copy_test/_copy/pages/two.md
|
414
|
+
- test/copy_test/_copy/stylesheets/_colors.scss
|
387
415
|
- test/copy_test/_copy/stylesheets/disable-this.css
|
388
416
|
- test/copy_test/_copy/stylesheets/disable.sass
|
389
417
|
- test/copy_test/_copy/stylesheets/main.scss
|
@@ -395,11 +423,16 @@ test_files:
|
|
395
423
|
- test/expected/favicon.png
|
396
424
|
- test/expected/four/index.xml
|
397
425
|
- test/expected/index.html
|
426
|
+
- test/expected/javascripts/all-.js
|
398
427
|
- test/expected/robots.txt
|
428
|
+
- test/expected/stylesheets/all-.css
|
429
|
+
- test/expected/stylesheets/print-.css
|
430
|
+
- test/expected/test.html
|
399
431
|
- test/expected/test_config/plugin_config.html
|
400
432
|
- test/expected/test_config/theme_config.html
|
401
433
|
- test/expected/test_layouts/local.html
|
402
434
|
- test/expected/test_layouts/plugin_layout.html
|
435
|
+
- test/expected/test_layouts/test_markdown.html
|
403
436
|
- test/expected/test_layouts/theme.html
|
404
437
|
- test/expected/test_layouts/theme_override.html
|
405
438
|
- test/expected/test_pages/feed/index.xml
|
@@ -414,6 +447,7 @@ test_files:
|
|
414
447
|
- test/expected/test_tags/filter.html
|
415
448
|
- test/expected/test_tags/include.html
|
416
449
|
- test/expected/test_tags/render.html
|
450
|
+
- test/expected/test_tags/return.html
|
417
451
|
- test/expected/test_tags/wrap.html
|
418
452
|
- test/plugins/awesome-sauce/config.yml
|
419
453
|
- test/plugins/awesome-sauce/docs/index.html
|
@@ -490,3 +524,5 @@ test_files:
|
|
490
524
|
- test/source/test_tags/return.html
|
491
525
|
- test/source/test_tags/wrap.html
|
492
526
|
- test/test.rb
|
527
|
+
- test/test_suite.rb
|
528
|
+
- test/uglify_js_false/javascripts/all-.js
|
@@ -1 +0,0 @@
|
|
1
|
-
body{display:table}body{background:#aaa111}div{display:table}
|
@@ -1 +0,0 @@
|
|
1
|
-
.css-plugin { background: #fed; }
|
@@ -1 +0,0 @@
|
|
1
|
-
console.log('local js')
|