octopress 3.0.0.rc.15 → 3.0.0.rc.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.clash.yml +159 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/README.md +11 -144
- data/assets/docs/index.md +187 -0
- data/bin/octopress +0 -2
- data/lib/octopress.rb +10 -6
- data/lib/octopress/commands/isolate.rb +31 -0
- data/lib/octopress/commands/new.rb +2 -1
- data/lib/octopress/isolate.rb +108 -0
- data/lib/octopress/scaffold.rb +2 -1
- data/lib/octopress/version.rb +1 -1
- data/octopress.gemspec +2 -1
- data/test/Gemfile +1 -2
- data/test/_config.yml +3 -0
- data/test/{expected → _expected/blank}/_config.yml +0 -0
- data/test/{expected → _expected/blank}/_octopress.yml +0 -0
- data/test/{expected → _expected/blank}/_templates/draft +0 -0
- data/test/{expected → _expected/blank}/_templates/page +0 -0
- data/test/{expected → _expected/blank}/_templates/post +0 -0
- data/test/{expected/_site → _expected/blank}/index.html +0 -0
- data/test/_expected/integrate/_posts/2011-11-11-a-random-post.markdown +6 -0
- data/test/_expected/integrate/_posts/2012-11-11-another-random-post.markdown +6 -0
- data/test/_expected/integrate/_posts/2013-11-11-this-post-is-happy.markdown +6 -0
- data/test/_expected/isolate-path/_posts/2011-11-11-a-random-post.markdown +6 -0
- data/test/_expected/isolate-path/_posts/_exile/2012-11-11-another-random-post.markdown +6 -0
- data/test/_expected/isolate-path/_posts/_exile/2013-11-11-this-post-is-happy.markdown +6 -0
- data/test/_expected/isolate-search/_posts/2011-11-11-a-random-post.markdown +6 -0
- data/test/_expected/isolate-search/_posts/2012-11-11-another-random-post.markdown +6 -0
- data/test/_expected/isolate-search/_posts/_exile/2013-11-11-this-post-is-happy.markdown +6 -0
- data/test/_expected/isolate/_posts/2013-11-11-this-post-is-happy.markdown +6 -0
- data/test/_expected/isolate/_posts/_exile/2011-11-11-a-random-post.markdown +6 -0
- data/test/_expected/isolate/_posts/_exile/2012-11-11-another-random-post.markdown +6 -0
- data/test/{expected/_posts/2014-03-11-idea.markdown → _expected/new-draft-slug/_drafts/idea.markdown} +0 -1
- data/test/{expected/_drafts/stupid-idea.markdown → _expected/new-draft/_drafts/some-cool-idea.markdown} +1 -1
- data/test/{expected/date-page.html → _expected/new-page-date/pages/awesome-page.html} +1 -1
- data/test/{expected/awesome-page.html → _expected/new-page-extension/pages/awesome-page.md} +0 -0
- data/test/_expected/new-page-index/pages/index.html +5 -0
- data/test/{expected/custom-template-page.html → _expected/new-page-template/pages/awesome-page.html} +1 -1
- data/test/_expected/new-page/pages/awesome-page.html +5 -0
- data/test/{expected → _expected/new-post-dir}/_posts/stuff/2014-02-11-some-stuff.markdown +0 -0
- data/test/{expected → _expected/new-post-slug}/_posts/2014-03-13-awesome.markdown +0 -0
- data/test/{expected → _expected/new-post}/_posts/2014-03-12-awesome-stuff.markdown +0 -0
- data/test/_expected/publish-draft-date/_posts/2014-03-11-some-cool-idea.markdown +6 -0
- data/test/_expected/publish-draft-dir/_posts/ideas/2014-03-10-some-cool-idea.markdown +6 -0
- data/test/_expected/publish-draft/_posts/2014-03-10-some-cool-idea.markdown +6 -0
- data/test/_layouts/page.html +1 -0
- data/test/_layouts/post.html +1 -0
- data/test/_octopress.yml +11 -0
- data/test/{expected/_templates/other_page → _templates/draft} +0 -1
- data/test/_templates/page +4 -0
- data/test/{expected/_templates/date_page → _templates/post} +0 -0
- metadata +100 -81
- data/lib/octopress/commands/build.rb +0 -19
- data/lib/octopress/commands/doctor.rb +0 -20
- data/lib/octopress/commands/serve.rb +0 -30
- data/test/expected/_layouts/page.html +0 -1
- data/test/expected/_layouts/post.html +0 -1
- data/test/expected/_posts/2014-02-10-another-idea.markdown +0 -6
- data/test/expected/_posts/ideas/2014-02-13-yet-another-idea.markdown +0 -6
- data/test/expected/_site/2014/02/10/another-idea.html +0 -2
- data/test/expected/_site/2014/02/11/some-stuff.html +0 -2
- data/test/expected/_site/2014/02/13/yet-another-idea.html +0 -2
- data/test/expected/_site/2014/03/11/idea.html +0 -2
- data/test/expected/_site/2014/03/12/awesome-stuff.html +0 -2
- data/test/expected/_site/2014/03/13/awesome.html +0 -2
- data/test/expected/_site/awesome-page.html +0 -1
- data/test/expected/_site/cool-page.html +0 -1
- data/test/expected/_site/custom-template-page.html +0 -1
- data/test/expected/_site/date-page.html +0 -1
- data/test/expected/_site/okay-page/index.html +0 -1
- data/test/expected/cool-page.html +0 -5
- data/test/expected/index.html +0 -0
- data/test/expected/okay-page/index.html +0 -5
- data/test/test.rb +0 -162
- data/test/test_suite.rb +0 -161
data/test/test_suite.rb
DELETED
@@ -1,161 +0,0 @@
|
|
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
|
-
|