FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
documentcloud/lib/tasks/build.rake at diffdocs · documentcloud/documentcloud · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Mar 11, 2021. It is now read-only.
documentcloud
/
documentcloud
Public archive
Notifications
You must be signed in to change notification settings
Fork
157
Star
425
Code
Issues
194
Pull requests
16
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
documentcloud
/
lib
/
tasks
/
build.rake
Copy path
More file actions
More file actions
Latest commit
History
History
History
97 lines (81 loc) · 3.14 KB
Breadcrumbs
documentcloud
/
lib
/
tasks
/
build.rake
Copy path
File metadata and controls
97 lines (81 loc) · 3.14 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
namespace
:build
do
BACKBONE
=
'../backbone/backbone.js'
UNDERSCORE
=
'../underscore/underscore.js'
VISUALSEARCH_JS
=
'../visualsearch/build/visualsearch.js'
VISUALSEARCH_CSS
=
'../visualsearch/build/visualsearch.css'
# Figure out the version number of a JS source file.
def
get_version
(
string
)
string
.
match
(
/VERSION = '(
\S
+)'/
)
[
1
]
end
# Pull in a new build of Backbone.
task
:backbone
do
version
=
get_version
File
.
read
BACKBONE
FileUtils
.
cp
BACKBONE
,
"public/javascripts/vendor/backbone-
#{
version
}
.js"
,
:verbose
=>
true
end
# Pull in a new build of Underscore.
task
:underscore
do
version
=
get_version
File
.
read
UNDERSCORE
FileUtils
.
cp
UNDERSCORE
,
"public/javascripts/vendor/underscore-
#{
version
}
.js"
,
:verbose
=>
true
end
# Pull in a new build of VisualSearch.
task
:visualsearch
do
version
=
get_version
File
.
read
VISUALSEARCH_JS
FileUtils
.
cp
VISUALSEARCH_JS
,
"public/javascripts/vendor/visualsearch-
#{
version
}
.js"
,
:verbose
=>
true
FileUtils
.
cp
VISUALSEARCH_CSS
,
"public/stylesheets/vendor/"
,
:verbose
=>
true
# Fix image url paths.
File
.
open
(
'public/stylesheets/vendor/visualsearch.css'
,
'r+'
)
do
|
file
|
css
=
file
.
read
css
.
gsub!
(
/url
\(
(.*?)images
\/
embed
\/
icons/
,
'url(../../images/embed/icons'
)
file
.
rewind
file
.
write
(
css
)
file
.
truncate
(
css
.
length
)
end
end
# Pull in a new build of the Document Viewer.
task
:viewer
do
Dir
.
chdir
'../document-viewer'
FileUtils
.
rm_r
(
'build'
)
if
File
.
exists?
(
'build'
)
sh
"jammit -f -o build"
sh
"rm build/*.gz"
Dir
[
'build/*.css'
]
.
each
do
|
css_file
|
File
.
open
(
css_file
,
'r+'
)
do
|
file
|
css
=
file
.
read
css
.
gsub!
(
/(
\.
\.
\/
)+images/
,
'images'
)
file
.
rewind
file
.
write
(
css
)
file
.
truncate
(
css
.
length
)
end
end
FileUtils
.
cp_r
(
'public/images'
,
'build/images'
)
# Export back to DocumentCloud
FileUtils
.
cp_r
(
'build/images'
,
'../documentcloud/public/viewer'
)
`cat build/viewer.js build/templates.js > build/viewer_new.js`
FileUtils
.
rm_r
(
[
'build/viewer.js'
,
'build/templates.js'
]
)
FileUtils
.
mv
'build/viewer_new.js'
,
'build/viewer.js'
FileUtils
.
cp
'build/print.css'
,
"../documentcloud/public/viewer/printviewer.css"
Dir
[
'build/viewer*'
]
.
each
do
|
asset
|
FileUtils
.
cp
(
asset
,
"../documentcloud/public/viewer/
#{
File
.
basename
(
asset
)
}
"
)
end
FileUtils
.
rm_r
(
'build'
)
if
File
.
exists?
(
'build'
)
end
[
:search_embed
,
:note_embed
]
.
each
do
|
embed
|
task
embed
do
FileUtils
.
rm_r
(
'build'
)
if
File
.
exists?
(
'build'
)
sh
"jammit -f -o build -c config/
#{
embed
}
_assets.yml"
sh
"rm build/*.gz"
Dir
[
'build/*.css'
]
.
each
do
|
css_file
|
File
.
open
(
css_file
,
'r+'
)
do
|
file
|
css
=
file
.
read
css
.
gsub!
(
"/images/
#{
embed
}
"
,
'images'
)
file
.
rewind
file
.
write
(
css
)
file
.
truncate
(
css
.
length
)
end
end
FileUtils
.
cp_r
(
"public/images/
#{
embed
}
"
,
'build/images'
)
FileUtils
.
rm_r
(
"public/
#{
embed
}
"
)
if
File
.
exists?
(
"public/
#{
embed
}
"
)
FileUtils
.
cp_r
(
'build'
,
"public/
#{
embed
}
"
)
FileUtils
.
rm_r
(
'build'
)
if
File
.
exists?
(
'build'
)
end
end
end
Back
|
FazBrowse Home
|
New Git URL