Extending sTeam shell commands

(ˢᵒᶜⁱᵉᵗʸserver) aims to be a platform for developing collaborative applications.
sTeam server project repository: sTeam.

Break the PR

A lot of new commands have been added to the sTeam-shell script.

The earlier PR sent  was addressing a lot of issue’s. As a result the PR was cherry picked and rebased to form smaller PR’s for each issue.

Issue. Github Issue Github PR
Add directory location for libxslt.so Issue-25 PR-66
Makefile.in changes to add the files in the tools directory to the installed location. Issue-27 PR-67

Import from git script

The import to git script was further enhanced to support the feature whereby a user can specify the name of the object in the sTeam directory when a single object is been imported.

The user can now import a single object to the steam work area using the import-from-git script.

The command works for objects of all mime-types.
Two formats for the command are supported.

Issue. Github Issue Github PR
Add utility to support single import in import-from-git script . Issue-16 PR-76

Format 1:

import-from-git.pike ~/gitfolder/zy.mp3 /home/sTeam/

This would create the object in the sTeam directory. The new object would have the same name as the object in the git directory.

Format 2:

import-from-git.pike ~/gitfolder/zy.mp3 /home/steam/ab.mp3

This would create an object with the name ab.mp3 in the sTeam directory. If the object exists from before, the contents of it will be over written with the contents of the object from the git-folder.

Note: Here ‘/’ at the end of the steam directory is used as a distinguishing factor between a directory and an object. Be careful while passing the steam directory in the command or it would throw error.

Import-changeName
List User’s

The command to list all the existing user’s in the sTeam server was also added to the steam-shell.

Issue. Github Issue Github PR
List users. Issue-72 PR-78

List_user

The user after creation needs to be activated by the root user. Thus a user can then access his steam-shell command line by passing the parameters of user name, host name or port number.

./steam-shell.pike -u uname -h hname -p pno

Passing Arguments to the sTeam-shell

The sTeam shell was modified during it’s integration with vi. This had introduced a bug where by the above parameters where not been able to pass along when a command to the sTeam-shell was passed as an argument. The issue was addressed and resolved.

The user can pass arguments like user name, host and port-number to the steam-shell.pike along with the steam-commands.

Issue. Github Issue Github PR
Add utility to support passing arguments to the sTeam-shell. Issue-71 PR-75

 Eg.

./steam-shell.pike -u user -h host -p portno steam-command

sTeam-shellArguments

Modularize the tasks

The commands for user manipulation were grouped under their operations like create, delete or list. Thus the commands were modularize.

Issue. Github Issue Github PR
The user commands have been modularized based on the actions they perform. Issue-73 PR-81

The action create, delete and list now support user operations.
Example:

To create a user.

create user test

The terminal would ask for password and email-id.

To delete a user

delete user test

To list all the users

list users

Modularize users

Create a file

The command to create a file of any type was added to the sTeam-shell. The code for creation and deletion of objects in the sTeam shell was modified and optimized.

The user can now create a file of any type from the command line.
The mime-type of the file is auto-detected.

Issue. Github Issue Github PR
Create a file from sTeam-shell Issue-79 PR-82

Usage:

create file filename destination

This would create a file with file name as specified in the given destination. The file name can be like xyz.txt / xyz.pike / xyz.jpg / xyz.mp3. The destination " . " means the current destination.

CreateFile
More commands for groups

The commands to create, join, leave and list groups were added by my colleague Siddhant Gupta. The branch was merged with my working repo. The merge conflicts were successfully resolved. More commands for operations of a group were added.  A user can list all the members of a group, list groups that a user is member of and delete a group.

Issue. Github Issue Github PR
Create a file from sTeam-shell Issue-80 PR-84

Usage

  • To list all the groups that a user is member of.
list my groups
  • To view all the members of a group.
list groupname members
  • To delete a group
delete groupname

GroupCommands
Support for sending mails

The steam-shell user can now send mails. The utility to support mails was added. The earlier web.spm package was analyzed to find the existing classes used in the web interface in order to support this utility. The browser.pike file can in handy.

Issue. Github Issue Github PR
Add utility to send emails. Issue-74 PR-85
 The user can now send emails from the steam-shell.pike.

Usage:

send_email

This would ask the user to enter the recipients. The recipients can be a sTeam user, a group or an external email.

Note: The recipients should be separated by “,”.

Then the user has to write the email subject and the email body.
After this the user would be then notified about the status of the email.

Successfully sent mail

SuccessfullMail

Mail failed due to wrong recipient

UnsuccessfullMailUser

Mail failed due to empty subject

UnsuccessfullMailNoSubject
Logs

Finally, the command to display the logs of the sTeam server from the steam-shell command line was added.

The user can now see the logs of the sTeam server from the command line. The logs are stored in the /var/log/steam/ directory.

Issue. Github Issue Github PR
Open sTeam-server logs from sTeam-shell. Issue-83 PR-86

Usage

log

The user will be notified about the logs and would be asked to input the name of the logs to open.

The log files include errors, events, fulltext.pike, graphic.pike, http, search.pike, security, server, slow_requests, smtp, spm..pike and tex.pike.
Enter the name of the log files you want to open.
Note: The filenames should be separated by ",".

Input the name of the log files to open. The log files would be then opened in a vi window. User can open multiple logs.

LogCommand
Opened Logs

OpenedLogs

Checkout the FOSSASIA Idea’s page for more information on projects supported by FOSSASIA.

Continue ReadingExtending sTeam shell commands

Increasing utility of sTeam tools

(ˢᵒᶜⁱᵉᵗʸserver) aims to be a platform for developing collaborative applications.
sTeam server project repository: sTeam.

User Utils

User  convenience is an important aspect for any application to succeed. The sTeam root user should be able to create or delete a user. A command to add / delete a user was added successfully.

The root user should be able to add new user’s using the command line.
The parameter’s like username, password, email-id etc. should be asked and then the user should be created.

Issue. Github Issue Github PR
Create a user. Issue-58 PR-59
Delete an object Issue-56 PR-57
Delete a user. Issue-69 PR-70

To create a new user:

create_user username password email

The current users can be found by running the command

 _Server->get_module("users")->get_users();

Similarly a command to delete the user was added to the steam-shell.

The user should be able to delete the objects created/existing inside the user area. A steam-shell command needs to be added to delete the objects from the command line.

The usage of command to delete a user inside steam-shell.pike. Only the root user can delete other user.
Command:

delete_user username

UserActivities
In order to delete an object which can be a container, document or a room in the current steam directory, run the command;

delete test.pike

The object would be deleted.

Tab-Completion Module

The tab completion module of the sTeam shell was analyzed during this period. The tab completion module has an issue whereby it doesn’t lists the options on pressing the tab after  ".

query_attribute("

After pressing the tab after ” the options should be listed. But this is not the case. The bug needs to be resolved.

Tab_completion

Import from git script

The import to git script can now import a single file into the sTeam directory.

The feature for this was added.

Issue. Github Issue Github PR
Add utility to support single import in import-from-git script . Issue-16 PR-76
sudo ./import-from-git.pike gitfolder/xyz.mp3 /home/sTeam/

The xyz.mp3 would be imported to the sTeam directory.

Import-script

The future work would include resolving the tab_completion module issues and enhancing the import script to support the feature where by a user would be able to specify the name of the file in the sTeam directory.

Checkout the FOSSASIA Idea’s page for more information on projects supported by FOSSASIA.

Continue ReadingIncreasing utility of sTeam tools

Improvements in sTeam shell and export script

(ˢᵒᶜⁱᵉᵗʸserver) aims to be a platform for developing collaborative applications.
sTeam server project repository: sTeam.

Logs

A breakthrough in sTeam development took place. Siddhant Gupta was able to successfully implement the TLS protocol in pike.

The Logs were displayed erroneously. Also the user was not able to scroll down the log to the latest message.  The golden ratio script used in the program was updated to it’s latest version.

Also the editor is opened using sudo command so as to access the vim scrips in the /usr/local/lib/steam/tools directory.
The files are opened using the vim command:
vim -S script -c edit filename1|sp filename2

Only one buffer is accessible at a time. In order to switch the buffer to log buffer the command is CTRL+Ww. Enter this command directly without entering the vim terminal using :.
The log buffer would be accessible, can be edited and scrolled down to the latest log message.

Issue. Github Issue Github PR
Access the log window till the end. Issue-20 PR-48
Open appropriate log window when a sTeam command is executed. Issue-49 PR-51

ScrollToLatest

The logs were displayed erroneously. Ideally the log should be displayed based on the buffer where the sTeam function is called and accordingly the relevant log buffer should be called and display the output. This error was fixed.

MultTabs

The log is displayed in the file named after the file which is opened and concatenated with the suffix “-disp”. In Vi the  :% buffer stores the value of the current file. Consequently this value was concatenated with “-disp” to display the buffer accordingly. The Vi script can be seen below.
ViFunc

Export to git script.

The  export-to-git script was tested vigorously.  All the known issue’s based on the script were replicated in the system and solution was found for them.

The export to git script is now capable of exporting multiple sources at a time. If the last argument is always the target repository then any number of previous arguments can be sources.

Issue. Github Issue Github PR
Support Multiple Source arguments Issue-14 Issue-19 PR-54
Include Source-name in branch name and add branch description. Issue-9 PR-55

Example command :
./export-to-git.pike /home/sTeam/file1 /home/coder/file2 /home/sTeam/container3 ~/gitfolder

The export-to-git script also exports the source name in the branch.  To help distinguish between the branches, we need more descriptive names:

./export-to-git.pike /sources/ /tmp/export-test/

This should create the branch sources-cur_time. Also when a file is specifically exported:

./ecport-to-git.pike /home/coder/demo1.txt /temp/export-test/

would create a branch with name home/coder/demo1.txt-cur_time. This is done to avoid ambiguity between files with same name existing in different locations.
Also a description is added fo the branch name using the git command
git config branch.<branch name>.description "describe branch"
To view this description go to the folder where the branch is exported and then enter the git command
git config branch.<branch name>.description

Export to Git script executing when Multiple Source arguments passed and the modified branch name.
GitExportAndBranchName

Branch Description

BranchDesc

Checkout the FOSSASIA Idea’s page for more information on projects supported by FOSSASIA.

Continue ReadingImprovements in sTeam shell and export script

Enhancement of steam-shell plugin and Import from git

(ˢᵒᶜⁱᵉᵗʸserver) aims to be a platform for developing collaborative applications.
sTeam server project repository: sTeam.

Indentation of output made independent of the screen-width.

There were errors encountered in the pull request. These needed to be modified. The notable one’s were the Indentation of the output displayed by the look command in the steam-shell. The earlier display was taken into consideration that the default size of the linux terminal is 80 char long. However this can differ from individual to individual terminal settings. Therefore the module reference of pike was studied and a method to display the contents in the output of ls command format was written down. Thus,  now the output is independent of the screen width of an individual.

Issue. Github Issue Github PR
Indentation of output in steal-shell. Issue-24 PR-42

Indentation

Also there were minor errors in the edit.pike script. These were resolved too. The edit.pike was not able to exit the program. Therefore an exit(0) call was made. This resulted in the edit.pike being able to exit successfully but a new error was introduced in the steam-shell.pike. When the edit.pike command was called inside it, the steam-shell.pike would exit on successfully completing the edit command. The steam-shell should not exit in this case. There were changes made in the VisTeam.pike, edit.pike and applauncher.pike in order to get the utility working correctly.

Issue. Github Issue Github PR
Edit.pike hangs on closing Issue-29 PR-44
Edit command closes the steam-shell abruptly Issue-43 PR-44

The steam-shell vim plugin was modified and the support for multi line commands was added. Now the user can type the commands in multipe lines, format them and then execute them. The output will be displayed in a new tab.

Issue. Github Issue Github PR
Integrate sTeam-shell into Vi. Issue-37 PR-41

An example of it can be seen below:-

ListGates
Output:

OutputMult

The import-from-git.pike script is used to import contents from a normal git repository into the steam directory. The import from git script was studied and understood initially. The issue’s listed were replicated in the system and a possible solution for them was found out.

The script has support for importing multiple documents at the same time. Also the objects imported supported only text mime type. The script was modified to support other mime types by initially detecting them through an external process. However later in the server/factories/Document_factory.pike file the auto detecting of mime type was found out and used in the code. Now the mime types are detected and updated successfully for documents of other mime types like MP3, jpg, png etc

Issue. Github Issue Github PR
Auto-detect Mime type. Issue-18 PR-45

ImportMimeType

The contents of objects of types other than text mime type were not been read by the existing process. As a result this resulted into creation of empty objects with the set mime type. The process to read the contents was modified and the contents of objects of other types were set accordingly. The content is read in the form of a string. Since every object can be read as a string.

However in the import-from-git an issue was encountered. Indexing over Null value with set_contents for every object created by the script. On running the script again the earlier object is successfully imported but the same error is encountered over the next object to be imported. This issue would be looked down and tried to be solved. Also support for importing single objects will be provided.

Error1

 

Checkout the FOSSASIA Idea’s page for more information on projects supported by FOSSASIA.

Continue ReadingEnhancement of steam-shell plugin and Import from git

Integrate sTeam-shell into Vi and Indentation of output

(ˢᵒᶜⁱᵉᵗʸserver) aims to be a platform for developing collaborative applications.
sTeam server project repository: sTeam.

Indentation of sTeam-shell output

The Indentation of the output in the look command in steam-shell is formatted to be displayed in the way the output is displayed when the ls command is executed in a terminal window.

The module reference provided by the pike language is used for formatting.
The pike reference module can be found at Pike Ref module

The screen-width of the the user is calculated using the command tput rows.
This value is then passed as an argument to the write function to display it in the form of output of an ls command.
The example of this can be seen in the modref by Pike.

Issue. Github Issue Github PR
Indentation of output in steal-shell. Issue-24 PR-42

Example:

write("%-$*s\n", screen_width,"Given a\nlist of\nslosh-n\nseparated\n'words',\nthis option\n"+ "creates a\ntable out\nof them\nthe number of\ncolumns\n"+"be forced\nby specifying a\npresision.\nThe most obvious\n"+"use is for\nformatted\nls output.");

Output:

 Given a          list of          slosh-n
 separated        'words',         this option
 creates a        table out        of them
 the number of    columns          be forced
 by specifying a  precision.       The most obvious
 use is for       formatted        ls output.

The following changes have been made in order to incorporate the changes:

IndentationCodeChange

Integration of sTeam-shell into Vi

For integration of sTeam-shell.pike into the Vi, the steam-shell is made compatible to be run when a command is passed as an argument to it. The changes have been made in steam-shell.pike and the applauncher.pike. Also a new file called as VisTeam.pike is created. When this is executed it validates the user and opens two vi buffers. One for typing the command and the other to display the log/ output of the executed command.

A steam-shell.vim vi plugin is created so as to be able to run the Steam function in vi. Whenever this function is executed the selected text in the vi visual mode will be executed.

The results are displayed in the log buffer in a new tab. Since the already existing vim scripts Goldenratio.vim and watchforchanges.vim divide the command buffer and the log buffer in the ration 2:1, the output is not visible in the logs. Thus a newtab consisting of the logs is opened.

Issue. Github Issue Github PR
Integrate sTeam-shell into Vi. Issue-37 PR-41

InsertIntoVIExecute the command:

ExecuteCommandsTeam

Display the output:

DisplayTheOutput

Checkout the FOSSASIA Idea’s page for more information on projects supported by FOSSASIA.

Continue ReadingIntegrate sTeam-shell into Vi and Indentation of output