You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Milindu Sanoj Kumarage <ag...@gmail.com> on 2015/04/28 19:37:34 UTC

Re: GSoC 2015

Hi everyone,
I'm really happy as I have been selected for GSoC for this task :D It is a
great pleasure to work with you. Hope I can do a good job. I'm continuing
with further development.

I'm currently working on testing. Did some optimization also to the code.

On Sun, Mar 29, 2015 at 7:41 AM, Imesh Gunaratne <im...@apache.org> wrote:

> +1 Great work Milindu! Yes this is exactly what we wanted. May be you
> could remove the space between the colon and the name of the attribute.
>
> Thanks
>
> On Sat, Mar 28, 2015 at 7:48 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I coded that tree printing functionality, assuming it is a JSON structure
>> we have to print and it looks likes this one.
>>
>>  [
>>         {
>>             "name": "level-one-group",
>>             "cartridges": [
>>                 "esb",
>>                 "tomcat"
>>             ],
>>             "groups": [
>>         {
>>             "name": "level-two-group",
>>             "cartridges": [
>>                 "esb",
>>                 "tomcat"
>>             ],
>>                     "groups": [
>>                 {
>>                     "name": "level-three-group",
>>                     "cartridges": [
>>                         "esb",
>>                         "tomcat"
>>                     ]
>>                 }
>>                  ]
>>         }
>>         ]
>>         }
>>     ]
>>
>> Giving the following JSON, the output tree structure look likes the
>> following.
>> _
>> |
>> +-|
>>   +-cartridges
>>   +-|
>>   | +-esb
>>   | +-tomcat
>>   +-name : level-one-group
>>   +-groups
>>   +-|
>>     +-|
>>       +-cartridges
>>       +-|
>>       | +-esb
>>       | +-tomcat
>>       +-name : level-two-group
>>       +-groups
>>       +-|
>>         +-|
>>           +-cartridges
>>           +-|
>>           | +-esb
>>           | +-tomcat
>>           +-name : level-three-group
>>
>> Hope this is how you want it. We can change the styles if you like.
>>
>> On Fri, Mar 27, 2015 at 7:11 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have updated the proposal including more implementation details, and
>>> the demo app's details.
>>>
>>> ​​​​​
>>>  Proposal : Python based Command Line Tool (CLI) for Stratos
>>> <https://docs.google.com/document/d/1ORkVPtFnJQi6szswKaim8ZCIKMHi3d3eCVOuA18GOG4/edit?usp=drive_web>
>>> ​
>>>
>>> Meanwhile, I'm implementing the tree printing functionality. What are
>>> the details that need to be printed? It is data relates to clusters that
>>> comes as a JSON, right? Can I have a sample JSON, please.
>>>
>>>
>>>
>>> On Thu, Mar 26, 2015 at 12:05 AM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi Imesh,
>>>>
>>>> Here I have uploaded  a simple CLI demo to Pip, you can install it with
>>>> giving this command if you have Pip on your system.
>>>>
>>>> $ sudo pip install stratos
>>>>
>>>> then can invoke it simply calling it on CLI as,
>>>>
>>>> $ stratos
>>>>
>>>>
>>>> What I'm trying to demonstrate with this demo is the basic
>>>> functionalists of the CLI, like autocomplete option, help options, input/
>>>> output redirection, etc. And ability to consume RESTful services via HTTP,
>>>> authenticating with HTTP Basic authentication. And also my ability to
>>>> create Python distributions.
>>>>
>>>> I'm using Github's API currently in order to demonstrate the ability to
>>>> make requests to API and get responses. Connecting to Github API with HTTP
>>>> Basic authentication.
>>>>
>>>>
>>>> *In the Interactive mode*
>>>>
>>>>    1. Give the 'user' command as follows. You will see your name and
>>>>    email retrieved from the Github API.
>>>>
>>>>    user -u <github-username> -p <github-password>
>>>>
>>>>    2. Type 're' and press Tab, it will complete the command.
>>>>    3. Type 'de' and press Tab, then the command will be completed up
>>>>    to 'deploy-' then press Tab twice. It will show the possible commands.
>>>>    4. Type 'de' and press Tab, then the command will be completed up
>>>>    to 'deploy-' then type 'u' and press Tab , it will complete the command.
>>>>    5. Type '?repositories' or 'help repositories' , this will show the
>>>>    help options for 'repositories' command.
>>>>    6. Give the 'repositories' command as follows. You will see 5 of
>>>>    your Github repositories in tabular format, retrieved from the Github API.
>>>>
>>>>    repositories -u <github-username> -p <github-password>
>>>>
>>>>    +----------------------+------------+
>>>>    |         Name         |  language  |
>>>>    +======================+============+
>>>>    | backbone-boilerplate | JavaScript |
>>>>    | CRUD.js              |        CSS |
>>>>    | DeciesGraph          |        CSS |
>>>>    | fancyBox             | JavaScript |
>>>>    | html5-boilerplate    | JavaScript |
>>>>    +----------------------+------------+
>>>>
>>>>    7. press up arrow key, you will the the last command issues, you
>>>>    can traverse through the history using up and down arrow keys.
>>>>    8. Try history command, Try list command.
>>>>    9. Try giving a shell command, it will work in the same way the
>>>>    bash works.
>>>>
>>>>    !ls
>>>>
>>>>    or
>>>>
>>>>    shell ls
>>>>
>>>> *In the single command mode*
>>>>
>>>>    1. Issues the commands in the same way as in interactive mode.
>>>>
>>>>    $ repositories -u <github-username> -p <github-password>
>>>>
>>>>    2. Issues this command in command line. It will write the output to
>>>>    a file names 'out.txt'.
>>>>
>>>>    stratos repositories -u <github-username> -p <github-password> >
>>>>    out.txt
>>>>
>>>>    3. Issues this command in command line. It will pipe the output to
>>>>    the grep command.
>>>>
>>>>    stratos repositories -u <github-username> -p <github-password> |
>>>>     grep JavaScript
>>>>
>>>>    4. Create a file with some commands, entered line by line, save it
>>>>    as commands.txt, then give this command while in CMD. It will execute the
>>>>    commands line by line and print the output to the console.
>>>>
>>>>    stratos < commands.txt
>>>>
>>>>    5. Create a file with some commands, entered line by line, save it
>>>>    as commands.txt, then give this command while in CMD. It will execute the
>>>>    commands line by line and print the output to out.txt file.
>>>>
>>>>    stratos < commands.txt > out.txt
>>>>
>>>>
>>>>
>>>>    ( I developed and tested  this on Linux with Python 2.7 version )
>>>>
>>>>
>>>
>>> On Thu, Mar 26, 2015 at 12:05 AM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi Imesh,
>>>>
>>>> Here I have uploaded  a simple CLI demo to Pip, you can install it with
>>>> giving this command if you have Pip on your system.
>>>>
>>>> $ sudo pip install stratos
>>>>
>>>> then can invoke it simply calling it on CLI as,
>>>>
>>>> $ stratos
>>>>
>>>>
>>>> What I'm trying to demonstrate with this demo is the basic
>>>> functionalists of the CLI, like autocomplete option, help options, input/
>>>> output redirection, etc. And ability to consume RESTful services via HTTP,
>>>> authenticating with HTTP Basic authentication. And also my ability to
>>>> create Python distributions.
>>>>
>>>> I'm using Github's API currently in order to demonstrate the ability to
>>>> make requests to API and get responses. Connecting to Github API with HTTP
>>>> Basic authentication.
>>>>
>>>>
>>>> *In the Interactive mode*
>>>>
>>>>    1. Give the 'user' command as follows. You will see your name and
>>>>    email retrieved from the Github API.
>>>>
>>>>    user -u <github-username> -p <github-password>
>>>>
>>>>    2. Type 're' and press Tab, it will complete the command.
>>>>    3. Type 'de' and press Tab, then the command will be completed up
>>>>    to 'deploy-' then press Tab twice. It will show the possible commands.
>>>>    4. Type 'de' and press Tab, then the command will be completed up
>>>>    to 'deploy-' then type 'u' and press Tab , it will complete the command.
>>>>    5. Type '?repositories' or 'help repositories' , this will show the
>>>>    help options for 'repositories' command.
>>>>    6. Give the 'repositories' command as follows. You will see 5 of
>>>>    your Github repositories in tabular format, retrieved from the Github API.
>>>>
>>>>    repositories -u <github-username> -p <github-password>
>>>>
>>>>    +----------------------+------------+
>>>>    |         Name         |  language  |
>>>>    +======================+============+
>>>>    | backbone-boilerplate | JavaScript |
>>>>    | CRUD.js              |        CSS |
>>>>    | DeciesGraph          |        CSS |
>>>>    | fancyBox             | JavaScript |
>>>>    | html5-boilerplate    | JavaScript |
>>>>    +----------------------+------------+
>>>>
>>>>    7. press up arrow key, you will the the last command issues, you
>>>>    can traverse through the history using up and down arrow keys.
>>>>    8. Try history command, Try list command.
>>>>    9. Try giving a shell command, it will work in the same way the
>>>>    bash works.
>>>>
>>>>    !ls
>>>>
>>>>    or
>>>>
>>>>    shell ls
>>>>
>>>> *In the single command mode*
>>>>
>>>>    1. Issues the commands in the same way as in interactive mode.
>>>>
>>>>    $ repositories -u <github-username> -p <github-password>
>>>>
>>>>    2. Issues this command in command line. It will write the output to
>>>>    a file names 'out.txt'.
>>>>
>>>>    stratos repositories -u <github-username> -p <github-password> >
>>>>    out.txt
>>>>
>>>>    3. Issues this command in command line. It will pipe the output to
>>>>    the grep command.
>>>>
>>>>    stratos repositories -u <github-username> -p <github-password> |
>>>>     grep JavaScript
>>>>
>>>>    4. Create a file with some commands, entered line by line, save it
>>>>    as commands.txt, then give this command while in CMD. It will execute the
>>>>    commands line by line and print the output to the console.
>>>>
>>>>    stratos < commands.txt
>>>>
>>>>    5. Create a file with some commands, entered line by line, save it
>>>>    as commands.txt, then give this command while in CMD. It will execute the
>>>>    commands line by line and print the output to out.txt file.
>>>>
>>>>    stratos < commands.txt > out.txt
>>>>
>>>>
>>>>
>>>>    ( I developed and tested  this on Linux with Python 2.7 version )
>>>>
>>>>
>>>
>>
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>