@@ -38,11 +38,11 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()) {
38
38
def resourceArchive (cls : String , name : String , ext : String , desc : String ): Future [String ] = {
39
39
val fileName = s " $name- $version. $ext"
40
40
val fullUrl = s " http://downloads.lightbend.com/scala/ $version/ $fileName"
41
- resource(cls, fileName, desc, fullUrl)
41
+ resource(cls, fileName, desc, fullUrl, fullUrl )
42
42
}
43
43
44
- def resource (cls : String , fileName : String , desc : String , fullUrl : String ): Future [String ] = {
45
- humanSize(fullUrl ) map (size => s """ [ $cls, " $fileName", " $fullUrl", " $desc", " $size"] """ )
44
+ def resource (cls : String , fileName : String , desc : String , fullUrl : String , urlForSize : String ): Future [String ] = {
45
+ humanSize(urlForSize ) map (size => s """ [ $cls, " $fileName", " $fullUrl", " $desc", " $size"] """ )
46
46
}
47
47
48
48
def defaultClass = """ "-non-main-sys""""
@@ -51,7 +51,12 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()) {
51
51
52
52
def format (fmt : String ) = new SimpleDateFormat (fmt).format(releaseDate)
53
53
54
- def ghSourceUrl = s " https://github.com/scala/scala/archive/v $version.tar.gz "
54
+ // maybe we wouldn't need both of these if I knew the right magic `curl` invocation,
55
+ // but just adding `-L` doesn't do it, we get the redirect info but not the size
56
+ // at the redirect location. this will be prone to breakage if GitHub moves
57
+ // this stuff around again
58
+ def ghSourceUrl = s " https://github.com/scala/scala/archive/v $version.tar.gz "
59
+ def ghSourceSizeUrl = s " https://codeload.github.com/scala/scala/tar.gz/v $version"
55
60
56
61
def resources : String = Await .result(
57
62
Future .sequence(Seq (
@@ -62,7 +67,7 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()) {
62
67
resourceArchive(defaultClass, " scala" , " rpm" , " RPM package" ),
63
68
resourceArchive(defaultClass, " scala-docs" , " txz" , " API docs" ),
64
69
resourceArchive(defaultClass, " scala-docs" , " zip" , " API docs" ),
65
- resource (defaultClass, s " scala-sources- $version.tar.gz " , " Sources" , ghSourceUrl )
70
+ resource (defaultClass, s " scala-sources- $version.tar.gz " , " Sources" , ghSourceUrl, ghSourceSizeUrl )
66
71
)).map(_.mkString(" ,\n " )), 30 .seconds)
67
72
68
73
// note: first and last lines must be exactly "---"
0 commit comments