This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Cross_Sans's profile picture

pBundle - An useful program for open-source projects

Started by Cross_Sans, 10 October 2016 - 05:46 PM
Cross_Sans #1
Posted 10 October 2016 - 07:46 PM
pBundle - An program to make bundles programmaticly

Version: 1.0


"What this program can do ?" section


pBundler is an program to make bundles programmaticly (via a programming language I created myself). But, why ? Because some programmers cannot do this on Lua, and need a simple programming language and do what they want without any complications. They need it for big programs, and need a simple way to tell what they want to install and share with any user in the world.

This is why pBundler (formely pBuilder) is created.

"Understanding the syntax" section


PBFILE
BEGIN
... CODE ...
END
Note: PBFILE, BEGIN and END is needed for pBundle to parse the file and execute it. Why ? Because PBFILE is to mark as an pBundle valid file, like an "authentification".

See actually what pBundle can do:
General Commands (where can be used in any part of the script):
SpoilerAT is an command for pointing a path for a file or a directory. Can be used by other commands.
COMMENT is an command for putting, at the next character, a comment. pBundle will ignore all the next characters until a new line.

Filesystem Manipulation (can be used only in BEGIN…END):
SpoilerNEWDIR is an command for making a new directory in the AT location.
DELETE is an command for deleting a file or a directory tree in the AT location.
WRITE is an command to write a line in the AT location.

Internet Communication (can be used only in BEGIN…END):
SpoilerPASTEGET "paste-id" is an command to download a pastebin file specified with paste-id argument and save it in the AT location.
DOWNLOAD "url" is an command to download a file content with url argument and save it in the AT location.

Script Necessary Commands (can be used only in BEGIN…END):
SpoilerPBFILE is an command to indicate to pBuilder is an valid file.
BEGIN is an command to start the program and unlocks all others commands (excepted COMMENT command)

Downloads section

This section contains all of the pBundle versions, it is sorted the most recent version to the oldest.

Latest version: 1.0
NOTE: An new BIGGER version is comming with ALOT commands, please be patient :)/> !

pBuilder (pBundler old program) 1.0:
Spoilerpastebin get 7shXUKva pbuilder

Acknowledgements section


Thanks to InDieTasten for the name
Thanks to Sewbacca for the suggestions of new commands
Thanks to Larry84 and H4X0RZ for the comments
And thanks to all who downloaded and tested the program !
Edited on 11 October 2016 - 02:46 PM
InDieTasten #2
Posted 10 October 2016 - 08:22 PM
So this is a program that can read such files to make the desired directories and download files, correct?
How exactly is this useful? it's like a makefile to just "install" something. I guess it's cool, but how am I supposed to use it to make best use of it. I think I just don't get it I think.

Can you explain further?

Oh wait. So can you "bundle" up the pbfile runner with it's script? If so that would be nice. If you'd have to download the runner first and then also the pbfile that would be kinda annoying again. At least for me :unsure:/>

EDIT: Ok, so if it's the cool way I described above, can you make it bundling all it's individual files as well? that would be a nice tool. I'd call it "pbundle", that just takes the pbfile, downloads all the stuff by itself and puts everything in some install.lua to publish for other computercrafters. This would be especially useful for cases, where you do not have access to all origins of the dependencies.

Another thing to consider would then be versioning, or at least removing directories or files, possibly with wildcards? so that you can run the pbfile multiple times and it's able to remove files first, because overriding files should error? or be interactive[y, N]? or require a force flag running the installer?

just some features I can think of that'd be making this more useful in my opinion.
Edited on 10 October 2016 - 06:30 PM
Sewbacca #3
Posted 10 October 2016 - 09:07 PM
Nice, an interpreter!
I would propose following commands:
COPY (To copy sources)
MOVE (To move temporary files)
DELETE (To delete temporary files)
RUN (To run programs (lua programs))
DO 'path' – iterates through the files and set PATH to the current path
DELETE PATH
END
Maybe you can write an translator to translate it to an executable lua file =)
Larry84 #4
Posted 10 October 2016 - 10:52 PM
As InDie Tasten said, this may be a little impratical - it's however a really well developed program. May be useful with big programs that needs lots of files being saved in several directories. Just one question: why this capitalization? It reminds me of cobol language :P/>/>
H4X0RZ #5
Posted 11 October 2016 - 12:39 AM
The idea is nice, but why use such a complicated implementation? Lua is a very flexible language and building a DSL is easy. No need for interpreters.
Cross_Sans #6
Posted 11 October 2016 - 12:12 PM
As InDie Tasten said, this may be a little impratical - it's however a really well developed program. May be useful with big programs that needs lots of files being saved in several directories. Just one question: why this capitalization? It reminds me of cobol language :P/>/>
Because the Cobol language is really simple to understand, this is why I choosed it :P/>

The idea is nice, but why use such a complicated implementation? Lua is a very flexible language and building a DSL is easy. No need for interpreters.
Yes, i know. But why not after all ? :)/>

Nice, an interpreter!
I would propose following commands:
COPY (To copy sources)
MOVE (To move temporary files)
DELETE (To delete temporary files)
RUN (To run programs (lua programs))
DO 'path' – iterates through the files and set PATH to the current path
DELETE PATH
END
Maybe you can write an translator to translate it to an executable lua file =)
DELETE is actually existing, i just forgot it.
MOVE is in the BIG list of commands to add :P/>
RUN is in too the BIG list of commands to add
COPY too

"Maybe you can write an translator to translate it to an executable lua file =)" - When i finished complety, why not :P/>

Thanks, for all your replies, you are the best :D/> !

So this is a program that can read such files to make the desired directories and download files, correct?
How exactly is this useful? it's like a makefile to just "install" something. I guess it's cool, but how am I supposed to use it to make best use of it. I think I just don't get it I think.

Can you explain further?

Oh wait. So can you "bundle" up the pbfile runner with it's script? If so that would be nice. If you'd have to download the runner first and then also the pbfile that would be kinda annoying again. At least for me :unsure:/>

EDIT: Ok, so if it's the cool way I described above, can you make it bundling all it's individual files as well? that would be a nice tool. I'd call it "pbundle", that just takes the pbfile, downloads all the stuff by itself and puts everything in some install.lua to publish for other computercrafters. This would be especially useful for cases, where you do not have access to all origins of the dependencies.

Another thing to consider would then be versioning, or at least removing directories or files, possibly with wildcards? so that you can run the pbfile multiple times and it's able to remove files first, because overriding files should error? or be interactive[y, N]? or require a force flag running the installer?

just some features I can think of that'd be making this more useful in my opinion.
I think I will rename it, thanks for your reply, because I am french and I do not really know how to spell it correctly, and thanks for your reply :D/>
Cross_Sans #7
Posted 11 October 2016 - 04:47 PM
The idea is nice, but why use such a complicated implementation? Lua is a very flexible language and building a DSL is easy. No need for interpreters.
Why "complicated", explain me ?

(Sorry for the double post!)
Edited on 11 October 2016 - 02:48 PM
InDieTasten #8
Posted 11 October 2016 - 10:34 PM
I have two more major features, that would make this an extremely useful tool:

1st: When implementing RUN, check the content of "AT" right now and see, if it's a pbfile. If it is (designated by PBFILE in the top), then interpret this pbfile. Maybe instead of reusing RUN it might as well be a new command, like "INCLUDE"
2nd: When RUNning a program, expose a function into the environment that let's me inject my own commands. Implementation detail is up to you, but I'd like to create some third-party script to add special services, like special commands for downloading entire repositories from github or similar. I know I could make a fork off your pBuilder. This may also get it's own command, like "REGISTER"


PBFILE

AT .pbundle
NEWDIR

AT .pbundle/github
DOWNLOAD path_to_my_special_script
REGISTER/RUN

COMMENT from this point on, I can use commands provided by my special script

AT .pdependencies
NEWDIR

AT .pdependencies/awesome_repo
DL_REPO path_to_some_github_repo
INCLUDE


Those two features would be pretty nice, and really make this a powerful tool. It's sort of a perfect mix between package manager, a bundler and a taskrunner.

Also, the name PBuilder is fine with me. I was proposing to call such a bundler/publisher pBundle, because it fits the name so well. The actual interpreter being called PBuilder was ok with me. But I guess you are going to integrate all of that into one command-line tool now? the "make" part, of interpreting and running a pbfile, and then later also the bundler, that composes the make process into a single executable installer.lua for distribution.

Is there a chance this project is going to be open source itself? I would like to collaborate if you like the presented features as well.

There should also be a better documentation, so people can easily get into it without having to read this entire thread. It needs to be really simple. It should only take one screen height of documentation to get a good grasp of how to use it.
Edited on 11 October 2016 - 08:43 PM
InDieTasten #9
Posted 11 October 2016 - 10:39 PM
I also propose to remove the BEGIN and END commands, as I don't see any advantage of having them and they just add noise and text in the documentation
H4X0RZ #10
Posted 11 October 2016 - 10:49 PM
The idea is nice, but why use such a complicated implementation? Lua is a very flexible language and building a DSL is easy. No need for interpreters.
Why "complicated", explain me ?

(Sorry for the double post!)

Most (if not all) commands follow The same pattern: Command name + String.

Instead of writing a big interpreter just to read these you could create a custom environment in which you run the files. You won't lose (most of) your syntax because
command "string"
is valid lua but you would gain a lot because the files would support Lua now. This means that you can use loops, tables and if-statements. On top of that you could easily add a function which would allow you to add custom commands on-the-fly.
Cross_Sans #11
Posted 12 October 2016 - 12:44 PM
I have two more major features, that would make this an extremely useful tool:

1st: When implementing RUN, check the content of "AT" right now and see, if it's a pbfile. If it is (designated by PBFILE in the top), then interpret this pbfile. Maybe instead of reusing RUN it might as well be a new command, like "INCLUDE"
2nd: When RUNning a program, expose a function into the environment that let's me inject my own commands. Implementation detail is up to you, but I'd like to create some third-party script to add special services, like special commands for downloading entire repositories from github or similar. I know I could make a fork off your pBuilder. This may also get it's own command, like "REGISTER"


PBFILE

AT .pbundle
NEWDIR

AT .pbundle/github
DOWNLOAD path_to_my_special_script
REGISTER/RUN

COMMENT from this point on, I can use commands provided by my special script

AT .pdependencies
NEWDIR

AT .pdependencies/awesome_repo
DL_REPO path_to_some_github_repo
INCLUDE


Those two features would be pretty nice, and really make this a powerful tool. It's sort of a perfect mix between package manager, a bundler and a taskrunner.

Also, the name PBuilder is fine with me. I was proposing to call such a bundler/publisher pBundle, because it fits the name so well. The actual interpreter being called PBuilder was ok with me. But I guess you are going to integrate all of that into one command-line tool now? the "make" part, of interpreting and running a pbfile, and then later also the bundler, that composes the make process into a single executable installer.lua for distribution.

Is there a chance this project is going to be open source itself? I would like to collaborate if you like the presented features as well.

There should also be a better documentation, so people can easily get into it without having to read this entire thread. It needs to be really simple. It should only take one screen height of documentation to get a good grasp of how to use it.
I also propose to remove the BEGIN and END commands, as I don't see any advantage of having them and they just add noise and text in the documentation
I will make a Wiki later when I will finish the re-writing the entire program.
For the moment, my program is a non open-source project, but there is a chance ;)/>
BEGIN and END will be complety removed.
pBundle is an idea for making simple bundlers. After, when the project is partially done, i will make a converter which will work like an normal interpreter, but convert code onto LUA compatible executable file.

The idea is nice, but why use such a complicated implementation? Lua is a very flexible language and building a DSL is easy. No need for interpreters.
Why "complicated", explain me ?

(Sorry for the double post!)

Most (if not all) commands follow The same pattern: Command name + String.

Instead of writing a big interpreter just to read these you could create a custom environment in which you run the files. You won't lose (most of) your syntax because
command "string"
is valid lua but you would gain a lot because the files would support Lua now. This means that you can use loops, tables and if-statements. On top of that you could easily add a function which would allow you to add custom commands on-the-fly.
Thanks for your reply. pBundle's syntax will change to be easier. I will change the syntax but resting on the "Coble" programming language because it is really simple.