lib/servel/cli.rb in servel-0.30.0 vs lib/servel/cli.rb in servel-0.31.0
- old
+ new
@@ -1,18 +1,14 @@
-class Servel::CLI
- def initialize(argv)
- @argv = argv
- end
-
- def start
- Rack::Handler::Puma.run(Servel.build_app(path_map))
- end
-
- def path_map
- @argv.map do |arg|
- root, url_root = arg.split(":" , 2)
- root = Pathname.new(root).realpath
-
- [root, url_root || "/"]
- end.to_h
- end
-end
\ No newline at end of file
+class Servel::CLI
+ def start
+ Rack::Handler::Puma.run(Servel.build_app(path_map))
+ end
+
+ def path_map
+ Servel.config.fetch(:listings).map do |listing|
+ listing = { listing => nil } if listing.is_a?(String)
+
+ root, url_root = listing.keys.first, listing.values.first || "/"
+ [Pathname.new(root).realpath, url_root]
+ end.to_h
+ end
+end