Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F212
new-site-in-source-templates-generator
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
dereckson
Nov 23 2014, 21:29
2014-11-23 21:29:27 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
new-site-in-source-templates-generator
View Options
#!/bin/sh
#
# Nasqueron Tools helper script
#
# Handles a new site on wikimedia/write/sourcetemplatesgenerator
#
# Usage: new-site-in-source-templates-generator http://www.domain.tld/ ClassNameForDomain
#
BASE
=
/home/dereckson/dev/nasqueron/tools
DIR
=
$BASE
/packages/source-templates-generator
TEMPLATE
=
$BASE
/support/ClassExtendingPage.tmpl
INDEX
=
$DIR
/pages/index.dat
# Checks arguments
if
[
$#
-eq
2
]
;
then
if
[
$(
echo
$1
|
grep -E
"^https?://.*?/
$
"
)
]
;
then
URL
=
$1
else
echo
"Not a valid URL:
$1
"
echo
"Expected format: http://www.domain.tld/"
exit
2
fi
CLASS
=
$2
CLASSFILE
=
$DIR
/pages/
`
echo
$CLASS
|
tr
[
A-Z
]
[
a-z
]
`
.php
else
echo
"Usage:
$0
http://www.domain.tld/ ClassNameForDomain"
exit
1
fi
# Generates content
#Creates the class file from template
cat
$TEMPLATE
|
sed
"s/%%class%%/
$CLASS
/g"
|
sed
"s!%%url%%!
$URL
!g"
>
$CLASSFILE
#Adds the class to index.dat
printf
"%s\t%s"
$URL
$CLASS
>>
$INDEX
sort
$INDEX
-o
$INDEX
#Launches editor, then shows the Git state of the repository
$EDITOR
$CLASSFILE
cd
$DIR
git status
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
207
Default Alt Text
new-site-in-source-templates-generator (1 KB)
Attached To
Mode
P11 new-site-in-source-templates-generator
Attached
Detach File
Event Timeline
Log In to Comment