FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
developer.github.com/tasks/enterprise.rake at master · TrinityComputers/developer.github.com · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
TrinityComputers
/
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
/
tasks
/
enterprise.rake
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (38 loc) · 1.42 KB
Breadcrumbs
developer.github.com
/
tasks
/
enterprise.rake
Copy path
File metadata and controls
48 lines (38 loc) · 1.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
require
'nokogiri'
def
setup
`git checkout gh-pages`
`git pull origin gh-pages`
`git checkout -b
#{
BRANCH_NAME
}
`
end
# we need to point links not to the root, but to the enterprise version root
# for assets and links
def
rewrite_content
(
path
)
Dir
.
glob
(
"
#{
path
}
/**/*.html"
)
do
|
html_file
|
doc
=
Nokogiri
::
HTML
(
File
.
read
(
html_file
)
)
# add '.enterprise' to `@class` in `body`
body
=
doc
.
search
(
'body'
)
.
first
unless
body
.
nil?
classes
=
body
.
get_attribute
(
'class'
)
.
to_s
.
split
(
' '
)
body
.
set_attribute
(
'class'
,
classes
.
push
(
'enterprise'
)
.
uniq
.
join
(
' '
)
)
end
doc
.
css
(
'a'
)
.
each
do
|
a
|
a
[
'href'
]
=
"/enterprise/
#{
VERSION
}
#{
a
[
'href'
]
}
"
if
a
[
'href'
]
=~
/^
\/
/
end
doc
.
css
(
'link'
)
.
each
do
|
link
|
link
[
'href'
]
=
"/enterprise/
#{
VERSION
}
#{
link
[
'href'
]
}
"
if
link
[
'href'
]
=~
/^
\/
/
end
doc
.
css
(
'script'
)
.
each
do
|
script
|
script
[
'src'
]
=
"/enterprise/
#{
VERSION
}
#{
script
[
'src'
]
}
"
if
script
[
'src'
]
=~
/^
\/
/
end
doc
.
css
(
'img'
)
.
each
do
|
img
|
img
[
'src'
]
=
"/enterprise/
#{
VERSION
}
#{
img
[
'src'
]
}
"
if
img
[
'src'
]
=~
/^
\/
/
end
doc
.
search
(
'//*[@class="not-enterprise"]'
)
.
remove
File
.
open
(
html_file
,
'w'
)
{
|
file
|
file
.
write
(
doc
.
to_html
)
}
end
Dir
.
glob
(
"
#{
path
}
/**/*.css"
)
do
|
css_file
|
contents
=
File
.
read
(
css_file
)
contents
.
gsub!
(
/url
\(
\/
shared/
,
"url(/enterprise/
#{
VERSION
}
/shared"
)
File
.
open
(
css_file
,
'w'
)
{
|
file
|
file
.
write
(
contents
)
}
end
end
Back
|
FazBrowse Home
|
New Git URL