8
8
import pl .nullpointersoftware .mudlet .mudletdocs .model .LuaDescriptor ;
9
9
import pl .nullpointersoftware .mudlet .mudletdocs .service .LuaWriter ;
10
10
import pl .nullpointersoftware .mudlet .mudletdocs .service .PageAnalyzer ;
11
- import pl .nullpointersoftware .mudlet .mudletdocs .service .api .GithubRestClient ;
12
11
import pl .nullpointersoftware .mudlet .mudletdocs .service .api .WikiRestClient ;
13
- import pl .nullpointersoftware .mudlet .mudletdocs .service .dropbox .DropBoxUploader ;
14
- import pl .nullpointersoftware .mudlet .mudletdocs .service .dropbox .DropBoxUploaderFactory ;
15
12
import pl .nullpointersoftware .mudlet .mudletdocs .service .github .GithubDownloader ;
16
13
17
14
import java .io .IOException ;
@@ -33,35 +30,28 @@ public class PagesRunner implements ApplicationRunner {
33
30
private final LuaWriter luaWriter ;
34
31
private final WikiRestClient wikiRestClient ;
35
32
private final GithubDownloader githubDownloader ;
36
- private final DropBoxUploaderFactory dropBoxUploaderFactory ;
37
33
38
34
@ Override
39
35
public void run (ApplicationArguments args ) throws InterruptedException , URISyntaxException , IOException {
40
- DropBoxUploader dropBoxUploader = dropBoxUploaderFactory .getClient ();
41
36
ExecutorService executor = Executors .newFixedThreadPool (appConfig .getPages ().size ());
42
- appConfig .getPages ().forEach (pageName -> {
43
- executor .submit (() -> {
44
- log .info ("Processing {}" , pageName );
45
- Set <LuaDescriptor > descriptors = pageAnalyzer .analyze (wikiRestClient .getPage (pageName ).getParse ().getWikitext ());
46
- dropBoxUploader .addFile (luaWriter .generateFile (sanitizeFilename (pageName ), descriptors ));
47
- });
48
- });
37
+ appConfig .getPages ().forEach (pageName -> executor .submit (() -> {
38
+ log .info ("Processing {}" , pageName );
39
+ Set <LuaDescriptor > descriptors = pageAnalyzer .analyze (wikiRestClient .getPage (pageName ).getParse ().getWikitext ());
40
+ luaWriter .generateFile (sanitizeFilename (pageName ), descriptors );
41
+ }));
49
42
50
43
executor .shutdown ();
51
44
executor .awaitTermination (1 , TimeUnit .MINUTES );
52
45
53
- githubDownloader .downloadAll (dropBoxUploader );
46
+ githubDownloader .downloadAll ();
54
47
55
- dropBoxUploader . addFile ( luaWriter .generateFile ("lfs.lua" , LfsDoc .DESCRIPTORS ) );
56
- dropBoxUploader . addFile ( luaWriter .generateFile ("rex.lua" , RexDoc .DESCRIPTORS ) );
48
+ luaWriter .generateFile ("lfs.lua" , LfsDoc .DESCRIPTORS );
49
+ luaWriter .generateFile ("rex.lua" , RexDoc .DESCRIPTORS );
57
50
58
51
String dir = System .getProperty ("user.dir" ) + "/Mudlet Docs/globals.lua" ;
59
52
Path globalsPath = Path .of (dir );
60
53
Files .deleteIfExists (globalsPath );
61
54
Files .copy (Path .of (getClass ().getClassLoader ().getResource ("globals.lua" ).toURI ()), Path .of (dir ));
62
- dropBoxUploader .addFile (globalsPath );
63
-
64
- dropBoxUploader .finish ();
65
55
log .info ("We are done!" );
66
56
}
67
57
0 commit comments