rufus-lua-win 5.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +69 -0
- data/Rakefile +1 -0
- data/lib/rufus/lua/win.rb +18 -0
- data/lib/rufus/lua/win/version.rb +7 -0
- data/rufus-lua-win.gemspec +23 -0
- data/vendor/lua/bin/liblua.dll +0 -0
- data/vendor/lua/lib/lua/LuaXml.lua +119 -0
- data/vendor/lua/lib/lua/alien.lua +250 -0
- data/vendor/lua/lib/lua/alien/core.dll +0 -0
- data/vendor/lua/lib/lua/alien/struct.dll +0 -0
- data/vendor/lua/lib/lua/base.lua +536 -0
- data/vendor/lua/lib/lua/bin.lua +20 -0
- data/vendor/lua/lib/lua/bit.dll +0 -0
- data/vendor/lua/lib/lua/cdlua.dll +0 -0
- data/vendor/lua/lib/lua/cdluacontextplus.dll +0 -0
- data/vendor/lua/lib/lua/cdluagl.dll +0 -0
- data/vendor/lua/lib/lua/cdluaim.dll +0 -0
- data/vendor/lua/lib/lua/cdluapdf.dll +0 -0
- data/vendor/lua/lib/lua/copas.lua +543 -0
- data/vendor/lua/lib/lua/coxpcall.lua +57 -0
- data/vendor/lua/lib/lua/date.lua +745 -0
- data/vendor/lua/lib/lua/debug_ext.lua +84 -0
- data/vendor/lua/lib/lua/debug_init.lua +2 -0
- data/vendor/lua/lib/lua/des56.dll +0 -0
- data/vendor/lua/lib/lua/dist/config.lua +109 -0
- data/vendor/lua/lib/lua/dist/constraints.lua +271 -0
- data/vendor/lua/lib/lua/dist/depends.lua +601 -0
- data/vendor/lua/lib/lua/dist/git.lua +307 -0
- data/vendor/lua/lib/lua/dist/init.lua +278 -0
- data/vendor/lua/lib/lua/dist/manifest.lua +225 -0
- data/vendor/lua/lib/lua/dist/package.lua +583 -0
- data/vendor/lua/lib/lua/dist/sys.lua +367 -0
- data/vendor/lua/lib/lua/dist/utils.lua +130 -0
- data/vendor/lua/lib/lua/ex.dll +0 -0
- data/vendor/lua/lib/lua/fstable.lua +116 -0
- data/vendor/lua/lib/lua/getopt.lua +273 -0
- data/vendor/lua/lib/lua/git.lua +5 -0
- data/vendor/lua/lib/lua/git/core.dll +0 -0
- data/vendor/lua/lib/lua/git/objects.lua +121 -0
- data/vendor/lua/lib/lua/git/pack.lua +316 -0
- data/vendor/lua/lib/lua/git/protocol.lua +188 -0
- data/vendor/lua/lib/lua/git/repo.lua +283 -0
- data/vendor/lua/lib/lua/git/util.lua +233 -0
- data/vendor/lua/lib/lua/gzio.dll +0 -0
- data/vendor/lua/lib/lua/gzip.lua +81 -0
- data/vendor/lua/lib/lua/iconv.dll +0 -0
- data/vendor/lua/lib/lua/imlua.dll +0 -0
- data/vendor/lua/lib/lua/imlua_fftw.dll +0 -0
- data/vendor/lua/lib/lua/imlua_jp2.dll +0 -0
- data/vendor/lua/lib/lua/imlua_process.dll +0 -0
- data/vendor/lua/lib/lua/imlua_process_omp.dll +0 -0
- data/vendor/lua/lib/lua/io_ext.lua +115 -0
- data/vendor/lua/lib/lua/iuplua.dll +0 -0
- data/vendor/lua/lib/lua/iuplua_mglplot.dll +0 -0
- data/vendor/lua/lib/lua/iuplua_pplot.dll +0 -0
- data/vendor/lua/lib/lua/iupluacd.dll +0 -0
- data/vendor/lua/lib/lua/iupluacontrols.dll +0 -0
- data/vendor/lua/lib/lua/iupluagl.dll +0 -0
- data/vendor/lua/lib/lua/iupluaim.dll +0 -0
- data/vendor/lua/lib/lua/iupluaimglib.dll +0 -0
- data/vendor/lua/lib/lua/iupluatuio.dll +0 -0
- data/vendor/lua/lib/lua/lanes-keeper.lua +302 -0
- data/vendor/lua/lib/lua/lanes.lua +591 -0
- data/vendor/lua/lib/lua/lanes/core.dll +0 -0
- data/vendor/lua/lib/lua/lcs.lua +55 -0
- data/vendor/lua/lib/lua/lemock.lua +659 -0
- data/vendor/lua/lib/lua/lfs.dll +0 -0
- data/vendor/lua/lib/lua/list.lua +375 -0
- data/vendor/lua/lib/lua/logging.lua +189 -0
- data/vendor/lua/lib/lua/logging/console.lua +22 -0
- data/vendor/lua/lib/lua/logging/email.lua +44 -0
- data/vendor/lua/lib/lua/logging/file.lua +55 -0
- data/vendor/lua/lib/lua/logging/rolling_file.lua +81 -0
- data/vendor/lua/lib/lua/logging/socket.lua +35 -0
- data/vendor/lua/lib/lua/logging/sql.lua +64 -0
- data/vendor/lua/lib/lua/loop/base.lua +68 -0
- data/vendor/lua/lib/lua/loop/cached.lua +312 -0
- data/vendor/lua/lib/lua/loop/collection/MapWithArrayOfKeys.lua +64 -0
- data/vendor/lua/lib/lua/loop/collection/ObjectCache.lua +39 -0
- data/vendor/lua/lib/lua/loop/collection/OrderedSet.lua +164 -0
- data/vendor/lua/lib/lua/loop/collection/PriorityQueue.lua +86 -0
- data/vendor/lua/lib/lua/loop/collection/UnorderedArray.lua +32 -0
- data/vendor/lua/lib/lua/loop/collection/UnorderedArraySet.lua +56 -0
- data/vendor/lua/lib/lua/loop/compiler/Arguments.lua +108 -0
- data/vendor/lua/lib/lua/loop/compiler/Conditional.lua +50 -0
- data/vendor/lua/lib/lua/loop/compiler/Expression.lua +215 -0
- data/vendor/lua/lib/lua/loop/component/base.lua +221 -0
- data/vendor/lua/lib/lua/loop/component/contained.lua +71 -0
- data/vendor/lua/lib/lua/loop/component/dynamic.lua +223 -0
- data/vendor/lua/lib/lua/loop/component/intercepted.lua +354 -0
- data/vendor/lua/lib/lua/loop/component/wrapped.lua +195 -0
- data/vendor/lua/lib/lua/loop/debug/Inspector.lua +521 -0
- data/vendor/lua/lib/lua/loop/debug/Matcher.lua +192 -0
- data/vendor/lua/lib/lua/loop/debug/Verbose.lua +266 -0
- data/vendor/lua/lib/lua/loop/debug/Viewer.lua +200 -0
- data/vendor/lua/lib/lua/loop/multiple.lua +105 -0
- data/vendor/lua/lib/lua/loop/object/Exception.lua +57 -0
- data/vendor/lua/lib/lua/loop/object/Publisher.lua +43 -0
- data/vendor/lua/lib/lua/loop/object/Wrapper.lua +39 -0
- data/vendor/lua/lib/lua/loop/scoped.lua +585 -0
- data/vendor/lua/lib/lua/loop/serial/FileStream.lua +48 -0
- data/vendor/lua/lib/lua/loop/serial/Serializer.lua +291 -0
- data/vendor/lua/lib/lua/loop/serial/SocketStream.lua +51 -0
- data/vendor/lua/lib/lua/loop/serial/StringStream.lua +47 -0
- data/vendor/lua/lib/lua/loop/simple.lua +75 -0
- data/vendor/lua/lib/lua/loop/table.lua +71 -0
- data/vendor/lua/lib/lua/loop/thread/CoSocket.lua +416 -0
- data/vendor/lua/lib/lua/loop/thread/IOScheduler.lua +170 -0
- data/vendor/lua/lib/lua/loop/thread/Scheduler.lua +327 -0
- data/vendor/lua/lib/lua/loop/thread/SocketScheduler.lua +88 -0
- data/vendor/lua/lib/lua/loop/thread/Timer.lua +54 -0
- data/vendor/lua/lib/lua/lpeg.dll +0 -0
- data/vendor/lua/lib/lua/ltn12.lua +292 -0
- data/vendor/lua/lib/lua/luaXML_lib.dll +0 -0
- data/vendor/lua/lib/lua/luacurl.dll +0 -0
- data/vendor/lua/lib/lua/luadoc/config.lua +34 -0
- data/vendor/lua/lib/lua/luadoc/doclet/debug.lua +46 -0
- data/vendor/lua/lib/lua/luadoc/doclet/formatter.lua +84 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html.lua +289 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/file.lp +113 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/function.lp +64 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/index.lp +70 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/luadoc.css +286 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/menu.lp +55 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/module.lp +109 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/table.lp +15 -0
- data/vendor/lua/lib/lua/luadoc/doclet/raw.lua +12 -0
- data/vendor/lua/lib/lua/luadoc/init.lua +58 -0
- data/vendor/lua/lib/lua/luadoc/lp.lua +130 -0
- data/vendor/lua/lib/lua/luadoc/taglet/standard.lua +495 -0
- data/vendor/lua/lib/lua/luadoc/taglet/standard/tags.lua +171 -0
- data/vendor/lua/lib/lua/luadoc/util.lua +233 -0
- data/vendor/lua/lib/lua/luagl.dll +0 -0
- data/vendor/lua/lib/lua/luaglu.dll +0 -0
- data/vendor/lua/lib/lua/luaidl.lua +113 -0
- data/vendor/lua/lib/lua/luaidl/lex.lua +793 -0
- data/vendor/lua/lib/lua/luaidl/pre.lua +149 -0
- data/vendor/lua/lib/lua/luaidl/sin.lua +3631 -0
- data/vendor/lua/lib/lua/luarocks/add.lua +108 -0
- data/vendor/lua/lib/lua/luarocks/admin_remove.lua +87 -0
- data/vendor/lua/lib/lua/luarocks/build.lua +330 -0
- data/vendor/lua/lib/lua/luarocks/build/builtin.lua +253 -0
- data/vendor/lua/lib/lua/luarocks/build/cmake.lua +54 -0
- data/vendor/lua/lib/lua/luarocks/build/command.lua +32 -0
- data/vendor/lua/lib/lua/luarocks/build/make.lua +92 -0
- data/vendor/lua/lib/lua/luarocks/cache.lua +85 -0
- data/vendor/lua/lib/lua/luarocks/cfg.lua +449 -0
- data/vendor/lua/lib/lua/luarocks/command_line.lua +163 -0
- data/vendor/lua/lib/lua/luarocks/deps.lua +654 -0
- data/vendor/lua/lib/lua/luarocks/dir.lua +69 -0
- data/vendor/lua/lib/lua/luarocks/download.lua +90 -0
- data/vendor/lua/lib/lua/luarocks/fetch.lua +321 -0
- data/vendor/lua/lib/lua/luarocks/fetch/cvs.lua +44 -0
- data/vendor/lua/lib/lua/luarocks/fetch/git.lua +81 -0
- data/vendor/lua/lib/lua/luarocks/fetch/git_file.lua +17 -0
- data/vendor/lua/lib/lua/luarocks/fetch/hg.lua +54 -0
- data/vendor/lua/lib/lua/luarocks/fetch/sscm.lua +42 -0
- data/vendor/lua/lib/lua/luarocks/fetch/svn.lua +53 -0
- data/vendor/lua/lib/lua/luarocks/fs.lua +40 -0
- data/vendor/lua/lib/lua/luarocks/fs/lua.lua +676 -0
- data/vendor/lua/lib/lua/luarocks/fs/unix.lua +88 -0
- data/vendor/lua/lib/lua/luarocks/fs/unix/tools.lua +325 -0
- data/vendor/lua/lib/lua/luarocks/fs/win32.lua +107 -0
- data/vendor/lua/lib/lua/luarocks/fs/win32/tools.lua +334 -0
- data/vendor/lua/lib/lua/luarocks/help.lua +101 -0
- data/vendor/lua/lib/lua/luarocks/index.lua +172 -0
- data/vendor/lua/lib/lua/luarocks/install.lua +151 -0
- data/vendor/lua/lib/lua/luarocks/list.lua +35 -0
- data/vendor/lua/lib/lua/luarocks/loader.lua +228 -0
- data/vendor/lua/lib/lua/luarocks/make.lua +71 -0
- data/vendor/lua/lib/lua/luarocks/make_manifest.lua +34 -0
- data/vendor/lua/lib/lua/luarocks/manif.lua +360 -0
- data/vendor/lua/lib/lua/luarocks/manif_core.lua +75 -0
- data/vendor/lua/lib/lua/luarocks/new_version.lua +141 -0
- data/vendor/lua/lib/lua/luarocks/pack.lua +205 -0
- data/vendor/lua/lib/lua/luarocks/path.lua +315 -0
- data/vendor/lua/lib/lua/luarocks/persist.lua +173 -0
- data/vendor/lua/lib/lua/luarocks/refresh_cache.lua +30 -0
- data/vendor/lua/lib/lua/luarocks/remove.lua +135 -0
- data/vendor/lua/lib/lua/luarocks/rep.lua +313 -0
- data/vendor/lua/lib/lua/luarocks/require.lua +6 -0
- data/vendor/lua/lib/lua/luarocks/search.lua +399 -0
- data/vendor/lua/lib/lua/luarocks/show.lua +138 -0
- data/vendor/lua/lib/lua/luarocks/site_config.lua +23 -0
- data/vendor/lua/lib/lua/luarocks/tools/patch.lua +712 -0
- data/vendor/lua/lib/lua/luarocks/tools/tar.lua +144 -0
- data/vendor/lua/lib/lua/luarocks/tools/zip.lua +245 -0
- data/vendor/lua/lib/lua/luarocks/type_check.lua +267 -0
- data/vendor/lua/lib/lua/luarocks/unpack.lua +151 -0
- data/vendor/lua/lib/lua/luarocks/util.lua +420 -0
- data/vendor/lua/lib/lua/luarocks/validate.lua +164 -0
- data/vendor/lua/lib/lua/luars232.dll +0 -0
- data/vendor/lua/lib/lua/luasql/mysql.dll +0 -0
- data/vendor/lua/lib/lua/luasql/postgres.dll +0 -0
- data/vendor/lua/lib/lua/luasql/sqlite3.dll +0 -0
- data/vendor/lua/lib/lua/luaunit.lua +601 -0
- data/vendor/lua/lib/lua/lxp.dll +0 -0
- data/vendor/lua/lib/lua/lxp/lom.lua +60 -0
- data/vendor/lua/lib/lua/math_ext.lua +27 -0
- data/vendor/lua/lib/lua/mbox.lua +53 -0
- data/vendor/lua/lib/lua/md5.lua +19 -0
- data/vendor/lua/lib/lua/md5/core.dll +0 -0
- data/vendor/lua/lib/lua/metalua.lua +0 -0
- data/vendor/lua/lib/lua/metalua/ast_to_string.mlua +553 -0
- data/vendor/lua/lib/lua/metalua/base.lua +104 -0
- data/vendor/lua/lib/lua/metalua/bytecode.lua +0 -0
- data/vendor/lua/lib/lua/metalua/clopts.mlua +204 -0
- data/vendor/lua/lib/lua/metalua/compiler.lua +3 -0
- data/vendor/lua/lib/lua/metalua/dollar.mlua +24 -0
- data/vendor/lua/lib/lua/metalua/extension/H-runtime.mlua +216 -0
- data/vendor/lua/lib/lua/metalua/extension/H.mlua +22 -0
- data/vendor/lua/lib/lua/metalua/extension/anaphoric.mlua +54 -0
- data/vendor/lua/lib/lua/metalua/extension/clist.mlua +149 -0
- data/vendor/lua/lib/lua/metalua/extension/continue.mlua +53 -0
- data/vendor/lua/lib/lua/metalua/extension/localin.mlua +2 -0
- data/vendor/lua/lib/lua/metalua/extension/log.mlua +39 -0
- data/vendor/lua/lib/lua/metalua/extension/match.mlua +374 -0
- data/vendor/lua/lib/lua/metalua/extension/ternary.mlua +10 -0
- data/vendor/lua/lib/lua/metalua/extension/trycatch.mlua +189 -0
- data/vendor/lua/lib/lua/metalua/extension/types-runtime.mlua +159 -0
- data/vendor/lua/lib/lua/metalua/extension/types.mlua +352 -0
- data/vendor/lua/lib/lua/metalua/extension/withdo.mlua +30 -0
- data/vendor/lua/lib/lua/metalua/extension/xglobal-runtime.lua +41 -0
- data/vendor/lua/lib/lua/metalua/extension/xglobal.mlua +20 -0
- data/vendor/lua/lib/lua/metalua/extension/xloop.mlua +100 -0
- data/vendor/lua/lib/lua/metalua/extension/xmatch.mlua +216 -0
- data/vendor/lua/lib/lua/metalua/metaloop.mlua +76 -0
- data/vendor/lua/lib/lua/metalua/mlc.lua +0 -0
- data/vendor/lua/lib/lua/metalua/mlc_xcall.lua +119 -0
- data/vendor/lua/lib/lua/metalua/mlp.lua +0 -0
- data/vendor/lua/lib/lua/metalua/package2.lua +101 -0
- data/vendor/lua/lib/lua/metalua/runtime.lua +3 -0
- data/vendor/lua/lib/lua/metalua/string2.lua +44 -0
- data/vendor/lua/lib/lua/metalua/table2.lua +372 -0
- data/vendor/lua/lib/lua/metalua/walk.mlua +304 -0
- data/vendor/lua/lib/lua/metalua/walk/bindings.mlua +41 -0
- data/vendor/lua/lib/lua/metalua/walk/id.mlua +186 -0
- data/vendor/lua/lib/lua/metalua/walk/scope.lua +54 -0
- data/vendor/lua/lib/lua/mime.lua +87 -0
- data/vendor/lua/lib/lua/mime/core.dll +0 -0
- data/vendor/lua/lib/lua/mobdebug.lua +1484 -0
- data/vendor/lua/lib/lua/modules.lua +16 -0
- data/vendor/lua/lib/lua/object.lua +56 -0
- data/vendor/lua/lib/lua/oil/Exception.lua +26 -0
- data/vendor/lua/lib/lua/oil/arch.lua +27 -0
- data/vendor/lua/lib/lua/oil/arch/basic/client.lua +29 -0
- data/vendor/lua/lib/lua/oil/arch/basic/common.lua +13 -0
- data/vendor/lua/lib/lua/oil/arch/basic/server.lua +27 -0
- data/vendor/lua/lib/lua/oil/arch/cooperative/common.lua +10 -0
- data/vendor/lua/lib/lua/oil/arch/cooperative/server.lua +16 -0
- data/vendor/lua/lib/lua/oil/arch/corba/client.lua +39 -0
- data/vendor/lua/lib/lua/oil/arch/corba/common.lua +58 -0
- data/vendor/lua/lib/lua/oil/arch/corba/intercepted/client.lua +9 -0
- data/vendor/lua/lib/lua/oil/arch/corba/intercepted/server.lua +9 -0
- data/vendor/lua/lib/lua/oil/arch/corba/server.lua +35 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/byref.lua +18 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/client.lua +19 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/common.lua +18 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/server.lua +19 -0
- data/vendor/lua/lib/lua/oil/arch/typed/client.lua +27 -0
- data/vendor/lua/lib/lua/oil/arch/typed/common.lua +9 -0
- data/vendor/lua/lib/lua/oil/arch/typed/server.lua +18 -0
- data/vendor/lua/lib/lua/oil/assert.lua +87 -0
- data/vendor/lua/lib/lua/oil/builder.lua +45 -0
- data/vendor/lua/lib/lua/oil/builder/basic/client.lua +31 -0
- data/vendor/lua/lib/lua/oil/builder/basic/common.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/basic/server.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/cooperative/common.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/cooperative/server.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/corba/client.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/corba/common.lua +24 -0
- data/vendor/lua/lib/lua/oil/builder/corba/gencode.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/corba/intercepted/client.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/corba/intercepted/server.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/corba/server.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/lua/client.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/lua/server.lua +12 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/byref.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/client.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/common.lua +14 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/server.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/typed/client.lua +16 -0
- data/vendor/lua/lib/lua/oil/builder/typed/server.lua +12 -0
- data/vendor/lua/lib/lua/oil/compat.lua +846 -0
- data/vendor/lua/lib/lua/oil/component.lua +1 -0
- data/vendor/lua/lib/lua/oil/corba/giop.lua +301 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Codec.lua +1568 -0
- data/vendor/lua/lib/lua/oil/corba/giop/CodecGen.lua +589 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Exception.lua +25 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Indexer.lua +63 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Listener.lua +343 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Messenger.lua +228 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Referrer.lua +180 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Requester.lua +462 -0
- data/vendor/lua/lib/lua/oil/corba/idl.lua +597 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Compiler.lua +133 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Importer.lua +235 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Indexer.lua +95 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Registry.lua +1821 -0
- data/vendor/lua/lib/lua/oil/corba/idl/ir.lua +847 -0
- data/vendor/lua/lib/lua/oil/corba/idl/sysex.lua +21 -0
- data/vendor/lua/lib/lua/oil/corba/iiop/Profiler.lua +200 -0
- data/vendor/lua/lib/lua/oil/corba/intercepted/Listener.lua +158 -0
- data/vendor/lua/lib/lua/oil/corba/intercepted/Requester.lua +181 -0
- data/vendor/lua/lib/lua/oil/corba/services/event.lua +126 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/ConsumerAdmin.lua +50 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/EventFactory.lua +15 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/EventQueue.lua +37 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/ProxyPushConsumer.lua +75 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/ProxyPushSupplier.lua +62 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/SingleDeferredDispatcher.lua +60 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/SingleSynchronousDispatcher.lua +39 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/SupplierAdmin.lua +50 -0
- data/vendor/lua/lib/lua/oil/corba/services/naming.lua +436 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Acceptor.lua +268 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Channels.lua +121 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Connector.lua +147 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Dispatcher.lua +99 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies.lua +86 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/asynchronous.lua +56 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/protected.lua +17 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/synchronous.lua +17 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/utils.lua +29 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Receiver.lua +110 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Servants.lua +207 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Sockets.lua +44 -0
- data/vendor/lua/lib/lua/oil/kernel/cooperative/Receiver.lua +139 -0
- data/vendor/lua/lib/lua/oil/kernel/intercepted/Listener.lua +47 -0
- data/vendor/lua/lib/lua/oil/kernel/intercepted/Requester.lua +58 -0
- data/vendor/lua/lib/lua/oil/kernel/lua/Dispatcher.lua +76 -0
- data/vendor/lua/lib/lua/oil/kernel/lua/Proxies.lua +69 -0
- data/vendor/lua/lib/lua/oil/kernel/typed/Dispatcher.lua +91 -0
- data/vendor/lua/lib/lua/oil/kernel/typed/Proxies.lua +153 -0
- data/vendor/lua/lib/lua/oil/kernel/typed/Servants.lua +137 -0
- data/vendor/lua/lib/lua/oil/ludo/Codec.lua +66 -0
- data/vendor/lua/lib/lua/oil/ludo/CodecByRef.lua +103 -0
- data/vendor/lua/lib/lua/oil/ludo/Listener.lua +151 -0
- data/vendor/lua/lib/lua/oil/ludo/Referrer.lua +72 -0
- data/vendor/lua/lib/lua/oil/ludo/Requester.lua +107 -0
- data/vendor/lua/lib/lua/oil/oo.lua +1 -0
- data/vendor/lua/lib/lua/oil/port.lua +1 -0
- data/vendor/lua/lib/lua/oil/properties.lua +57 -0
- data/vendor/lua/lib/lua/oil/verbose.lua +133 -0
- data/vendor/lua/lib/lua/package_ext.lua +15 -0
- data/vendor/lua/lib/lua/parser.lua +268 -0
- data/vendor/lua/lib/lua/pl/Date.lua +555 -0
- data/vendor/lua/lib/lua/pl/List.lua +613 -0
- data/vendor/lua/lib/lua/pl/Map.lua +113 -0
- data/vendor/lua/lib/lua/pl/MultiMap.lua +62 -0
- data/vendor/lua/lib/lua/pl/OrderedMap.lua +151 -0
- data/vendor/lua/lib/lua/pl/Set.lua +153 -0
- data/vendor/lua/lib/lua/pl/app.lua +165 -0
- data/vendor/lua/lib/lua/pl/array2d.lua +501 -0
- data/vendor/lua/lib/lua/pl/class.lua +180 -0
- data/vendor/lua/lib/lua/pl/comprehension.lua +286 -0
- data/vendor/lua/lib/lua/pl/config.lua +176 -0
- data/vendor/lua/lib/lua/pl/data.lua +606 -0
- data/vendor/lua/lib/lua/pl/dir.lua +475 -0
- data/vendor/lua/lib/lua/pl/file.lua +70 -0
- data/vendor/lua/lib/lua/pl/func.lua +376 -0
- data/vendor/lua/lib/lua/pl/init.lua +68 -0
- data/vendor/lua/lib/lua/pl/input.lua +173 -0
- data/vendor/lua/lib/lua/pl/lapp.lua +407 -0
- data/vendor/lua/lib/lua/pl/lexer.lua +456 -0
- data/vendor/lua/lib/lua/pl/luabalanced.lua +264 -0
- data/vendor/lua/lib/lua/pl/operator.lua +201 -0
- data/vendor/lua/lib/lua/pl/path.lua +398 -0
- data/vendor/lua/lib/lua/pl/permute.lua +63 -0
- data/vendor/lua/lib/lua/pl/platf/luajava.lua +101 -0
- data/vendor/lua/lib/lua/pl/pretty.lua +285 -0
- data/vendor/lua/lib/lua/pl/seq.lua +551 -0
- data/vendor/lua/lib/lua/pl/sip.lua +344 -0
- data/vendor/lua/lib/lua/pl/strict.lua +70 -0
- data/vendor/lua/lib/lua/pl/stringio.lua +158 -0
- data/vendor/lua/lib/lua/pl/stringx.lua +440 -0
- data/vendor/lua/lib/lua/pl/tablex.lua +817 -0
- data/vendor/lua/lib/lua/pl/template.lua +103 -0
- data/vendor/lua/lib/lua/pl/test.lua +135 -0
- data/vendor/lua/lib/lua/pl/text.lua +243 -0
- data/vendor/lua/lib/lua/pl/utils.lua +550 -0
- data/vendor/lua/lib/lua/pl/xml.lua +689 -0
- data/vendor/lua/lib/lua/profiler.dll +0 -0
- data/vendor/lua/lib/lua/re.lua +248 -0
- data/vendor/lua/lib/lua/rex_onig.dll +0 -0
- data/vendor/lua/lib/lua/rex_pcre.dll +0 -0
- data/vendor/lua/lib/lua/rex_posix.dll +0 -0
- data/vendor/lua/lib/lua/rings.dll +0 -0
- data/vendor/lua/lib/lua/serialize.lua +193 -0
- data/vendor/lua/lib/lua/set.lua +149 -0
- data/vendor/lua/lib/lua/socket.lua +133 -0
- data/vendor/lua/lib/lua/socket/core.dll +0 -0
- data/vendor/lua/lib/lua/socket/ftp.lua +281 -0
- data/vendor/lua/lib/lua/socket/http.lua +350 -0
- data/vendor/lua/lib/lua/socket/smtp.lua +251 -0
- data/vendor/lua/lib/lua/socket/tp.lua +123 -0
- data/vendor/lua/lib/lua/socket/url.lua +297 -0
- data/vendor/lua/lib/lua/ssl.dll +0 -0
- data/vendor/lua/lib/lua/ssl.lua +93 -0
- data/vendor/lua/lib/lua/ssl/https.lua +138 -0
- data/vendor/lua/lib/lua/stable.lua +28 -0
- data/vendor/lua/lib/lua/std.lua +16 -0
- data/vendor/lua/lib/lua/strbuf.lua +32 -0
- data/vendor/lua/lib/lua/strict.lua +45 -0
- data/vendor/lua/lib/lua/string_ext.lua +274 -0
- data/vendor/lua/lib/lua/table_ext.lua +117 -0
- data/vendor/lua/lib/lua/tar.lua +262 -0
- data/vendor/lua/lib/lua/task.dll +0 -0
- data/vendor/lua/lib/lua/tree.lua +81 -0
- data/vendor/lua/lib/lua/unicode.dll +0 -0
- data/vendor/lua/lib/lua/verbose_require.lua +11 -0
- data/vendor/lua/lib/lua/vstruct.lua +86 -0
- data/vendor/lua/lib/lua/vstruct/ast.lua +192 -0
- data/vendor/lua/lib/lua/vstruct/ast/Bitpack.lua +33 -0
- data/vendor/lua/lib/lua/vstruct/ast/Generator.lua +174 -0
- data/vendor/lua/lib/lua/vstruct/ast/IO.lua +45 -0
- data/vendor/lua/lib/lua/vstruct/ast/List.lua +56 -0
- data/vendor/lua/lib/lua/vstruct/ast/Name.lua +20 -0
- data/vendor/lua/lib/lua/vstruct/ast/Repeat.lua +23 -0
- data/vendor/lua/lib/lua/vstruct/ast/Root.lua +19 -0
- data/vendor/lua/lib/lua/vstruct/ast/Table.lua +65 -0
- data/vendor/lua/lib/lua/vstruct/cursor.lua +81 -0
- data/vendor/lua/lib/lua/vstruct/io.lua +45 -0
- data/vendor/lua/lib/lua/vstruct/io/a.lua +24 -0
- data/vendor/lua/lib/lua/vstruct/io/b.lua +28 -0
- data/vendor/lua/lib/lua/vstruct/io/bigendian.lua +21 -0
- data/vendor/lua/lib/lua/vstruct/io/c.lua +25 -0
- data/vendor/lua/lib/lua/vstruct/io/defaults.lua +24 -0
- data/vendor/lua/lib/lua/vstruct/io/endianness.lua +41 -0
- data/vendor/lua/lib/lua/vstruct/io/f.lua +129 -0
- data/vendor/lua/lib/lua/vstruct/io/hostendian.lua +21 -0
- data/vendor/lua/lib/lua/vstruct/io/i.lua +42 -0
- data/vendor/lua/lib/lua/vstruct/io/littleendian.lua +21 -0
- data/vendor/lua/lib/lua/vstruct/io/m.lua +62 -0
- data/vendor/lua/lib/lua/vstruct/io/p.lua +23 -0
- data/vendor/lua/lib/lua/vstruct/io/s.lua +27 -0
- data/vendor/lua/lib/lua/vstruct/io/seekb.lua +18 -0
- data/vendor/lua/lib/lua/vstruct/io/seekf.lua +18 -0
- data/vendor/lua/lib/lua/vstruct/io/seekto.lua +18 -0
- data/vendor/lua/lib/lua/vstruct/io/u.lua +54 -0
- data/vendor/lua/lib/lua/vstruct/io/x.lua +34 -0
- data/vendor/lua/lib/lua/vstruct/io/z.lua +63 -0
- data/vendor/lua/lib/lua/vstruct/lexer.lua +100 -0
- data/vendor/lua/lib/lua/vstruct/pack.lua +142 -0
- data/vendor/lua/lib/lua/vstruct/test.lua +47 -0
- data/vendor/lua/lib/lua/vstruct/test/basic.lua +73 -0
- data/vendor/lua/lib/lua/vstruct/test/common.lua +100 -0
- data/vendor/lua/lib/lua/vstruct/test/fp-bigendian.lua +56 -0
- data/vendor/lua/lib/lua/vstruct/test/fp-littleendian.lua +56 -0
- data/vendor/lua/lib/lua/vstruct/test/struct-test-gen.lua +1230 -0
- data/vendor/lua/lib/lua/vstruct/unpack.lua +126 -0
- data/vendor/lua/lib/lua/wx.dll +0 -0
- data/vendor/lua/lib/lua/xml.lua +75 -0
- data/vendor/lua/lib/lua/zip.dll +0 -0
- data/vendor/lua/lib/lua/zlib.dll +0 -0
- metadata +529 -0
@@ -0,0 +1,475 @@
|
|
1
|
+
--- Useful functions for getting directory contents and matching them against wildcards.
|
2
|
+
--
|
3
|
+
-- Dependencies: `pl.utils`, `pl.path`, `pl.tablex`
|
4
|
+
--
|
5
|
+
-- Soft Dependencies: `alien`, `ffi` (either are used on Windows for copying/moving files)
|
6
|
+
-- @module pl.dir
|
7
|
+
|
8
|
+
local utils = require 'pl.utils'
|
9
|
+
local path = require 'pl.path'
|
10
|
+
local is_windows = path.is_windows
|
11
|
+
local tablex = require 'pl.tablex'
|
12
|
+
local ldir = path.dir
|
13
|
+
local chdir = path.chdir
|
14
|
+
local mkdir = path.mkdir
|
15
|
+
local rmdir = path.rmdir
|
16
|
+
local sub = string.sub
|
17
|
+
local os,pcall,ipairs,pairs,require,setmetatable,_G = os,pcall,ipairs,pairs,require,setmetatable,_G
|
18
|
+
local remove = os.remove
|
19
|
+
local append = table.insert
|
20
|
+
local wrap = coroutine.wrap
|
21
|
+
local yield = coroutine.yield
|
22
|
+
local assert_arg,assert_string,raise = utils.assert_arg,utils.assert_string,utils.raise
|
23
|
+
local List = utils.stdmt.List
|
24
|
+
|
25
|
+
local dir = {}
|
26
|
+
|
27
|
+
local function assert_dir (n,val)
|
28
|
+
assert_arg(n,val,'string',path.isdir,'not a directory',4)
|
29
|
+
end
|
30
|
+
|
31
|
+
local function assert_file (n,val)
|
32
|
+
assert_arg(n,val,'string',path.isfile,'not a file',4)
|
33
|
+
end
|
34
|
+
|
35
|
+
local function filemask(mask)
|
36
|
+
mask = utils.escape(mask)
|
37
|
+
return mask:gsub('%%%*','.+'):gsub('%%%?','.')..'$'
|
38
|
+
end
|
39
|
+
|
40
|
+
--- does the filename match the shell pattern?.
|
41
|
+
-- (cf. fnmatch.fnmatch in Python, 11.8)
|
42
|
+
-- @param file A file name
|
43
|
+
-- @param pattern A shell pattern
|
44
|
+
-- @return true or false
|
45
|
+
-- @raise file and pattern must be strings
|
46
|
+
function dir.fnmatch(file,pattern)
|
47
|
+
assert_string(1,file)
|
48
|
+
assert_string(2,pattern)
|
49
|
+
return path.normcase(file):find(filemask(pattern)) ~= nil
|
50
|
+
end
|
51
|
+
|
52
|
+
--- return a list of all files which match the pattern.
|
53
|
+
-- (cf. fnmatch.filter in Python, 11.8)
|
54
|
+
-- @param files A table containing file names
|
55
|
+
-- @param pattern A shell pattern.
|
56
|
+
-- @return list of files
|
57
|
+
-- @raise file and pattern must be strings
|
58
|
+
function dir.filter(files,pattern)
|
59
|
+
assert_arg(1,files,'table')
|
60
|
+
assert_string(2,pattern)
|
61
|
+
local res = {}
|
62
|
+
local mask = filemask(pattern)
|
63
|
+
for i,f in ipairs(files) do
|
64
|
+
if f:find(mask) then append(res,f) end
|
65
|
+
end
|
66
|
+
return setmetatable(res,List)
|
67
|
+
end
|
68
|
+
|
69
|
+
local function _listfiles(dir,filemode,match)
|
70
|
+
local res = {}
|
71
|
+
local check = utils.choose(filemode,path.isfile,path.isdir)
|
72
|
+
if not dir then dir = '.' end
|
73
|
+
for f in ldir(dir) do
|
74
|
+
if f ~= '.' and f ~= '..' then
|
75
|
+
local p = path.join(dir,f)
|
76
|
+
if check(p) and (not match or match(p)) then
|
77
|
+
append(res,p)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
return setmetatable(res,List)
|
82
|
+
end
|
83
|
+
|
84
|
+
--- return a list of all files in a directory which match the a shell pattern.
|
85
|
+
-- @param dir A directory. If not given, all files in current directory are returned.
|
86
|
+
-- @param mask A shell pattern. If not given, all files are returned.
|
87
|
+
-- @return lsit of files
|
88
|
+
-- @raise dir and mask must be strings
|
89
|
+
function dir.getfiles(dir,mask)
|
90
|
+
assert_dir(1,dir)
|
91
|
+
if mask then assert_string(2,mask) end
|
92
|
+
local match
|
93
|
+
if mask then
|
94
|
+
mask = filemask(mask)
|
95
|
+
match = function(f)
|
96
|
+
return f:find(mask)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
return _listfiles(dir,true,match)
|
100
|
+
end
|
101
|
+
|
102
|
+
--- return a list of all subdirectories of the directory.
|
103
|
+
-- @param dir A directory
|
104
|
+
-- @return a list of directories
|
105
|
+
-- @raise dir must be a string
|
106
|
+
function dir.getdirectories(dir)
|
107
|
+
assert_dir(1,dir)
|
108
|
+
return _listfiles(dir,false)
|
109
|
+
end
|
110
|
+
|
111
|
+
local function quote_argument (f)
|
112
|
+
f = path.normcase(f)
|
113
|
+
if f:find '%s' then
|
114
|
+
return '"'..f..'"'
|
115
|
+
else
|
116
|
+
return f
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
local alien,ffi,ffi_checked,CopyFile,MoveFile,GetLastError,win32_errors,cmd_tmpfile
|
122
|
+
|
123
|
+
local function execute_command(cmd,parms)
|
124
|
+
if not cmd_tmpfile then cmd_tmpfile = path.tmpname () end
|
125
|
+
local err = path.is_windows and ' > ' or ' 2> '
|
126
|
+
cmd = cmd..' '..parms..err..cmd_tmpfile
|
127
|
+
local ret = utils.execute(cmd)
|
128
|
+
if not ret then
|
129
|
+
return false,(utils.readfile(cmd_tmpfile):gsub('\n(.*)',''))
|
130
|
+
else
|
131
|
+
return true
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
local function find_ffi_copyfile ()
|
136
|
+
if not ffi_checked then
|
137
|
+
ffi_checked = true
|
138
|
+
local res
|
139
|
+
res,alien = pcall(require,'alien')
|
140
|
+
if not res then
|
141
|
+
alien = nil
|
142
|
+
res, ffi = pcall(require,'ffi')
|
143
|
+
end
|
144
|
+
if not res then
|
145
|
+
ffi = nil
|
146
|
+
return
|
147
|
+
end
|
148
|
+
else
|
149
|
+
return
|
150
|
+
end
|
151
|
+
if alien then
|
152
|
+
-- register the Win32 CopyFile and MoveFile functions
|
153
|
+
local kernel = alien.load('kernel32.dll')
|
154
|
+
CopyFile = kernel.CopyFileA
|
155
|
+
CopyFile:types{'string','string','int',ret='int',abi='stdcall'}
|
156
|
+
MoveFile = kernel.MoveFileA
|
157
|
+
MoveFile:types{'string','string',ret='int',abi='stdcall'}
|
158
|
+
GetLastError = kernel.GetLastError
|
159
|
+
GetLastError:types{ret ='int', abi='stdcall'}
|
160
|
+
elseif ffi then
|
161
|
+
ffi.cdef [[
|
162
|
+
int CopyFileA(const char *src, const char *dest, int iovr);
|
163
|
+
int MoveFileA(const char *src, const char *dest);
|
164
|
+
int GetLastError();
|
165
|
+
]]
|
166
|
+
CopyFile = ffi.C.CopyFileA
|
167
|
+
MoveFile = ffi.C.MoveFileA
|
168
|
+
GetLastError = ffi.C.GetLastError
|
169
|
+
end
|
170
|
+
win32_errors = {
|
171
|
+
ERROR_FILE_NOT_FOUND = 2,
|
172
|
+
ERROR_PATH_NOT_FOUND = 3,
|
173
|
+
ERROR_ACCESS_DENIED = 5,
|
174
|
+
ERROR_WRITE_PROTECT = 19,
|
175
|
+
ERROR_BAD_UNIT = 20,
|
176
|
+
ERROR_NOT_READY = 21,
|
177
|
+
ERROR_WRITE_FAULT = 29,
|
178
|
+
ERROR_READ_FAULT = 30,
|
179
|
+
ERROR_SHARING_VIOLATION = 32,
|
180
|
+
ERROR_LOCK_VIOLATION = 33,
|
181
|
+
ERROR_HANDLE_DISK_FULL = 39,
|
182
|
+
ERROR_BAD_NETPATH = 53,
|
183
|
+
ERROR_NETWORK_BUSY = 54,
|
184
|
+
ERROR_DEV_NOT_EXIST = 55,
|
185
|
+
ERROR_FILE_EXISTS = 80,
|
186
|
+
ERROR_OPEN_FAILED = 110,
|
187
|
+
ERROR_INVALID_NAME = 123,
|
188
|
+
ERROR_BAD_PATHNAME = 161,
|
189
|
+
ERROR_ALREADY_EXISTS = 183,
|
190
|
+
}
|
191
|
+
end
|
192
|
+
|
193
|
+
local function two_arguments (f1,f2)
|
194
|
+
return quote_argument(f1)..' '..quote_argument(f2)
|
195
|
+
end
|
196
|
+
|
197
|
+
local function file_op (is_copy,src,dest,flag)
|
198
|
+
if flag == 1 and path.exists(dest) then
|
199
|
+
return false,"cannot overwrite destination"
|
200
|
+
end
|
201
|
+
if is_windows then
|
202
|
+
-- if we haven't tried to load Alien/LuaJIT FFI before, then do so
|
203
|
+
find_ffi_copyfile()
|
204
|
+
-- fallback if there's no Alien, just use DOS commands *shudder*
|
205
|
+
-- 'rename' involves a copy and then deleting the source.
|
206
|
+
if not CopyFile then
|
207
|
+
src = path.normcase(src)
|
208
|
+
dest = path.normcase(dest)
|
209
|
+
local cmd = is_copy and 'copy' or 'rename'
|
210
|
+
local res, err = execute_command('copy',two_arguments(src,dest))
|
211
|
+
if not res then return nil,err end
|
212
|
+
if not is_copy then
|
213
|
+
return execute_command('del',quote_argument(src))
|
214
|
+
end
|
215
|
+
else
|
216
|
+
if path.isdir(dest) then
|
217
|
+
dest = path.join(dest,path.basename(src))
|
218
|
+
end
|
219
|
+
local ret
|
220
|
+
if is_copy then ret = CopyFile(src,dest,flag)
|
221
|
+
else ret = MoveFile(src,dest) end
|
222
|
+
if ret == 0 then
|
223
|
+
local err = GetLastError()
|
224
|
+
for name,value in pairs(win32_errors) do
|
225
|
+
if value == err then return false,name end
|
226
|
+
end
|
227
|
+
return false,"Error #"..err
|
228
|
+
else return true
|
229
|
+
end
|
230
|
+
end
|
231
|
+
else -- for Unix, just use cp for now
|
232
|
+
return execute_command(is_copy and 'cp' or 'mv',
|
233
|
+
two_arguments(src,dest))
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
--- copy a file.
|
238
|
+
-- @param src source file
|
239
|
+
-- @param dest destination file or directory
|
240
|
+
-- @param flag true if you want to force the copy (default)
|
241
|
+
-- @return true if operation succeeded
|
242
|
+
-- @raise src and dest must be strings
|
243
|
+
function dir.copyfile (src,dest,flag)
|
244
|
+
assert_string(1,src)
|
245
|
+
assert_string(2,dest)
|
246
|
+
flag = flag==nil or flag
|
247
|
+
return file_op(true,src,dest,flag and 0 or 1)
|
248
|
+
end
|
249
|
+
|
250
|
+
--- move a file.
|
251
|
+
-- @param src source file
|
252
|
+
-- @param dest destination file or directory
|
253
|
+
-- @return true if operation succeeded
|
254
|
+
-- @raise src and dest must be strings
|
255
|
+
function dir.movefile (src,dest)
|
256
|
+
assert_string(1,src)
|
257
|
+
assert_string(2,dest)
|
258
|
+
return file_op(false,src,dest,0)
|
259
|
+
end
|
260
|
+
|
261
|
+
local function _dirfiles(dir,attrib)
|
262
|
+
local dirs = {}
|
263
|
+
local files = {}
|
264
|
+
for f in ldir(dir) do
|
265
|
+
if f ~= '.' and f ~= '..' then
|
266
|
+
local p = path.join(dir,f)
|
267
|
+
local mode = attrib(p,'mode')
|
268
|
+
if mode=='directory' then
|
269
|
+
append(dirs,f)
|
270
|
+
else
|
271
|
+
append(files,f)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
return setmetatable(dirs,List),setmetatable(files,List)
|
276
|
+
end
|
277
|
+
|
278
|
+
|
279
|
+
local function _walker(root,bottom_up,attrib)
|
280
|
+
local dirs,files = _dirfiles(root,attrib)
|
281
|
+
if not bottom_up then yield(root,dirs,files) end
|
282
|
+
for i,d in ipairs(dirs) do
|
283
|
+
_walker(root..path.sep..d,bottom_up,attrib)
|
284
|
+
end
|
285
|
+
if bottom_up then yield(root,dirs,files) end
|
286
|
+
end
|
287
|
+
|
288
|
+
--- return an iterator which walks through a directory tree starting at root.
|
289
|
+
-- The iterator returns (root,dirs,files)
|
290
|
+
-- Note that dirs and files are lists of names (i.e. you must say path.join(root,d)
|
291
|
+
-- to get the actual full path)
|
292
|
+
-- If bottom_up is false (or not present), then the entries at the current level are returned
|
293
|
+
-- before we go deeper. This means that you can modify the returned list of directories before
|
294
|
+
-- continuing.
|
295
|
+
-- This is a clone of os.walk from the Python libraries.
|
296
|
+
-- @param root A starting directory
|
297
|
+
-- @param bottom_up False if we start listing entries immediately.
|
298
|
+
-- @param follow_links follow symbolic links
|
299
|
+
-- @return an iterator returning root,dirs,files
|
300
|
+
-- @raise root must be a string
|
301
|
+
function dir.walk(root,bottom_up,follow_links)
|
302
|
+
assert_dir(1,root)
|
303
|
+
local attrib
|
304
|
+
if path.is_windows or not follow_links then
|
305
|
+
attrib = path.attrib
|
306
|
+
else
|
307
|
+
attrib = path.link_attrib
|
308
|
+
end
|
309
|
+
return wrap(function () _walker(root,bottom_up,attrib) end)
|
310
|
+
end
|
311
|
+
|
312
|
+
--- remove a whole directory tree.
|
313
|
+
-- @param fullpath A directory path
|
314
|
+
-- @return true or nil
|
315
|
+
-- @return error if failed
|
316
|
+
-- @raise fullpath must be a string
|
317
|
+
function dir.rmtree(fullpath)
|
318
|
+
assert_dir(1,fullpath)
|
319
|
+
if path.islink(fullpath) then return false,'will not follow symlink' end
|
320
|
+
for root,dirs,files in dir.walk(fullpath,true) do
|
321
|
+
for i,f in ipairs(files) do
|
322
|
+
remove(path.join(root,f))
|
323
|
+
end
|
324
|
+
rmdir(root)
|
325
|
+
end
|
326
|
+
return true
|
327
|
+
end
|
328
|
+
|
329
|
+
local dirpat
|
330
|
+
if path.is_windows then
|
331
|
+
dirpat = '(.+)\\[^\\]+$'
|
332
|
+
else
|
333
|
+
dirpat = '(.+)/[^/]+$'
|
334
|
+
end
|
335
|
+
|
336
|
+
local _makepath
|
337
|
+
function _makepath(p)
|
338
|
+
-- windows root drive case
|
339
|
+
if p:find '^%a:[\\]*$' then
|
340
|
+
return true
|
341
|
+
end
|
342
|
+
if not path.isdir(p) then
|
343
|
+
local subp = p:match(dirpat)
|
344
|
+
if not _makepath(subp) then return raise ('cannot create '..subp) end
|
345
|
+
return mkdir(p)
|
346
|
+
else
|
347
|
+
return true
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
--- create a directory path.
|
352
|
+
-- This will create subdirectories as necessary!
|
353
|
+
-- @param p A directory path
|
354
|
+
-- @return a valid created path
|
355
|
+
-- @raise p must be a string
|
356
|
+
function dir.makepath (p)
|
357
|
+
assert_string(1,p)
|
358
|
+
return _makepath(path.normcase(path.abspath(p)))
|
359
|
+
end
|
360
|
+
|
361
|
+
|
362
|
+
--- clone a directory tree. Will always try to create a new directory structure
|
363
|
+
-- if necessary.
|
364
|
+
-- @param path1 the base path of the source tree
|
365
|
+
-- @param path2 the new base path for the destination
|
366
|
+
-- @param file_fun an optional function to apply on all files
|
367
|
+
-- @param verbose an optional boolean to control the verbosity of the output.
|
368
|
+
-- It can also be a logging function that behaves like print()
|
369
|
+
-- @return true, or nil
|
370
|
+
-- @return error message, or list of failed directory creations
|
371
|
+
-- @return list of failed file operations
|
372
|
+
-- @raise path1 and path2 must be strings
|
373
|
+
-- @usage clonetree('.','../backup',copyfile)
|
374
|
+
function dir.clonetree (path1,path2,file_fun,verbose)
|
375
|
+
assert_string(1,path1)
|
376
|
+
assert_string(2,path2)
|
377
|
+
if verbose == true then verbose = print end
|
378
|
+
local abspath,normcase,isdir,join = path.abspath,path.normcase,path.isdir,path.join
|
379
|
+
local faildirs,failfiles = {},{}
|
380
|
+
if not isdir(path1) then return raise 'source is not a valid directory' end
|
381
|
+
path1 = abspath(normcase(path1))
|
382
|
+
path2 = abspath(normcase(path2))
|
383
|
+
if verbose then verbose('normalized:',path1,path2) end
|
384
|
+
-- particularly NB that the new path isn't fully contained in the old path
|
385
|
+
if path1 == path2 then return raise "paths are the same" end
|
386
|
+
local i1,i2 = path2:find(path1,1,true)
|
387
|
+
if i2 == #path1 and path2:sub(i2+1,i2+1) == path.sep then
|
388
|
+
return raise 'destination is a subdirectory of the source'
|
389
|
+
end
|
390
|
+
local cp = path.common_prefix (path1,path2)
|
391
|
+
local idx = #cp
|
392
|
+
if idx == 0 then -- no common path, but watch out for Windows paths!
|
393
|
+
if path1:sub(2,2) == ':' then idx = 3 end
|
394
|
+
end
|
395
|
+
for root,dirs,files in dir.walk(path1) do
|
396
|
+
local opath = path2..root:sub(idx)
|
397
|
+
if verbose then verbose('paths:',opath,root) end
|
398
|
+
if not isdir(opath) then
|
399
|
+
local ret = dir.makepath(opath)
|
400
|
+
if not ret then append(faildirs,opath) end
|
401
|
+
if verbose then verbose('creating:',opath,ret) end
|
402
|
+
end
|
403
|
+
if file_fun then
|
404
|
+
for i,f in ipairs(files) do
|
405
|
+
local p1 = join(root,f)
|
406
|
+
local p2 = join(opath,f)
|
407
|
+
local ret = file_fun(p1,p2)
|
408
|
+
if not ret then append(failfiles,p2) end
|
409
|
+
if verbose then
|
410
|
+
verbose('files:',p1,p2,ret)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
415
|
+
return true,faildirs,failfiles
|
416
|
+
end
|
417
|
+
|
418
|
+
--- return an iterator over all entries in a directory tree
|
419
|
+
-- @param d a directory
|
420
|
+
-- @return an iterator giving pathname and mode (true for dir, false otherwise)
|
421
|
+
-- @raise d must be a non-empty string
|
422
|
+
function dir.dirtree( d )
|
423
|
+
assert( d and d ~= "", "directory parameter is missing or empty" )
|
424
|
+
local exists, isdir = path.exists, path.isdir
|
425
|
+
local sep = path.sep
|
426
|
+
|
427
|
+
local last = sub ( d, -1 )
|
428
|
+
if last == sep or last == '/' then
|
429
|
+
d = sub( d, 1, -2 )
|
430
|
+
end
|
431
|
+
|
432
|
+
local function yieldtree( dir )
|
433
|
+
for entry in ldir( dir ) do
|
434
|
+
if entry ~= "." and entry ~= ".." then
|
435
|
+
entry = dir .. sep .. entry
|
436
|
+
if exists(entry) then -- Just in case a symlink is broken.
|
437
|
+
local is_dir = isdir(entry)
|
438
|
+
yield( entry, is_dir )
|
439
|
+
if is_dir then
|
440
|
+
yieldtree( entry )
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
return wrap( function() yieldtree( d ) end )
|
448
|
+
end
|
449
|
+
|
450
|
+
|
451
|
+
--- Recursively returns all the file starting at <i>path</i>. It can optionally take a shell pattern and
|
452
|
+
-- only returns files that match <i>pattern</i>. If a pattern is given it will do a case insensitive search.
|
453
|
+
-- @param start_path {string} A directory. If not given, all files in current directory are returned.
|
454
|
+
-- @param pattern {string} A shell pattern. If not given, all files are returned.
|
455
|
+
-- @return Table containing all the files found recursively starting at <i>path</i> and filtered by <i>pattern</i>.
|
456
|
+
-- @raise start_path must be a string
|
457
|
+
function dir.getallfiles( start_path, pattern )
|
458
|
+
assert_dir(1,start_path)
|
459
|
+
pattern = pattern or ""
|
460
|
+
|
461
|
+
local files = {}
|
462
|
+
local normcase = path.normcase
|
463
|
+
for filename, mode in dir.dirtree( start_path ) do
|
464
|
+
if not mode then
|
465
|
+
local mask = filemask( pattern )
|
466
|
+
if normcase(filename):find( mask ) then
|
467
|
+
files[#files + 1] = filename
|
468
|
+
end
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
472
|
+
return files
|
473
|
+
end
|
474
|
+
|
475
|
+
return dir
|