FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
developer.github.com/Rakefile at master · GoProjectOwner/developer.github.com · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
GoProjectOwner
/
developer.github.com
Public
forked from
github/developer.github.com
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
developer.github.com
/
Rakefile
Copy path
More file actions
More file actions
Latest commit
History
History
History
83 lines (71 loc) · 2.42 KB
Breadcrumbs
developer.github.com
/
Rakefile
Copy path
File metadata and controls
83 lines (71 loc) · 2.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
require_relative
'lib/resources'
require
'tmpdir'
task
:default
=>
[
:test
]
desc
'Builds the site'
task
:build
do
if
ENV
[
'RACK_ENV'
]
==
'test'
begin
sh
'node_modules/gulp/bin/gulp.js build > build.txt'
rescue
StandardError
=>
e
puts
'uh oh'
$stderr
.
puts
`cat build.txt`
raise
e
end
else
sh
'node_modules/gulp/bin/gulp.js build'
end
end
desc
"Test the output"
task
:test
=>
[
:remove_tmp_dir
,
:remove_output_dir
,
:build
,
:run_proofer
]
desc
"Run the HTML-Proofer"
task
:run_proofer
do
require
'html/proofer'
ignored_links
=
[
%r{www.w3.org}
]
latest_ent_version
=
GitHub
::
Resources
::
Helpers
::
CONTENT
[
'LATEST_ENTERPRISE_VERSION'
]
# swap versionless Enterprise articles with versioned paths
href_swap
=
{
%r{help
\.
github
\.
com/enterprise/admin/}
=>
"help.github.com/enterprise/
#{
latest_ent_version
}
/admin/"
,
%r{help
\.
github
\.
com/enterprise/user/}
=>
"help.github.com/enterprise/
#{
latest_ent_version
}
/user/"
}
HTML
::
Proofer
.
new
(
"./output"
,
:href_ignore
=>
ignored_links
,
:href_swap
=>
href_swap
)
.
run
end
desc
"Remove the tmp dir"
task
:remove_tmp_dir
do
FileUtils
.
rm_r
(
'tmp'
)
if
File
.
exist?
(
'tmp'
)
end
desc
"Remove the output dir"
task
:remove_output_dir
do
FileUtils
.
rm_r
(
'output'
)
if
File
.
exist?
(
'output'
)
end
# Prompt user for a commit message; default: P U B L I S H :emoji:
def
commit_message
(
no_commit_msg
=
false
)
publish_emojis
=
[
':boom:'
,
':rocket:'
,
':metal:'
,
':bulb:'
,
':zap:'
,
':sailboat:'
,
':gift:'
,
':ship:'
,
':shipit:'
,
':sparkles:'
,
':rainbow:'
]
default_message
=
"P U B L I S H
#{
publish_emojis
.
sample
}
"
unless
no_commit_msg
print
"Enter a commit message (default: '
#{
default_message
}
'): "
STDOUT
.
flush
mesg
=
STDIN
.
gets
.
chomp
.
strip
end
mesg
=
default_message
if
mesg
.
nil?
||
mesg
==
''
mesg
.
gsub
(
/'/
,
''
)
# Allow this to be handed off via -m '#{message}'
end
namespace
:assets
do
task
:precompile
=>
[
:build
]
do
sh
'mv output _site/'
end
end
desc
"Publish to http://developer.github.com"
task
:publish
,
[
:no_commit_msg
]
=>
[
:remove_tmp_dir
,
:remove_output_dir
,
:build
]
do
|
t
,
args
|
message
=
commit_message
(
args
[
:no_commit_msg
]
)
Dir
.
mktmpdir
do
|
tmp
|
system
"mv output/*
#{
tmp
}
"
system
"cp .gitignore
#{
tmp
}
"
system
'git checkout gh-pages'
system
"rsync -av
#{
tmp
}
/ ."
system
'git add .'
system
"git commit -am
#{
message
.
shellescape
}
"
system
'git push origin gh-pages --force'
system
'git checkout master'
end
end
Back
|
FazBrowse Home
|
New Git URL