8000 Sync changes from upstream repository · fangj99/developer.github.com@ead0f50 · GitHub
[go: up one dir, main page]

Skip to content

Commit ead0f50

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent 218f6d1 commit ead0f50

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

spec/content/blog_date_spec.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
require 'spec_helper'
22

33
describe 'Blog Date' do
4-
before do
5-
@posts = `git diff --name-only --diff-filter=ACMRTUXB master... | grep .md`.split("\n")
6-
end
7-
84
it 'is not in the past' do
9-
@posts.each do |post|
5+
posts.each do |post|
106
matches = post.match(%r{(\d{4}-\d{2}-\d{2})-})
117
next unless matches
128

spec/spec_helper.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@
1111

1212
Dir.glob('tasks/*.rake').each { |r| load r}
1313

14+
# All the blog posts we're interested in checking. This means we're looking at
15+
# files that have changed on this particular branch we're on.
16+
#
17+
# Returns an Array of String filenames.
18+
def posts
19+
return @posts if defined? @posts
20+
21+
diffable_files = `git diff -z --name-only --diff-filter=ACMRTUXB origin/master`.split("\0")
22+
23+
@posts = diffable_files.select do |filename|
24+
ext = File.extname(filename)
25+
ext == ".md" || ext == ".html"
26+
end
27+
end
28+
1429
# this does the file serving
1530
class ImplictIndex
1631
def initialize(root)

0 commit comments

Comments
 (0)
0