Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#3251): move eo-files to eo-runtime #3309

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
77c94da
feat(#3251): added file, dir and tmpdir to eo-runtime
maxonfjvipon Aug 1, 2024
697638c
feat(#3251): fix tests and style
maxonfjvipon Aug 1, 2024
3d1e834
feat(#3251): custom config
maxonfjvipon Aug 1, 2024
63281e3
feat(#3251): custom config x2
maxonfjvipon Aug 1, 2024
fe1a258
feat(#3251): custom config x3
maxonfjvipon Aug 1, 2024
f713c9a
feat(#3251): custom config x4
maxonfjvipon Aug 1, 2024
f8acb75
feat(#3251): custom config x5
maxonfjvipon Aug 1, 2024
30b5665
feat(#3251): custom config x6
maxonfjvipon Aug 1, 2024
07c8f86
feat(#3251): custom config x7
maxonfjvipon Aug 1, 2024
9ccf1c1
feat(#3251): custom config x8
maxonfjvipon Aug 1, 2024
f4f7a58
feat(#3251): custom config x9
maxonfjvipon Aug 1, 2024
21f8d2d
feat(#3251): custom config x10
maxonfjvipon Aug 1, 2024
4a31115
feat(#3251): codacy
maxonfjvipon Aug 1, 2024
9f2efcc
feat(#3251): more codacy
maxonfjvipon Aug 1, 2024
9ccb653
feat(#3251): temp on windows
maxonfjvipon Aug 1, 2024
48e7a9f
feat(#3251): prints tmpdir
maxonfjvipon Aug 1, 2024
8588e77
feat(#3251): prints tmpdir x2
maxonfjvipon Aug 1, 2024
7c0c0a7
feat(#3251): env is
maxonfjvipon Aug 1, 2024
5c65d8e
feat(#3251): env is x2
maxonfjvipon Aug 1, 2024
5940e21
feat(#3251): fix unescape
maxonfjvipon Aug 1, 2024
35a63df
feat(#3251): malloc-as-output
maxonfjvipon Aug 1, 2024
ea51ce5
feat(#3251): try unescape
maxonfjvipon Aug 1, 2024
c8d4ae7
feat(#3251): try unescape x2
maxonfjvipon Aug 1, 2024
9ef3eae
feat(#3251): replace slashes
maxonfjvipon Aug 1, 2024
00a0f74
feat(#3251): unescape
maxonfjvipon Aug 1, 2024
eeb63f5
feat(#3251): file test
maxonfjvipon Aug 1, 2024
9d4510f
feat(#3251): print
maxonfjvipon Aug 1, 2024
3a4a9c3
feat(#3251): dirs
maxonfjvipon Aug 1, 2024
6af99ac
feat(#3251): dirs x2
maxonfjvipon Aug 1, 2024
4597439
feat(#3251): disable some tests on windows
maxonfjvipon Aug 2, 2024
f88a58b
feat(#3251): sout
maxonfjvipon Aug 2, 2024
478ecf3
feat(#3251): resolve
maxonfjvipon Aug 2, 2024
c27cb04
feat(#3251): no unescape merge
maxonfjvipon Aug 2, 2024
6892410
feat(#3251): fix
maxonfjvipon Aug 2, 2024
6a8fadc
Merge branch 'master' into feat/#3251/eo-files-to-eo-runtime
maxonfjvipon Aug 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,23 @@
# package name contains capital letter and such names are conventional.
---
exclude_paths:
- "eo-runtime/src/main/java/EOorg/EOeolang/EOio/EOconsole$EOread$EOread_bytes.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOio/EOconsole$EOwrite$EOwritten_bytes.java"
- "eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOconsoleTest.java"
- "eo-runtime/src/test/java/EOorg/EOeolang/EOsys/EOuname$EOφ.java"
- "eo-runtime/src/test/java/EOorg/EOeolang/EOsys/package-info.java"
- "eo-runtime/src/test/java/EOorg/EOeolang/EOnumberTest.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOsys/package-info.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOdir$EOmade$EOmkdir.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOdir$EOtmpfile$EOtouch.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOdir$EOwalk.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOdeleted$EOdelete.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOexists.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOis_directory.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOmoved$EOmove.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/package-info.java"
- "eo-runtime/src/test/java/EOorg/EOeolang/EOfs/package-info.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOopen$EOfile_stream$EOwrite$EOwritten_bytes.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOopen$EOfile_stream$EOread$EOread_bytes.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOopen$EOprocess_file.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOresolved$EOresolve.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOsize.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOtouched$EOtouch.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/Files.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOsys/EOgetenv.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOsys/EOos$EOname.java"
- "eo-runtime/src/test/java/EOorg/EOeolang/EOfs/FilesTest.java"
- "eo-runtime/src/test/java/EOorg/EOeolang/EOfs/EOfileTest.java"
2 changes: 2 additions & 0 deletions .github/.typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[files]
extend-exclude = ["eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOis_directory.java"]
2 changes: 2 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master
with:
config: ./.github/.typos.toml
112 changes: 112 additions & 0 deletions eo-runtime/src/main/eo/org/eolang/fs/dir.eo
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# The MIT License (MIT)
#
# Copyright (c) 2016-2024 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

+alias org.eolang.txt.sprintf
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang.fs
+rt jvm org.eolang:eo-runtime:0.0.0
+rt node eo2js-runtime:0.0.0
+version 0.0.0

# Directory in the file system.
# Apparently every directory is a file.
[file] > dir
$.file > @
true > is-directory

# Makes a directory together with all required
# parent directories and returns the created directory.
[] > made
if. > @
^.exists
^
seq
*
mkdir
^

# Makes a directory together with all required
# parent directories.
#
# Attention! The object is for internal usage only, please
# don't use it programmatically outside of `dir` object.
[] > mkdir /true

# Goes though all files in the directory, recursively
# finding them with the `glob` provided.
# Returns `tuple` of all files in the directory.
[glob] > walk /tuple

# Deletes directory and all files in it, recursively.
# Returns the deleted directory.
[] > deleted
(^.walk "**").at.^ > walked
walked.length > len!
if. > @
^.exists
seq
*
rec-delete walked 0
^
^

# Deletes files and directories in current directory recursively.
# Returns `true`.
#
# Attention! The object is for internal usage only, please
# don't use the object programmatically outside of `dir` object.
[tup index] > rec-delete
if. > @
^.len.eq index
true
seq
*
tup.tail.deleted.exists
^.rec-delete
tup.head
index.plus 1

# Creates an empty temporary file in the current directory.
[] > tmpfile
if. > @
^.exists
QQ.fs.file touch.as-bytes.as-string
error
sprintf
"Directory %s does not exist, can't create temporary file"
* ^.path

# Creates an empty temporary file in the current directory and
# returns absolute path to it as `string`.
#
# Attention! The object is for internal usage only, please
# don't use the object programmatically outside of the `dir` object.
[] > touch /string

# Opens the file for I/O operations.
# Since current file is a directory - returns an `error`.
[mode scope] > open
error > @
sprintf
"The file %s is a directory, can't open for I/O operations"
* ^.path
Loading
Loading